From patchwork Wed Mar 6 17:50:48 2024 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: 778415 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B20075D48F for ; Wed, 6 Mar 2024 17:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709747466; cv=none; b=aEecIT0yIy6I9gsVq0E4dadQ1hGvTgvZ5VnASyYdQp/c9JyBY/nTXpOB7WHvGma/CkMOcrdZFU6Lg4VG4e4x2p+l+R/itXcHzBc8/mGYSvsQm3Vlygr2NOmg/m6cE9oow/qecSz4ukHOLj0GMfGEGwrt5xSS9PSlDdHuvQVcORs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709747466; c=relaxed/simple; bh=X8BkERi10tX+G/I0WlhN0twyIhqVhoouN1iH+TY17Kw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HlgTKNbBLGYF2voddD3SrpKe5kDV6oUZqWT+H8bbws7czo9SZSmZ+5zcDyNYc/ljqj8YH4GxAHlkMjy3nUGPGpvkrjJOCQ56BOHkanWxuz67q9QQedVP6gSdNideWUXL7bpiw61BJsr5HaACjsgkggoU0W7QryUCRyoTCU+qe/Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rhvPt-0002LP-Ue; Wed, 06 Mar 2024 18:50:57 +0100 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 1rhvPt-004n6c-Hi; Wed, 06 Mar 2024 18:50:57 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rhvPt-000nxz-1V; Wed, 06 Mar 2024 18:50:57 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jiri Kosina , Benjamin Tissoires Cc: linux-input@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 1/3] HID: google: hammer: Convert to platform remove callback returning void Date: Wed, 6 Mar 2024 18:50:48 +0100 Message-ID: <33de82975dd3dc0c867f740ca1121d95a9eb17b2.1709747164.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1870; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=X8BkERi10tX+G/I0WlhN0twyIhqVhoouN1iH+TY17Kw=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBl6Kz4GE1x15w87fkycpFClSzWjVQZl1OPGH654 LUOIej3nSWJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZeis+AAKCRCPgPtYfRL+ Tkk3B/9IKjCg2FCxumlciNLQScphS206ZSTixKMkuXZlREuaIYI//sRDykdrPomuKFJwwJwMRz9 Df9AmLXXgvNlOlEEJhELVClUxMzd12knzfmk9tmASuM1FdqFItraSbvue6GF72mmrxL8/qqDE5B n3x3ACqldQhHePuCtSsHCFebhbrYVoYZIHieBu4Ll5JZ6MgiTUF1vt99//LN8yGBOm+KyaTV0Nm 4MSt4lazFm78NbTCR9BNRw/xA8rScPrGHwPuQFfoNctPY68ZRMxbkubrobAdDvxo8yvle8vvEBT GMbk+mYeXYx5CXNgoc6Lv9yrP6QZ92l3XmXydRGvmsDbxDbP 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 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/hid/hid-google-hammer.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/hid/hid-google-hammer.c b/drivers/hid/hid-google-hammer.c index c6bdb9c4ef3e..25331695ae32 100644 --- a/drivers/hid/hid-google-hammer.c +++ b/drivers/hid/hid-google-hammer.c @@ -255,7 +255,7 @@ static int cbas_ec_probe(struct platform_device *pdev) return retval; } -static int cbas_ec_remove(struct platform_device *pdev) +static void cbas_ec_remove(struct platform_device *pdev) { struct cros_ec_device *ec = dev_get_drvdata(pdev->dev.parent); @@ -266,7 +266,6 @@ static int cbas_ec_remove(struct platform_device *pdev) cbas_ec_set_input(NULL); mutex_unlock(&cbas_ec_reglock); - return 0; } static const struct acpi_device_id cbas_ec_acpi_ids[] = { @@ -285,7 +284,7 @@ MODULE_DEVICE_TABLE(of, cbas_ec_of_match); static struct platform_driver cbas_ec_driver = { .probe = cbas_ec_probe, - .remove = cbas_ec_remove, + .remove_new = cbas_ec_remove, .driver = { .name = "cbas_ec", .acpi_match_table = ACPI_PTR(cbas_ec_acpi_ids), From patchwork Wed Mar 6 17:50:49 2024 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: 778697 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0148F13BAF1 for ; Wed, 6 Mar 2024 17:51:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709747471; cv=none; b=YYbgxwW7YwkxHJqGa7acmzlOzhKrF6bCLIFItMyRK5KD32GNF8NrqQDEDedALoBt9uOfJaMnNwST8Txosgsp//zl6ZOcGA9Wp+rWU+g5XikR6cIKappQD8+ku5gQEXn0JqZvwyuUTRHvzBSB6xXi0Aye0zGHaSOCqbFGJXx3Zv8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709747471; c=relaxed/simple; bh=eK4NW9Rk4JvCfGAlFvUDp7R7qIYr4GqYENwx7iHN+QA=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=RxaBid3KSiez27n18MNlnruRFbnw1FKLAqw/z2O+wyCqAJPq6PWR+1pmuOqntIuF+pdDU9cBug0RJijukpJ6Z6VgkSv7RzKhKMgvpK2xSqNi/qEMpQD568Ly3LKMvruBFb4ScxihRIulTvgZvGcxhYV6+80VJ0aRIOqvthsIq7Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rhvPw-0002OA-Ls; Wed, 06 Mar 2024 18:51:00 +0100 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 1rhvPw-004n6g-4N; Wed, 06 Mar 2024 18:51:00 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rhvPw-000ny5-09; Wed, 06 Mar 2024 18:51:00 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jiri Kosina , Benjamin Tissoires Cc: Jonathan Cameron , Srinivas Pandruvada , linux-input@vger.kernel.org, linux-iio@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 2/3] HID: hid-sensor-custom: Convert to platform remove callback returning void Date: Wed, 6 Mar 2024 18:50:49 +0100 Message-ID: X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2267; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=eK4NW9Rk4JvCfGAlFvUDp7R7qIYr4GqYENwx7iHN+QA=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBl6Kz6u4elbe732bZ1momXG+oG1DpXHlk/tdD/Z 6Re+1mS/peJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZeis+gAKCRCPgPtYfRL+ TmU7B/0eaFD339wXp3yiNszZyWj0Szdjw2jZdUB8ijcWtke+65zdHwczl7MoPf7Y5ynEyBVFjK9 o7Xxa1DlDTTV57pHtZzVLFDrf8q5ByxSp3ZzLXE8CwPHIdlmqfpnaQAE3z0IB2hfAVMeOuNYNAq rd1AYbhRcDMJtXwKlv79cps8OyOeM8WjQFlfKvD80dlMBDCQHMPO8jnTio89KvWTKPj1eqXTq7r CtYD/dhQD7i18T+n71+Cp72y8v8bNEpKax8Ax+lUVnzwYfKLAFYlxoOTvktFqxqRI7jw8d81vy/ OeM3hCNlc7uyh9J7lJiabWrVfckmyOwfiufuNPNKLM9gfpDa 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 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 Reviewed-by: Jonathan Cameron --- drivers/hid/hid-sensor-custom.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/hid/hid-sensor-custom.c b/drivers/hid/hid-sensor-custom.c index d85398721659..de7287f3af61 100644 --- a/drivers/hid/hid-sensor-custom.c +++ b/drivers/hid/hid-sensor-custom.c @@ -1032,14 +1032,14 @@ static int hid_sensor_custom_probe(struct platform_device *pdev) return ret; } -static int hid_sensor_custom_remove(struct platform_device *pdev) +static void hid_sensor_custom_remove(struct platform_device *pdev) { struct hid_sensor_custom *sensor_inst = platform_get_drvdata(pdev); struct hid_sensor_hub_device *hsdev = pdev->dev.platform_data; if (sensor_inst->custom_pdev) { platform_device_unregister(sensor_inst->custom_pdev); - return 0; + return; } hid_sensor_custom_dev_if_remove(sensor_inst); @@ -1047,8 +1047,6 @@ static int hid_sensor_custom_remove(struct platform_device *pdev) sysfs_remove_group(&sensor_inst->pdev->dev.kobj, &enable_sensor_attr_group); sensor_hub_remove_callback(hsdev, hsdev->usage); - - return 0; } static const struct platform_device_id hid_sensor_custom_ids[] = { @@ -1068,7 +1066,7 @@ static struct platform_driver hid_sensor_custom_platform_driver = { .name = KBUILD_MODNAME, }, .probe = hid_sensor_custom_probe, - .remove = hid_sensor_custom_remove, + .remove_new = hid_sensor_custom_remove, }; module_platform_driver(hid_sensor_custom_platform_driver); From patchwork Wed Mar 6 17:50:50 2024 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: 778698 Received: from metis.whiteo.stw.pengutronix.de (metis.whiteo.stw.pengutronix.de [185.203.201.7]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A569013BAE9 for ; Wed, 6 Mar 2024 17:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.203.201.7 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709747470; cv=none; b=I09RQY5Cyx3WJRNftgmK9+WTffzfj08bFhu5MBsph6llXjR700VjyBOwWvaMtXyjCDUghnvTryfP9jY5KPYMPqnrABPU5Vr/9UM6s0K8m3TYImOAV9K8Ny65bCp8d/MkIEZE/nG6RtJirbg8kL4CnaDbgvBkGC2aDEZlZ/GNG3o= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709747470; c=relaxed/simple; bh=X4WgGpBn1NzPFix2PE5nZ871DVdaTNhuoct3kfjsvmY=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=sBEumvwzFxGVnEAoFDmG6rNErg7Ii3cVomzHhNQty0raJ/zq60ewbMw6CA2c2aIFlqu3G53zyTFE5DdkWZNLv+hlmVpsN6UcfpH2nOweseYzDLx778SZP8QGzbXlRXuilRlWhtFoE9Daf2cFpddAUW1PmM/0qCHE1ILrL3YhIdI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de; spf=pass smtp.mailfrom=pengutronix.de; arc=none smtp.client-ip=185.203.201.7 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=pengutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=pengutronix.de 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 1rhvPz-0002VO-0r; Wed, 06 Mar 2024 18:51:03 +0100 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 1rhvPy-004n6k-K4; Wed, 06 Mar 2024 18:51:02 +0100 Received: from ukl by ptz.office.stw.pengutronix.de with local (Exim 4.96) (envelope-from ) id 1rhvPy-000nyE-1k; Wed, 06 Mar 2024 18:51:02 +0100 From: =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= To: Jiri Kosina , Benjamin Tissoires Cc: Maximilian Luz , linux-input@vger.kernel.org, platform-driver-x86@vger.kernel.org, kernel@pengutronix.de Subject: [PATCH 3/3] HID: surface-hid: kbd: Convert to platform remove callback returning void Date: Wed, 6 Mar 2024 18:50:50 +0100 Message-ID: <05d0d6ef781ebd6124a36f70cda1f90331799dc7.1709747164.git.u.kleine-koenig@pengutronix.de> X-Mailer: git-send-email 2.43.0 In-Reply-To: References: Precedence: bulk X-Mailing-List: linux-input@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1802; i=u.kleine-koenig@pengutronix.de; h=from:subject:message-id; bh=X4WgGpBn1NzPFix2PE5nZ871DVdaTNhuoct3kfjsvmY=; b=owEBbQGS/pANAwAKAY+A+1h9Ev5OAcsmYgBl6Kz7zH/6x8nO1lJWbTkq6Xc/bw3q+BioyB+oB KjNsFBXy8eJATMEAAEKAB0WIQQ/gaxpOnoeWYmt/tOPgPtYfRL+TgUCZeis+wAKCRCPgPtYfRL+ TsO6B/9o4i7/IO8vYjQ46Da4IKi4jmRxIGA4TVq2BD2hVrG6tbab1SA0NYVDIaeqgMaDwGQN2am KqyMARdw+7JghgZlSAhGzCeCao4TYfZNMJHzJC3+O9zcOTL/iSN203ljlS0W83DRKlLPWy8369M bIBnNppQEGe5ZtxVdy2tonxFw9c5h3CKZWMe76YykInlWXZBgPj7nf6v7raaVvF1LFbEr9ofepZ fbFHhxuZ4xxFvtqlcs5/llUUtNO+eYTX/Vs2D2w0OBu9VrNQb5HOOrlp3Bvw+Ih/7Mm/QV0/ull s8cDc1na6ksRuqe2g9UcWPcO8ai8U0SOGhpZXf2PYCnoFLqR 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 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 Reviewed-by: Maximilian Luz --- drivers/hid/surface-hid/surface_kbd.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/hid/surface-hid/surface_kbd.c b/drivers/hid/surface-hid/surface_kbd.c index 4fbce201db6a..8c0cbb2deb11 100644 --- a/drivers/hid/surface-hid/surface_kbd.c +++ b/drivers/hid/surface-hid/surface_kbd.c @@ -271,10 +271,9 @@ static int surface_kbd_probe(struct platform_device *pdev) return surface_hid_device_add(shid); } -static int surface_kbd_remove(struct platform_device *pdev) +static void surface_kbd_remove(struct platform_device *pdev) { surface_hid_device_destroy(platform_get_drvdata(pdev)); - return 0; } static const struct acpi_device_id surface_kbd_match[] = { @@ -285,7 +284,7 @@ MODULE_DEVICE_TABLE(acpi, surface_kbd_match); static struct platform_driver surface_kbd_driver = { .probe = surface_kbd_probe, - .remove = surface_kbd_remove, + .remove_new = surface_kbd_remove, .driver = { .name = "surface_keyboard", .acpi_match_table = surface_kbd_match,