From patchwork Mon Dec 4 22:05:21 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: 173575 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3066661vqy; Mon, 4 Dec 2023 14:06:16 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoWBaHMpfVh1GcwcNllOd4IVg3vITSvCkR3OiGkLBXUksqPoQxg2O6HXcOI1nU++Id9WDr X-Received: by 2002:a17:902:da82:b0:1d0:c345:c1d7 with SMTP id j2-20020a170902da8200b001d0c345c1d7mr358593plx.77.1701727575888; Mon, 04 Dec 2023 14:06:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701727575; cv=none; d=google.com; s=arc-20160816; b=on2keXws5o6VPgbVw9TREsM7L1+IO1LC2POy5Uemn9cbUvzmkEPWGgkoLyPjB3Fgz2 rEy4sHY9nx0x0CfkejDx9BcHBzdrgQ3PqNCpmdKtqv/PE/lqOMzCBtN8ACljMkvucYX4 VRaQgHqRM2u5Trg8mQ1O6ezQZD07qmPaG/CI7d9R7jnJXRglCIhdZqHl1bA5yIg+xWVY KtQ1NI4I4bE4mhogV+0lVVuK/F3l/WxcihB44jRxoDhRzg+BqRoCp9zahmrMhtVqg+sw uotLd4Z3NqbDx0b4RQcmMc9osOKlc+M1wJ9cvlKHXV1U+AnWJyQAmF7/dRyLPFR7B2Ty N1SA== 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=oX8cz5nfMGTDizKC5/+K/nAzbwG3hh671PMnbmSTJ9o=; fh=SRV02Hl1+bLVWhSoERk98/CYHq6XG7S5J1sqaC6oS10=; b=KnXQcfs7DOj30A6fpocilYYoO/3lMV1AnZE+L+FPEphlz5Df/l+za+buZPLLKA1jBb bvfhjhaA4yYKBRl9XmGwf4a3UCZKa7KocY0fnnobwjNY8xbx1w//lnsPlSENw6EOW26Q cU5pvtyWBYyraExWduHNQ/Dnm6JTEt9CIOg76sIxnJsfFswAtc+exAlmb+we0lyV3p7N bD4WqTzLpBzYAIz1KBcjy92mz1vmmgssB5FTnQneIcHGmsc4nPephAQmiEEgJtd57wVL 1R7KD7r/6S3UwbDdnWgzU7rYtJVpNYq17V2ImIsUNKbRhvinZHE7OaN7WQ7wdQmDThid CY8w== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from morse.vger.email (morse.vger.email. [23.128.96.31]) by mx.google.com with ESMTPS id n11-20020a170902d2cb00b001cb02e6f174si109207plc.492.2023.12.04.14.06.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:06:15 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) client-ip=23.128.96.31; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.31 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by morse.vger.email (Postfix) with ESMTP id A703F80A5B53; Mon, 4 Dec 2023 14:06:12 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at morse.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234146AbjLDWFg (ORCPT + 99 others); Mon, 4 Dec 2023 17:05:36 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32784 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233852AbjLDWFa (ORCPT ); Mon, 4 Dec 2023 17:05:30 -0500 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A7EB0FF for ; Mon, 4 Dec 2023 14:05:35 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rAH4G-0003EN-JZ; Mon, 04 Dec 2023 23:05:32 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAH4G-00DbY0-0e; Mon, 04 Dec 2023 23:05:32 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rAH4F-00EMX2-Nj; Mon, 04 Dec 2023 23:05:31 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Krzysztof Kozlowski Cc: Rob Herring , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v2 1/3] w1: gpio: Don't use platform data for driver data Date: Mon, 4 Dec 2023 23:05:21 +0100 Message-ID: <8f7ebe03ddaa5a5c6e2b36fecdf59da7fc373527.1701727212.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5383; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=AKyfJXZm9/5UE4F6cuV9Y1FnKF2AOE5dzxjtMA4AAnw=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbk0giTnUy1TC2koQvlwIjM1T+c3sZfvwKQ1u7 E5uex4YWWyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZW5NIAAKCRCPgPtYfRL+ TmCtB/9ZlAHAk4HQBIprhIRLWZRuhqP39AuxtCUHKLxPveQNUpAsWVwaa0NZH34R62CWYcmbdHb xXDLlF2Wfv5ygWBIkYmSgslamIa+5Ot2ZYbmD9lXfOUgD7BOPjG0ym/xG5evupUXuVqbjh5Kcw0 uXartNW+Nxstn6GSar5/op2D0tRaVEto1CvIFNimln53D8S2BRxI8O5H2FQIIHRWq7ZTlHwik9h RvwItkWH6nzKrjcGLOpvQmsauTXBeSM5fzLV688Y4niN/tD9m6gypcfj7YBT5D7cUG6MM29tzda HAkBIdl9JudotU9/g7riHqhnMGh1u4WRQak8qjJCRIN47wf4 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on morse.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (morse.vger.email [0.0.0.0]); Mon, 04 Dec 2023 14:06:12 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784390694481989206 X-GMAIL-MSGID: 1784390694481989206 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 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 Mon Dec 4 22:05: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: 173573 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3066517vqy; Mon, 4 Dec 2023 14:05:58 -0800 (PST) X-Google-Smtp-Source: AGHT+IGp0eG0t+FQjIztjaP4WBxE06fPc87nPsz0gm72+xBGV2AOzowD/Odr9R2+t/xzH9TDKNxT X-Received: by 2002:a05:6a00:a0b:b0:6ce:57f2:45fa with SMTP id p11-20020a056a000a0b00b006ce57f245famr272410pfh.49.1701727557925; Mon, 04 Dec 2023 14:05:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701727557; cv=none; d=google.com; s=arc-20160816; b=qzxFk8FC1tV6JOTfagOcpvJgYgnxcI06unlWHazuU77fmRJUAJ7xRr3SC/UBmN8ls7 HVFFnDfzxLOCUR6MwTCRg5LT/7cnuF/BlcPPU7yy19GBho/C9HssnGUBXysZvFxnN835 Ez+2VFjRA2owcfEECKXgAWY2cIhVetMFFB0tcoxMShE9mIJzTpqlwGVFucn5FmDYTRF0 Rtm6TwkDW02Usush920Aqk3tmNYUCEUyDc3FqkHj1Ih0dVxqUOQt3Z+ggUEdaGL5IEee MVFXocIYiXNV4BumTGaaBZzyI+059bGwlg5s6Kk0d4rNjs5XLoeQQfvR9isCHc9+Kd+7 9oHQ== 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=DrgVIi34b8ZYEjDRjjefP6WNBT2H2a7I9AxssTLpbDw=; fh=SRV02Hl1+bLVWhSoERk98/CYHq6XG7S5J1sqaC6oS10=; b=Pxas8PawMST6qORuLN3Xhz5EoXxj9RuaDlILwMRf3DQ6DuNjrgQVMQ2ZQQA2hrDuNh vrEqqxr1JtsISorcgAY9XyTwKXLVAKVkvISXOE0H7QQrUYp5yR43Kdb4ND3r/z+aYqsp JPrHdc7snTsawsLducBRf2ivpWCgJpdhntoQwk1SASLBra2Ad81pK0RsMY9mTTDYflwO iWl+vEZn4+BwwIbmPd1Bl9WifSp8QIhz/E1yLmpFLAdJavfMQw6IP8hjz7hVjHCSlKXb fMv/vSPQkDSishNY1oaywzbhcJNO4ZWOrv5hLSJe3kjaMotYBWZ6XrLQguxvuVYBodnr o0IQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from howler.vger.email (howler.vger.email. [23.128.96.34]) by mx.google.com with ESMTPS id d20-20020a056a0010d400b006cda012bf20si8527253pfu.264.2023.12.04.14.05.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:05:57 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) client-ip=23.128.96.34; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.34 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by howler.vger.email (Postfix) with ESMTP id 1FAA680B6BB8; Mon, 4 Dec 2023 14:05:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234464AbjLDWFn (ORCPT + 99 others); Mon, 4 Dec 2023 17:05:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231584AbjLDWF3 (ORCPT ); Mon, 4 Dec 2023 17:05:29 -0500 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 780E5FA for ; Mon, 4 Dec 2023 14:05:35 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rAH4G-0003EO-JY; Mon, 04 Dec 2023 23:05:32 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAH4G-00DbY3-6U; Mon, 04 Dec 2023 23:05:32 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rAH4F-00EMX6-TN; Mon, 04 Dec 2023 23:05:31 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Krzysztof Kozlowski Cc: Rob Herring , Greg Kroah-Hartman , linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v2 2/3] w1: gpio: Drop unused enable_external_pullup from driver data Date: Mon, 4 Dec 2023 23:05:22 +0100 Message-ID: <7009fc53745c8e0336e9379022ce648a60c519f8.1701727212.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2219; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=iZiYCCot4tFbakRhO9/1l9MMZBqNsQ48MgdJZLGkafQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbk0hf6byIO3pueIYUffdIjp0VJY4K7iFX/YW7 nCF5PvLkDqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZW5NIQAKCRCPgPtYfRL+ Trg0B/9gatIZe8tiLY8urH16QIiet3H5sbGv6UEua91F2XViJUukPKafvD98uoBvhbmsISw5zMT z1ChyaOwTuYnq6sWYshaES0S094/PcOPG6GSFZBwqgrbB4yZGyGnlJsesKN5Tga1O6rJY8Q67Ja j/lPKtM3ZdQp/qoy2uvF6qf9mNjcLz+L9biPE31+AD5GgczphCbkTwi/pkSq+Z85nrXCytqh8zg +In1zRjJyVQZQYlrjOTpZGEFSEBL5dQdkZB9uOdYruSCnwRZpQWZUtZfEK+mB797hQ4jfPXpMl1 rMKfBn0yNeckcU1hW41StNn31FHt6s2YFShcxGtM+wxneDqt 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 howler.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (howler.vger.email [0.0.0.0]); Mon, 04 Dec 2023 14:05:53 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784390675517774304 X-GMAIL-MSGID: 1784390675517774304 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 Mon Dec 4 22:05: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: 173574 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp3066524vqy; Mon, 4 Dec 2023 14:05:59 -0800 (PST) X-Google-Smtp-Source: AGHT+IEGok3TE0m+62Dh/8AfiD03SyQYx4bBp8SN1ZGgUiGo9QP1CLPSPuMEaAflkQ5IuihMxErs X-Received: by 2002:a17:902:dac4:b0:1cf:d7e2:5e73 with SMTP id q4-20020a170902dac400b001cfd7e25e73mr2863996plx.49.1701727558510; Mon, 04 Dec 2023 14:05:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701727558; cv=none; d=google.com; s=arc-20160816; b=y7dQaQX7k7cu/k3VPqlgDt8JfpZo23o99dv/1yDyYDz3fYfcWV8vuYYfawxrQKoQAb 7RJ0OjsNUIsZy9MDLd8BuT6kE+xPiq1OTfnKEGBpv7apmjnWYyAWmzmTUnNChI1irHtd 8JYlFROH+30++Zu74xjvHhafn7cYz5Gk9VeEFnSFfWr8Ob6oCDuvmfOCPgyrve5jRch0 io/jxFNDAjdx6uU/HuORAAnIJ7HMlr0dXt/FfZiOrW+i4mMo9kRGD0EAlvSniNOQvGbE YibjAoiwYPqhvIzpNS+Xx2KncbwuyvkUr1W1ofCVAzESH4o7lH/orqa2BSLnbWiAv+EF OEcA== 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=odDc91bxdxAD2UYjeZVEGqOe60eJ92gn5XLeoNASEGQ=; fh=+hm/0mWpOwx5vUwQFqg7TUR5phUxQgOi8rSeuI2z51w=; b=q/3iv34vQefidfSUVE0raE5xdHkBzTzJdaK70ViE7QGq0TmoRKgWlF5wInDiL4rN94 oHPyUFog0WOioy4+LVtH7T86QgFaZjNZIdKvp+6AVEBt4nCrozpYlrdNfYIWsY0UqJNz BwLfgnHF/toTqQjv/ogmJ/bas2Sah2cnmf69CSvkmqdsaB2UlWkwedFOAVBtIHH+QZ2F v3wt4bvG7sa9sVubBwzCeRwDil5VB3onqyWybebYhKlc9dBQoNOjyQOE/jf1PEIfVEBb lkWcrvIOU02gkZtSwcsIZMEurqg0vnqejZHLBnazIY+OHQ3Yql1gcZ19mmHw/G9jyjzQ 3ieA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id b6-20020a170903228600b001cfbb926859si8392568plh.387.2023.12.04.14.05.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Dec 2023 14:05:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 21BA6809F3BE; Mon, 4 Dec 2023 14:05:53 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234279AbjLDWFj (ORCPT + 99 others); Mon, 4 Dec 2023 17:05:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231195AbjLDWF2 (ORCPT ); Mon, 4 Dec 2023 17:05:28 -0500 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [IPv6:2a0a:edc0:2:b01:1d::104]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EA16CD for ; Mon, 4 Dec 2023 14:05:35 -0800 (PST) Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.whiteo.stw.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1rAH4G-0003Eq-Uv; Mon, 04 Dec 2023 23:05:32 +0100 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1rAH4G-00DbY6-I5; Mon, 04 Dec 2023 23:05:32 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1rAH4G-00EMXA-95; Mon, 04 Dec 2023 23:05:32 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Krzysztof Kozlowski Cc: Greg Kroah-Hartman , Rob Herring , linux-kernel@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH v2 3/3] w1: gpio: rename pointer to driver data from pdata to ddata Date: Mon, 4 Dec 2023 23:05:23 +0100 Message-ID: X-Mailer: git-send-email 2.42.0 In-Reply-To: References: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4335; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=xHTjgY4K9af7P1vNMusocVvYmeNn9kGZK5/hjxTbjaU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlbk0iwrlaqHGrugWKtZmWyfwV958P94eltYw5k s9bGNTaSpGJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZW5NIgAKCRCPgPtYfRL+ TqFkB/9dHTTrpvTiJhJauqJI0ZRre/cfyGBfu6hDGN+SGMJexK2NZrucAy8W81E85QyamsZpttt N3fL5og4hOD+DFYEU1C4cjfkTOzWTc5NHk02RXzcg38yhET1YI+BeyQ8577bxTbE+5GOJyym3yD 11as0zhIKVXjldIEaLOSX2mj4JSKU4c8Yy6X4aJnYc1E3gIW7ltEl+S9N0901eU+njaxBmGeu6l o1jGlRfrUq+zNSf5H/Fr+AE50ue5B6/tXTRurGj3Btyg/IK9wIUtGpgCBP5OQACFLODTa63Tiag vUpjxW2CUQ6ZaKUfQIFxyl38WtPBLDK1S67KHRRzrpmn5gxU 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.whiteo.stw.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,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 fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Mon, 04 Dec 2023 14:05:53 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784390676194087814 X-GMAIL-MSGID: 1784390676194087814 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..05c67038ed20 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(*ddata), 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);