Message ID | 20230928070706.2290137-23-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:cae8:0:b0:403:3b70:6f57 with SMTP id r8csp3137018vqu; Thu, 28 Sep 2023 00:41:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGN3QJC4vmTUzVlLqjYhYGp1z9ntWaTT0of+GuV5Akxu1I+523uR8iNraGHEoYhVhiEGzM1 X-Received: by 2002:a17:902:f804:b0:1c3:188c:a347 with SMTP id ix4-20020a170902f80400b001c3188ca347mr419160plb.54.1695886866800; Thu, 28 Sep 2023 00:41:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1695886866; cv=none; d=google.com; s=arc-20160816; b=nvlv3PkSc5pY60+W9Bw2/ps5gHoAZ6vpNQ8fzzwv+Z5HH0IvJT6fpiDQk17foQeEwW Ev1B1ucxG3ZkZ0zAi48oLcTgLjFQ6CrF/8le/1ZuDm2tZfuFCLAhMOnsrqGL9bcVVPDo FEYHcIbCcnEqDo597FIbdi0Aa6ESaa1No5EzXDc+thtHkO4hdP6P02UIBM+/qTN4sDXr k102FIg1I/6Bt6uj+Hh8c3CNtQSLhQfylpykZAcm7haEM0b4ZyzN8Ch0VYdIBMFHwVyg 3xtN1OPWVWnamFbmmFJUl0CGBag+ErAjH3gBMqa7b2Bf6jIdgavjDhov0GwrDHcQZNAK gbPg== 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=5VxIUetHUTbIgVUPmY2ygeDI9lygqbMz2/Ljtw8chs4=; fh=cAyRiaK3IJ2bBHCE7Fx1qcCHVnZYAp+cWXd1BpuS6EM=; b=v2p9VQtV4MAusEtWeQIjoM/mcNhi3+c0YpObVSPqrsL7NUlpNmFhsFlaeyEnomlW/k b+7x/uI+Yhw72d86gQWABNkzt8D2Ui9KnKcIS5O6Ioz1gM8Qr4FDMwp3luzKpWJ+qSkw FEldLobID1OFn4rhgLeQGMzlgq7EgazAknywJq6UP1sjrx1N25RpMcWUiwbQq4Kws+OU RzGA4GhTSMUZ0M3BadVch77g2091JoPI58f84R2RwQBj3G28YqcSyDcz1p39Gzee5Nna oCznMiSQTasOGeZ75vy8m76oU/0DlEaey6yrJIkrX6xEr0prKGrH3iJUTKuA1l8lD+V0 FinQ== 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 c4-20020a170903234400b001bb3406a5f7si885894plh.11.2023.09.28.00.41.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Sep 2023 00:41:06 -0700 (PDT) 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 C80288411D44; Thu, 28 Sep 2023 00:08:59 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at howler.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231289AbjI1HIw (ORCPT <rfc822;ruipengqi7@gmail.com> + 20 others); Thu, 28 Sep 2023 03:08:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48176 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231295AbjI1HH2 (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Thu, 28 Sep 2023 03:07:28 -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 E1B861B5 for <linux-kernel@vger.kernel.org>; Thu, 28 Sep 2023 00:07:23 -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 1qll7B-0002SH-4M; Thu, 28 Sep 2023 09:07:13 +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 1qll7A-009WCi-Mf; Thu, 28 Sep 2023 09:07:12 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from <ukl@pengutronix.de>) id 1qll7A-005ZYI-DN; Thu, 28 Sep 2023 09:07:12 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= <u.kleine-koenig@pengutronix.de> To: Linus Walleij <linus.walleij@linaro.org>, Bartosz Golaszewski <brgl@bgdev.pl> Cc: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>, Srinivas Neeli <srinivas.neeli@amd.com>, Michal Simek <michal.simek@amd.com>, Andy Shevchenko <andy@kernel.org>, linux-gpio@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH 22/23] gpio: xilinx: Convert to platform remove callback returning void Date: Thu, 28 Sep 2023 09:07:05 +0200 Message-Id: <20230928070706.2290137-23-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230928070706.2290137-1-u.kleine-koenig@pengutronix.de> References: <20230928070706.2290137-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=1831; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=OCUSDDDlpZowRKqn3i2KYETfeDiSoQ+fcaqhgCGW9E4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlFSR3juZR4QyyPw/qwux7zvp19nI7Skn/j7o6l tjat0CcGDyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZRUkdwAKCRCPgPtYfRL+ TnvSCACTk10j0dDCUwbMK8QsXCHKp6qMtMBfB69H00zn5h7bKfGDtOapxGbJmv0Vn9Prjfu+7Ua a6nKdghGiNXaYoeXGsL9g/fJVk4oWOnhXJ50bd3Hy+vNaCYRn/5WhvoXcajvyxLEjlQONXcddF/ YrMo75AayD4Bi0GED4bj4At8pU0UYawkjPjF63IgENPmHrYXvmFIoPn+WmU7hPO1i6IMbtoWRix DSdLPtF59wHjXS+7j1o9vYadzthGsZ0Q2rqhcxz3+f59FaPAnM2mqv3HMEUtTKPPLOPZXP6eHOu lEi0VbqeosVGRbsPmWgGUwBVP04FqZCUGjQSzCqtcVesEBpt 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=-1.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS 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: <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 (howler.vger.email [0.0.0.0]); Thu, 28 Sep 2023 00:08:59 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1778266267133417742 X-GMAIL-MSGID: 1778266267133417742 |
Series |
gpio: Convert to platform remove callback returning void
|
|
Commit Message
Uwe Kleine-König
Sept. 28, 2023, 7:07 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/gpio/gpio-xilinx.c | 6 ++----
1 file changed, 2 insertions(+), 4 deletions(-)
Comments
[AMD Official Use Only - General] Hi , Thanks for the patch > -----Original Message----- > From: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> > Sent: Thursday, September 28, 2023 12:37 PM > To: Linus Walleij <linus.walleij@linaro.org>; Bartosz Golaszewski > <brgl@bgdev.pl> > Cc: Datta, Shubhrajyoti <shubhrajyoti.datta@amd.com>; Neeli, Srinivas > <srinivas.neeli@amd.com>; Simek, Michal <michal.simek@amd.com>; Andy > Shevchenko <andy@kernel.org>; linux-gpio@vger.kernel.org; linux-arm- > kernel@lists.infradead.org; linux-kernel@vger.kernel.org > Subject: [PATCH 22/23] gpio: xilinx: Convert to platform remove callback > returning void > > Caution: This message originated from an External Source. Use proper caution > when opening attachments, clicking links, or responding. > > > 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> Reviewed-by: Shubhrajyoti Datta <shubhrajyoti.datta@amd.com>
diff --git a/drivers/gpio/gpio-xilinx.c b/drivers/gpio/gpio-xilinx.c index a16945e8319e..823198368250 100644 --- a/drivers/gpio/gpio-xilinx.c +++ b/drivers/gpio/gpio-xilinx.c @@ -332,7 +332,7 @@ static int __maybe_unused xgpio_suspend(struct device *dev) * * Return: 0 always */ -static int xgpio_remove(struct platform_device *pdev) +static void xgpio_remove(struct platform_device *pdev) { struct xgpio_instance *gpio = platform_get_drvdata(pdev); @@ -340,8 +340,6 @@ static int xgpio_remove(struct platform_device *pdev) pm_runtime_put_noidle(&pdev->dev); pm_runtime_disable(&pdev->dev); clk_disable_unprepare(gpio->clk); - - return 0; } /** @@ -715,7 +713,7 @@ MODULE_DEVICE_TABLE(of, xgpio_of_match); static struct platform_driver xgpio_plat_driver = { .probe = xgpio_probe, - .remove = xgpio_remove, + .remove_new = xgpio_remove, .driver = { .name = "gpio-xilinx", .of_match_table = xgpio_of_match,