From patchwork Tue Sep 19 17:48: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: 13391703 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 141E9CE79A9 for ; Tue, 19 Sep 2023 17:50:03 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232675AbjISRuG (ORCPT ); Tue, 19 Sep 2023 13:50:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45020 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232648AbjISRuG (ORCPT ); Tue, 19 Sep 2023 13:50:06 -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 AEBEB9E for ; Tue, 19 Sep 2023 10:49:59 -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 1qier5-0006Jk-EV; Tue, 19 Sep 2023 19:49:47 +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 1qier4-007VVW-K5; Tue, 19 Sep 2023 19:49:46 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qier4-0034WL-70; Tue, 19 Sep 2023 19:49:46 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Jiri Kosina , Srinivas Pandruvada , Lars-Peter Clausen , linux-input@vger.kernel.org, linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 01/49] iio: accel: hid-sensor-accel-3d: Convert to platform remove callback returning void Date: Tue, 19 Sep 2023 19:48:43 +0200 Message-Id: <20230919174931.1417681-2-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> References: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2124; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=+f8rosmRaslDVCZSXhS/rf09fL9HMI2ZpPZZR4YJ2k4=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCd7wAmG+YPnES2pQ0u+1BwY95J3oWiANiNy2x aB646KHHrqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQne8AAKCRCPgPtYfRL+ ToMRB/9ZVJzsU19xYjA5+Q9JwLsajvQe8ME3tfyvOSvm+HJSXmlxYFgu4Aj73X1kU8oEA163MPG /khbkslcdoG9SaokOyvU3aeXOwUKaN/L3aBGy9ZYkhgHDMbXpONGKzh7Xheq2brD3AWnl6EuWvH kb5uuHubmAoa5p4zXw0gSwMABc+EXzUkYpJ9MdEg/WUrMrw4U552y0WLGHaK5AgyNQ1kFiiIdJu mf/9lQMc+swX4gZuHL3KQDCaQApcR7s/EyU0wEr+/eNCIyaaiSjNxewXH0+4c/+GrlSw55ovvBC jE1QJ9tWmb43O1G/h/6tftz0OWWrWmk+WujO8zyFfzTflmSO 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-input@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/iio/accel/hid-sensor-accel-3d.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hid-sensor-accel-3d.c index 5eac7ea19993..9b7a73a4c48a 100644 --- a/drivers/iio/accel/hid-sensor-accel-3d.c +++ b/drivers/iio/accel/hid-sensor-accel-3d.c @@ -422,7 +422,7 @@ static int hid_accel_3d_probe(struct platform_device *pdev) } /* Function to deinitialize the processing for usage id */ -static int hid_accel_3d_remove(struct platform_device *pdev) +static void hid_accel_3d_remove(struct platform_device *pdev) { struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; struct iio_dev *indio_dev = platform_get_drvdata(pdev); @@ -431,8 +431,6 @@ static int hid_accel_3d_remove(struct platform_device *pdev) sensor_hub_remove_callback(hsdev, hsdev->usage); iio_device_unregister(indio_dev); hid_sensor_remove_trigger(indio_dev, &accel_state->common_attributes); - - return 0; } static const struct platform_device_id hid_accel_3d_ids[] = { @@ -454,7 +452,7 @@ static struct platform_driver hid_accel_3d_platform_driver = { .pm = &hid_sensor_pm_ops, }, .probe = hid_accel_3d_probe, - .remove = hid_accel_3d_remove, + .remove_new = hid_accel_3d_remove, }; module_platform_driver(hid_accel_3d_platform_driver); From patchwork Tue Sep 19 17:49:16 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: 13391704 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 6F47ACE79AB for ; Tue, 19 Sep 2023 17:50:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232784AbjISRuO (ORCPT ); Tue, 19 Sep 2023 13:50:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232781AbjISRuM (ORCPT ); Tue, 19 Sep 2023 13:50: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 D96B3A6 for ; Tue, 19 Sep 2023 10:50:06 -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 1qierE-0006pR-W7; Tue, 19 Sep 2023 19:49:57 +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 1qierD-007VXa-Ha; Tue, 19 Sep 2023 19:49:55 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qierD-0034Yh-8R; Tue, 19 Sep 2023 19:49:55 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Jiri Kosina , Srinivas Pandruvada , Lars-Peter Clausen , linux-input@vger.kernel.org, linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 34/49] iio: gyro: hid-sensor-gyro-3d: Convert to platform remove callback returning void Date: Tue, 19 Sep 2023 19:49:16 +0200 Message-Id: <20230919174931.1417681-35-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> References: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2115; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=LsFMCu/59s/o//XlWzq+zXpjMPw78iwzcioYjxKNai0=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCd8V3JOis6CtIlBcx/dYjMKOgEB8SvhQFPJU9 7jFinopSUqJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQnfFQAKCRCPgPtYfRL+ To0cCAC5Wkk7iYyyrUv3ZUOQHCnVbpvL3dMAaN8MStGzAUtR67Kgn8CDZxCvnfyMToPb9QSYUuj i8UmrtoYTWOEkOv+XYa5wDk0ZciGvqQf2iVE7nNfqAuFa8JvY756JFbnxaRThucGkw5/8KJh365 cVOPCI5F4m3q1BflhHoV8iFxrKqawdCNtEdWOmLbTEJg9GNieDhT6jetrUWyWEOdZLUcpl6yA6w 9DkPgnwE3nqHDYS6bQcgCNsMhqDz/TtShv62F930xFiVYF6rVuIxlGkIF3EFtKpFNW9EsdWD2Nn KXTzNvNZSctiAGk+f5X+hIYOl9wZrR5/MGpNXIukOlGaymVi 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-input@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/iio/gyro/hid-sensor-gyro-3d.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-sensor-gyro-3d.c index 698c50da1f10..59a38bf9459b 100644 --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c @@ -359,7 +359,7 @@ static int hid_gyro_3d_probe(struct platform_device *pdev) } /* Function to deinitialize the processing for usage id */ -static int hid_gyro_3d_remove(struct platform_device *pdev) +static void hid_gyro_3d_remove(struct platform_device *pdev) { struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; struct iio_dev *indio_dev = platform_get_drvdata(pdev); @@ -368,8 +368,6 @@ static int hid_gyro_3d_remove(struct platform_device *pdev) sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_GYRO_3D); iio_device_unregister(indio_dev); hid_sensor_remove_trigger(indio_dev, &gyro_state->common_attributes); - - return 0; } static const struct platform_device_id hid_gyro_3d_ids[] = { @@ -388,7 +386,7 @@ static struct platform_driver hid_gyro_3d_platform_driver = { .pm = &hid_sensor_pm_ops, }, .probe = hid_gyro_3d_probe, - .remove = hid_gyro_3d_remove, + .remove_new = hid_gyro_3d_remove, }; module_platform_driver(hid_gyro_3d_platform_driver); From patchwork Tue Sep 19 17:49:17 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: 13391706 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 057C4CE79AD for ; Tue, 19 Sep 2023 17:50:12 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232585AbjISRuP (ORCPT ); Tue, 19 Sep 2023 13:50:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45194 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232748AbjISRuO (ORCPT ); Tue, 19 Sep 2023 13:50: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 083BAC6 for ; Tue, 19 Sep 2023 10:50:08 -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 1qierF-0006qJ-6I; Tue, 19 Sep 2023 19:49:57 +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 1qierD-007VXd-P6; Tue, 19 Sep 2023 19:49:55 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qierD-0034Yl-Fu; Tue, 19 Sep 2023 19:49:55 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Jiri Kosina , Srinivas Pandruvada , Lars-Peter Clausen , linux-input@vger.kernel.org, linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 35/49] iio: humidity: hid-sensor-humidity: Convert to platform remove callback returning void Date: Tue, 19 Sep 2023 19:49:17 +0200 Message-Id: <20230919174931.1417681-36-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> References: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2154; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=f6SnRHi4QXOG5VVuNxA/zoxyAcyQnHWl7QhOls1+tbU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCd8WZHPm/jhhG2JSXhQiv7Sv7SqTfydYRGlhR yD2rahbH+iJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQnfFgAKCRCPgPtYfRL+ Tox9B/4gdoH+pg1SdoruDhgn1NAC2FaRBikwaS/fUVfOBd/eaf4e/cEXvINjZZkbemmnv7Vhg6T DPuU4R3+UAkUiX3scymaHzL19POOeRkv0vOL5z73CG2tY2LWRjgt8F//MKNXxV7q9YCIevH5RgL xj7n3SajccEc4YRhAy63oEasJZSc3KZtUBVfsO9RKw7Lver51tucP8f0/5Ute0pM71CjehS5/Ht H65dYH0/r3v3tYSt2ozrnJk+WccPjfi6hgWTlxrqHxvOGhg6VYh56DsBxzFHIvLprL9u//qDYf1 Kuk+CpaYtfwkpvxjhkbEsRrQV+Z26Qi2yk85ADsiPYB1rNpd 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-input@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/iio/humidity/hid-sensor-humidity.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/humidity/hid-sensor-humidity.c b/drivers/iio/humidity/hid-sensor-humidity.c index fa0fe404a70a..bf6d2636a85e 100644 --- a/drivers/iio/humidity/hid-sensor-humidity.c +++ b/drivers/iio/humidity/hid-sensor-humidity.c @@ -260,7 +260,7 @@ static int hid_humidity_probe(struct platform_device *pdev) } /* Function to deinitialize the processing for usage id */ -static int hid_humidity_remove(struct platform_device *pdev) +static void hid_humidity_remove(struct platform_device *pdev) { struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev); struct iio_dev *indio_dev = platform_get_drvdata(pdev); @@ -269,8 +269,6 @@ static int hid_humidity_remove(struct platform_device *pdev) iio_device_unregister(indio_dev); sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_HUMIDITY); hid_sensor_remove_trigger(indio_dev, &humid_st->common_attributes); - - return 0; } static const struct platform_device_id hid_humidity_ids[] = { @@ -289,7 +287,7 @@ static struct platform_driver hid_humidity_platform_driver = { .pm = &hid_sensor_pm_ops, }, .probe = hid_humidity_probe, - .remove = hid_humidity_remove, + .remove_new = hid_humidity_remove, }; module_platform_driver(hid_humidity_platform_driver); From patchwork Tue Sep 19 17:49:19 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: 13391705 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 8225ACE79AF for ; Tue, 19 Sep 2023 17:50:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232805AbjISRuO (ORCPT ); Tue, 19 Sep 2023 13:50:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232757AbjISRuN (ORCPT ); Tue, 19 Sep 2023 13:50: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 63C1B8F for ; Tue, 19 Sep 2023 10:50:07 -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 1qierF-0006sA-77; Tue, 19 Sep 2023 19:49:57 +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 1qierE-007VXm-8s; Tue, 19 Sep 2023 19:49:56 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qierD-0034Yt-Vp; Tue, 19 Sep 2023 19:49:55 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Jiri Kosina , Srinivas Pandruvada , Lars-Peter Clausen , linux-input@vger.kernel.org, linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 37/49] iio: light: hid-sensor-als: Convert to platform remove callback returning void Date: Tue, 19 Sep 2023 19:49:19 +0200 Message-Id: <20230919174931.1417681-38-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> References: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2047; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=9CIDZYOavpioxbdWwZP93s8Mxb5cwCdJEMfgjHqB9jE=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCd8ZMhz3s0VXB+Qv/6OFciGPPuEXCyn3d53CD abdWhTbpi+JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQnfGQAKCRCPgPtYfRL+ Tm6rB/9H8xDlagxGgdRt1NVXiyC0/iZWf26IoEj4oz9ipUo96QShreKzC7CRWBPgV9y2YMtGeF1 Ke2xskRLn2BsbXY+q7/9/JQ9/yizmg7VswSRS7Nl7VXy6uY7WlxJqUE4vnHooQ89bmJ7iRXMuWL v0SEkpDHrwLMj8o6jkpzt5qXNrpE5G8y26Pb6i6cS0hjRnY14o5BQ8HNDKzUmqiomopIz95rvxd 2CBx8ae/+e0RZOgp62bv4bw1pkAOt8rwVgSZ019KKvX7ESVuKOI6ZVtMZhUySC8mC4G+bYT6pha hhCC9KwcssXGC0akdPEaGn3kpNerzrA6UNGm49GaMQCNKGqu 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-input@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/iio/light/hid-sensor-als.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sensor-als.c index eb1aedad7edc..cb76841ec0ce 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c @@ -347,7 +347,7 @@ static int hid_als_probe(struct platform_device *pdev) } /* Function to deinitialize the processing for usage id */ -static int hid_als_remove(struct platform_device *pdev) +static void hid_als_remove(struct platform_device *pdev) { struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; struct iio_dev *indio_dev = platform_get_drvdata(pdev); @@ -356,8 +356,6 @@ static int hid_als_remove(struct platform_device *pdev) sensor_hub_remove_callback(hsdev, hsdev->usage); iio_device_unregister(indio_dev); hid_sensor_remove_trigger(indio_dev, &als_state->common_attributes); - - return 0; } static const struct platform_device_id hid_als_ids[] = { @@ -380,7 +378,7 @@ static struct platform_driver hid_als_platform_driver = { .pm = &hid_sensor_pm_ops, }, .probe = hid_als_probe, - .remove = hid_als_remove, + .remove_new = hid_als_remove, }; module_platform_driver(hid_als_platform_driver); From patchwork Tue Sep 19 17:49:20 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: 13391713 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 C68A3CE79AC for ; Tue, 19 Sep 2023 17:50:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232830AbjISRuW (ORCPT ); Tue, 19 Sep 2023 13:50:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34288 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232594AbjISRuU (ORCPT ); Tue, 19 Sep 2023 13:50:20 -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 59C6B92 for ; Tue, 19 Sep 2023 10:50:12 -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 1qierF-0006t7-I1; Tue, 19 Sep 2023 19:49:57 +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 1qierE-007VXr-Hm; Tue, 19 Sep 2023 19:49:56 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qierE-0034Yx-80; Tue, 19 Sep 2023 19:49:56 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Jiri Kosina , Srinivas Pandruvada , Lars-Peter Clausen , linux-input@vger.kernel.org, linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 38/49] iio: light: hid-sensor-prox: Convert to platform remove callback returning void Date: Tue, 19 Sep 2023 19:49:20 +0200 Message-Id: <20230919174931.1417681-39-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> References: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2063; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=9InOe8eBQN4BfxU+d0oPtNrpfmneHomGKn+oBC5Wt5U=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCd8a5kC5Xle7OYZtn5cPdMfbzzP4vfuWGFfIz rLOJO+4Y6GJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQnfGgAKCRCPgPtYfRL+ TqG/CAC47dI86pAkLIkJTCWzIaSW7nP6OOoZ58lvz/EltwAzYwBtIaK+VsSYY1KyMw/llyUM4gT Nh6KHhYi/85iAhOD4Hob4Vk7VwB18FxR4iStwv0FRWiLqdgjWONuRSHJpJoRb19cS52XW1M53b7 /A0IIB/wn9F8XjYgef77TNYKFpQvVaV5ml5tTqv3oBb+2NfJc/vzRy87Y6lyKE28S3O8MwZz4F9 XOqLFgLdij16iavNatEOa7KfOoVxxH5Fem/6GCzmYzlq3eUwlWawdbEdA98No4kXKQLx+mbgMRQ jq+bxYAUUMRyRsKAXEoebuNz9ZVp5HFxqugRc0E4qwt7Pj0V 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-input@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/iio/light/hid-sensor-prox.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-sensor-prox.c index a47591e1bad9..26c481d2998c 100644 --- a/drivers/iio/light/hid-sensor-prox.c +++ b/drivers/iio/light/hid-sensor-prox.c @@ -313,7 +313,7 @@ static int hid_prox_probe(struct platform_device *pdev) } /* Function to deinitialize the processing for usage id */ -static int hid_prox_remove(struct platform_device *pdev) +static void hid_prox_remove(struct platform_device *pdev) { struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; struct iio_dev *indio_dev = platform_get_drvdata(pdev); @@ -322,8 +322,6 @@ static int hid_prox_remove(struct platform_device *pdev) sensor_hub_remove_callback(hsdev, hsdev->usage); iio_device_unregister(indio_dev); hid_sensor_remove_trigger(indio_dev, &prox_state->common_attributes); - - return 0; } static const struct platform_device_id hid_prox_ids[] = { @@ -346,7 +344,7 @@ static struct platform_driver hid_prox_platform_driver = { .pm = &hid_sensor_pm_ops, }, .probe = hid_prox_probe, - .remove = hid_prox_remove, + .remove_new = hid_prox_remove, }; module_platform_driver(hid_prox_platform_driver); From patchwork Tue Sep 19 17:49:22 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13391709 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 0681CCE79AD for ; Tue, 19 Sep 2023 17:50:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232804AbjISRuT (ORCPT ); Tue, 19 Sep 2023 13:50:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34264 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232782AbjISRuQ (ORCPT ); Tue, 19 Sep 2023 13:50: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 5B285D6 for ; Tue, 19 Sep 2023 10:50:09 -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 1qierG-0006ug-CY; Tue, 19 Sep 2023 19:49: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 1qierF-007VXy-2w; Tue, 19 Sep 2023 19:49:57 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qierE-0034Z5-Nu; Tue, 19 Sep 2023 19:49:56 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Jiri Kosina , Srinivas Pandruvada , Lars-Peter Clausen , linux-input@vger.kernel.org, linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 40/49] iio: magnetometer: hid-sensor-magn-3d: Convert to platform remove callback returning void Date: Tue, 19 Sep 2023 19:49:22 +0200 Message-Id: <20230919174931.1417681-41-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> References: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2161; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=BI2AxeWkrm/vq5Q7OpicwiFXiDU8Zd6bfxo8tcMqVts=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCd8cH1EHijdLlKNElQ7qEIBaxbGMJwKgTb6rF /htcbiQVvWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQnfHAAKCRCPgPtYfRL+ To3VB/4mRqkW4+tuyaOxAYxR0vXfukPsmvNNHM7r7wJBN7XEgW/vlfd9DnykHd+9o8MQpgjeGBY hzOpdYdx2z3mzavxvnVPoTherzwoQvkkPvH2JcYxOFodI520vvN7/QKkJQaUSpd15gEkxTWrBDw MHK+nM5RxSVCyADcp1CLQF0Wq6AUQZoZA9Yt9QhOHCJJp1tfoqs/FdPcWYYak+OuhMZ7O8oSRIj T25GXeSHam3nzBMUturDiMLdDkg/crzos2K3Tqvr6N8Mzozw4x9g5xYsJtwrH4lmBOYcEeYJfG1 3MvGjKqKGKK/JdqupQ38jG/WSS2/QpHiJ1be2E0rIPlBWf4q 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-input@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/iio/magnetometer/hid-sensor-magn-3d.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/magnetometer/hid-sensor-magn-3d.c index e85a3a8eea90..5c795a430d09 100644 --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c @@ -547,7 +547,7 @@ static int hid_magn_3d_probe(struct platform_device *pdev) } /* Function to deinitialize the processing for usage id */ -static int hid_magn_3d_remove(struct platform_device *pdev) +static void hid_magn_3d_remove(struct platform_device *pdev) { struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; struct iio_dev *indio_dev = platform_get_drvdata(pdev); @@ -556,8 +556,6 @@ static int hid_magn_3d_remove(struct platform_device *pdev) sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_COMPASS_3D); iio_device_unregister(indio_dev); hid_sensor_remove_trigger(indio_dev, &magn_state->magn_flux_attributes); - - return 0; } static const struct platform_device_id hid_magn_3d_ids[] = { @@ -576,7 +574,7 @@ static struct platform_driver hid_magn_3d_platform_driver = { .pm = &hid_sensor_pm_ops, }, .probe = hid_magn_3d_probe, - .remove = hid_magn_3d_remove, + .remove_new = hid_magn_3d_remove, }; module_platform_driver(hid_magn_3d_platform_driver); From patchwork Tue Sep 19 17:49:23 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= X-Patchwork-Id: 13391708 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 E90A1CE79A8 for ; Tue, 19 Sep 2023 17:50:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232832AbjISRuS (ORCPT ); Tue, 19 Sep 2023 13:50:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45282 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232804AbjISRuQ (ORCPT ); Tue, 19 Sep 2023 13:50: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 7FB0F95 for ; Tue, 19 Sep 2023 10:50:09 -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 1qierG-0006vP-K0; Tue, 19 Sep 2023 19:49: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 1qierF-007VY4-AD; Tue, 19 Sep 2023 19:49:57 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qierF-0034Z9-0k; Tue, 19 Sep 2023 19:49:57 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Jiri Kosina , Srinivas Pandruvada , Lars-Peter Clausen , linux-input@vger.kernel.org, linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 41/49] iio: orientation: hid-sensor-incl-3d: Convert to platform remove callback returning void Date: Tue, 19 Sep 2023 19:49:23 +0200 Message-Id: <20230919174931.1417681-42-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> References: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2158; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=bvlostt4/Xm1Sm0cpixx5KcFeNqM0BdXq2gVKb+ZXgQ=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCd8dH79fYN/eRk2sKchGDvleN0lBw9sF2oof8 JtH9c8WPUCJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQnfHQAKCRCPgPtYfRL+ TjfYCACD4BGFq2kFLf9nucvkYR/em6kRJ3bwo3cSSwuSXzXn+eAGPG8N8SpDMV9C4U4QBS5w2hd BDK07drBbMazLkztvmaFDyUcgW9r4rVdsmDqiKF4Vpo88Kn+UK0b9Cd1adk+wubgylzZnYbh/ym jR8JSd6BF/WQfSs2I41Piyj2MHRItTDBhSDWFV5lbhnx2FodCb9eXa98sI2c4gTwwPkjD12TDSj EP8GMd3Ml3WzwucYJWSXmS3xYV+eLeopNo5mGKdsMv0RxhaP3dPg/B6ycla43f6uw7LsVAVaRgf 0QR5JUGc8YHSwfqd+D/hRykJn5yJjlzwzhaC08qhIuscGOeP 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-input@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/iio/orientation/hid-sensor-incl-3d.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c b/drivers/iio/orientation/hid-sensor-incl-3d.c index ba5b581d5b25..8943d5c78bc0 100644 --- a/drivers/iio/orientation/hid-sensor-incl-3d.c +++ b/drivers/iio/orientation/hid-sensor-incl-3d.c @@ -383,7 +383,7 @@ static int hid_incl_3d_probe(struct platform_device *pdev) } /* Function to deinitialize the processing for usage id */ -static int hid_incl_3d_remove(struct platform_device *pdev) +static void hid_incl_3d_remove(struct platform_device *pdev) { struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; struct iio_dev *indio_dev = platform_get_drvdata(pdev); @@ -392,8 +392,6 @@ static int hid_incl_3d_remove(struct platform_device *pdev) sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_INCLINOMETER_3D); iio_device_unregister(indio_dev); hid_sensor_remove_trigger(indio_dev, &incl_state->common_attributes); - - return 0; } static const struct platform_device_id hid_incl_3d_ids[] = { @@ -412,7 +410,7 @@ static struct platform_driver hid_incl_3d_platform_driver = { .pm = &hid_sensor_pm_ops, }, .probe = hid_incl_3d_probe, - .remove = hid_incl_3d_remove, + .remove_new = hid_incl_3d_remove, }; module_platform_driver(hid_incl_3d_platform_driver); From patchwork Tue Sep 19 17:49:24 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: 13391710 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 E80A7CE79AB for ; Tue, 19 Sep 2023 17:50:16 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232758AbjISRuU (ORCPT ); Tue, 19 Sep 2023 13:50:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232594AbjISRuR (ORCPT ); Tue, 19 Sep 2023 13:50: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 B6256123 for ; Tue, 19 Sep 2023 10:50:09 -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 1qierH-0006w0-0T; Tue, 19 Sep 2023 19:49: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 1qierF-007VY9-JA; Tue, 19 Sep 2023 19:49:57 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qierF-0034ZD-8o; Tue, 19 Sep 2023 19:49:57 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Jiri Kosina , Srinivas Pandruvada , Lars-Peter Clausen , linux-input@vger.kernel.org, linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 42/49] iio: orientation: hid-sensor-rotation: Convert to platform remove callback returning void Date: Tue, 19 Sep 2023 19:49:24 +0200 Message-Id: <20230919174931.1417681-43-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> References: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2146; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=M5KJaEC0r6hyiz93LrjvNIjI5lXA3JxdGcPMPplvUuM=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCd8eUstTMY0rI4t/ZTzfQ2pHreWhl9r1RkMeS NiuOCeQb4KJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQnfHgAKCRCPgPtYfRL+ TvFECAC5vtwC65OjcJLNu95zPyLrzX1yjaQhIeA6njY2pI8aoqE/cXPtuAiVdXzugFrUkwW97AB G0kQ5ehXMD2oxGaS8KbETCcK2Yy1IcvmSCoN3xMI9PPU/YhjzORX7/A+KSXv7Lb5yzBrzllRnuX DWrT+sAAWJexb1c8za1MwG+3VuNZzc9x8Yhdu1WlD7UPBk3tslsv+V3/wGp3s/uHFry2F1gUnUS /7lR7K8e4lYdwB7y1XD3kFu1buanWa+pEyOopm9l21M1L1hbsWQVEmZJ5wccOzWwXv2PEQ5075Z CeWEZnXpNobt8H9x2QygcytXqz5vVKq8MKT95eWJ8NMOFitW 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-input@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/iio/orientation/hid-sensor-rotation.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/orientation/hid-sensor-rotation.c index a033699910e8..5e8cadd5177a 100644 --- a/drivers/iio/orientation/hid-sensor-rotation.c +++ b/drivers/iio/orientation/hid-sensor-rotation.c @@ -327,7 +327,7 @@ static int hid_dev_rot_probe(struct platform_device *pdev) } /* Function to deinitialize the processing for usage id */ -static int hid_dev_rot_remove(struct platform_device *pdev) +static void hid_dev_rot_remove(struct platform_device *pdev) { struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; struct iio_dev *indio_dev = platform_get_drvdata(pdev); @@ -336,8 +336,6 @@ static int hid_dev_rot_remove(struct platform_device *pdev) sensor_hub_remove_callback(hsdev, hsdev->usage); iio_device_unregister(indio_dev); hid_sensor_remove_trigger(indio_dev, &rot_state->common_attributes); - - return 0; } static const struct platform_device_id hid_dev_rot_ids[] = { @@ -364,7 +362,7 @@ static struct platform_driver hid_dev_rot_platform_driver = { .pm = &hid_sensor_pm_ops, }, .probe = hid_dev_rot_probe, - .remove = hid_dev_rot_remove, + .remove_new = hid_dev_rot_remove, }; module_platform_driver(hid_dev_rot_platform_driver); From patchwork Tue Sep 19 17:49:25 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: 13391711 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 74FB5CE79B3 for ; Tue, 19 Sep 2023 17:50:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232846AbjISRuU (ORCPT ); Tue, 19 Sep 2023 13:50:20 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34286 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232781AbjISRuR (ORCPT ); Tue, 19 Sep 2023 13:50: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 16022130 for ; Tue, 19 Sep 2023 10:50:10 -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 1qierG-0006wQ-NY; Tue, 19 Sep 2023 19:49: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 1qierF-007VYD-PU; Tue, 19 Sep 2023 19:49:57 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qierF-0034ZH-GK; Tue, 19 Sep 2023 19:49:57 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Jiri Kosina , Srinivas Pandruvada , Lars-Peter Clausen , linux-input@vger.kernel.org, linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 43/49] iio: position: hid-sensor-custom-intel-hinge: Convert to platform remove callback returning void Date: Tue, 19 Sep 2023 19:49:25 +0200 Message-Id: <20230919174931.1417681-44-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> References: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2150; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=SZHmCKpYvFTVvluI6YDr51S6fTEqIaSpngNwPQ2HFUY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCd8fK5kPyZVpreXPW5JwHopqDZ5Avs6UvDvuQ 9tg9n+vLD6JATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQnfHwAKCRCPgPtYfRL+ ThfQCACbwGkRdNs04ln1s5xCC5SnJNQVYK10b21hNzBXaFd6B+3djVY8l0Qbgvf93g6EYV5yZC0 E4dfo0OuySKKGbkweKvdVR3WfbgKkUhQlyBEWWQfpdhK63Skj+D8JobNDkOMvtifL6lk0mdS6yi tdJ8faC22hOM9MKgXENbW8qnFbtSEpLhwg97cGTELEREFk5mp3ATlp9QeX6lOaaODI8bA8/qX5N dXMTnIrtiFF0t7EerqOj/0Zg9/u6CzFQ0U8IUKVrEdmQeTQ9+RwcNljUQDxWp978g/rKhz/UDNB T0bHJ1HbMttP26JjW38/ywmno4AOi4mDWuDOxa+8o1cNT2US 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-input@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/iio/position/hid-sensor-custom-intel-hinge.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c b/drivers/iio/position/hid-sensor-custom-intel-hinge.c index 07c30d217255..76e173850a35 100644 --- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c +++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c @@ -342,7 +342,7 @@ static int hid_hinge_probe(struct platform_device *pdev) } /* Function to deinitialize the processing for usage id */ -static int hid_hinge_remove(struct platform_device *pdev) +static void hid_hinge_remove(struct platform_device *pdev) { struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; struct iio_dev *indio_dev = platform_get_drvdata(pdev); @@ -351,8 +351,6 @@ static int hid_hinge_remove(struct platform_device *pdev) iio_device_unregister(indio_dev); sensor_hub_remove_callback(hsdev, hsdev->usage); hid_sensor_remove_trigger(indio_dev, &st->common_attributes); - - return 0; } static const struct platform_device_id hid_hinge_ids[] = { @@ -371,7 +369,7 @@ static struct platform_driver hid_hinge_platform_driver = { .pm = &hid_sensor_pm_ops, }, .probe = hid_hinge_probe, - .remove = hid_hinge_remove, + .remove_new = hid_hinge_remove, }; module_platform_driver(hid_hinge_platform_driver); From patchwork Tue Sep 19 17:49:26 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: 13391712 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 2248BCE79AF for ; Tue, 19 Sep 2023 17:50:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232808AbjISRuV (ORCPT ); Tue, 19 Sep 2023 13:50:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34270 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232845AbjISRuR (ORCPT ); Tue, 19 Sep 2023 13:50: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 A0A27132 for ; Tue, 19 Sep 2023 10:50:10 -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 1qierH-0006xO-9M; Tue, 19 Sep 2023 19:49: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 1qierF-007VYG-Vw; Tue, 19 Sep 2023 19:49:58 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qierF-0034ZL-Mx; Tue, 19 Sep 2023 19:49:57 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Jiri Kosina , Srinivas Pandruvada , Lars-Peter Clausen , linux-input@vger.kernel.org, linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 44/49] iio: pressure: hid-sensor: Convert to platform remove callback returning void Date: Tue, 19 Sep 2023 19:49:26 +0200 Message-Id: <20230919174931.1417681-45-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> References: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2107; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=LsDjAC9CMb28Jv+rsMoc5esLJvlCpdT8PpLZI8ZCSlU=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBlCd8h6hX+PVwoXP+ENdcJWVmKx8yOrY/eXDU6b wpAt/lHqDWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZQnfIQAKCRCPgPtYfRL+ TugvCACgMMtpdS2SROpZLFCcxBonK7xSrxpZ6GuibN+gwD+xFvJ18o3N047LaelTRNC/w7htVE7 BxMUEeSvuE7QDEx+EfHjQTxQ3HOm8JcpQWi9z24gqHQjo6Lq4EangwMpc/ax5tPlqbVz/aV/Lxm 6e0yKNOaUtY5UyCRN8A1elqo2Ksu9zbs3RNarc5gjfRys/d9yCMMZbs0XzC9hVbnAE+IePCTgVj gVEx5vOiQfDevOnXlFE0Kon0K2woiaZ7RalyCch6FUlHZUGcVFC6IGzsgc02b41zTItj9QY+v8S UPClIgKYYJ30wNhyjPcMEE0zNsgmus3lhtj4kYYlPUh/q5+1 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-input@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/iio/pressure/hid-sensor-press.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure/hid-sensor-press.c index a9215eb32d70..956045e2db29 100644 --- a/drivers/iio/pressure/hid-sensor-press.c +++ b/drivers/iio/pressure/hid-sensor-press.c @@ -323,7 +323,7 @@ static int hid_press_probe(struct platform_device *pdev) } /* Function to deinitialize the processing for usage id */ -static int hid_press_remove(struct platform_device *pdev) +static void hid_press_remove(struct platform_device *pdev) { struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; struct iio_dev *indio_dev = platform_get_drvdata(pdev); @@ -332,8 +332,6 @@ static int hid_press_remove(struct platform_device *pdev) sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_PRESSURE); iio_device_unregister(indio_dev); hid_sensor_remove_trigger(indio_dev, &press_state->common_attributes); - - return 0; } static const struct platform_device_id hid_press_ids[] = { @@ -352,7 +350,7 @@ static struct platform_driver hid_press_platform_driver = { .pm = &hid_sensor_pm_ops, }, .probe = hid_press_probe, - .remove = hid_press_remove, + .remove_new = hid_press_remove, }; module_platform_driver(hid_press_platform_driver); From patchwork Tue Sep 19 17:49: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: 13391707 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 E0F3ACE79B1 for ; Tue, 19 Sep 2023 17:50:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232752AbjISRuR (ORCPT ); Tue, 19 Sep 2023 13:50:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45210 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232832AbjISRuQ (ORCPT ); Tue, 19 Sep 2023 13:50: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 CB095D7 for ; Tue, 19 Sep 2023 10:50:09 -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 1qierH-00072h-CS; Tue, 19 Sep 2023 19:49: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 1qierG-007VYU-OK; Tue, 19 Sep 2023 19:49:58 +0200 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.94.2) (envelope-from ) id 1qierG-0034ZX-F5; Tue, 19 Sep 2023 19:49:58 +0200 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jonathan Cameron Cc: Jiri Kosina , Srinivas Pandruvada , Lars-Peter Clausen , linux-input@vger.kernel.org, linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 47/49] iio: temperature: hid-sensor: Convert to platform remove callback returning void Date: Tue, 19 Sep 2023 19:49:29 +0200 Message-Id: <20230919174931.1417681-48-u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> References: <20230919174931.1417681-1-u.kleine-koenig@pengutronix.de> MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2182; i=u.kleine-koenig@pengutronix.de; h=from:subject; bh=aX4Pfti1v1qagUJAO/Ih4/eifvGcgHks4RixWzcD/PA=; b=owGbwMvMwMXY3/A7olbonx/jabUkhlTO+ypH1N7OfT/NaoFYQz9HcNf85mhGp7cvYxQ6v2561 as03+lZJ6MxCwMjF4OsmCKLfeOaTKsqucjOtf8uwwxiZQKZwsDFKQAT8bdk/2dwT6huNs9hhpNy bjkutV356saNbbnXQxdPk5zvmPPvnOVNk7zDk9LeMP1ezhb2+Q5v2COGmrc7VXvvWzunF23zuSh 5ksslfJ5l2tkzZ4TP9grPmVHFJnnkTuXqnJKpKowxHuXG0rc2l3Kq7M2yPdbeNPHuW5PNmmnnTZ +orzPUUOJJLHn+7Jx3QYLwDp4XjW22s56Gxt1av0Z1kUXgg00Ctvb9qdseGwUcVIm9fJ7f2+7Ta ceCfT9jFOUvret6uGthZt7e+DsmT751pPUeqPpiNls9sneFl0qagYfhMfU5Fxd76jD3zRL3XiMb N9XXiumXU7NYW9VTwfqZ0y6YWrxsXqqRuT7caq1fmlk9AA== 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-input@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-input@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() will be renamed to .remove(). Trivially convert this driver from always returning zero in the remove callback to the void returning variant. Signed-off-by: Uwe Kleine-König --- drivers/iio/temperature/hid-sensor-temperature.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/iio/temperature/hid-sensor-temperature.c b/drivers/iio/temperature/hid-sensor-temperature.c index d40f235af1d4..0143fd478933 100644 --- a/drivers/iio/temperature/hid-sensor-temperature.c +++ b/drivers/iio/temperature/hid-sensor-temperature.c @@ -257,7 +257,7 @@ static int hid_temperature_probe(struct platform_device *pdev) } /* Function to deinitialize the processing for usage id */ -static int hid_temperature_remove(struct platform_device *pdev) +static void hid_temperature_remove(struct platform_device *pdev) { struct hid_sensor_hub_device *hsdev = dev_get_platdata(&pdev->dev); struct iio_dev *indio_dev = platform_get_drvdata(pdev); @@ -265,8 +265,6 @@ static int hid_temperature_remove(struct platform_device *pdev) sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TEMPERATURE); hid_sensor_remove_trigger(indio_dev, &temp_st->common_attributes); - - return 0; } static const struct platform_device_id hid_temperature_ids[] = { @@ -285,7 +283,7 @@ static struct platform_driver hid_temperature_platform_driver = { .pm = &hid_sensor_pm_ops, }, .probe = hid_temperature_probe, - .remove = hid_temperature_remove, + .remove_new = hid_temperature_remove, }; module_platform_driver(hid_temperature_platform_driver);