From patchwork Mon Sep 18 08:59:28 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: 13389251 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3A789CD3421 for ; Mon, 18 Sep 2023 09:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241056AbjIRJBB (ORCPT ); Mon, 18 Sep 2023 05:01:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240924AbjIRJAS (ORCPT ); Mon, 18 Sep 2023 05:00:18 -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 E9A1918D for ; Mon, 18 Sep 2023 02:00:04 -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 ) id 1qiA6o-0008IP-Hf; Mon, 18 Sep 2023 10:59:58 +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 ) id 1qiA6m-007B5j-KP; Mon, 18 Sep 2023 10:59:56 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6m-002Z8j-BD; Mon, 18 Sep 2023 10:59:56 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: Alistair John Strachan , Hans de Goede , linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 01/24] hwmon: (abitguru{,3}) Enable build testing on !X86 Date: Mon, 18 Sep 2023 10:59:28 +0200 Message-Id: <20230918085951.1234172-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1128; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=Rj9hWijlZJ1jXilABPCHA0zWEHk6lFehoTJvNUwnOCU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBAr0Mj3rLktnJWlqi5VOa2vO9lVDbT8umQqV PxfXeTX79yJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQKwAKCRCPgPtYfRL+ Tp79B/wNRJpGObhtSdIsOKA4zpYnFHNASTWzmPaKS2kGXQF5dyodJrA/eB2TJM5dVOsl1fskRL8 /VyBy7VxzKchCJMipwzPdofN0W9XvYbkLkp/OUHk505aXS1BfOBOdjddMwN1zetu8XeY2zu1WNj I6n/96HpAZ9qi5LvQklvXO8bNAQaLkMzRgvZ+JlUG5mhR6w7gxqlvPey+B7E0g+iX0DutU76VmO F/5tW+kmCh61sDUFNimmcUoTFXJYoRB1mXjlPneLiu2xISKAbZmK0nu8bvSIo3fhZYfkF/XWwfi At+1P43gcpBkiXEF+89klWb3cedIDEtdrb8mHsUBusH9ryCf 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org The two drivers compile fine on arm64, powerpc, m68k and s390. So make it possible to enable the drivers in the presence of COMPILE_TEST. Signed-off-by: Uwe Kleine-König Reviewed-by: Hans de Goede --- drivers/hwmon/Kconfig | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/hwmon/Kconfig b/drivers/hwmon/Kconfig index ea390da7bc75..e36f58b01f2d 100644 --- a/drivers/hwmon/Kconfig +++ b/drivers/hwmon/Kconfig @@ -40,7 +40,7 @@ comment "Native drivers" config SENSORS_ABITUGURU tristate "Abit uGuru (rev 1 & 2)" - depends on X86 && DMI + depends on (X86 && DMI) || COMPILE_TEST help If you say yes here you get support for the sensor part of the first and second revision of the Abit uGuru chip. The voltage and frequency @@ -55,7 +55,7 @@ config SENSORS_ABITUGURU config SENSORS_ABITUGURU3 tristate "Abit uGuru (rev 3)" - depends on X86 && DMI + depends on (X86 && DMI) || COMPILE_TEST help If you say yes here you get support for the sensor part of the third revision of the Abit uGuru chip. Only reading the sensors From patchwork Mon Sep 18 08:59:29 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: 13389252 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4BB7CCD3420 for ; Mon, 18 Sep 2023 09:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241072AbjIRJBB (ORCPT ); Mon, 18 Sep 2023 05:01:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47996 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240923AbjIRJAS (ORCPT ); Mon, 18 Sep 2023 05:00:18 -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 9F46D18C for ; Mon, 18 Sep 2023 02:00:04 -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 ) id 1qiA6o-0008IR-Cz; Mon, 18 Sep 2023 10:59:58 +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 ) id 1qiA6m-007B5m-Qg; Mon, 18 Sep 2023 10:59:56 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6m-002Z8m-HU; Mon, 18 Sep 2023 10:59:56 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: Hans de Goede , linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 02/24] hwmon: (abituguru) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:29 +0200 Message-Id: <20230918085951.1234172-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1901; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=hr0l0aXjbLsXopIASPHUOnQPED/fbQwnTgx8hLnCzpc=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBAskSBM9rJwPhp+qrZhIofZIQUoNQoDweS14 iIIV3U6/yqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQLAAKCRCPgPtYfRL+ ThZvB/0VZzwpYArp+d/nosnbgJlmjNmAdqE2j7cS16yGy/awFC+rZTwsWYbsj+C4IYI7q3IheIu RpZf1MNHwafAr/WSwL4FoXMWTmo4ZRl1IqMT/ekQMt8jkSJYDcakQy5C+TrvsKDXzH/C8NiB4Pd 8VsfSDH2BFFChyEnzAmj6sv7osObtCo4d/Enn8pgGU+8hwK39Ip9jUcCoKyb4KMnFsQArirrtVg 4c9HkDXd8zLcEz4aqUj/a4UZqR3a7izXh9ZEDpCbAHoPBvbyQha31LPDiHVZGJqMUmXjGa60/Ej JbJZqEixDwTZJVDUd5dAQ8m+eXlzydXx0I+2oCxDwShdMZhK 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 Reviewed-by: Hans de Goede --- drivers/hwmon/abituguru.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/abituguru.c b/drivers/hwmon/abituguru.c index a7cae6568155..93653ea05430 100644 --- a/drivers/hwmon/abituguru.c +++ b/drivers/hwmon/abituguru.c @@ -1428,7 +1428,7 @@ static int abituguru_probe(struct platform_device *pdev) return res; } -static int abituguru_remove(struct platform_device *pdev) +static void abituguru_remove(struct platform_device *pdev) { int i; struct abituguru_data *data = platform_get_drvdata(pdev); @@ -1439,8 +1439,6 @@ static int abituguru_remove(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(abituguru_sysfs_attr); i++) device_remove_file(&pdev->dev, &abituguru_sysfs_attr[i].dev_attr); - - return 0; } static struct abituguru_data *abituguru_update_device(struct device *dev) @@ -1533,7 +1531,7 @@ static struct platform_driver abituguru_driver = { .pm = pm_sleep_ptr(&abituguru_pm), }, .probe = abituguru_probe, - .remove = abituguru_remove, + .remove_new = abituguru_remove, }; static int __init abituguru_detect(void) From patchwork Mon Sep 18 08:59:30 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: 13389232 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A015ACD13DA for ; Mon, 18 Sep 2023 09:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240943AbjIRJAr (ORCPT ); Mon, 18 Sep 2023 05:00:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56844 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234572AbjIRJAK (ORCPT ); Mon, 18 Sep 2023 05:00:10 -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 1D20B10D for ; Mon, 18 Sep 2023 02:00:01 -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 ) id 1qiA6o-0008IS-Hb; Mon, 18 Sep 2023 10:59:58 +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 ) id 1qiA6n-007B5p-1L; Mon, 18 Sep 2023 10:59:57 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6m-002Z8r-OH; Mon, 18 Sep 2023 10:59:56 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: Alistair John Strachan , linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 03/24] hwmon: (abituguru3) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:30 +0200 Message-Id: <20230918085951.1234172-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1919; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=goNf4rLekOcsxbVlk/nlpWJi0z9FI8unadeLWY5YZK4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBAtutzZk79bx1i5R05/IJGuuTpyVtsEjDpK6 PLDh8WHuymJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQLQAKCRCPgPtYfRL+ TiPZB/9vohH9EgHa2h3tILvPx2aNOK1B/K5+7MR8OBrk3nfsPMGGvUECA0IsCYs17ILkULlYLIi 4olDOT6a2EZibI7HiHuzfDz6tZOWREpXi6mRWrJb7YQ1nCcia1BE8U8IP/3Zw5XvdMM2sXmAsZr 1/cKtlutGpe33uUhZjZGHTKPZKO3X3r72qx9+0ktphPODp8XLlfdDjxhxEy8Vf3Vt/67hS85qJI taTvkcQJmJsS7oZgbkTVS+CMWhUQWFMsumSUqzC02u/IHosWKtykTYk6UbChUcmGglZCyxymV+C LGtMWawTvolVdRBuDgX+3xj5/lAW4vbNqkOVMTCXAcU+BGAj 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/abituguru3.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/abituguru3.c b/drivers/hwmon/abituguru3.c index afb21f73032d..4501f0e49efb 100644 --- a/drivers/hwmon/abituguru3.c +++ b/drivers/hwmon/abituguru3.c @@ -1061,7 +1061,7 @@ static int abituguru3_probe(struct platform_device *pdev) return res; } -static int abituguru3_remove(struct platform_device *pdev) +static void abituguru3_remove(struct platform_device *pdev) { int i; struct abituguru3_data *data = platform_get_drvdata(pdev); @@ -1072,7 +1072,6 @@ static int abituguru3_remove(struct platform_device *pdev) for (i = 0; i < ARRAY_SIZE(abituguru3_sysfs_attr); i++) device_remove_file(&pdev->dev, &abituguru3_sysfs_attr[i].dev_attr); - return 0; } static struct abituguru3_data *abituguru3_update_device(struct device *dev) @@ -1153,7 +1152,7 @@ static struct platform_driver abituguru3_driver = { .pm = pm_sleep_ptr(&abituguru3_pm), }, .probe = abituguru3_probe, - .remove = abituguru3_remove, + .remove_new = abituguru3_remove, }; static int __init abituguru3_dmi_detect(void) From patchwork Mon Sep 18 08:59:31 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: 13389237 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F06F1CD13DD for ; Mon, 18 Sep 2023 09:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240965AbjIRJAv (ORCPT ); Mon, 18 Sep 2023 05:00:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240851AbjIRJAL (ORCPT ); Mon, 18 Sep 2023 05:00:11 -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 82B48119 for ; Mon, 18 Sep 2023 02:00:01 -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 ) id 1qiA6o-0008IT-FZ; Mon, 18 Sep 2023 10:59:58 +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 ) id 1qiA6n-007B5s-8F; Mon, 18 Sep 2023 10:59:57 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6m-002Z8v-V5; Mon, 18 Sep 2023 10:59:56 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: Support Opensource , linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 04/24] hwmon: (da9052-hwmon) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:31 +0200 Message-Id: <20230918085951.1234172-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1757; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=CiVPdsDBpYOFw0XZx1KwV6JX9RA8Rx4wdI7I6zWBwUo=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBAuewaxF1EgrhoHDeIbEHFwT7ost+nYIidjd a/wAmQZyHGJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQLgAKCRCPgPtYfRL+ TrTZB/40sV68jJV1H42ha8kvm1HwM9AylsG/m9BjLSUEdKvGdmu2MNgzd0VcbNj/Ce7K+swHM5L jFG7aqBO46U3nnqfQHGbncia482WuC92h0yLGLUJ+CloVKdFCpwhJzn0uV9Bff8S8z4BtCqs0NY xIK9ShnCUEQPoUu2eDjZ8zbac3fQSb0RCe1X/NLr+q+kczV23nypsQLI8vRJuqZkD7YNSa6m5+i hNRT8cLgyyrVe90jImBRpq+mRp9ddwcEH6kszy1xTKrDa3uO1N6REf3AUILKUhOMz44tw+CyR1E Lz8y8CACPWk7edium+yn1wGz0//t4wBpv7WR9jSQ/ljv2Dzt 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/da9052-hwmon.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/da9052-hwmon.c b/drivers/hwmon/da9052-hwmon.c index ed6c5df94fdf..2bd7ae8100d7 100644 --- a/drivers/hwmon/da9052-hwmon.c +++ b/drivers/hwmon/da9052-hwmon.c @@ -479,7 +479,7 @@ static int da9052_hwmon_probe(struct platform_device *pdev) return err; } -static int da9052_hwmon_remove(struct platform_device *pdev) +static void da9052_hwmon_remove(struct platform_device *pdev) { struct da9052_hwmon *hwmon = platform_get_drvdata(pdev); @@ -487,13 +487,11 @@ static int da9052_hwmon_remove(struct platform_device *pdev) da9052_free_irq(hwmon->da9052, DA9052_IRQ_TSIREADY, hwmon); regulator_disable(hwmon->tsiref); } - - return 0; } static struct platform_driver da9052_hwmon_driver = { .probe = da9052_hwmon_probe, - .remove = da9052_hwmon_remove, + .remove_new = da9052_hwmon_remove, .driver = { .name = "da9052-hwmon", }, From patchwork Mon Sep 18 08:59:32 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: 13389236 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D0C9CCD13D9 for ; Mon, 18 Sep 2023 09:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240837AbjIRJAt (ORCPT ); Mon, 18 Sep 2023 05:00:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239127AbjIRJAL (ORCPT ); Mon, 18 Sep 2023 05:00:11 -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 5C083114 for ; Mon, 18 Sep 2023 02:00:01 -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 ) id 1qiA6o-0008Ip-RG; Mon, 18 Sep 2023 10:59:58 +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 ) id 1qiA6n-007B5v-EG; Mon, 18 Sep 2023 10:59:57 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6n-002Z8z-4e; Mon, 18 Sep 2023 10:59:57 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: Juerg Haefliger , linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 05/24] hwmon: (dme1737) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:32 +0200 Message-Id: <20230918085951.1234172-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1758; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=2cHQePTYCcqPbt4Weuf5TBiTdzKUj+uGMN9gzgtwRBk=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBAvnSQevwSTUpkd01jS+z4ygXes7x3bcnE4t RXGTu47Kp+JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQLwAKCRCPgPtYfRL+ Ti6ACACppXvXL8EipqqVY1P/MTKIzU9av5y9s6HNyiK7BsyG4kvD1CGqP84HwNpzO596Ew+S9lK P+FDklKGegr2LofpuZRSsv4C+3sD9W3ATkqwcsbeug83BD1flb+r79gtqufhvr9jj3IfUZ9kpEo Q3il0scJ+7ImThjRUsCyMV9Ps283EjnAzbHaROASQecrYDVY7qAQKL1H+r52TkxHMNRSQFnJwFx 2vaKl1ER2nwfGKEgM0xXadSI7Do+UOz5MK9iO35l60LeiOBE95ueqG7fS0y+G6Id9Re+lnDyWcL oDdgnLYk4PraZhcniSvUOmeut7Hget6uAgLjDCskMJT/BqKa 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/dme1737.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/dme1737.c b/drivers/hwmon/dme1737.c index cdbf3dff9172..3dcef221041d 100644 --- a/drivers/hwmon/dme1737.c +++ b/drivers/hwmon/dme1737.c @@ -2710,14 +2710,12 @@ static int dme1737_isa_probe(struct platform_device *pdev) return err; } -static int dme1737_isa_remove(struct platform_device *pdev) +static void dme1737_isa_remove(struct platform_device *pdev) { struct dme1737_data *data = platform_get_drvdata(pdev); hwmon_device_unregister(data->hwmon_dev); dme1737_remove_files(&pdev->dev); - - return 0; } static struct platform_driver dme1737_isa_driver = { @@ -2725,7 +2723,7 @@ static struct platform_driver dme1737_isa_driver = { .name = "dme1737", }, .probe = dme1737_isa_probe, - .remove = dme1737_isa_remove, + .remove_new = dme1737_isa_remove, }; /* --------------------------------------------------------------------- From patchwork Mon Sep 18 08:59:33 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: 13389229 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 47E7ACD13D1 for ; Mon, 18 Sep 2023 09:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238933AbjIRJAm (ORCPT ); Mon, 18 Sep 2023 05:00:42 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56820 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240935AbjIRJAJ (ORCPT ); Mon, 18 Sep 2023 05:00:09 -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 759B9D9 for ; Mon, 18 Sep 2023 02:00:00 -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 ) id 1qiA6o-0008Iq-Cv; Mon, 18 Sep 2023 10:59:58 +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 ) id 1qiA6n-007B5y-KI; Mon, 18 Sep 2023 10:59:57 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6n-002Z92-Ai; Mon, 18 Sep 2023 10:59:57 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 06/24] hwmon: (f71805f) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:33 +0200 Message-Id: <20230918085951.1234172-7-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1874; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=fdxXzCVZhTMr0kPb4TAF1QYRebcQPTKZmZ5e2WrPjHo=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBAw8sLYB9fdLOj4Rs5AzQuS9+3xmMtI9hsUe wce3V3OVW2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQMAAKCRCPgPtYfRL+ Tp6gB/9FZ/TD6hfOARe0B3sOF3QoyFdlsZnS7vy1UsCQLmSj7r7Xfg7Qh8YfqpuNuP3mYIH5UyB RVsYP7uaP36W2HaQnavzt2V602NFI4q5+T1kjSEJ5moeGBW8yGoLWkuSnVbztCvXe4qU5lPSLod oOnHQI7bF0fDxM0Q7feIxRdMjTJC0JdlhOMi4FtO1S/ihjkkP/uzjB5gJjtEt6AjNytYlyIhaMi CaNEYWIJwfDYpzbgZ7N/f3C1UdPqfYquZ+0a88qWtYUde6F8bHM65qEp27GbfPzS3ZIt3u/m01M 3jyMenCyN8LQIvDc3IyFJFnBXFnwQhrbtXZc5g06MiWOCg5M 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/f71805f.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/f71805f.c b/drivers/hwmon/f71805f.c index 7f20edb0677c..243c570dee4c 100644 --- a/drivers/hwmon/f71805f.c +++ b/drivers/hwmon/f71805f.c @@ -1480,7 +1480,7 @@ static int f71805f_probe(struct platform_device *pdev) return err; } -static int f71805f_remove(struct platform_device *pdev) +static void f71805f_remove(struct platform_device *pdev) { struct f71805f_data *data = platform_get_drvdata(pdev); int i; @@ -1490,8 +1490,6 @@ static int f71805f_remove(struct platform_device *pdev) for (i = 0; i < 4; i++) sysfs_remove_group(&pdev->dev.kobj, &f71805f_group_optin[i]); sysfs_remove_group(&pdev->dev.kobj, &f71805f_group_pwm_freq); - - return 0; } static struct platform_driver f71805f_driver = { @@ -1499,7 +1497,7 @@ static struct platform_driver f71805f_driver = { .name = DRVNAME, }, .probe = f71805f_probe, - .remove = f71805f_remove, + .remove_new = f71805f_remove, }; static int __init f71805f_device_add(unsigned short address, From patchwork Mon Sep 18 08:59:34 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: 13389230 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C9F4CD13D8 for ; Mon, 18 Sep 2023 09:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240928AbjIRJAq (ORCPT ); Mon, 18 Sep 2023 05:00:46 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56790 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240930AbjIRJAJ (ORCPT ); Mon, 18 Sep 2023 05:00:09 -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 CB9CEFB for ; Mon, 18 Sep 2023 02:00:00 -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 ) id 1qiA6o-0008Ir-Cu; Mon, 18 Sep 2023 10:59:58 +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 ) id 1qiA6n-007B61-QU; Mon, 18 Sep 2023 10:59:57 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6n-002Z96-HC; Mon, 18 Sep 2023 10:59:57 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 07/24] hwmon: (f71882fg) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:34 +0200 Message-Id: <20230918085951.1234172-8-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1799; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=50l0hLGmaPxmeEZGz9hTtFDVpGPNc3HHZDLrvu0Nrqk=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBAyr8DqJ9SMTeL+cwp9i3yaGDeAMMqxrB/4W FKOt+KkEFCJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQMgAKCRCPgPtYfRL+ TujQB/9uXDy8q2Ph1lpEefpNejz/CFy2Ck+OuOZNDtevf7YgbLFehISUR6vionNENgWR1WAhoO/ tB88oIbCos3x7wdh14nUzFPBmX6wQtm0uzOUlgQ4SyskjoZFnd1GSBD77+NKXeunfqN7bf0jYfg +U44Bf9Y6CkCE4fiJn7DeekKqTap4I5EmYVIsBDc4q53pNSDhoq4JwabPzevi2GkWpsV8zmJQdJ 6XwCkC5qC4oHZ6O+hWnAOxZCQGJfuDlIucUMscGjZyW/gRS/HFSNZxqP+t1r0yH6kWGyEEfalwu TQiqptbIvHAnqQ/oR2GIQETx1D/q1iIb2+2jIxRsI51qdGmH 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/f71882fg.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/f71882fg.c b/drivers/hwmon/f71882fg.c index 27207ec6f7fe..7c941d320a18 100644 --- a/drivers/hwmon/f71882fg.c +++ b/drivers/hwmon/f71882fg.c @@ -2223,7 +2223,7 @@ static int f71882fg_create_fan_sysfs_files( return err; } -static int f71882fg_remove(struct platform_device *pdev) +static void f71882fg_remove(struct platform_device *pdev) { struct f71882fg_data *data = platform_get_drvdata(pdev); int nr_fans = f71882fg_nr_fans[data->type]; @@ -2333,7 +2333,6 @@ static int f71882fg_remove(struct platform_device *pdev) ARRAY_SIZE(fxxxx_auto_pwm_attr[0]) * nr_fans); } } - return 0; } static int f71882fg_probe(struct platform_device *pdev) @@ -2659,7 +2658,7 @@ static struct platform_driver f71882fg_driver = { .name = DRVNAME, }, .probe = f71882fg_probe, - .remove = f71882fg_remove, + .remove_new = f71882fg_remove, }; static int __init f71882fg_init(void) From patchwork Mon Sep 18 08:59:35 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: 13389234 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 574F8CD37B0 for ; Mon, 18 Sep 2023 09:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240895AbjIRJAp (ORCPT ); Mon, 18 Sep 2023 05:00:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56802 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240931AbjIRJAJ (ORCPT ); Mon, 18 Sep 2023 05:00:09 -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 CC3C110A for ; Mon, 18 Sep 2023 02:00:00 -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 ) id 1qiA6o-0008Is-D1; Mon, 18 Sep 2023 10:59:58 +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 ) id 1qiA6o-007B64-0Y; Mon, 18 Sep 2023 10:59:58 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6n-002Z9B-Nd; Mon, 18 Sep 2023 10:59:57 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 08/24] hwmon: (i5k_amb) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:35 +0200 Message-Id: <20230918085951.1234172-9-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1778; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=VWlulYbPf5rVhjZ/FS6dh3ZqMiObZmpW+i9lXbXxNzY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBAzg9nONqAZlycztBd3aNaztUl5VazT+fjp4 mvKGDH18CGJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQMwAKCRCPgPtYfRL+ TpMlB/0SmI105rutpO8FVoQAM5wVPJlhXcHPwGX4wkTBAXrvzcx0GZjjcm0HFkcu0vV7EtErNKr 0nMP4GrOdfwG3jthrUkYEGaucmP0XYq2tlJWpi8nRtNEcnCGZecGeA4wlDDPOxhknk/hXM/i+iI rV+YfTkSz9sP1CP+CgdJ2sJRx6pfIBaLxh7PP6lDtQRz8GyC7hQv8DPiuSJwtiDqDho1VxF+Ism CWAuTZiXdn5Y971IfEbewD/5ByXtkSjJMyjbXJFjP90U+T2BKBCS9OIszuY4/tTYa4ioa1XjIoG tpSKlZi60cvclqFOqVavilfGbfUdKEfwA+rlr3GIukGvCnYa 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/i5k_amb.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c index 783fa936e4d1..ff48913fe6bf 100644 --- a/drivers/hwmon/i5k_amb.c +++ b/drivers/hwmon/i5k_amb.c @@ -555,7 +555,7 @@ static int i5k_amb_probe(struct platform_device *pdev) return res; } -static int i5k_amb_remove(struct platform_device *pdev) +static void i5k_amb_remove(struct platform_device *pdev) { int i; struct i5k_amb_data *data = platform_get_drvdata(pdev); @@ -568,7 +568,6 @@ static int i5k_amb_remove(struct platform_device *pdev) iounmap(data->amb_mmio); release_mem_region(data->amb_base, data->amb_len); kfree(data); - return 0; } static struct platform_driver i5k_amb_driver = { @@ -576,7 +575,7 @@ static struct platform_driver i5k_amb_driver = { .name = DRVNAME, }, .probe = i5k_amb_probe, - .remove = i5k_amb_remove, + .remove_new = i5k_amb_remove, }; static int __init i5k_amb_init(void) From patchwork Mon Sep 18 08:59:36 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: 13389228 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D338C46CA1 for ; Mon, 18 Sep 2023 09:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238266AbjIRJAl (ORCPT ); Mon, 18 Sep 2023 05:00:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56812 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240933AbjIRJAJ (ORCPT ); Mon, 18 Sep 2023 05:00:09 -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 74E00D8 for ; Mon, 18 Sep 2023 02:00:00 -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 ) id 1qiA6o-0008JI-M8; Mon, 18 Sep 2023 10:59:58 +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 ) id 1qiA6o-007B69-8p; Mon, 18 Sep 2023 10:59:58 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6n-002Z9F-Vg; Mon, 18 Sep 2023 10:59:57 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 09/24] hwmon: (max197) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:36 +0200 Message-Id: <20230918085951.1234172-10-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1743; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=MWVb3o3fYD3B/3RNm0kBj7/nNllWuIZC/s7a5ncXA04=; b=owGbwMvMwMXY3/A7olbonx/jabUkhlQOARMNvd9xMnNcFE59kr/i8tU4P9DRVNz+6YwcB/7iB G+j6QKdjMYsDIxcDLJiiiz2jWsyrarkIjvX/rsMM4iVCWQKAxenAEzEgZ39fyzXYR6R5Ru2yHyR mC6Yudg3i23ZutkGbNt2u27ZvnfasU9nS2UrJyY9eHTq20sOweS+dCkZs6L7qnZBRufEC9kqd3x WFekR1WSQe3F16dSsfnPbi0/537Xztd1OXO/+r4YnZmPS851LHr5N1Pb/37P5SHJiZVTQ/8QElv Mt+S9+XWPc5fs/927ph4vd3E5TGfY2/jiep2AY86bxYfTT0DrlN0oWH3NTnv2JeXgr20ZhU2A5Y 5FBHuNa78/Hc+5mzIrY+32m/r/5iVuTc+6Ften5bjiaVvUv9aTOPH+lU/Oql/6Vqb/cWL8813ul jbcAH/NqYZtTuV3VTYWZh/uFhTTeSt++/nRmjuzTTd1vAA== 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/max197.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/max197.c b/drivers/hwmon/max197.c index 56add579e32f..bb30403f81ca 100644 --- a/drivers/hwmon/max197.c +++ b/drivers/hwmon/max197.c @@ -312,14 +312,12 @@ static int max197_probe(struct platform_device *pdev) return ret; } -static int max197_remove(struct platform_device *pdev) +static void max197_remove(struct platform_device *pdev) { struct max197_data *data = platform_get_drvdata(pdev); hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&pdev->dev.kobj, &max197_sysfs_group); - - return 0; } static const struct platform_device_id max197_device_ids[] = { @@ -334,7 +332,7 @@ static struct platform_driver max197_driver = { .name = "max197", }, .probe = max197_probe, - .remove = max197_remove, + .remove_new = max197_remove, .id_table = max197_device_ids, }; module_platform_driver(max197_driver); From patchwork Mon Sep 18 08:59:37 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: 13389233 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6CF52CD13D2 for ; Mon, 18 Sep 2023 09:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240868AbjIRJAo (ORCPT ); Mon, 18 Sep 2023 05:00:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56834 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240934AbjIRJAJ (ORCPT ); Mon, 18 Sep 2023 05:00:09 -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 CC329102 for ; Mon, 18 Sep 2023 02:00:00 -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 ) id 1qiA6o-0008Jp-RI; Mon, 18 Sep 2023 10:59:58 +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 ) id 1qiA6o-007B6C-Dr; Mon, 18 Sep 2023 10:59:58 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6o-002Z9J-4j; Mon, 18 Sep 2023 10:59:58 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 10/24] hwmon: (mc13783-adc) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:37 +0200 Message-Id: <20230918085951.1234172-11-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2024; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=nn5xrq7DX7lu5wY9Yint50s0zoLGHsO0W7k4UgigcaI=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBA17cNiFpctvRTnAn3v4gg4T0+PrYy7+nSul mo7SP048AOJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQNQAKCRCPgPtYfRL+ TvPyCACRc1aPEDmh3ydUXn5OQ3Kn++FFtDyc3ghOsYWy4aykVuOAcK9iZgRYO9UzJfqHRZuBLaT 0Fu3yn/B5W3G2AbfcZrPQjdUPQ0KsttOFnaz9UXayEExjwIQK5fuorCeRzzJLd7kkJr3Pgdo+K6 DPp/ieomVNTw6eFJXkpY1aukwEO1ULLGPWry3rnJc453SG5wwBxHl4I7ri00Bob3/mqAEMEejan be87MURKlqGajCory3AtCFWA8dUMDxUbkds5DV+mysc6Ve95qESSovVIM7pFnoak1Dkdmm+wN03 Bq1E1ZcvSbEj4DisxQ22hGWvI2gNfIgHnI0vVV1sl2aljp97 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/mc13783-adc.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/mc13783-adc.c b/drivers/hwmon/mc13783-adc.c index ff147e5e1b8c..67471c9cd4d4 100644 --- a/drivers/hwmon/mc13783-adc.c +++ b/drivers/hwmon/mc13783-adc.c @@ -285,7 +285,7 @@ static int __init mc13783_adc_probe(struct platform_device *pdev) return ret; } -static int mc13783_adc_remove(struct platform_device *pdev) +static void mc13783_adc_remove(struct platform_device *pdev) { struct mc13783_adc_priv *priv = platform_get_drvdata(pdev); kernel_ulong_t driver_data = platform_get_device_id(pdev)->driver_data; @@ -299,8 +299,6 @@ static int mc13783_adc_remove(struct platform_device *pdev) sysfs_remove_group(&pdev->dev.kobj, &mc13783_group_16chans); sysfs_remove_group(&pdev->dev.kobj, &mc13783_group_base); - - return 0; } static const struct platform_device_id mc13783_adc_idtable[] = { @@ -317,7 +315,7 @@ static const struct platform_device_id mc13783_adc_idtable[] = { MODULE_DEVICE_TABLE(platform, mc13783_adc_idtable); static struct platform_driver mc13783_adc_driver = { - .remove = mc13783_adc_remove, + .remove_new = mc13783_adc_remove, .driver = { .name = DRIVER_NAME, }, From patchwork Mon Sep 18 08:59:38 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: 13389245 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFD1BCD13D9 for ; Mon, 18 Sep 2023 09:03:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239119AbjIRJA5 (ORCPT ); Mon, 18 Sep 2023 05:00:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240886AbjIRJAP (ORCPT ); Mon, 18 Sep 2023 05:00:15 -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 740D4133 for ; Mon, 18 Sep 2023 02:00:03 -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 ) id 1qiA6p-0008K2-8U; Mon, 18 Sep 2023 10:59:59 +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 ) id 1qiA6o-007B6K-KI; Mon, 18 Sep 2023 10:59:58 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6o-002Z9M-B1; Mon, 18 Sep 2023 10:59:58 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: Eddie James , Joel Stanley , linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 11/24] hwmon: (occ/p9_sbe) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:38 +0200 Message-Id: <20230918085951.1234172-12-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1835; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=j/zzKHeL+lXUf6yMc0MgEdhByyOp6Ef/q3lwvFKiPfU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBA2ZvDrq87BAh63A0MtT5aQCijs3P/cpVPjQ 9xNSDpbWD6JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQNgAKCRCPgPtYfRL+ TuY1B/49W+hSHIlJtQRVE0CgR8maRFcPpwl6GVOCU3LUzGKDWVj5JKTmujvNlsijiTbzfXxZae0 Oi4UOgGT7QbcroGv6yj74uc85IdaY/Ju3opVWKcOhxDhekoljQtcRFD/FyZLMA+eMdgysRaK0P1 l1lp5WMhRsWbRq7n0/RSBt7wf9dN9/8ksQ8b06P+AtBgXNzq/DyGqSALsWdAJX/jLvTb3urtyND YaRBrAf29SNY480lxNeoJkCH8OjbxRkuMqcjCTWStfzrMXn4Mp1pxHQKB0YgoBy5nuzxmue8zDZ 6dJEGh0SStYySt9Sxq8GtM+q9fyRZx0aJAotEt7L2XCimn24 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 Reviewed-by: Eddie James --- drivers/hwmon/occ/p9_sbe.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/occ/p9_sbe.c b/drivers/hwmon/occ/p9_sbe.c index 96521363b696..b5993c79c09e 100644 --- a/drivers/hwmon/occ/p9_sbe.c +++ b/drivers/hwmon/occ/p9_sbe.c @@ -167,7 +167,7 @@ static int p9_sbe_occ_probe(struct platform_device *pdev) return rc; } -static int p9_sbe_occ_remove(struct platform_device *pdev) +static void p9_sbe_occ_remove(struct platform_device *pdev) { struct occ *occ = platform_get_drvdata(pdev); struct p9_sbe_occ *ctx = to_p9_sbe_occ(occ); @@ -178,8 +178,6 @@ static int p9_sbe_occ_remove(struct platform_device *pdev) occ_shutdown(occ); kvfree(ctx->ffdc); - - return 0; } static const struct of_device_id p9_sbe_occ_of_match[] = { @@ -195,7 +193,7 @@ static struct platform_driver p9_sbe_occ_driver = { .of_match_table = p9_sbe_occ_of_match, }, .probe = p9_sbe_occ_probe, - .remove = p9_sbe_occ_remove, + .remove_new = p9_sbe_occ_remove, }; module_platform_driver(p9_sbe_occ_driver); From patchwork Mon Sep 18 08:59:39 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: 13389231 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D377CD13D3 for ; Mon, 18 Sep 2023 09:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234572AbjIRJAs (ORCPT ); Mon, 18 Sep 2023 05:00:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240837AbjIRJAL (ORCPT ); Mon, 18 Sep 2023 05:00:11 -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 7F5DB116 for ; Mon, 18 Sep 2023 02:00:01 -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 ) id 1qiA6p-0008Kq-6V; Mon, 18 Sep 2023 10:59:59 +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 ) id 1qiA6o-007B6P-Pf; Mon, 18 Sep 2023 10:59:58 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6o-002Z9Q-GK; Mon, 18 Sep 2023 10:59:58 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: Jim Cromie , linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 12/24] hwmon: (pc87360) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:39 +0200 Message-Id: <20230918085951.1234172-13-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1614; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=rLYFljyEvQKJvsuc8knRlHVTk+M9jk+lmoFGTyz1Qcs=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBA3hsWDb6t3JHWYxY6QzZTJG67z9NZ5OJQ6M ocofTTGlKeJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQNwAKCRCPgPtYfRL+ TnA2B/9iEXXbkksa5gAneOEJJ5niV7lHbQorfxVNFRaX4xYKVfnUgrqiJEUiEoLdwdXKEOorYIA Tb057aiSoOYg0jiRiKY8CV/BKED3in7eMHj4znVKijv7/3jojGoPxcB9+YtRyfC39VCBwHyYqY0 hsy16VPif/iNzkv8ezmJ8q8j4zdqKRTJUVd/nst4BaT7G2bjN6WDjn7MjVBNlO09asebflLyDuc IeLmh2Wd4DUhfp/u145Jd+xFqya7Ug8zQMYr/v1/M5K1kfEGs+KUyLTEa1p94i5kJ7CGcP59Tih XW7Mu7aYStP3982723LrQ7Y9rS3KqUMrWqsxp2ucxXuzA5JB 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/pc87360.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index a4adc8bd531f..926ea1fe133c 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c @@ -1586,14 +1586,12 @@ static int pc87360_probe(struct platform_device *pdev) return err; } -static int pc87360_remove(struct platform_device *pdev) +static void pc87360_remove(struct platform_device *pdev) { struct pc87360_data *data = platform_get_drvdata(pdev); hwmon_device_unregister(data->hwmon_dev); pc87360_remove_files(&pdev->dev); - - return 0; } /* @@ -1604,7 +1602,7 @@ static struct platform_driver pc87360_driver = { .name = DRIVER_NAME, }, .probe = pc87360_probe, - .remove = pc87360_remove, + .remove_new = pc87360_remove, }; /* From patchwork Mon Sep 18 08:59:40 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: 13389235 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id DFDA9CD13DE for ; Mon, 18 Sep 2023 09:01:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239127AbjIRJAu (ORCPT ); Mon, 18 Sep 2023 05:00:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240854AbjIRJAM (ORCPT ); Mon, 18 Sep 2023 05:00:12 -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 C22FA11C for ; Mon, 18 Sep 2023 02:00:01 -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 ) id 1qiA6p-0008Mo-HM; Mon, 18 Sep 2023 10:59:59 +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 ) id 1qiA6o-007B6V-W2; Mon, 18 Sep 2023 10:59:59 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6o-002Z9U-Mf; Mon, 18 Sep 2023 10:59:58 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 13/24] hwmon: (pc87427) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:40 +0200 Message-Id: <20230918085951.1234172-14-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1683; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=RUT/Pfu/4GocYLB/DQhEVDWcd0hkLupM+oTfz9pjpag=; b=owGbwMvMwMXY3/A7olbonx/jabUkhlQOAQv/3m0OcYcCDU7UBDJ7HNofVee+17D2ctmVW+pRI vEHYnw7GY1ZGBi5GGTFFFnsG9dkWlXJRXau/XcZZhArE8gUBi5OAZjIL0/2f4q3bErZxMUYLSRz zOtunZouzOzsP2nbHu95t/ZNOffL/maW90rtJcxaBjpPAlITL8b/2P3grtxMyRrx2dJ/5DZOsct 6MC+NbW3eLt4FBdk/Vty75qX2SP5Q3T9ny12/s1ZMcshPZJczNzdiulMXsMCvIsuq/HWnh6KmyK LVjy607wqbfH3hvsp/H+Rv/t427f8jIUGuiIhmGbZpmybv4643O3K3uJqDb9HR9o+u1g2FW46ZW 7JUaXHZ7Ki4Z/y9vLlk59lJdzcH7WqL0rLlvuYyTysiZOLcFWaHjDov3tEyNVFm8xRfdN7PTj1R iLfr5qkQESuPUt5vGuy/ElvDWo9/Nlqjm3/vodbdu+b+AA== 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/pc87427.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/pc87427.c b/drivers/hwmon/pc87427.c index eaab83d879fb..7bca04eb4ee4 100644 --- a/drivers/hwmon/pc87427.c +++ b/drivers/hwmon/pc87427.c @@ -1115,14 +1115,12 @@ static int pc87427_probe(struct platform_device *pdev) return err; } -static int pc87427_remove(struct platform_device *pdev) +static void pc87427_remove(struct platform_device *pdev) { struct pc87427_data *data = platform_get_drvdata(pdev); hwmon_device_unregister(data->hwmon_dev); pc87427_remove_files(&pdev->dev); - - return 0; } @@ -1131,7 +1129,7 @@ static struct platform_driver pc87427_driver = { .name = DRVNAME, }, .probe = pc87427_probe, - .remove = pc87427_remove, + .remove_new = pc87427_remove, }; static int __init pc87427_device_add(const struct pc87427_sio_data *sio_data) From patchwork Mon Sep 18 08:59:41 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: 13389240 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 130B3C46CA1 for ; Mon, 18 Sep 2023 09:03:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240988AbjIRJAx (ORCPT ); Mon, 18 Sep 2023 05:00:53 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240870AbjIRJAN (ORCPT ); Mon, 18 Sep 2023 05:00:13 -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 6B81E123 for ; Mon, 18 Sep 2023 02:00:02 -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 ) id 1qiA6q-0008Op-6D; Mon, 18 Sep 2023 11:00:00 +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 ) id 1qiA6p-007B6Y-8X; Mon, 18 Sep 2023 10:59:59 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6o-002Z9Z-Vf; Mon, 18 Sep 2023 10:59:58 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 14/24] hwmon: (sch5636) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:41 +0200 Message-Id: <20230918085951.1234172-15-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1845; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=j8xaUCT3dTtmLiW7iOuAvLGnTMMAyl3wVD33QVj+sbE=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBA6ovR9VgGMxua60JLlk8T0B/27TPRMMZwpn zXx+b3MfBiJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQOgAKCRCPgPtYfRL+ TngOB/9NTACq594rtiBvzkA8vF5ZB5E+GTaommC4cmNLA1YBQIZCFOWzWJD5yHL1jZx+i2Q5Nuk N7UOBxW1DASV4K84M+HY45YX/5Ty3/xxdaFYwGQ9XkYuA0uu4/lHZXW+cf3A2rbHCyaJdNuOeeV 5rUsLkSUFfjWOYyosqAvBiDMjmWUVFbzdlmamCld5BFS70xEps2cBnPbKCVx3/+pEKnrQtXWkYL C47FkAHUFzn5JpbFENqm/h6baxo3kpd7mtixPlonIfml4xqe6bquINGOFKP+5VJ9G21R8IUKgrm /hrUJuyfmRuKuA692PGAZ7vFa2blKIdIbGL8d2pHYckeMjK9 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/sch5636.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/sch5636.c b/drivers/hwmon/sch5636.c index 269757bc3a9e..6e6d54158474 100644 --- a/drivers/hwmon/sch5636.c +++ b/drivers/hwmon/sch5636.c @@ -367,7 +367,7 @@ static struct sensor_device_attribute sch5636_fan_attr[] = { SENSOR_ATTR_RO(fan8_alarm, fan_alarm, 7), }; -static int sch5636_remove(struct platform_device *pdev) +static void sch5636_remove(struct platform_device *pdev) { struct sch5636_data *data = platform_get_drvdata(pdev); int i; @@ -385,8 +385,6 @@ static int sch5636_remove(struct platform_device *pdev) for (i = 0; i < SCH5636_NO_FANS * 3; i++) device_remove_file(&pdev->dev, &sch5636_fan_attr[i].dev_attr); - - return 0; } static int sch5636_probe(struct platform_device *pdev) @@ -515,7 +513,7 @@ static struct platform_driver sch5636_driver = { .name = DRVNAME, }, .probe = sch5636_probe, - .remove = sch5636_remove, + .remove_new = sch5636_remove, .id_table = sch5636_device_id, }; From patchwork Mon Sep 18 08:59:42 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: 13389243 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AC796CD13D8 for ; Mon, 18 Sep 2023 09:03:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241014AbjIRJAz (ORCPT ); Mon, 18 Sep 2023 05:00:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240873AbjIRJAN (ORCPT ); Mon, 18 Sep 2023 05:00:13 -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 8130E126 for ; Mon, 18 Sep 2023 02:00:02 -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 ) id 1qiA6q-0008Pz-8P; Mon, 18 Sep 2023 11:00:00 +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 ) id 1qiA6p-007B6d-E6; Mon, 18 Sep 2023 10:59:59 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6p-002Z9d-4x; Mon, 18 Sep 2023 10:59:59 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 15/24] hwmon: (sht15) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:42 +0200 Message-Id: <20230918085951.1234172-16-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1835; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=CNcSN+6qyggS67LklJ7L+JGNjE/Y0egQ0kP4RGqgE/8=; b=owGbwMvMwMXY3/A7olbonx/jabUkhlQOAetStiiz6XnsJxs/rD/xc9ctZdffa5xYNvt5ncvs1 eu8e3VHJ6MxCwMjF4OsmCKLfeOaTKsqucjOtf8uwwxiZQKZwsDFKQAT8U1l/+9uuujwnaor16Sd ZGzX+Tv6Fik6TjCatXbvUU7DBXZ/fj2qYzL78M+4WKk6T2aP7ewv0oq7FXe227ww2OjFNOFWltO fhu1sMcq/17+rCu+yVv4541VCZovNW8nN142msJnO8oz7+v2DquwLmfzSMIufL3u4uNzWPVJd8d Buy5mji4XED5uwKVVf9g05LOzuLKeQFVloMYdx58My+Ws9KhZMrHV3T0zjF7cKYThtkTVfQuSU+ SWeRpWXJZW39wid/r1NMd5dMyZdzS0440D1pajnb/JX/ZsSMeWi/JFZR2UsO5nyZLob5XZG3eG3 MLlklsWwliOmN336/HiDOf02NVInNl6zErrF9zTHLDIUAA== 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/sht15.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/sht15.c b/drivers/hwmon/sht15.c index 32a41fc56fc9..494f9655f44f 100644 --- a/drivers/hwmon/sht15.c +++ b/drivers/hwmon/sht15.c @@ -1017,7 +1017,7 @@ static int sht15_probe(struct platform_device *pdev) return ret; } -static int sht15_remove(struct platform_device *pdev) +static void sht15_remove(struct platform_device *pdev) { struct sht15_data *data = platform_get_drvdata(pdev); int ret; @@ -1033,8 +1033,6 @@ static int sht15_remove(struct platform_device *pdev) regulator_unregister_notifier(data->reg, &data->nb); regulator_disable(data->reg); } - - return 0; } static const struct platform_device_id sht15_device_ids[] = { @@ -1053,7 +1051,7 @@ static struct platform_driver sht15_driver = { .of_match_table = of_match_ptr(sht15_dt_match), }, .probe = sht15_probe, - .remove = sht15_remove, + .remove_new = sht15_remove, .id_table = sht15_device_ids, }; module_platform_driver(sht15_driver); From patchwork Mon Sep 18 08:59:43 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: 13389244 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99DC2CD13D1 for ; Mon, 18 Sep 2023 09:03:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237689AbjIRJAz (ORCPT ); Mon, 18 Sep 2023 05:00:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240881AbjIRJAO (ORCPT ); Mon, 18 Sep 2023 05:00:14 -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 B28CD12A for ; Mon, 18 Sep 2023 02:00:02 -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 ) id 1qiA6q-0008Qx-Il; Mon, 18 Sep 2023 11:00:00 +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 ) id 1qiA6p-007B6h-KT; Mon, 18 Sep 2023 10:59:59 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6p-002Z9g-BI; Mon, 18 Sep 2023 10:59:59 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 16/24] hwmon: (sis5595) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:43 +0200 Message-Id: <20230918085951.1234172-17-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1881; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=S1ts/lyOk18OE3/RHR+4V/NjuO0HJyUoYjNx0bxf1lQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBA8cbOlf3w1lu7ElrBc515qDWh9lWLFlanZj zZEheO3bU2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQPAAKCRCPgPtYfRL+ ToqNCACICBMDN40GXNFQmD6H1/y3t3d0YyJpO2npOX3vFwE0ev08rZZgmu9Bxk7q61zOf/FyX0p 1765xjvuJF+xb/QPfk9jniikr8+jpTP96HF6aFHkPbOvTFfi8hTYlLo6B1RE8Hu/DCYwz+utS73 H1u/X14u3TSoptRNQRqcJsPmKjYzG40uEIAga4rq/qbGptf16r1BXJ3bDieT/s+aMxPJGGuTSi6 8+1aDZAVkq5M21So28ZlNf7fnokuukYk3ngB0yEQI4rYf4tuemTG/4o94pyr3/9nM1Ox+y4bbDa KPxgyxJI8DkUvf+zExoC8MrPKNypIeQrw4D9Z/ksMhhWLYsa 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/sis5595.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/sis5595.c b/drivers/hwmon/sis5595.c index 0a0479501e11..641be1f7f9cd 100644 --- a/drivers/hwmon/sis5595.c +++ b/drivers/hwmon/sis5595.c @@ -709,7 +709,7 @@ static int sis5595_probe(struct platform_device *pdev) return err; } -static int sis5595_remove(struct platform_device *pdev) +static void sis5595_remove(struct platform_device *pdev) { struct sis5595_data *data = platform_get_drvdata(pdev); @@ -717,8 +717,6 @@ static int sis5595_remove(struct platform_device *pdev) sysfs_remove_group(&pdev->dev.kobj, &sis5595_group); sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_in4); sysfs_remove_group(&pdev->dev.kobj, &sis5595_group_temp1); - - return 0; } static const struct pci_device_id sis5595_pci_ids[] = { @@ -790,7 +788,7 @@ static struct platform_driver sis5595_driver = { .name = DRIVER_NAME, }, .probe = sis5595_probe, - .remove = sis5595_remove, + .remove_new = sis5595_remove, }; static int sis5595_pci_probe(struct pci_dev *dev, From patchwork Mon Sep 18 08:59:44 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: 13389242 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83F51CD13D2 for ; Mon, 18 Sep 2023 09:03:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240994AbjIRJAy (ORCPT ); Mon, 18 Sep 2023 05:00:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240877AbjIRJAO (ORCPT ); Mon, 18 Sep 2023 05:00:14 -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 2156812C for ; Mon, 18 Sep 2023 02:00:02 -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 ) id 1qiA6q-0008Sc-Lv; Mon, 18 Sep 2023 11:00:00 +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 ) id 1qiA6p-007B6l-Sl; Mon, 18 Sep 2023 10:59:59 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6p-002Z9l-JW; Mon, 18 Sep 2023 10:59:59 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 17/24] hwmon: (ultra45_env) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:44 +0200 Message-Id: <20230918085951.1234172-18-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1755; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=8ed1skhb69iRw8dFQY5YnJaBV1WEBpHoLBwlLo9O9cg=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBA9tTWkORb/S8bmo0kuM04iXIlXHkE2laBsa M6j2+F9RlGJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQPQAKCRCPgPtYfRL+ TixJB/9FCzvxDxbLs4ryz/Uix1ABQd1dU6Onr4tcRMP3lfMTtC4l4eh1UrWJfNYnKP5avUktacF 56+IPt7nWNPRHmIlOHdnrQ5SentWm4/ZAmMtFp3dWfUQGBAAp9Wz+gANm1SmSAE3BPHFYCJ/O1x 2jnqbxlB8WSoWJvOm2+SvfJh1Afa7JDH7mJ0SnW1YJzzBUsok3vcuELzZ8wE9HRQJB1XaE2cNNq Ky6nwVAzi79LH0Jcg5FGZL2RZxVBpT1MHlZmwoXCFgqYrXynujMMJRCEzIYG5DgCthEUTFMtqtn EX7tYh4kN2Obwi4YYCHmVoHdYi1CvbBGmG3ZGcW+d31eKRbH 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/ultra45_env.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/ultra45_env.c b/drivers/hwmon/ultra45_env.c index 3b580f229887..9823afb0675a 100644 --- a/drivers/hwmon/ultra45_env.c +++ b/drivers/hwmon/ultra45_env.c @@ -291,7 +291,7 @@ static int env_probe(struct platform_device *op) goto out; } -static int env_remove(struct platform_device *op) +static void env_remove(struct platform_device *op) { struct env *p = platform_get_drvdata(op); @@ -300,8 +300,6 @@ static int env_remove(struct platform_device *op) hwmon_device_unregister(p->hwmon_dev); of_iounmap(&op->resource[0], p->regs, REG_SIZE); } - - return 0; } static const struct of_device_id env_match[] = { @@ -319,7 +317,7 @@ static struct platform_driver env_driver = { .of_match_table = env_match, }, .probe = env_probe, - .remove = env_remove, + .remove_new = env_remove, }; module_platform_driver(env_driver); From patchwork Mon Sep 18 08:59:45 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: 13389246 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id BE9C3CD13D3 for ; Mon, 18 Sep 2023 09:03:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241020AbjIRJA4 (ORCPT ); Mon, 18 Sep 2023 05:00:56 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240884AbjIRJAP (ORCPT ); Mon, 18 Sep 2023 05:00:15 -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 5E07E12F for ; Mon, 18 Sep 2023 02:00:03 -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 ) id 1qiA6r-0008TU-18; Mon, 18 Sep 2023 11:00:01 +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 ) id 1qiA6q-007B6o-3F; Mon, 18 Sep 2023 11:00:00 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6p-002Z9p-QF; Mon, 18 Sep 2023 10:59:59 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 18/24] hwmon: (via-cputemp) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:45 +0200 Message-Id: <20230918085951.1234172-19-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1850; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=UeAJlM9DxFPVPTGLYJAguFg8qxQfa7bWZe0XLxihHUw=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBA+smKiUGTLyJGMWf+g5p9Efx6fJT1/+x4Dt OKZ/nuIvW+JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQPgAKCRCPgPtYfRL+ TpHYB/4ueF3eHyI/yy6Xz2OeSXY7PaY6a308blHyEBYgD8Z79VSONx8F55krqo4X4quvv96WVPs z/F5J+mFEFRfUQPxDhCd79C+BE1zMkS6f0Qw9bQQTqPwjQwubVLj6vKvB3HezpC2x4m6Flb8DJt GNnWjZpFFF6b0SqCm6Nk184yv5NwU2EA7SoUVM9VtGNOxUXBfrcJowUmtwEYYf+B5mckcqzYGRB 1dkXfWQfAHSBt9+Jamf3FR04w/qTdoHNNKmB3X5jfVfAujPMLMXVkL8W8XmiFFtS5X05sgHoVAD cMlDMhFaaQubo+sI313GwGpA2pt2gAMaQ8OMvMrcSA6D6zlz 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/via-cputemp.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/hwmon/via-cputemp.c b/drivers/hwmon/via-cputemp.c index e5d18dac8ee7..5abe95b683c0 100644 --- a/drivers/hwmon/via-cputemp.c +++ b/drivers/hwmon/via-cputemp.c @@ -182,7 +182,7 @@ static int via_cputemp_probe(struct platform_device *pdev) return err; } -static int via_cputemp_remove(struct platform_device *pdev) +static void via_cputemp_remove(struct platform_device *pdev) { struct via_cputemp_data *data = platform_get_drvdata(pdev); @@ -190,7 +190,6 @@ static int via_cputemp_remove(struct platform_device *pdev) if (data->vrm) device_remove_file(&pdev->dev, &dev_attr_cpu0_vid); sysfs_remove_group(&pdev->dev.kobj, &via_cputemp_group); - return 0; } static struct platform_driver via_cputemp_driver = { @@ -198,7 +197,7 @@ static struct platform_driver via_cputemp_driver = { .name = DRVNAME, }, .probe = via_cputemp_probe, - .remove = via_cputemp_remove, + .remove_new = via_cputemp_remove, }; struct pdev_entry { From patchwork Mon Sep 18 08:59:46 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: 13389248 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0430CD13DA for ; Mon, 18 Sep 2023 09:03:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241029AbjIRJA6 (ORCPT ); Mon, 18 Sep 2023 05:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56898 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240893AbjIRJAQ (ORCPT ); Mon, 18 Sep 2023 05:00:16 -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 7DA70135 for ; Mon, 18 Sep 2023 02:00:03 -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 ) id 1qiA6r-0008UI-6u; Mon, 18 Sep 2023 11:00:01 +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 ) id 1qiA6q-007B6s-Bp; Mon, 18 Sep 2023 11:00:00 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6q-002Z9t-2k; Mon, 18 Sep 2023 11:00:00 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 19/24] hwmon: (via686a) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:46 +0200 Message-Id: <20230918085951.1234172-20-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1728; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=UbYkt5+nCLXQGedS8E+XLGCNJfqo10L1sWvUfNUcjeU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBA/tIBd1TJTYbuSDx2EqVoG9yi6zYtl8M3i+ ITgyIhSaeiJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQPwAKCRCPgPtYfRL+ TmnwCACvfeiokLBb1sT5/1Il/OAENpQCsyq1cuR18sj0q923kyJVmlRJXX3jahWAcJrXwoxzs7N 4L3j6pOZgOtU6BUDXkrIap2qWu0KDp5iOmm5KBS6fPBHWM+Gzyd5L/kzYt7IzDx5XNY/jliHifH V6NJCjWF1cnAqohF8RDtp0oyaJET/FEPn7dLfZLLgxxh0dt3DyLnhJDvYt8/6YRFOlz7/qf9par KEOspfy8RqexXT3HA9Kdp4wcE3UkUSxcHpZa9JuEWWD+3hMzzWgHPVufGnE16mV2fIZLQX3fmbV /rmES8BcKhJRNJWVNpubq0BywiVpwNfxQL4Vz/Tsh/imoQzr 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/via686a.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/via686a.c b/drivers/hwmon/via686a.c index 407933d6e425..3a002ad3c005 100644 --- a/drivers/hwmon/via686a.c +++ b/drivers/hwmon/via686a.c @@ -786,14 +786,12 @@ static int via686a_probe(struct platform_device *pdev) return err; } -static int via686a_remove(struct platform_device *pdev) +static void via686a_remove(struct platform_device *pdev) { struct via686a_data *data = platform_get_drvdata(pdev); hwmon_device_unregister(data->hwmon_dev); sysfs_remove_group(&pdev->dev.kobj, &via686a_group); - - return 0; } static struct platform_driver via686a_driver = { @@ -801,7 +799,7 @@ static struct platform_driver via686a_driver = { .name = DRIVER_NAME, }, .probe = via686a_probe, - .remove = via686a_remove, + .remove_new = via686a_remove, }; static const struct pci_device_id via686a_pci_ids[] = { From patchwork Mon Sep 18 08:59:47 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: 13389250 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 105C6CD13DF for ; Mon, 18 Sep 2023 09:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241042AbjIRJA7 (ORCPT ); Mon, 18 Sep 2023 05:00:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240901AbjIRJAR (ORCPT ); Mon, 18 Sep 2023 05:00:17 -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 02507138 for ; Mon, 18 Sep 2023 02:00:03 -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 ) id 1qiA6r-0008V0-DT; Mon, 18 Sep 2023 11:00:01 +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 ) id 1qiA6q-007B6w-Iu; Mon, 18 Sep 2023 11:00:00 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6q-002Z9x-9e; Mon, 18 Sep 2023 11:00:00 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: Juerg Haefliger , linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 20/24] hwmon: (vt1211) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:47 +0200 Message-Id: <20230918085951.1234172-21-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1692; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=7YTdkKp9WZi2RZWUvgGvSMHdcv9J/v0L3eNYSth4Luc=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBBATjKJhpeMffKMjHYl6nDe7e0NwkHw+rk0F gS1pzCWXHiJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQQAAKCRCPgPtYfRL+ TlBuCACm3FYpEvqxIA+eQ0zzmk3iit7M3vZMjhVfIXRgX+WMNj47EtevJMc/oaMx94x3BwvPxF1 jHlOz6DVY0meQXdRui1Nw6DqWNejKyfy+FQn17GWmrN+4E32Za3dqtWjvGtRscmeWFO8KPVbIBY ZwFGffKs1Y1Tm4HwvxHCpsrvfdyKWVVDlc4vev/CGXBSkxl8HwIQVeZuyDA7BZoKQ7+6Tpe0aSS gJT3ehhDRB3/RhGQXgI65KozbjXjT07CtBIvGVO+8c1gPj3GJwV6QGZdJfW+Wgy3h+IuHM4Px5H NE1ROg400iy8asdNaySezrVuzGPSxB/fQFpE6h8k3jOiqHD3 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/vt1211.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/vt1211.c b/drivers/hwmon/vt1211.c index fcd4be7a5a85..2f3890463e18 100644 --- a/drivers/hwmon/vt1211.c +++ b/drivers/hwmon/vt1211.c @@ -1208,14 +1208,12 @@ static int vt1211_probe(struct platform_device *pdev) return err; } -static int vt1211_remove(struct platform_device *pdev) +static void vt1211_remove(struct platform_device *pdev) { struct vt1211_data *data = platform_get_drvdata(pdev); hwmon_device_unregister(data->hwmon_dev); vt1211_remove_sysfs(pdev); - - return 0; } static struct platform_driver vt1211_driver = { @@ -1223,7 +1221,7 @@ static struct platform_driver vt1211_driver = { .name = DRVNAME, }, .probe = vt1211_probe, - .remove = vt1211_remove, + .remove_new = vt1211_remove, }; static int __init vt1211_device_add(unsigned short address) From patchwork Mon Sep 18 08:59:48 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: 13389239 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1CA60CD13DF for ; Mon, 18 Sep 2023 09:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241089AbjIRJBE (ORCPT ); Mon, 18 Sep 2023 05:01:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47984 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240917AbjIRJAS (ORCPT ); Mon, 18 Sep 2023 05:00:18 -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 84D98188 for ; Mon, 18 Sep 2023 02:00:04 -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 ) id 1qiA6r-0008VQ-FU; Mon, 18 Sep 2023 11:00:01 +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 ) id 1qiA6q-007B70-PJ; Mon, 18 Sep 2023 11:00:00 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6q-002ZA1-G2; Mon, 18 Sep 2023 11:00:00 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: Roger Lucas , linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 21/24] hwmon: (vt8231) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:48 +0200 Message-Id: <20230918085951.1234172-22-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1767; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=qR6TESNlDnUSqetH+MwtFfp5v8mHVaX029JscLQ5gJA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBBBCLdp/79C47Aij126MeIYC4WhvWbwU79qZ RSLQg2ab5yJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQQQAKCRCPgPtYfRL+ TsoICACzDiTJYoMFZ7Bj4aX3faE2GfQGBI4UMKb9F3ZCkXw3ildD9YImUuaYkr/ViGohsGsXC6E i1oXmPo6WPaTh9fVPjZ/5z6ag69q++dCkxtPvt826IBrUt67DNRe3YMk4+7dIbGxC0zldDlf+bO aerKxhpFviiG+OMCPkUxefAiTOReVU5iFhpeNlRgqwD5i/hhYMW2fC4wbHmJbhmNrsfEOO0TPoi X8IlJdBJ40+P/SoN/ooo3+1bbnxpD1nRoVBe/mG8liCidw4jgKnqqsk1icpApNlbm6wN8kYyP5E IJlljszIq7kM7Pz+St6dMRnx6PFK2LySIYVsjRC2y1sLQH1n 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/vt8231.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/vt8231.c b/drivers/hwmon/vt8231.c index 16bc16d33cd1..dcdd14ccd115 100644 --- a/drivers/hwmon/vt8231.c +++ b/drivers/hwmon/vt8231.c @@ -892,7 +892,7 @@ static int vt8231_probe(struct platform_device *pdev) return err; } -static int vt8231_remove(struct platform_device *pdev) +static void vt8231_remove(struct platform_device *pdev) { struct vt8231_data *data = platform_get_drvdata(pdev); int i; @@ -906,8 +906,6 @@ static int vt8231_remove(struct platform_device *pdev) sysfs_remove_group(&pdev->dev.kobj, &vt8231_group_temps[i]); sysfs_remove_group(&pdev->dev.kobj, &vt8231_group); - - return 0; } @@ -916,7 +914,7 @@ static struct platform_driver vt8231_driver = { .name = DRIVER_NAME, }, .probe = vt8231_probe, - .remove = vt8231_remove, + .remove_new = vt8231_remove, }; static const struct pci_device_id vt8231_pci_ids[] = { From patchwork Mon Sep 18 08:59:49 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: 13389249 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 215F0CD13DE for ; Mon, 18 Sep 2023 09:04:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230267AbjIRJBA (ORCPT ); Mon, 18 Sep 2023 05:01:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56924 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240909AbjIRJAR (ORCPT ); Mon, 18 Sep 2023 05:00:17 -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 1189013E for ; Mon, 18 Sep 2023 02:00:04 -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 ) id 1qiA6r-00004s-Pk; Mon, 18 Sep 2023 11:00:01 +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 ) id 1qiA6q-007B74-WE; Mon, 18 Sep 2023 11:00:01 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6q-002ZA5-Mt; Mon, 18 Sep 2023 11:00:00 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 22/24] hwmon: (w83627hf) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:49 +0200 Message-Id: <20230918085951.1234172-23-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1861; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=1wNtftdHg+/e+1gVtxKSOjAtWXFqdiCZyH+hNfOa9YA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBBCp3ffOj4+00TiURCf8Rz8L1BNFzTPLPRzQ wB/xHwlONyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQQgAKCRCPgPtYfRL+ Tn7kB/432w7UwtMd7gxYrvL8ZMVRklNomEj0lMcEvvJmyqCxjitR9vevae1SfmuQvWzncx13GhO nMduYKr6IcPXQShykb1S8IyARDgz6rrFsvx+eDi9TbH98vuzasj6VMe/drNaL3yWpV3vtx4foJ9 OLuouYTR2MglgpNpE7f9C8dkBtnIvB9LL35571vjKzJ5g+jTniKqaw9rQ143sgaBvzo4LyECcZ0 ZdV74tHb/7kiGmn4j6g7XApr1KS8JQxlQ8vfdB1H+dDxOaJzrxVI/I6syB1NYZjEmwhRa+GlOSJ BnFoPyQpLH0vFQ9slVYFCEfpz0ksOux68e4HO3d26lUs5N0W 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/w83627hf.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/w83627hf.c b/drivers/hwmon/w83627hf.c index b638d672ac45..2fc9b718e2ab 100644 --- a/drivers/hwmon/w83627hf.c +++ b/drivers/hwmon/w83627hf.c @@ -1828,7 +1828,7 @@ static int w83627hf_probe(struct platform_device *pdev) return err; } -static int w83627hf_remove(struct platform_device *pdev) +static void w83627hf_remove(struct platform_device *pdev) { struct w83627hf_data *data = platform_get_drvdata(pdev); @@ -1836,8 +1836,6 @@ static int w83627hf_remove(struct platform_device *pdev) sysfs_remove_group(&pdev->dev.kobj, &w83627hf_group); sysfs_remove_group(&pdev->dev.kobj, &w83627hf_group_opt); - - return 0; } static struct platform_driver w83627hf_driver = { @@ -1846,7 +1844,7 @@ static struct platform_driver w83627hf_driver = { .pm = W83627HF_DEV_PM_OPS, }, .probe = w83627hf_probe, - .remove = w83627hf_remove, + .remove_new = w83627hf_remove, }; static int __init w83627hf_find(int sioaddr, unsigned short *addr, From patchwork Mon Sep 18 08:59:50 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: 13389247 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E0DCECD13DD for ; Mon, 18 Sep 2023 09:03:59 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241035AbjIRJA6 (ORCPT ); Mon, 18 Sep 2023 05:00:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56892 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240912AbjIRJAR (ORCPT ); Mon, 18 Sep 2023 05:00:17 -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 1E135185 for ; Mon, 18 Sep 2023 02:00:04 -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 ) id 1qiA6r-000068-Q4; Mon, 18 Sep 2023 11:00:01 +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 ) id 1qiA6r-007B78-84; Mon, 18 Sep 2023 11:00:01 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6q-002ZA9-Us; Mon, 18 Sep 2023 11:00:00 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 23/24] hwmon: (w83781d) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:50 +0200 Message-Id: <20230918085951.1234172-24-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1785; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=rOKuEs91KkITMwg+W+2TRDUVHiFdyRY4k6XBTAySM/4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBBEs4Mc3V0cW13vfHqk5JtKTat9YGojQlLj3 QOA5KEubZeJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQRAAKCRCPgPtYfRL+ Tut2B/4pZ2jrYma3zQYBgw02Y9ShjLz1CwNkLDG86Rc9cZWTNMBReQSnE1IkB1LtYCfzSI6XZyJ dOcixJDWuVpgfL4WkmYOvbJ3yE+LHiQTIi6G7I1zkbC8x7PS8zbSSfOJF0ubECpsdiOmlTcrEfB UWJLQiqeFVpkMQMnIXCxBuoxXxRlfVy8Nd+AqmqvDKGKFVMLHks/3V78/EPNkyp3wjL7l8i5Ten 1Ft+AaBmPo8zxnHfZ2ttlWhytZe6G9SVCblGzKJnTPmBKnKpx0Y1/X4H0wSHKxB2lNt99B68Rov XW3teThm2ZlzRUkVxdxBFnSUuRQfyo9CjeuZiceV9ByJ0ijD 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/w83781d.c | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/hwmon/w83781d.c b/drivers/hwmon/w83781d.c index b33f382f238d..cba5ec432e6d 100644 --- a/drivers/hwmon/w83781d.c +++ b/drivers/hwmon/w83781d.c @@ -1816,16 +1816,13 @@ w83781d_isa_probe(struct platform_device *pdev) return err; } -static int -w83781d_isa_remove(struct platform_device *pdev) +static void w83781d_isa_remove(struct platform_device *pdev) { struct w83781d_data *data = platform_get_drvdata(pdev); hwmon_device_unregister(data->hwmon_dev); w83781d_remove_files(&pdev->dev); device_remove_file(&pdev->dev, &dev_attr_name); - - return 0; } static struct platform_driver w83781d_isa_driver = { @@ -1833,7 +1830,7 @@ static struct platform_driver w83781d_isa_driver = { .name = "w83781d", }, .probe = w83781d_isa_probe, - .remove = w83781d_isa_remove, + .remove_new = w83781d_isa_remove, }; /* return 1 if a supported chip is found, 0 otherwise */ From patchwork Mon Sep 18 08:59:51 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: 13389238 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0D5EACD3420 for ; Mon, 18 Sep 2023 09:01:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241081AbjIRJBC (ORCPT ); Mon, 18 Sep 2023 05:01:02 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47988 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240920AbjIRJAS (ORCPT ); Mon, 18 Sep 2023 05:00:18 -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 90A2D189 for ; Mon, 18 Sep 2023 02:00:04 -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 ) id 1qiA6s-00006X-4q; Mon, 18 Sep 2023 11:00:02 +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 ) id 1qiA6r-007B7C-Dg; Mon, 18 Sep 2023 11:00:01 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qiA6r-002ZAD-48; Mon, 18 Sep 2023 11:00:01 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jean Delvare , Guenter Roeck Cc: linux-hwmon@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 24/24] hwmon: (xgene-hwmon) Convert to platform remove callback returning void Date: Mon, 18 Sep 2023 10:59:51 +0200 Message-Id: <20230918085951.1234172-25-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> References: <20230918085951.1234172-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1902; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=8pxXYYb/AcFS5gSBOZ6GeCD6lyrxSH69Ls+FXw4Jh0E=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCBBFofc17ejH6KSQhXTmyWdP9fy9iQEMqe+v/ /bUyIu9A3eJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQgQRQAKCRCPgPtYfRL+ Tuy9B/9Y4oOpCf036eoOeoGrUFcOuRztbi67wrfgqV88ySU6963xTXSnqvI3mrTlo63LHYqyEWl uNRKKYxVg7HoD2eEHLvsgIyZHAiUImC6aTCwYHIEskM6VEwkMLUmfxNYhBMWhrk4ezs4ii5Gr1p QTYhFCALpijxwE3Plj/Si4vBVm7gTxiETyWqC6C0bBkPmuTVE2f7P8pDTMWezgrYkwXQz93NN6L KRkG19VxELioc856ZhEZe3uCjYJkJ5VuATZj9ts5qjIjPudQOPvoUSuMhAOj1dnCdKnq7uDUT8c 9162onep5k2tkzhU6NUGRunBc/p4RKNiD8NaDcX3NBDmeASZ 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-hwmon@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-hwmon@vger.kernel.org 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() is 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 --- drivers/hwmon/xgene-hwmon.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/hwmon/xgene-hwmon.c b/drivers/hwmon/xgene-hwmon.c index 78d9f52e2a71..bf5b3880ce5b 100644 --- a/drivers/hwmon/xgene-hwmon.c +++ b/drivers/hwmon/xgene-hwmon.c @@ -757,7 +757,7 @@ static int xgene_hwmon_probe(struct platform_device *pdev) return rc; } -static int xgene_hwmon_remove(struct platform_device *pdev) +static void xgene_hwmon_remove(struct platform_device *pdev) { struct xgene_hwmon_dev *ctx = platform_get_drvdata(pdev); @@ -768,8 +768,6 @@ static int xgene_hwmon_remove(struct platform_device *pdev) mbox_free_channel(ctx->mbox_chan); else pcc_mbox_free_channel(ctx->pcc_chan); - - return 0; } static const struct of_device_id xgene_hwmon_of_match[] = { @@ -780,7 +778,7 @@ MODULE_DEVICE_TABLE(of, xgene_hwmon_of_match); static struct platform_driver xgene_hwmon_driver = { .probe = xgene_hwmon_probe, - .remove = xgene_hwmon_remove, + .remove_new = xgene_hwmon_remove, .driver = { .name = "xgene-slimpro-hwmon", .of_match_table = xgene_hwmon_of_match,