From patchwork Thu May 25 09:56:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 98955 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp263077vqr; Thu, 25 May 2023 03:39:59 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5AOCRPR0wbPErRXenqzeZqaiH5V3ZKh2smsnDotg4Krz0bfbIk0VBhPMrowD1g6+4e/5Bv X-Received: by 2002:a05:6a00:158b:b0:641:558:8e2e with SMTP id u11-20020a056a00158b00b0064105588e2emr7510365pfk.15.1685011198944; Thu, 25 May 2023 03:39:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685011198; cv=none; d=google.com; s=arc-20160816; b=CREnn/WrATHt8LX3WwRl5mwfl2Fo0WJ865AbkrYY4yhpLV5S1txcR8RMc0YArputcV HgLz4aEl+rtwIz4wedl1mFGNuUuLpNp4ZdzXNJWzz4aTeL0FCXMQUN5gIMm5RdlCUI4B yYcj9dzP0vBncxrFZVo+mmAbCSzKUogGt/WNIdhWk/NVBitQKz+t8K8+qYGkzgmtJXEm Fhfg+2lJIY/WhiWHbYOxSKvBi+9Q3+PD/Qi29HUXvCS/753bYCJ2frqYrrjsPES2+CUX ks1vSjitZgZELgWAiGz92Yc+u34iV3OiC/R4G15E0RmlCGFv/KRRH31y2FfELZExKCJH +Utg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=aH+xFEPLgGWhSU//wrOcj0fBnHsePPzWA5P3HqQdymw=; b=TMuUrLFEFjNJteJjWZz9mV7Zz8X5WRYjukpItVSS/z6dlNGCMjW+GCmZa5N03NJXF8 wpYID/M3kirt00OAr0WyYLrPzfMH+h7a4SA1Etkxb3Zmqx3kNQ4k2qeEUYhFAOgPS+L1 Yvd2SsA2kUHYcme1tCdMc07Eu0aV6kxOS/WzrDvpK15ymJn5Q/8OVkADiBjLdQnKwzY4 FtScXyOHDkJqJjTU7/jL7tRTPhuKOvm5C4fj5mAhj08X/MjtBlfP9tE8ZkUHmd/kUn2v zo15TOdh7+PU3pZor+2fmiPHZeFdyre6eUKNl1oh7NQWRB8cPrIoSL4bVvFQa6Cut+oB VftQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 185-20020a6300c2000000b0052dcd67347asi878231pga.382.2023.05.25.03.39.45; Thu, 25 May 2023 03:39:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240745AbjEYJ4p (ORCPT + 99 others); Thu, 25 May 2023 05:56:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41440 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240760AbjEYJ4h (ORCPT ); Thu, 25 May 2023 05:56:37 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F8FD1A8 for ; Thu, 25 May 2023 02:56:34 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q27hv-000883-9M; Thu, 25 May 2023 11:56:31 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1q27ht-002h38-Ud; Thu, 25 May 2023 11:56:29 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q27ht-007oDK-Cl; Thu, 25 May 2023 11:56:29 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Krzysztof Kozlowski Cc: Rob Herring , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Philipp Marek Subject: [PATCH 1/3] w1: gpio: Don't use platform data for driver data Date: Thu, 25 May 2023 11:56:22 +0200 Message-Id: <20230525095624.615350-1-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5440; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=Jr4jdd4Vt9tRKMjOFoYlMijWrtsLO2vVIlPaYdkD+R0=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkbzDFc/Nj9ZzPpm5eilXnslC+/f1q4jaQBR/up uPTvCurhC2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZG8wxQAKCRCPgPtYfRL+ TqJ/B/9dVbYK5JxkcaW3vYtvn3QzSxxKTL3tWtV1yUQxGu21tRypwnhsil9xJpgASJkFt9GkmnD MBJg+tHqB0NNnWxbSKDD6exSeNn4HRuRd1ehOVeJ/ZimFUFVZis06cE86oUyGYT/euAMUEL/4SP KrLkRgpnSGo+O9yTUjwKXoXbZohExbMPBfasjTPtweyv2nTNelA9GRYlpn0/Fl74ankM9/u/bP5 kBMHqwRrSK4seqQef5gwjk2ZafLQsyYYGHQuqpFjkcq5IHs4YER52TrwnSDj4HOXJkpmxdbubQ/ +xFEIn45wrQzSFOdmW2uOrv4hX9/UBPLUs1r/XkLvU/jPSdm X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766862302676004057?= X-GMAIL-MSGID: =?utf-8?q?1766862302676004057?= struct device's .platform_data isn't for drivers to write to. For driver-specific data there is .driver_data instead. As there is no in-tree platform that provides w1_gpio_platform_data, drop the include file and replace it by a local struct w1_gpio_ddata. Signed-off-by: Uwe Kleine-König --- drivers/w1/masters/w1-gpio.c | 56 +++++++++++++++++------------------- include/linux/w1-gpio.h | 22 -------------- 2 files changed, 27 insertions(+), 51 deletions(-) delete mode 100644 include/linux/w1-gpio.h base-commit: ac9a78681b921877518763ba0e89202254349d1b diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c index e45acb6d916e..8d65db65178c 100644 --- a/drivers/w1/masters/w1-gpio.c +++ b/drivers/w1/masters/w1-gpio.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -18,9 +17,16 @@ #include +struct w1_gpio_ddata { + struct gpio_desc *gpiod; + struct gpio_desc *pullup_gpiod; + void (*enable_external_pullup)(int enable); + unsigned int pullup_duration; +}; + static u8 w1_gpio_set_pullup(void *data, int delay) { - struct w1_gpio_platform_data *pdata = data; + struct w1_gpio_ddata *pdata = data; if (delay) { pdata->pullup_duration = delay; @@ -46,14 +52,14 @@ static u8 w1_gpio_set_pullup(void *data, int delay) static void w1_gpio_write_bit(void *data, u8 bit) { - struct w1_gpio_platform_data *pdata = data; + struct w1_gpio_ddata *pdata = data; gpiod_set_value(pdata->gpiod, bit); } static u8 w1_gpio_read_bit(void *data) { - struct w1_gpio_platform_data *pdata = data; + struct w1_gpio_ddata *pdata = data; return gpiod_get_value(pdata->gpiod) ? 1 : 0; } @@ -69,35 +75,25 @@ MODULE_DEVICE_TABLE(of, w1_gpio_dt_ids); static int w1_gpio_probe(struct platform_device *pdev) { struct w1_bus_master *master; - struct w1_gpio_platform_data *pdata; + struct w1_gpio_ddata *pdata; struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; /* Enforce open drain mode by default */ enum gpiod_flags gflags = GPIOD_OUT_LOW_OPEN_DRAIN; int err; - if (of_have_populated_dt()) { - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) - return -ENOMEM; + pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!pdata) + return -ENOMEM; - /* - * This parameter means that something else than the gpiolib has - * already set the line into open drain mode, so we should just - * driver it high/low like we are in full control of the line and - * open drain will happen transparently. - */ - if (of_property_present(np, "linux,open-drain")) - gflags = GPIOD_OUT_LOW; - - pdev->dev.platform_data = pdata; - } - pdata = dev_get_platdata(dev); - - if (!pdata) { - dev_err(dev, "No configuration data\n"); - return -ENXIO; - } + /* + * This parameter means that something else than the gpiolib has + * already set the line into open drain mode, so we should just + * driver it high/low like we are in full control of the line and + * open drain will happen transparently. + */ + if (of_property_present(np, "linux,open-drain")) + gflags = GPIOD_OUT_LOW; master = devm_kzalloc(dev, sizeof(struct w1_bus_master), GFP_KERNEL); @@ -152,7 +148,7 @@ static int w1_gpio_probe(struct platform_device *pdev) static int w1_gpio_remove(struct platform_device *pdev) { struct w1_bus_master *master = platform_get_drvdata(pdev); - struct w1_gpio_platform_data *pdata = dev_get_platdata(&pdev->dev); + struct w1_gpio_ddata *pdata = master->data; if (pdata->enable_external_pullup) pdata->enable_external_pullup(0); @@ -167,7 +163,8 @@ static int w1_gpio_remove(struct platform_device *pdev) static int __maybe_unused w1_gpio_suspend(struct device *dev) { - struct w1_gpio_platform_data *pdata = dev_get_platdata(dev); + struct w1_bus_master *master = dev_get_drvdata(dev); + struct w1_gpio_ddata *pdata = master->data; if (pdata->enable_external_pullup) pdata->enable_external_pullup(0); @@ -177,7 +174,8 @@ static int __maybe_unused w1_gpio_suspend(struct device *dev) static int __maybe_unused w1_gpio_resume(struct device *dev) { - struct w1_gpio_platform_data *pdata = dev_get_platdata(dev); + struct w1_bus_master *master = dev_get_drvdata(dev); + struct w1_gpio_ddata *pdata = master->data; if (pdata->enable_external_pullup) pdata->enable_external_pullup(1); diff --git a/include/linux/w1-gpio.h b/include/linux/w1-gpio.h deleted file mode 100644 index 3495fd0dc790..000000000000 --- a/include/linux/w1-gpio.h +++ /dev/null @@ -1,22 +0,0 @@ -/* SPDX-License-Identifier: GPL-2.0-only */ -/* - * w1-gpio interface to platform code - * - * Copyright (C) 2007 Ville Syrjala - */ -#ifndef _LINUX_W1_GPIO_H -#define _LINUX_W1_GPIO_H - -struct gpio_desc; - -/** - * struct w1_gpio_platform_data - Platform-dependent data for w1-gpio - */ -struct w1_gpio_platform_data { - struct gpio_desc *gpiod; - struct gpio_desc *pullup_gpiod; - void (*enable_external_pullup)(int enable); - unsigned int pullup_duration; -}; - -#endif /* _LINUX_W1_GPIO_H */ From patchwork Thu May 25 09:56:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 98940 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp254249vqr; Thu, 25 May 2023 03:21:05 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4cQb+iYTMVCWsYg1s8KWuRrwJ0kqyg7B8Ru0NTHyl4dmLtJuonPrUUfEgT5YzAcfra8f8S X-Received: by 2002:a17:90a:4b87:b0:255:dd84:8643 with SMTP id i7-20020a17090a4b8700b00255dd848643mr1555509pjh.8.1685010064972; Thu, 25 May 2023 03:21:04 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685010064; cv=none; d=google.com; s=arc-20160816; b=AHYM0tmIx7D0SFxn7MORiy70bvIYY5quIuBPYhP6a49MapPzhEZ2eNNdsMm5zZIdhp fLsMgWTRiaeehY0IHZm5sxFnpInrK6bCQPujcQy1BXULd8qSySebAVlYazm2JV/dFZ7A MYbUH8fgdZy643ToUoNxEd+QDK5eqTTcLNpb/tqtssaClVw4OdD5KQdhUHGkh6U+MzY1 SiVgpKxN790w5MFEcQ99l9zpoq7IxRpyEBmuMX4ickbx8QCbXtl+QSAsRAGoVCKH5X7d 57G0sI9NXqvRXDsdHliWwcnFeNoK+AGlImm9XkAKdGmH4DTTmHTzz6b4RCH9fENZIDpN G6EA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=qxeejnT27BZTV9KKu+UfzKzRNUq8MxN0LkhIhtLhvuY=; b=wc59sfeKPF/CTSpuaDIy8FFDCbPb1rRqfo7jSJ54EI25fmHbbBymWTtASzUGCwDl/d jgpgUDKdhgGb+6g7pXKRToSyh8aKBiClPQSvLk2lM8aQdegBT0pnlzmc8wfZIqzDJ+Ci LNRhiafN/wAJutAEuge6+aaiUC7O6V4VqhGTSiqLcX9dLt/GGLkZ0SNi+L6ob8gP50YG R3u39XA+kkc5EID5T6v9+uRurit3jQj5OZP/SrQgGHj+QdBCJ2gWEoGS+myZskbS2Sm5 D7B/ekDkGsCdEWkwRsIix/VAEkULXZ3TSMSovXvnAGjLteVjOJwKYVaFt8utckAXGp4j cK+w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id 2-20020a631842000000b00534769ac796si873010pgy.495.2023.05.25.03.20.52; Thu, 25 May 2023 03:21:04 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240769AbjEYJ4n (ORCPT + 99 others); Thu, 25 May 2023 05:56:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41368 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240747AbjEYJ4h (ORCPT ); Thu, 25 May 2023 05:56:37 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F6251A6 for ; Thu, 25 May 2023 02:56:34 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q27hv-000884-9M; Thu, 25 May 2023 11:56:31 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1q27hu-002h3C-9C; Thu, 25 May 2023 11:56:30 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q27ht-007oDN-Ir; Thu, 25 May 2023 11:56:29 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Krzysztof Kozlowski Cc: Rob Herring , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Philipp Marek Subject: [PATCH 2/3] w1: gpio: Drop unused enable_external_pullup from driver data Date: Thu, 25 May 2023 11:56:23 +0200 Message-Id: <20230525095624.615350-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230525095624.615350-1-u.kleine-koenig@pengutronix.de> References: <20230525095624.615350-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2219; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=wlk+inFMM6onbNsMp3REBJLwSwRlU4DLnUXy0UUy6ZY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkbzDGZTn3s1FWL0WrHWwKlkcG51UN8vqGmFIrs Jz6JarQPhCJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZG8wxgAKCRCPgPtYfRL+ Tqn8B/4xpUWG5boSPk0b/zSVHy/EQND0ai9bQh5ZaH7oOIQ3iQ4nMrw9hJy0n7KkN2HJUa9QjF3 a20Q1/MD89URMBEKkhGT3muNeWQPNd7siBDXBRe5KMTCUttoz4FiRx7Q54aQa6UGskZ1B9w1Edu KZj6vc9iXYflF/JWuNPNeRudcbxRniIw3rJAQEkYyD/a0Zp2p9tjK3Vk8qcvYECxVqpr5LzMONT +FrKQVNTvBbtjbbFfVRoGxeZIS156FeUTUAHc8Sxe9h+GX+qARmHw7kRDwrI9i6wL2Ea7mgmtUO UJKfqB5rJ9Uosqky9S0Y1Loq3bxtjjr2nabOfOgE1CYnyW/F X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766861114144814343?= X-GMAIL-MSGID: =?utf-8?q?1766861114144814343?= This member is always NULL, so drop it. That makes the suspend and resume callbacks empty, so they can be dropped, too. Signed-off-by: Uwe Kleine-König --- drivers/w1/masters/w1-gpio.c | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c index 8d65db65178c..67596428f69b 100644 --- a/drivers/w1/masters/w1-gpio.c +++ b/drivers/w1/masters/w1-gpio.c @@ -20,7 +20,6 @@ struct w1_gpio_ddata { struct gpio_desc *gpiod; struct gpio_desc *pullup_gpiod; - void (*enable_external_pullup)(int enable); unsigned int pullup_duration; }; @@ -134,9 +133,6 @@ static int w1_gpio_probe(struct platform_device *pdev) return err; } - if (pdata->enable_external_pullup) - pdata->enable_external_pullup(1); - if (pdata->pullup_gpiod) gpiod_set_value(pdata->pullup_gpiod, 1); @@ -150,9 +146,6 @@ static int w1_gpio_remove(struct platform_device *pdev) struct w1_bus_master *master = platform_get_drvdata(pdev); struct w1_gpio_ddata *pdata = master->data; - if (pdata->enable_external_pullup) - pdata->enable_external_pullup(0); - if (pdata->pullup_gpiod) gpiod_set_value(pdata->pullup_gpiod, 0); @@ -161,34 +154,9 @@ static int w1_gpio_remove(struct platform_device *pdev) return 0; } -static int __maybe_unused w1_gpio_suspend(struct device *dev) -{ - struct w1_bus_master *master = dev_get_drvdata(dev); - struct w1_gpio_ddata *pdata = master->data; - - if (pdata->enable_external_pullup) - pdata->enable_external_pullup(0); - - return 0; -} - -static int __maybe_unused w1_gpio_resume(struct device *dev) -{ - struct w1_bus_master *master = dev_get_drvdata(dev); - struct w1_gpio_ddata *pdata = master->data; - - if (pdata->enable_external_pullup) - pdata->enable_external_pullup(1); - - return 0; -} - -static SIMPLE_DEV_PM_OPS(w1_gpio_pm_ops, w1_gpio_suspend, w1_gpio_resume); - static struct platform_driver w1_gpio_driver = { .driver = { .name = "w1-gpio", - .pm = &w1_gpio_pm_ops, .of_match_table = of_match_ptr(w1_gpio_dt_ids), }, .probe = w1_gpio_probe, From patchwork Thu May 25 09:56:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 98950 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:994d:0:b0:3d9:f83d:47d9 with SMTP id k13csp260734vqr; Thu, 25 May 2023 03:34:29 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ79bP4bEW+4F/6w1rQhqJ+186lmRJ3/qDQeLbKfo8M0uq5PfQQgIO149J/kjuaCfT3+tWc4 X-Received: by 2002:a17:902:8d95:b0:1ae:501:e230 with SMTP id v21-20020a1709028d9500b001ae0501e230mr1048400plo.11.1685010868817; Thu, 25 May 2023 03:34:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685010868; cv=none; d=google.com; s=arc-20160816; b=W+OeTVe+jvq2DQlsNQPLZxme2mXBXO9DzUegUwyDNXpuvkzq3KMakC+90fyYFla6ds c0FiTI7rFGRxOjQocKjCnBlsrd/rlBJGf5uiqwSlqPLIn4nIxVXPS5l8+mAdxonWMavE WUQq0wrJZeFTIZ8glcWmG0KQZr85XEhKF50tT4eN8+SeOR9w83uTJjP1w9Up3izZZ9Vf +7P5LnV0jawYzdKVyXLDSo7+3RuviTgMQRNKJ7Mfkif7UokTiOdeEAH+GwNiUDPe/Nci fqlsGQZCgeDODUK3lmXVM9OJVViLcfgHpFP47vUuamE+XnVvxBexZTEK2a8Fe5zTQwU+ Twgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=DC3JQAytQcp6mCCwMNcqXtx4NQIAyVtj8Kg4CfIj3iU=; b=UESAsi2OeDUicNCaVYXVyici36Q/KeRGFVkXSgN1sg7So5BwDFkevdCHCtTAgn26K0 kaGvJneM/P1v+uCO5YyjTos+XFZy0W4cr33sU4L0HgcAGKkKj18rZieCuNHzpAWYCccc Pg7CO9DX2cdT2qdHFZgpDoWqkIFqmsYoaI4sbxNNEdiGRFKixv2w5YOfjj8lNu01VeYJ oBeWyayiEVoruSKKAMGzAp9tNG20CT8VEGKLHcSKC80cdcmoVYTBaaRxqh6EM4rGgFml twDj0ebgsp/oMZTS6l2sdgBB0kaKDUO3Q1Gt/Cc1ozdSAnJ5ws8hYSxqduqhWk04ikPp 4QJQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id t15-20020a170902e84f00b001a64b603189si1293930plg.100.2023.05.25.03.34.13; Thu, 25 May 2023 03:34:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240801AbjEYJ4x (ORCPT + 99 others); Thu, 25 May 2023 05:56:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41450 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240762AbjEYJ4j (ORCPT ); Thu, 25 May 2023 05:56:39 -0400 Received: from metis.ext.pengutronix.de (metis.ext.pengutronix.de [IPv6:2001:67c:670:201:290:27ff:fe1d:cc33]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3F6FB1A7 for ; Thu, 25 May 2023 02:56:34 -0700 (PDT) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1q27hv-000885-Ei; Thu, 25 May 2023 11:56:31 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1q27hu-002h3F-O0; Thu, 25 May 2023 11:56:30 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1q27ht-007oDQ-Ot; Thu, 25 May 2023 11:56:29 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Krzysztof Kozlowski Cc: Rob Herring , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, Philipp Marek Subject: [PATCH 3/3] w1: gpio: rename pointer to driver data from pdata to ddata Date: Thu, 25 May 2023 11:56:24 +0200 Message-Id: <20230525095624.615350-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230525095624.615350-1-u.kleine-koenig@pengutronix.de> References: <20230525095624.615350-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4335; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=AL8CVkR6GSrHzRoCdksK3js8JGBEqMjHRgMeJ1Oggjc=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBkbzDH0KELSukdPftEo8RAgyLRMStfIcT+5PD0R yJ4FlQUnNeJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZG8wxwAKCRCPgPtYfRL+ ToyTCAC5m+tHjJxbk2R67TK+LYh2Xcq/tl4oYbKBVtVdT9GRgTeCH5PBijr9h8emMFaGOZt032S vFroEkvptDgSa/UakxeJVBExfQvq7GS8PDcNdqICsyszxT2GAWK4FDp688PrOu3uz3DXhirTSjw cM717ggqNsWD2HmTYZ95Ixc1GYGj4jPEx1cPoGwPi5gSjVOGmT/RuK/CLTNmHFOZd+XEm1U/gyQ EJDuKcTd4yWHQRhJr9Md/FOKyqbY/sSrGwvyuXqSKJjVTedqG0B422+mcdAneA9xV6WUDgSXUUH pxUmsPDMtQoG1R+uwOwzFcdAO+AOhliX4SM9ZtoCwvEnEcKP X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1766861957108381653?= X-GMAIL-MSGID: =?utf-8?q?1766861957108381653?= pdata is a relict when this was still platform data. Signed-off-by: Uwe Kleine-König --- drivers/w1/masters/w1-gpio.c | 54 ++++++++++++++++++------------------ 1 file changed, 27 insertions(+), 27 deletions(-) diff --git a/drivers/w1/masters/w1-gpio.c b/drivers/w1/masters/w1-gpio.c index 67596428f69b..0956ea857226 100644 --- a/drivers/w1/masters/w1-gpio.c +++ b/drivers/w1/masters/w1-gpio.c @@ -25,25 +25,25 @@ struct w1_gpio_ddata { static u8 w1_gpio_set_pullup(void *data, int delay) { - struct w1_gpio_ddata *pdata = data; + struct w1_gpio_ddata *ddata = data; if (delay) { - pdata->pullup_duration = delay; + ddata->pullup_duration = delay; } else { - if (pdata->pullup_duration) { + if (ddata->pullup_duration) { /* * This will OVERRIDE open drain emulation and force-pull * the line high for some time. */ - gpiod_set_raw_value(pdata->gpiod, 1); - msleep(pdata->pullup_duration); + gpiod_set_raw_value(ddata->gpiod, 1); + msleep(ddata->pullup_duration); /* * This will simply set the line as input since we are doing * open drain emulation in the GPIO library. */ - gpiod_set_value(pdata->gpiod, 1); + gpiod_set_value(ddata->gpiod, 1); } - pdata->pullup_duration = 0; + ddata->pullup_duration = 0; } return 0; @@ -51,16 +51,16 @@ static u8 w1_gpio_set_pullup(void *data, int delay) static void w1_gpio_write_bit(void *data, u8 bit) { - struct w1_gpio_ddata *pdata = data; + struct w1_gpio_ddata *ddata = data; - gpiod_set_value(pdata->gpiod, bit); + gpiod_set_value(ddata->gpiod, bit); } static u8 w1_gpio_read_bit(void *data) { - struct w1_gpio_ddata *pdata = data; + struct w1_gpio_ddata *ddata = data; - return gpiod_get_value(pdata->gpiod) ? 1 : 0; + return gpiod_get_value(ddata->gpiod) ? 1 : 0; } #if defined(CONFIG_OF) @@ -74,15 +74,15 @@ MODULE_DEVICE_TABLE(of, w1_gpio_dt_ids); static int w1_gpio_probe(struct platform_device *pdev) { struct w1_bus_master *master; - struct w1_gpio_ddata *pdata; + struct w1_gpio_ddata *ddata; struct device *dev = &pdev->dev; struct device_node *np = dev->of_node; /* Enforce open drain mode by default */ enum gpiod_flags gflags = GPIOD_OUT_LOW_OPEN_DRAIN; int err; - pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); - if (!pdata) + ddata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); + if (!ddata) return -ENOMEM; /* @@ -99,23 +99,23 @@ static int w1_gpio_probe(struct platform_device *pdev) if (!master) return -ENOMEM; - pdata->gpiod = devm_gpiod_get_index(dev, NULL, 0, gflags); - if (IS_ERR(pdata->gpiod)) { + ddata->gpiod = devm_gpiod_get_index(dev, NULL, 0, gflags); + if (IS_ERR(ddata->gpiod)) { dev_err(dev, "gpio_request (pin) failed\n"); - return PTR_ERR(pdata->gpiod); + return PTR_ERR(ddata->gpiod); } - pdata->pullup_gpiod = + ddata->pullup_gpiod = devm_gpiod_get_index_optional(dev, NULL, 1, GPIOD_OUT_LOW); - if (IS_ERR(pdata->pullup_gpiod)) { + if (IS_ERR(ddata->pullup_gpiod)) { dev_err(dev, "gpio_request_one " "(ext_pullup_enable_pin) failed\n"); - return PTR_ERR(pdata->pullup_gpiod); + return PTR_ERR(ddata->pullup_gpiod); } - master->data = pdata; + master->data = ddata; master->read_bit = w1_gpio_read_bit; - gpiod_direction_output(pdata->gpiod, 1); + gpiod_direction_output(ddata->gpiod, 1); master->write_bit = w1_gpio_write_bit; /* @@ -133,8 +133,8 @@ static int w1_gpio_probe(struct platform_device *pdev) return err; } - if (pdata->pullup_gpiod) - gpiod_set_value(pdata->pullup_gpiod, 1); + if (ddata->pullup_gpiod) + gpiod_set_value(ddata->pullup_gpiod, 1); platform_set_drvdata(pdev, master); @@ -144,10 +144,10 @@ static int w1_gpio_probe(struct platform_device *pdev) static int w1_gpio_remove(struct platform_device *pdev) { struct w1_bus_master *master = platform_get_drvdata(pdev); - struct w1_gpio_ddata *pdata = master->data; + struct w1_gpio_ddata *ddata = master->data; - if (pdata->pullup_gpiod) - gpiod_set_value(pdata->pullup_gpiod, 0); + if (ddata->pullup_gpiod) + gpiod_set_value(ddata->pullup_gpiod, 0); w1_remove_master_device(master);