[06/20] pinctrl: intel: lynxpoint: Convert to platform remove callback returning void
Message ID | 20231009083856.222030-7-u.kleine-koenig@pengutronix.de |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp1743146vqo; Mon, 9 Oct 2023 02:23:55 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGyrMEdKin8HpdlP7NLRgk0EFNWsSvHW88t73/s5nZuearaTyD3R5k5d0QsWlb/hhh7IZSy X-Received: by 2002:a05:6808:2097:b0:3ae:55e5:43b6 with SMTP id s23-20020a056808209700b003ae55e543b6mr17818387oiw.48.1696843435720; Mon, 09 Oct 2023 02:23:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696843435; cv=none; d=google.com; s=arc-20160816; b=wHSGZn6VPM8kEWQOh7IQf7y5Q0dX1lgSEWN60C1g/9NP9UsoRLLkZyXNaYyGPWNd96 LWkiYvlCDsRmqlzOnxEIz9wIXtPpofli0f3IN4unNEr8jiGRATshs8Vb3bLn/zGek0Io Rgb0svhC5NAUzdEqUafl+cVCQbYLMHTmurSaia0iR3pdVU/SJdjHM6kzCqKqoZwRohce YY9tGt8pTC7MpLYQAwz2yF3beG2cl6VShn6uFmztdohPPBtMR/0wgjz9bsUnHNYx6G9z gRXOsDoUBJA0VQeV4EAMH7J6jJO9/Gw1GlbHOBlDeiQqsCZdvpf0glmDdZlCEtERR5/L 6Bqg== 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=sCdEJ/yDaUBI/2Hdy+qCVy0OP6+QFn8BDaFTqil13tM=; fh=mSN73oHr7kfDNqWHLaWDjU7cicS/WqCMc4qshTlcuJ0=; b=d2ajvOd+VCs6aVsvgMEyZnVyD3fBIr7HuLfupBw/a96+6MKePL+iaKJxb7JbOgWp9Q /hvFSZuxNvV445jp/DTMG6u7t2/QNN0P5r+nqsrS5KkqYUZO/kNePwwI2O3jIFqGCOZY V6UT/z3P/pUURERWmrUSMDVSS2j5X8PCX1aFZU9s0TLgbt3pwjUGIoKX+Zzv8N5l2d/a AYVATW0bZd3LDH6y6maKdjPwm2QdrpYtDumZGBW3J1wcx4/RhhVo6B2y687YuHCjTtFA Fzc6B8Js9vSbUewAZLvK1w3xUFoHNDTaEmYosby9bCMFTHxUgEZHUqhWPrEwM9O4lGXx hsgA== 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:6 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from pete.vger.email (pete.vger.email. [2620:137:e000::3:6]) by mx.google.com with ESMTPS id a62-20020a639041000000b005859e22461csi9166165pge.817.2023.10.09.02.23.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 09 Oct 2023 02:23:55 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 as permitted sender) client-ip=2620:137:e000::3:6; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:6 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 pete.vger.email (Postfix) with ESMTP id B496980B3B63; Mon, 9 Oct 2023 02:23:45 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1345969AbjJIJXE (ORCPT <rfc822;ezelljr.billy@gmail.com> + 18 others); Mon, 9 Oct 2023 05:23:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345773AbjJIJW5 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 9 Oct 2023 05:22:57 -0400 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 4C940F2 for <linux-kernel@vger.kernel.org>; Mon, 9 Oct 2023 02:22:44 -0700 (PDT) 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 <ukl@pengutronix.de>) id 1qpmTD-0006sq-ML; Mon, 09 Oct 2023 11:22:35 +0200 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 <ukl@pengutronix.de>) id 1qpmTD-000NWd-8p; Mon, 09 Oct 2023 11:22:35 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from <ukl@pengutronix.de>) id 1qpmTC-00C4p9-Vt; Mon, 09 Oct 2023 11:22:34 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de> To: Linus Walleij <linus.walleij@linaro.org> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>, Andy Shevchenko <andy@kernel.org>, linux-gpio@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 06/20] pinctrl: intel: lynxpoint: Convert to platform remove callback returning void Date: Mon, 9 Oct 2023 10:38:42 +0200 Message-Id: <20231009083856.222030-7-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20231009083856.222030-1-u.kleine-koenig@pengutronix.de> References: <20231009083856.222030-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Developer-Signature: v=1; a=openpgp-sha256; l=1761; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=fsWrpmMKU/rWYOktZJIIlG/sX3wfJlY9nv6zFWW4epw=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlI7wFI8hfY+1w3twniM/3CdxJLG0rAcTAt0xJF 0qOyf/xxIyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZSO8BQAKCRCPgPtYfRL+ TghlCACZDDI0PkhZyjCfCHJ0oqnMoOlO09LfV3fC5w9nMJGRtsyksabDJwhBx983q4n/99/S8xK ywSo9xqhRmu7U1TVeL2sySStoniBDvRChCr4b0dXEEEoqIS+oxraQSqvL7fOTm3Y1unpnZlLnkV VVWCFZTUI1Zq1wtfwctxP4o6Kbsi6hrp/2cydsHJ2VP7Z7LEhJkhHjpAuvpi3rbeI93fn8kwtKW AkPmk7TGjz9odn1RnyYK7X4DTdQUZkyF7PEwhxyUprZj9g2uCU0ZTUrUQhMxKaYVPt5znxy1HVo pUcfO8/APURWonW/z7OfVzxfbdcYq/LQGRlMiqSgxkymvVoc X-Developer-Key: i=u.kleine-koenig@pengutronix.de; a=openpgp; fpr=0D2511F322BFAB1C1580266BE2DCDD9132669BD6 Content-Transfer-Encoding: 8bit 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=2.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on pete.vger.email Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (pete.vger.email [0.0.0.0]); Mon, 09 Oct 2023 02:23:45 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779269302553704857 X-GMAIL-MSGID: 1779269302553704857 |
Series |
pinctrl: Convert to platform remove callback returning void
|
|
Commit Message
Uwe Kleine-König
Oct. 9, 2023, 8:38 a.m. UTC
The .remove() callback for a platform driver returns an int which makes
many driver authors wrongly assume it's possible to do error handling by
returning an error code. However the value returned is ignored (apart
from emitting a warning) and this typically results in resource leaks.
To improve here there is a quest to make the remove callback return
void. In the first step of this quest all drivers are converted to
.remove_new(), which already returns void. Eventually after all drivers
are converted, .remove_new() will be renamed to .remove().
Trivially convert this driver from always returning zero in the remove
callback to the void returning variant.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
drivers/pinctrl/intel/pinctrl-lynxpoint.c | 5 ++---
1 file changed, 2 insertions(+), 3 deletions(-)
Comments
On Mon, Oct 09, 2023 at 10:38:42AM +0200, Uwe Kleine-König wrote: > The .remove() callback for a platform driver returns an int which makes > many driver authors wrongly assume it's possible to do error handling by > returning an error code. However the value returned is ignored (apart > from emitting a warning) and this typically results in resource leaks. > > To improve here there is a quest to make the remove callback return > void. In the first step of this quest all drivers are converted to > .remove_new(), which already returns void. Eventually after all drivers > are converted, .remove_new() will be renamed to .remove(). > > Trivially convert this driver from always returning zero in the remove > callback to the void returning variant. > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
On Mon, Oct 09, 2023 at 02:10:48PM +0300, Mika Westerberg wrote: > On Mon, Oct 09, 2023 at 10:38:42AM +0200, Uwe Kleine-König wrote: > > The .remove() callback for a platform driver returns an int which makes > > many driver authors wrongly assume it's possible to do error handling by > > returning an error code. However the value returned is ignored (apart > > from emitting a warning) and this typically results in resource leaks. > > > > To improve here there is a quest to make the remove callback return > > void. In the first step of this quest all drivers are converted to > > .remove_new(), which already returns void. Eventually after all drivers > > are converted, .remove_new() will be renamed to .remove(). > > > > Trivially convert this driver from always returning zero in the remove > > callback to the void returning variant. > > > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > > Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Pushed to my review and testing queue, thanks!
On Mon, Oct 9, 2023 at 2:10 PM Mika Westerberg <mika.westerberg@linux.intel.com> wrote: > On Mon, Oct 09, 2023 at 10:38:42AM +0200, Uwe Kleine-König wrote: ... > Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Actually this one got skipped as there is no more ->remove() in the driver!
diff --git a/drivers/pinctrl/intel/pinctrl-lynxpoint.c b/drivers/pinctrl/intel/pinctrl-lynxpoint.c index c3732a9f0658..f0725edcab3b 100644 --- a/drivers/pinctrl/intel/pinctrl-lynxpoint.c +++ b/drivers/pinctrl/intel/pinctrl-lynxpoint.c @@ -846,10 +846,9 @@ static int lp_gpio_probe(struct platform_device *pdev) return 0; } -static int lp_gpio_remove(struct platform_device *pdev) +static void lp_gpio_remove(struct platform_device *pdev) { pm_runtime_disable(&pdev->dev); - return 0; } static int lp_gpio_runtime_suspend(struct device *dev) @@ -890,7 +889,7 @@ MODULE_DEVICE_TABLE(acpi, lynxpoint_gpio_acpi_match); static struct platform_driver lp_gpio_driver = { .probe = lp_gpio_probe, - .remove = lp_gpio_remove, + .remove_new = lp_gpio_remove, .driver = { .name = "lp_gpio", .pm = pm_ptr(&lp_gpio_pm_ops),