From patchwork Sun Sep 17 20:37:59 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: 13388641 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 33983CD13D3 for ; Sun, 17 Sep 2023 20:39:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241231AbjIQUi7 (ORCPT ); Sun, 17 Sep 2023 16:38:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40512 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241273AbjIQUiY (ORCPT ); Sun, 17 Sep 2023 16:38:24 -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 1391F133 for ; Sun, 17 Sep 2023 13:38:19 -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 1qhyWz-0005nb-JG; Sun, 17 Sep 2023 22:38:13 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qhyWy-00742s-La; Sun, 17 Sep 2023 22:38:12 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qhyWy-002Q71-CM; Sun, 17 Sep 2023 22:38:12 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Hans de Goede , Mark Gross , Maximilian Luz Cc: platform-driver-x86@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 1/7] platform/surface: surface3-wmi: Convert to platform remove callback returning void Date: Sun, 17 Sep 2023 22:37:59 +0200 Message-Id: <20230917203805.1149595-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230917203805.1149595-1-u.kleine-koenig@pengutronix.de> References: <20230917203805.1149595-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1839; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=rK7FmuKl9TDejR04w+UJ40TgF76fwC4kyoeNmSUR+2Y=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlB2OhtatsN53cIJtktNOboorVHtZJkzbFVwc36 Iwqes+OOU+JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQdjoQAKCRCPgPtYfRL+ TsthB/9EEDRu+ZcliQ2l2SNxgtwysA6kabKgzO1Zq0a+NY2t/IEhKXArsqnMvqw0EkQ6KryYm88 Z0GTmFrWdCvtFo6McnCUYuZf2C1H+ApwaQo9TRm8GAgVHi4u4jfWwl/rePAUP3kUWF5G2n8pw4y h9blPSvrD9nk6zmpinKbbeLh98dVfZJAAHnX0ilHQXXka0SH27txX/l1kkrrNRvZaQFjgqBmVhz C9cUfdIE/MB7smbXSi0S+f00COeAzBmQyR7S29fubfOlGadWjDxElzurbY6LT6NlE8jqXOpXqgP cC68LrrMCMMwtKER8ZophJ6H+QloPRcAE+N5A1b9FaY36Qm3 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: platform-driver-x86@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@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/platform/surface/surface3-wmi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/platform/surface/surface3-wmi.c b/drivers/platform/surface/surface3-wmi.c index ca4602bcc7de..c15ed7a12784 100644 --- a/drivers/platform/surface/surface3-wmi.c +++ b/drivers/platform/surface/surface3-wmi.c @@ -226,14 +226,13 @@ static int __init s3_wmi_probe(struct platform_device *pdev) return error; } -static int s3_wmi_remove(struct platform_device *device) +static void s3_wmi_remove(struct platform_device *device) { /* remove the hotplug context from the acpi device */ s3_wmi.touchscreen_adev->hp = NULL; /* reinstall the actual PNPC0C0D LID default handle */ acpi_bus_scan(s3_wmi.pnp0c0d_adev->handle); - return 0; } static int __maybe_unused s3_wmi_resume(struct device *dev) @@ -248,7 +247,7 @@ static struct platform_driver s3_wmi_driver = { .name = "surface3-wmi", .pm = &s3_wmi_pm, }, - .remove = s3_wmi_remove, + .remove_new = s3_wmi_remove, }; static int __init s3_wmi_init(void) From patchwork Sun Sep 17 20:38:00 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: 13388642 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 0635ACD13D2 for ; Sun, 17 Sep 2023 20:39:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241180AbjIQUi5 (ORCPT ); Sun, 17 Sep 2023 16:38:57 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40518 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241275AbjIQUiY (ORCPT ); Sun, 17 Sep 2023 16:38:24 -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 D3E74123 for ; Sun, 17 Sep 2023 13:38:18 -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 1qhyWz-0005nc-JG; Sun, 17 Sep 2023 22:38:13 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qhyWy-00742v-U0; Sun, 17 Sep 2023 22:38:12 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qhyWy-002Q75-Kf; Sun, 17 Sep 2023 22:38:12 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Maximilian Luz , Hans de Goede , Mark Gross Cc: platform-driver-x86@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 2/7] platform/surface: acpi-notify: Convert to platform remove callback returning void Date: Sun, 17 Sep 2023 22:38:00 +0200 Message-Id: <20230917203805.1149595-3-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230917203805.1149595-1-u.kleine-koenig@pengutronix.de> References: <20230917203805.1149595-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=MpOKhH0uoAR010lAUKn2htlumWVTsDfbF9BeI1OYL/E=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlB2OiFPV+Y6qGveNAlEDOBMlDtIk6m6ShdEEOV 7zc6qsHAZ6JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQdjogAKCRCPgPtYfRL+ Tt2NB/9jd5OiVAg6SWXLtxKphwGjroxt6kLrr3tYvAPCbendG8n87VwSjJLJG9KknZCajoOFH0h re7ABq1eFpb4OTO6U7FHqMpxNPxMunS4eqyk1YkPocwbnNuFEC6l1akYaqdHiGngXwToTh1MCEp BR3IB/d7tWpDOqHL6ZRJLianF57kCmHLPpXf7maD7z0SS0K69BKzgCxKzQHiSHOfxGyIB/uAmvb ivu3z7gjNvcNkSZB1zIUemeBih8Z1l7RqkGB7UQwfUpTpFdMPgz244RZtrhDtuTnMfb/pWQNG6b FAZCRLruAjSfVEli06Zy96Ti8Rv1crzNiWhGEPCxkgQq016v 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: platform-driver-x86@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@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/platform/surface/surface_acpi_notify.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/surface/surface_acpi_notify.c b/drivers/platform/surface/surface_acpi_notify.c index 897cdd9c3aae..2c091066b6a1 100644 --- a/drivers/platform/surface/surface_acpi_notify.c +++ b/drivers/platform/surface/surface_acpi_notify.c @@ -850,7 +850,7 @@ static int san_probe(struct platform_device *pdev) return status; } -static int san_remove(struct platform_device *pdev) +static void san_remove(struct platform_device *pdev) { acpi_handle san = ACPI_HANDLE(&pdev->dev); @@ -864,8 +864,6 @@ static int san_remove(struct platform_device *pdev) * all delayed works they may have spawned are run to completion. */ flush_workqueue(san_wq); - - return 0; } static const struct acpi_device_id san_match[] = { @@ -876,7 +874,7 @@ MODULE_DEVICE_TABLE(acpi, san_match); static struct platform_driver surface_acpi_notify = { .probe = san_probe, - .remove = san_remove, + .remove_new = san_remove, .driver = { .name = "surface_acpi_notify", .acpi_match_table = san_match, From patchwork Sun Sep 17 20:38:01 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: 13388638 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 B38ADCD13D8 for ; Sun, 17 Sep 2023 20:38:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241208AbjIQUi2 (ORCPT ); Sun, 17 Sep 2023 16:38:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40464 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241268AbjIQUiX (ORCPT ); Sun, 17 Sep 2023 16:38:23 -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 DFC2E10E for ; Sun, 17 Sep 2023 13:38:17 -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 1qhyWz-0005nd-JG; Sun, 17 Sep 2023 22:38:13 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qhyWz-00742y-62; Sun, 17 Sep 2023 22:38:13 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qhyWy-002Q79-So; Sun, 17 Sep 2023 22:38:12 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Maximilian Luz , Hans de Goede , Mark Gross Cc: platform-driver-x86@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 3/7] platform/surface: aggregator-cdev: Convert to platform remove callback returning void Date: Sun, 17 Sep 2023 22:38:01 +0200 Message-Id: <20230917203805.1149595-4-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230917203805.1149595-1-u.kleine-koenig@pengutronix.de> References: <20230917203805.1149595-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1961; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=CEzK6ktEzqymZF2pAhogyNZYWD/p05seka6E4hr1zrY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlB2Ojd77rsTb71DC0p68lQg5Nvws9AcrI4yCsO JMOSMgj47yJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQdjowAKCRCPgPtYfRL+ TovEB/9ym3ZzcGpSQ3ZUxskLDeFib6RZWTkFBNBxPmpi7tWc6DUaKRIur3544DL5Zmjv9olS+Dl rkJf597vVWkiAVXs9KR17S72GxxFMr3VzJX4tAhsGhGuaIHmyuxSCRx8D+3NXb0U1kXt4c6eK6E qS1nTQOo20y6FXH0VKajp/v6JUVNMalye81oYpAKiYPO33SGjoOAvUtXXXK7BJncHfDvhFwT/al LIH2h92MzvH+FzudJEUz+Rm3lNZRI0iJFoepVdrYf5VqwZF4g4i5tXg7Ityuc3WvV/WsEWixC4Z k7PfRDU2EyIOQiWMmU2Vb5ZmYSlyJey2EVz0ao2vSV6i4Hv+ 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: platform-driver-x86@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@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/platform/surface/surface_aggregator_cdev.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/platform/surface/surface_aggregator_cdev.c b/drivers/platform/surface/surface_aggregator_cdev.c index 07f0ed658369..07e065b9159f 100644 --- a/drivers/platform/surface/surface_aggregator_cdev.c +++ b/drivers/platform/surface/surface_aggregator_cdev.c @@ -714,7 +714,7 @@ static int ssam_dbg_device_probe(struct platform_device *pdev) return 0; } -static int ssam_dbg_device_remove(struct platform_device *pdev) +static void ssam_dbg_device_remove(struct platform_device *pdev) { struct ssam_cdev *cdev = platform_get_drvdata(pdev); struct ssam_cdev_client *client; @@ -757,14 +757,13 @@ static int ssam_dbg_device_remove(struct platform_device *pdev) misc_deregister(&cdev->mdev); ssam_cdev_put(cdev); - return 0; } static struct platform_device *ssam_cdev_device; static struct platform_driver ssam_cdev_driver = { .probe = ssam_dbg_device_probe, - .remove = ssam_dbg_device_remove, + .remove_new = ssam_dbg_device_remove, .driver = { .name = SSAM_CDEV_DEVICE_NAME, .probe_type = PROBE_PREFER_ASYNCHRONOUS, From patchwork Sun Sep 17 20:38:02 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: 13388636 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 43375CD37B4 for ; Sun, 17 Sep 2023 20:38:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241196AbjIQUi1 (ORCPT ); Sun, 17 Sep 2023 16:38:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241270AbjIQUiY (ORCPT ); Sun, 17 Sep 2023 16:38:24 -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 575EC115 for ; Sun, 17 Sep 2023 13:38:18 -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 1qhyWz-0005ni-QN; Sun, 17 Sep 2023 22:38:13 +0200 Received: from [2a0a:edc0:0:900:1d::77] (helo=ptz.office.stw.pengutronix.de) by drehscheibe.grey.stw.pengutronix.de with esmtps (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1qhyWz-007433-Ct; Sun, 17 Sep 2023 22:38:13 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qhyWz-002Q7D-3U; Sun, 17 Sep 2023 22:38:13 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Maximilian Luz , Hans de Goede , Mark Gross Cc: platform-driver-x86@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 4/7] platform/surface: aggregator-registry: Convert to platform remove callback returning void Date: Sun, 17 Sep 2023 22:38:02 +0200 Message-Id: <20230917203805.1149595-5-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230917203805.1149595-1-u.kleine-koenig@pengutronix.de> References: <20230917203805.1149595-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1928; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=yROS7RsrxYaxxX/blwDQjqKU8CNtnJkAA3bIRFelpSo=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlB2OkVe+3XG6/5au4b+xtMC4kiAzQ/Q9HVz4v/ KmJQuEvWcyJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQdjpAAKCRCPgPtYfRL+ TqGIB/9ikDdGucGKDdVEYhdbI/QtSbV5IUBTb0BVUSTrx172atCXX1k8mG6+ZFlSz3tPpFk2Q+M SmzrkhsE8SO7n+F++2hhDtPynw/EJMal8jIXWUCh9Q5japd0/x6ztoA4011YpiN0QmWUHx9LX60 4wZQ5IoWa9BB1rK4+QLQblf79QznjY2ZIt1XfeGxYgLq8/APKdliu2+BvkqaX8s3ruN4LCv2zDN 4xNp+zRb6Yw8J9eYfGvBXTZSqxg+EUWe5qjrSMYCRrm9FW3pEmP5ZWu+d9rUyv4El5DnQj0bIP2 zfLj2ooV2McRfuhi1Bd7FfdRr6D0wRa8JM0tE2MAk0KJJFsF 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: platform-driver-x86@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@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/platform/surface/surface_aggregator_registry.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/platform/surface/surface_aggregator_registry.c b/drivers/platform/surface/surface_aggregator_registry.c index 0fe5be539652..aeb3feae40ff 100644 --- a/drivers/platform/surface/surface_aggregator_registry.c +++ b/drivers/platform/surface/surface_aggregator_registry.c @@ -418,19 +418,18 @@ static int ssam_platform_hub_probe(struct platform_device *pdev) return status; } -static int ssam_platform_hub_remove(struct platform_device *pdev) +static void ssam_platform_hub_remove(struct platform_device *pdev) { const struct software_node **nodes = platform_get_drvdata(pdev); ssam_remove_clients(&pdev->dev); set_secondary_fwnode(&pdev->dev, NULL); software_node_unregister_node_group(nodes); - return 0; } static struct platform_driver ssam_platform_hub_driver = { .probe = ssam_platform_hub_probe, - .remove = ssam_platform_hub_remove, + .remove_new = ssam_platform_hub_remove, .driver = { .name = "surface_aggregator_platform_hub", .acpi_match_table = ssam_platform_hub_match, From patchwork Sun Sep 17 20:38:03 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: 13388639 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 D469BCD13DA for ; Sun, 17 Sep 2023 20:38:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241197AbjIQUi1 (ORCPT ); Sun, 17 Sep 2023 16:38:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241269AbjIQUiY (ORCPT ); Sun, 17 Sep 2023 16:38:24 -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 2443A10F for ; Sun, 17 Sep 2023 13:38:18 -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 1qhyX0-0005oL-1E; Sun, 17 Sep 2023 22:38:14 +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 1qhyWz-00743I-KE; Sun, 17 Sep 2023 22:38:13 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qhyWz-002Q7H-Av; Sun, 17 Sep 2023 22:38:13 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Maximilian Luz , Hans de Goede , Mark Gross Cc: platform-driver-x86@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 5/7] platform/surface: dtx: Convert to platform remove callback returning void Date: Sun, 17 Sep 2023 22:38:03 +0200 Message-Id: <20230917203805.1149595-6-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230917203805.1149595-1-u.kleine-koenig@pengutronix.de> References: <20230917203805.1149595-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1847; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=3z0VkSAse5K2/+67mYlA60MVHhf6JKhl+iFnbVHx5Yc=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlB2OmAvPCWdxPfJ1MpIysLXoWW1SXydEJihcJK mPYTlm1mA2JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQdjpgAKCRCPgPtYfRL+ Tq99B/9ImtwQyvHbg8Gqpm2F4VEHvd0NaZEB+uxRkTp284GgXpHbdbldIRiLyFDqU1eYa/mrMA0 vWcBMwwLeXxvNPTAlPNbRxjXAJpzpMbuPFkxDJL4T2sOX7bBgVbS2+r1zSRI+63A7GIejnRMkId fLBLqE5h7BQmL8qoCkblMBpPuZ6itN4wWwWcFC7m4XErZyIBkJHDkWcvcDT89CJ1KLP1PFkfKA6 PjiREOp7ymNveROCIQtm51Ne8XqBIgipqo9OzXDwlzzTCjzqqnLkzUFerEMb4uJRyxL4zBlOvuV 7NWh39CE5yhbPhiOLe/CDl33SIpVjT/fBA92woBNBTbaf4af 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: platform-driver-x86@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@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/platform/surface/surface_dtx.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/platform/surface/surface_dtx.c b/drivers/platform/surface/surface_dtx.c index 30cbde278c59..2de843b7ea70 100644 --- a/drivers/platform/surface/surface_dtx.c +++ b/drivers/platform/surface/surface_dtx.c @@ -1168,10 +1168,9 @@ static int surface_dtx_platform_probe(struct platform_device *pdev) return 0; } -static int surface_dtx_platform_remove(struct platform_device *pdev) +static void surface_dtx_platform_remove(struct platform_device *pdev) { sdtx_device_destroy(platform_get_drvdata(pdev)); - return 0; } static const struct acpi_device_id surface_dtx_acpi_match[] = { @@ -1182,7 +1181,7 @@ MODULE_DEVICE_TABLE(acpi, surface_dtx_acpi_match); static struct platform_driver surface_dtx_platform_driver = { .probe = surface_dtx_platform_probe, - .remove = surface_dtx_platform_remove, + .remove_new = surface_dtx_platform_remove, .driver = { .name = "surface_dtx_pltf", .acpi_match_table = surface_dtx_acpi_match, From patchwork Sun Sep 17 20:38:04 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: 13388643 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 8247CCD13DE for ; Sun, 17 Sep 2023 20:39:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241236AbjIQUi7 (ORCPT ); Sun, 17 Sep 2023 16:38:59 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40498 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241272AbjIQUiY (ORCPT ); Sun, 17 Sep 2023 16:38:24 -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 D075C11B for ; Sun, 17 Sep 2023 13:38:18 -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 1qhyX0-0005oS-7W; Sun, 17 Sep 2023 22:38:14 +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 1qhyWz-00743P-Qy; Sun, 17 Sep 2023 22:38:13 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qhyWz-002Q7L-Ho; Sun, 17 Sep 2023 22:38:13 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Maximilian Luz , Hans de Goede , Mark Gross Cc: platform-driver-x86@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 6/7] platform/surface: gpe: Convert to platform remove callback returning void Date: Sun, 17 Sep 2023 22:38:04 +0200 Message-Id: <20230917203805.1149595-7-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230917203805.1149595-1-u.kleine-koenig@pengutronix.de> References: <20230917203805.1149595-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1783; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=A8/mNBASSnoDS23LrI29IE0CtD5xUhsHXkUnF2jSKN4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlB2OnQAresGdBJZyZbgE88rkiSgRdbfS8O6te5 6gpBWgQQ4KJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQdjpwAKCRCPgPtYfRL+ To4lB/9Yy3T47FSlwJTahE28EwUjIuiM/ZLwbbpXoqQ25/Xa1i11LohvjAHrzx0fOQGQpZiMaf3 sdK1Yaq8K4ZoLuXGWhw3hRHPmGN5/ZPzctc/tdycFai2D98UAkaV/291juKuCorX+ReLIXS7306 o/3UeLrR2pbH7iVyCvpI+K5MfV4Pv93vq9CiCHSZiy6MVd9DX6SQAuPsF4o3upLHt6PnQmWNqzN NuWUvPlwX24WmfN5u0FeGv15S6alzrFZKB2IAJnuHst27fVWdXQNX2hgYUk8J9F3E8K7O1OOitb cKWlC+EF0QeGYOvAQRDup5959Pndg9cU+kcnC7xEXhlz1eMl 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: platform-driver-x86@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@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/platform/surface/surface_gpe.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/surface/surface_gpe.c b/drivers/platform/surface/surface_gpe.c index c219b840d491..62fd4004db31 100644 --- a/drivers/platform/surface/surface_gpe.c +++ b/drivers/platform/surface/surface_gpe.c @@ -267,20 +267,18 @@ static int surface_gpe_probe(struct platform_device *pdev) return ret; } -static int surface_gpe_remove(struct platform_device *pdev) +static void surface_gpe_remove(struct platform_device *pdev) { struct surface_lid_device *lid = dev_get_drvdata(&pdev->dev); /* restore default behavior without this module */ surface_lid_enable_wakeup(&pdev->dev, false); acpi_disable_gpe(NULL, lid->gpe_number); - - return 0; } static struct platform_driver surface_gpe_driver = { .probe = surface_gpe_probe, - .remove = surface_gpe_remove, + .remove_new = surface_gpe_remove, .driver = { .name = "surface_gpe", .pm = &surface_gpe_pm, From patchwork Sun Sep 17 20:38:05 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: 13388637 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 92515CD13D3 for ; Sun, 17 Sep 2023 20:38:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241183AbjIQUi0 (ORCPT ); Sun, 17 Sep 2023 16:38:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40494 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241271AbjIQUiY (ORCPT ); Sun, 17 Sep 2023 16:38:24 -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 C57D4118 for ; Sun, 17 Sep 2023 13:38:18 -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 1qhyX0-0005oi-I3; Sun, 17 Sep 2023 22:38:14 +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 1qhyX0-00743T-30; Sun, 17 Sep 2023 22:38:14 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qhyWz-002Q7P-Q3; Sun, 17 Sep 2023 22:38:13 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Maximilian Luz , Hans de Goede , Mark Gross Cc: platform-driver-x86@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 7/7] platform/surface: hotplug: Convert to platform remove callback returning void Date: Sun, 17 Sep 2023 22:38:05 +0200 Message-Id: <20230917203805.1149595-8-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230917203805.1149595-1-u.kleine-koenig@pengutronix.de> References: <20230917203805.1149595-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1999; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=Jh1HVZXkx6Rx+ALiihWqjxEv+hD2xIyJD34jiaw6mso=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlB2OomvTyDOP3KixhGCa5btQjmL6UaM37v7Rka JetvmZeT7mJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQdjqAAKCRCPgPtYfRL+ TuHNB/4pIWfMajvIbLRPKziJyLUgmvhaktGTfzWOTgIFFEcsf1N+8iRPm3ZPK3/ElYS97k+QuKH mhuvMkQphEIk76UohmM202Ak7wfOSfBMtxXWoA8HzZ9k41V/Un9WIpn86S3vlJ21WBtxjKNMu7L +Bno+ycelEFtnwTGk4CDpXMapVZWoWtR3vZHiBZd38CCXfScpX5KdgJ22Fsp+19etJnS615kt3Y JAeWKphx6FmnLZJUXDM7p5kNJu+bo5mie7S4dBe5k1YQTjtCIPA2j7/bZs3EWKI2KL2xGofWaBd /lVGo2QiBUbPh9oKjDXhVp2HM1v3x9D0QgzfGMCSDZigysox 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: platform-driver-x86@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: platform-driver-x86@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/platform/surface/surface_hotplug.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/platform/surface/surface_hotplug.c b/drivers/platform/surface/surface_hotplug.c index 7b6d887dccdb..a404f26cfae8 100644 --- a/drivers/platform/surface/surface_hotplug.c +++ b/drivers/platform/surface/surface_hotplug.c @@ -183,7 +183,7 @@ static int shps_setup_irq(struct platform_device *pdev, enum shps_irq_type type) return 0; } -static int surface_hotplug_remove(struct platform_device *pdev) +static void surface_hotplug_remove(struct platform_device *pdev) { struct shps_device *sdev = platform_get_drvdata(pdev); int i; @@ -195,8 +195,6 @@ static int surface_hotplug_remove(struct platform_device *pdev) mutex_destroy(&sdev->lock[i]); } - - return 0; } static int surface_hotplug_probe(struct platform_device *pdev) @@ -261,7 +259,7 @@ MODULE_DEVICE_TABLE(acpi, surface_hotplug_acpi_match); static struct platform_driver surface_hotplug_driver = { .probe = surface_hotplug_probe, - .remove = surface_hotplug_remove, + .remove_new = surface_hotplug_remove, .driver = { .name = "surface_hotplug", .acpi_match_table = surface_hotplug_acpi_match,