From nobody Fri Oct 2 01:19:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 53AD747D45D; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019204; cv=none; b=Lee9E4T0v2nn29mutAF+zCWT7cCrSdyvGgJCCH2UheSgdpK7ppBzenl+1JdVZRYfsJ15yqvzrMzJNIphcT8v5FgajekjwwtOtjSrxSPf1WEZdI5ypfxmxWzz/Unpbw++tLSjzyJbZjqG8jNEsAly2l+S0G0zwmLBsCsEWMqMLZQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019204; c=relaxed/simple; bh=9aamxJaAlbNAyP/XT2PL9UCl7/3M7pX0Ykfr9BWj7f8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qtYGwRLjmMPZd/DLTpBLDuAB9Q9F1tSVqEoQPKzh1RCwy9H4Odhl1veauszwuw0PepEYJAGcy5+8kDOHSF39kqLNgVo7bmiMGHo8EBTO9IWEyi5W4QsTH47SyrWCs2vh+kO6KLMnKy0jF2Z8sjUuhplF85at25iHcYZjxZH9pA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=sNlqdJ55; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="sNlqdJ55" Received: by smtp.kernel.org (Postfix) with ESMTPS id B1FD7C2BCB9; Thu, 6 Aug 2026 12:26:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786019203; bh=9aamxJaAlbNAyP/XT2PL9UCl7/3M7pX0Ykfr9BWj7f8=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=sNlqdJ55OPfkGJ9EPA7VcdbSyLy/a7IOjxlzHdcOWtsX80PK0eSMzAMFdMyXMh+Bk p1POxDwrKAko8HH3EcSVB0xLoWp3wp1kgi53xKTuKW7qguk/kwN1kK7HOgrONUzgQw Qrd2FUPoPgtwhZhvA0q7Vp35XuxL5wWZn62u8cpfqirDeNKzoWAiBBY9VdP4X+dcTa +qWFyiLA0wKUV28peyn605g6IydBOIyjlWqJ82mm0PvBfTL+5SZ9xK6jkHa03nfIKg nIvMVGzxl40ZJXmLLtUdoa8rFhO5JjKkR024hbV6ExZ1UBJr4Kkd4aLTLIWkWVBded 1ZjLz75Msf2Tw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8D679C56205; Thu, 6 Aug 2026 12:26:43 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Thu, 06 Aug 2026 17:55:47 +0530 Subject: [PATCH v5 01/13] iio: hid-sensors: remove unused iio_dev argument Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-1-f1f92c1d830f@gmail.com> References: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> In-Reply-To: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jiri Kosina , Srinivas Pandruvada , Benjamin Tissoires Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sanjay Chitroda , Zhang Lixu X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786019201; l=13414; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=rqULksWRo4n4xKz5vV577269g3Z9xdZeQPfcg6BV1bg=; b=Mo0bvVXcn6LdFg6qkpG1cCE77I5NOV9ab1Lu8Ymnl52cHPtWgDHG7MFVrvVHAYZnLgNCqZZ69 9rPDcq0Opg+B9EZhEuPgc7NXeCKb9prKCSScFDv2J7uO6B/Gh+AFtoT X-Developer-Key: i=sanjayembeddedse@gmail.com; a=ed25519; pk=PcneEFtkmY+Ldl+KmOTpB/Q/HDsqko6Fb0/Z/5cuycI= X-Endpoint-Received: by B4 Relay for sanjayembeddedse@gmail.com/20260702 with auth_id=848 X-Original-From: Sanjay Chitroda Reply-To: sanjayembeddedse@gmail.com From: Sanjay Chitroda hid_sensor_remove_trigger() no longer uses the iio_dev argument. Remove the unused argument from all HID IIO drivers to match updated function prototype. Signed-off-by: Sanjay Chitroda Acked-by: Srinivas Pandruvada Tested-by: Zhang Lixu --- changes in v4: - Rectify commit message with input from David --- drivers/iio/accel/hid-sensor-accel-3d.c | 4 ++-- drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 3 +-- drivers/iio/common/hid-sensors/hid-sensor-trigger.h | 3 +-- drivers/iio/gyro/hid-sensor-gyro-3d.c | 4 ++-- drivers/iio/humidity/hid-sensor-humidity.c | 4 ++-- drivers/iio/light/hid-sensor-als.c | 4 ++-- drivers/iio/light/hid-sensor-prox.c | 4 ++-- drivers/iio/magnetometer/hid-sensor-magn-3d.c | 4 ++-- drivers/iio/orientation/hid-sensor-incl-3d.c | 4 ++-- drivers/iio/orientation/hid-sensor-rotation.c | 4 ++-- drivers/iio/position/hid-sensor-custom-intel-hinge.c | 4 ++-- drivers/iio/pressure/hid-sensor-press.c | 4 ++-- drivers/iio/temperature/hid-sensor-temperature.c | 4 ++-- 13 files changed, 24 insertions(+), 26 deletions(-) diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hi= d-sensor-accel-3d.c index eb521125f4eb..a7cccbaa82f8 100644 --- a/drivers/iio/accel/hid-sensor-accel-3d.c +++ b/drivers/iio/accel/hid-sensor-accel-3d.c @@ -402,7 +402,7 @@ static int hid_accel_3d_probe(struct platform_device *p= dev) error_remove_callback: sensor_hub_remove_callback(hsdev, hsdev->usage); error_remove_trigger: - hid_sensor_remove_trigger(indio_dev, &accel_state->common_attributes); + hid_sensor_remove_trigger(&accel_state->common_attributes); return ret; } =20 @@ -415,7 +415,7 @@ static void hid_accel_3d_remove(struct platform_device = *pdev) =20 iio_device_unregister(indio_dev); sensor_hub_remove_callback(hsdev, hsdev->usage); - hid_sensor_remove_trigger(indio_dev, &accel_state->common_attributes); + hid_sensor_remove_trigger(&accel_state->common_attributes); } =20 static const struct platform_device_id hid_accel_3d_ids[] =3D { diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/= iio/common/hid-sensors/hid-sensor-trigger.c index 60808e2430ca..6e6adc501602 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c @@ -218,8 +218,7 @@ static const struct iio_buffer_setup_ops hid_sensor_buf= fer_ops =3D { .predisable =3D buffer_predisable, }; =20 -void hid_sensor_remove_trigger(struct iio_dev *indio_dev, - struct hid_sensor_common *attrb) +void hid_sensor_remove_trigger(struct hid_sensor_common *attrb) { if (atomic_read(&attrb->runtime_pm_enable)) pm_runtime_disable(&attrb->pdev->dev); diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.h b/drivers/= iio/common/hid-sensors/hid-sensor-trigger.h index 589de858e369..ee17d5cc2437 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.h +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.h @@ -16,8 +16,7 @@ extern const struct dev_pm_ops hid_sensor_pm_ops; =20 int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name, struct hid_sensor_common *attrb); -void hid_sensor_remove_trigger(struct iio_dev *indio_dev, - struct hid_sensor_common *attrb); +void hid_sensor_remove_trigger(struct hid_sensor_common *attrb); int hid_sensor_power_state(struct hid_sensor_common *st, bool state); =20 #endif diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-s= ensor-gyro-3d.c index 58250a972567..cf049700d415 100644 --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c @@ -339,7 +339,7 @@ static int hid_gyro_3d_probe(struct platform_device *pd= ev) error_remove_callback: sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_GYRO_3D); error_remove_trigger: - hid_sensor_remove_trigger(indio_dev, &gyro_state->common_attributes); + hid_sensor_remove_trigger(&gyro_state->common_attributes); return ret; } =20 @@ -352,7 +352,7 @@ static void hid_gyro_3d_remove(struct platform_device *= pdev) =20 iio_device_unregister(indio_dev); sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_GYRO_3D); - hid_sensor_remove_trigger(indio_dev, &gyro_state->common_attributes); + hid_sensor_remove_trigger(&gyro_state->common_attributes); } =20 static const struct platform_device_id hid_gyro_3d_ids[] =3D { diff --git a/drivers/iio/humidity/hid-sensor-humidity.c b/drivers/iio/humid= ity/hid-sensor-humidity.c index 7cec81ff5685..89daf9d534d1 100644 --- a/drivers/iio/humidity/hid-sensor-humidity.c +++ b/drivers/iio/humidity/hid-sensor-humidity.c @@ -255,7 +255,7 @@ static int hid_humidity_probe(struct platform_device *p= dev) error_remove_callback: sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_HUMIDITY); error_remove_trigger: - hid_sensor_remove_trigger(indio_dev, &humid_st->common_attributes); + hid_sensor_remove_trigger(&humid_st->common_attributes); return ret; } =20 @@ -268,7 +268,7 @@ static void hid_humidity_remove(struct platform_device = *pdev) =20 iio_device_unregister(indio_dev); sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_HUMIDITY); - hid_sensor_remove_trigger(indio_dev, &humid_st->common_attributes); + hid_sensor_remove_trigger(&humid_st->common_attributes); } =20 static const struct platform_device_id hid_humidity_ids[] =3D { diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sen= sor-als.c index 929343e42d83..10bf46ea4f47 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c @@ -423,7 +423,7 @@ static int hid_als_probe(struct platform_device *pdev) error_remove_callback: sensor_hub_remove_callback(hsdev, hsdev->usage); error_remove_trigger: - hid_sensor_remove_trigger(indio_dev, &als_state->common_attributes); + hid_sensor_remove_trigger(&als_state->common_attributes); return ret; } =20 @@ -436,7 +436,7 @@ static void hid_als_remove(struct platform_device *pdev) =20 iio_device_unregister(indio_dev); sensor_hub_remove_callback(hsdev, hsdev->usage); - hid_sensor_remove_trigger(indio_dev, &als_state->common_attributes); + hid_sensor_remove_trigger(&als_state->common_attributes); } =20 static const struct platform_device_id hid_als_ids[] =3D { diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-se= nsor-prox.c index 63fd3eff171c..5e28f9b7f40a 100644 --- a/drivers/iio/light/hid-sensor-prox.c +++ b/drivers/iio/light/hid-sensor-prox.c @@ -327,7 +327,7 @@ static int hid_prox_probe(struct platform_device *pdev) error_remove_callback: sensor_hub_remove_callback(hsdev, hsdev->usage); error_remove_trigger: - hid_sensor_remove_trigger(indio_dev, &prox_state->common_attributes); + hid_sensor_remove_trigger(&prox_state->common_attributes); return ret; } =20 @@ -340,7 +340,7 @@ static void hid_prox_remove(struct platform_device *pde= v) =20 iio_device_unregister(indio_dev); sensor_hub_remove_callback(hsdev, hsdev->usage); - hid_sensor_remove_trigger(indio_dev, &prox_state->common_attributes); + hid_sensor_remove_trigger(&prox_state->common_attributes); } =20 static const struct platform_device_id hid_prox_ids[] =3D { diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/ma= gnetometer/hid-sensor-magn-3d.c index ad18f233ee16..5402cffa8326 100644 --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c @@ -526,7 +526,7 @@ static int hid_magn_3d_probe(struct platform_device *pd= ev) error_remove_callback: sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_COMPASS_3D); error_remove_trigger: - hid_sensor_remove_trigger(indio_dev, &magn_state->magn_flux_attributes); + hid_sensor_remove_trigger(&magn_state->magn_flux_attributes); return ret; } =20 @@ -539,7 +539,7 @@ static void hid_magn_3d_remove(struct platform_device *= pdev) =20 iio_device_unregister(indio_dev); sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_COMPASS_3D); - hid_sensor_remove_trigger(indio_dev, &magn_state->magn_flux_attributes); + hid_sensor_remove_trigger(&magn_state->magn_flux_attributes); } =20 static const struct platform_device_id hid_magn_3d_ids[] =3D { diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c b/drivers/iio/ori= entation/hid-sensor-incl-3d.c index aea28321db95..435e70557721 100644 --- a/drivers/iio/orientation/hid-sensor-incl-3d.c +++ b/drivers/iio/orientation/hid-sensor-incl-3d.c @@ -372,7 +372,7 @@ static int hid_incl_3d_probe(struct platform_device *pd= ev) error_remove_callback: sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_INCLINOMETER_3D); error_remove_trigger: - hid_sensor_remove_trigger(indio_dev, &incl_state->common_attributes); + hid_sensor_remove_trigger(&incl_state->common_attributes); return ret; } =20 @@ -385,7 +385,7 @@ static void hid_incl_3d_remove(struct platform_device *= pdev) =20 iio_device_unregister(indio_dev); sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_INCLINOMETER_3D); - hid_sensor_remove_trigger(indio_dev, &incl_state->common_attributes); + hid_sensor_remove_trigger(&incl_state->common_attributes); } =20 static const struct platform_device_id hid_incl_3d_ids[] =3D { diff --git a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/or= ientation/hid-sensor-rotation.c index 9e13a0ecd584..67ffa4f4075e 100644 --- a/drivers/iio/orientation/hid-sensor-rotation.c +++ b/drivers/iio/orientation/hid-sensor-rotation.c @@ -348,7 +348,7 @@ static int hid_dev_rot_probe(struct platform_device *pd= ev) error_remove_callback: sensor_hub_remove_callback(hsdev, hsdev->usage); error_remove_trigger: - hid_sensor_remove_trigger(indio_dev, &rot_state->common_attributes); + hid_sensor_remove_trigger(&rot_state->common_attributes); return ret; } =20 @@ -361,7 +361,7 @@ static void hid_dev_rot_remove(struct platform_device *= pdev) =20 iio_device_unregister(indio_dev); sensor_hub_remove_callback(hsdev, hsdev->usage); - hid_sensor_remove_trigger(indio_dev, &rot_state->common_attributes); + hid_sensor_remove_trigger(&rot_state->common_attributes); } =20 static const struct platform_device_id hid_dev_rot_ids[] =3D { diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c b/drivers= /iio/position/hid-sensor-custom-intel-hinge.c index d275bc1413fe..7f6186fea004 100644 --- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c +++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c @@ -337,7 +337,7 @@ static int hid_hinge_probe(struct platform_device *pdev) error_remove_callback: sensor_hub_remove_callback(hsdev, hsdev->usage); error_remove_trigger: - hid_sensor_remove_trigger(indio_dev, &st->common_attributes); + hid_sensor_remove_trigger(&st->common_attributes); return ret; } =20 @@ -350,7 +350,7 @@ static void hid_hinge_remove(struct platform_device *pd= ev) =20 iio_device_unregister(indio_dev); sensor_hub_remove_callback(hsdev, hsdev->usage); - hid_sensor_remove_trigger(indio_dev, &st->common_attributes); + hid_sensor_remove_trigger(&st->common_attributes); } =20 static const struct platform_device_id hid_hinge_ids[] =3D { diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure= /hid-sensor-press.c index e688b0776547..4e0f42fefd6b 100644 --- a/drivers/iio/pressure/hid-sensor-press.c +++ b/drivers/iio/pressure/hid-sensor-press.c @@ -306,7 +306,7 @@ static int hid_press_probe(struct platform_device *pdev) error_remove_callback: sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_PRESSURE); error_remove_trigger: - hid_sensor_remove_trigger(indio_dev, &press_state->common_attributes); + hid_sensor_remove_trigger(&press_state->common_attributes); return ret; } =20 @@ -319,7 +319,7 @@ static void hid_press_remove(struct platform_device *pd= ev) =20 iio_device_unregister(indio_dev); sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_PRESSURE); - hid_sensor_remove_trigger(indio_dev, &press_state->common_attributes); + hid_sensor_remove_trigger(&press_state->common_attributes); } =20 static const struct platform_device_id hid_press_ids[] =3D { diff --git a/drivers/iio/temperature/hid-sensor-temperature.c b/drivers/iio= /temperature/hid-sensor-temperature.c index 76723176d6b6..ddd61cf505f1 100644 --- a/drivers/iio/temperature/hid-sensor-temperature.c +++ b/drivers/iio/temperature/hid-sensor-temperature.c @@ -252,7 +252,7 @@ static int hid_temperature_probe(struct platform_device= *pdev) error_remove_callback: sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TEMPERATURE); error_remove_trigger: - hid_sensor_remove_trigger(indio_dev, &temp_st->common_attributes); + hid_sensor_remove_trigger(&temp_st->common_attributes); return ret; } =20 @@ -264,7 +264,7 @@ static void hid_temperature_remove(struct platform_devi= ce *pdev) struct temperature_state *temp_st =3D iio_priv(indio_dev); =20 sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TEMPERATURE); - hid_sensor_remove_trigger(indio_dev, &temp_st->common_attributes); + hid_sensor_remove_trigger(&temp_st->common_attributes); } =20 static const struct platform_device_id hid_temperature_ids[] =3D { --=20 2.34.1 From nobody Fri Oct 2 01:19:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B5B0847D936; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019204; cv=none; b=Tiz1GtB1WqOFd/r6FNCmL0gF+/T2faVHHTubOjsawcnPD/zD0SwWtR6NP2c+NIpc7f05FBkn7hmUUGucw6ukilOEPUBiMppyTbGJBwIn9ruZiQeCntf78nddSE+zCPkPZv+zD4mpP31RAalE0myCZFmUbs2lo4YWM/omRjYnTd0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019204; c=relaxed/simple; bh=G5ZjpCMc41koCIu50EVHnP0iTN4/vsCvxrW/ycokfzA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nlmDDxSTR9GWaD0xHOME6lWhpuhB+70I5kcW1UZzEnrqzaHYZNgGIJbyzCtKYqyaY1JEU0G4xd6BWFEjDvfbnTdi4sYJX9wVRKGX7VhQuhZh8xQf1p5ShHc9x2DNwIBoHb7a6n9vV5MXS5ruFKiff8ol9Q9Fhq2jKiV5TmB0r9E= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=UawJS8i7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="UawJS8i7" Received: by smtp.kernel.org (Postfix) with ESMTPS id C58BEC2BCFB; Thu, 6 Aug 2026 12:26:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786019203; bh=G5ZjpCMc41koCIu50EVHnP0iTN4/vsCvxrW/ycokfzA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=UawJS8i7//fZW9c6gHoSaEV/5uYY3fK8RXn+E29YxqYuBTO2crmfbwSg9HOOyVjoO 24nY53D5U9vbE6QlkTdtZ07KurS/EvaKCG5+YT+T3Dbmj15M0RNcJY0fs+JTZBkzKW el7Vl7LceBp8H855YYitA/q60H+UApp3pSLplq+Dm6fujF6iig4yZvcSjtiWT2Xytq yDixPprKz+B/K2Mh5yxtTGOcTNXd2zZHWhAvGOwcQCwxKXr5B6NelagMcg+UK4nMIZ 8ohfY9PAXbtBvPfoIviTNB3f6arDKkYWhH8K8t6n2Tqaf+2zR2o1IK+LPaK7cVoGdq wUQP39yG4Lz1Q== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id A38C4C5620A; Thu, 6 Aug 2026 12:26:43 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Thu, 06 Aug 2026 17:55:48 +0530 Subject: [PATCH v5 02/13] iio: hid-sensors: introduce device managed API Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-2-f1f92c1d830f@gmail.com> References: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> In-Reply-To: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jiri Kosina , Srinivas Pandruvada , Benjamin Tissoires Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sanjay Chitroda , Zhang Lixu X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786019201; l=2481; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=XJmRzPXaqhKqM4yIeSm5h1wY7VWEZl4o+Whwft4tGS0=; b=Hb7yChVALMw6zcc9nYcHY72DoLLNrKRXSIdvM3tNa3tEGjb8AqhlYC6GbWoPWuu9VdZFjEUpK YG+3LAZNNRFBPiiv+0GamZ5J7vTer4MV1xj67v/W8ERkwun7D6AJSXL X-Developer-Key: i=sanjayembeddedse@gmail.com; a=ed25519; pk=PcneEFtkmY+Ldl+KmOTpB/Q/HDsqko6Fb0/Z/5cuycI= X-Endpoint-Received: by B4 Relay for sanjayembeddedse@gmail.com/20260702 with auth_id=848 X-Original-From: Sanjay Chitroda Reply-To: sanjayembeddedse@gmail.com From: Sanjay Chitroda hid_sensor_setup_trigger() is common API used for the HID IIO drivers, prepare devm API devm_hid_sensor_setup_trigger() to acquire resource during setup and release using device managed framework during drivers fail, unbind or remove path. Register action with devm_add_action_or_reset() to release resource with devres framework. Signed-off-by: Sanjay Chitroda Tested-by: Zhang Lixu --- drivers/iio/common/hid-sensors/hid-sensor-trigger.c | 18 ++++++++++++++++++ drivers/iio/common/hid-sensors/hid-sensor-trigger.h | 2 ++ 2 files changed, 20 insertions(+) diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c b/drivers/= iio/common/hid-sensors/hid-sensor-trigger.c index 6e6adc501602..df6c07d6a6b7 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.c +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.c @@ -301,6 +301,24 @@ int hid_sensor_setup_trigger(struct iio_dev *indio_dev= , const char *name, } EXPORT_SYMBOL_NS(hid_sensor_setup_trigger, "IIO_HID"); =20 +static void hid_sensor_remove_trigger_action(void *attrb) +{ + hid_sensor_remove_trigger(attrb); +} + +int devm_hid_sensor_setup_trigger(struct device *dev, struct iio_dev *indi= o_dev, + const char *name, struct hid_sensor_common *attrb) +{ + int ret; + + ret =3D hid_sensor_setup_trigger(indio_dev, name, attrb); + if (ret) + return ret; + + return devm_add_action_or_reset(dev, hid_sensor_remove_trigger_action, at= trb); +} +EXPORT_SYMBOL_NS(devm_hid_sensor_setup_trigger, "IIO_HID"); + static int __maybe_unused hid_sensor_suspend(struct device *dev) { struct iio_dev *indio_dev =3D dev_get_drvdata(dev); diff --git a/drivers/iio/common/hid-sensors/hid-sensor-trigger.h b/drivers/= iio/common/hid-sensors/hid-sensor-trigger.h index ee17d5cc2437..c4b901ca4879 100644 --- a/drivers/iio/common/hid-sensors/hid-sensor-trigger.h +++ b/drivers/iio/common/hid-sensors/hid-sensor-trigger.h @@ -17,6 +17,8 @@ extern const struct dev_pm_ops hid_sensor_pm_ops; int hid_sensor_setup_trigger(struct iio_dev *indio_dev, const char *name, struct hid_sensor_common *attrb); void hid_sensor_remove_trigger(struct hid_sensor_common *attrb); +int devm_hid_sensor_setup_trigger(struct device *dev, struct iio_dev *indi= o_dev, + const char *name, struct hid_sensor_common *attrb); int hid_sensor_power_state(struct hid_sensor_common *st, bool state); =20 #endif --=20 2.34.1 From nobody Fri Oct 2 01:19:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 536E747D45C; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019204; cv=none; b=Y2K+Etb339Ju9oIgQIlHgIHFRPlfI7RWcvmOAV7Ld/rfVUTkqSWFma1QxDCHK4h8LLODtkh1lrAPxPXZIOSPVlK62RUHw/4g49YDzlgSEyWn32iTCcd4IQHR1cGXrPNgMsExAZIhiDPBGOCm0A0qvOgsjfBGMNMXFR4ODAadZn0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019204; c=relaxed/simple; bh=zokDt6p0efWKRUUpl2vOZnLC2b68P0WDbNk5RWW/DH4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hekMzQuI8c3zpG75rWr4izZlsulMpykJBRzSB5zJaii39PeOkNiH3uiIEf2z3R2vpwi99l/bZiTyJvd3lV0yBEh69wj0IAPF5LTrsjk2NfR0AtJrZXgUSTqKQGvjDTKHckNZsQhc7aqpx+IJk6AlBpSAdBiSvzc/ZiAKm1YnvRk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=guwtVKdu; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="guwtVKdu" Received: by smtp.kernel.org (Postfix) with ESMTPS id CE314C2BCFD; Thu, 6 Aug 2026 12:26:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786019203; bh=zokDt6p0efWKRUUpl2vOZnLC2b68P0WDbNk5RWW/DH4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=guwtVKduE6QE8fghUL1lUhJe2IuVHxixySWsZWTFoxSlo683oWvWe1k5l+J7fgu80 4sDmuutpboi3QKleEIPIx+yug0MCddpdW22FxB4PTh5hJXvbLDmPs/N9+w4ZI25r8b JH/AD5TUSBnhK7Ms57cCXCnCyBNzI6g6YiAZpQzK38ZseWawZUORG7cPyiVc7h1bRc /6lCiz7knoOid5cy6tsneYXrKNkoT3j4afe7Husut+Q/UwrWNHuBnGxwnSzSlhR52Z BMLvzT2pZ9K9VRGM9NApRrsGadDn6SXgbUjMTaKHQjlu8sQJXyb3UYrPA1ABpdB6bf 4mwkkIaQNU/yA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B98F2C55ABF; Thu, 6 Aug 2026 12:26:43 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Thu, 06 Aug 2026 17:55:49 +0530 Subject: [PATCH v5 03/13] HID: hid-sensor-hub: introduce device managed API Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-3-f1f92c1d830f@gmail.com> References: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> In-Reply-To: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jiri Kosina , Srinivas Pandruvada , Benjamin Tissoires Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sanjay Chitroda X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786019201; l=3632; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=E6NeHcHn1od2bjcFdG8WUYv/9lNEM6tJvVUI7ONP3w0=; b=JYVSUlbW7/7kXX43nB26KQ64ZWCJUNjHLe8ae/jXHO55V1lUuuI+ab73jw3FQ7IINPfYtSi/e TIn2NT4VigxCVb57E9lcYF7Kf85SoLH0LbsrSV8AzueVg1F3vEdmS22 X-Developer-Key: i=sanjayembeddedse@gmail.com; a=ed25519; pk=PcneEFtkmY+Ldl+KmOTpB/Q/HDsqko6Fb0/Z/5cuycI= X-Endpoint-Received: by B4 Relay for sanjayembeddedse@gmail.com/20260702 with auth_id=848 X-Original-From: Sanjay Chitroda Reply-To: sanjayembeddedse@gmail.com From: Sanjay Chitroda sensor_hub_register_callback() is common API used for the HID IIO drivers, prepare devm API devm_sensor_hub_register_callback() to acquire resource during setup and release using device managed framework during drivers fail, unbind or remove path. store the required callback removal context (hsdev and usage_id) in a dedicated struct sensor_hub_cb_devres, and register a devres action to handle to release resource with devres framework and helper API. Signed-off-by: Sanjay Chitroda --- drivers/hid/hid-sensor-hub.c | 32 ++++++++++++++++++++++++++++++++ include/linux/hid-sensor-hub.h | 24 ++++++++++++++++++++++++ 2 files changed, 56 insertions(+) diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 90666ff629de..31dbdce27dc6 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -187,6 +187,38 @@ int sensor_hub_remove_callback(struct hid_sensor_hub_d= evice *hsdev, } EXPORT_SYMBOL_GPL(sensor_hub_remove_callback); =20 +static void sensor_hub_remove_callback_helper(void *ptr) +{ + struct sensor_hub_cb_devres *res =3D ptr; + + sensor_hub_remove_callback(res->hsdev, res->usage_id); +} + +int devm_sensor_hub_register_callback(struct device *dev, + struct hid_sensor_hub_device *hsdev, + u32 usage_id, + struct hid_sensor_hub_callbacks *usage_callback) +{ + struct sensor_hub_cb_devres *res; + int ret; + + ret =3D sensor_hub_register_callback(hsdev, usage_id, usage_callback); + if (ret) + return ret; + + res =3D devm_kmalloc(dev, sizeof(*res), GFP_KERNEL); + if (!res) { + sensor_hub_remove_callback(hsdev, usage_id); + return -ENOMEM; + } + + res->hsdev =3D hsdev; + res->usage_id =3D usage_id; + + return devm_add_action_or_reset(dev, sensor_hub_remove_callback_helper, r= es); +} +EXPORT_SYMBOL_GPL(devm_sensor_hub_register_callback); + int sensor_hub_set_feature(struct hid_sensor_hub_device *hsdev, u32 report= _id, u32 field_index, int buffer_size, void *buffer) { diff --git a/include/linux/hid-sensor-hub.h b/include/linux/hid-sensor-hub.h index e71056553108..c00347b15513 100644 --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h @@ -75,6 +75,16 @@ struct hid_sensor_hub_device { struct sensor_hub_pending pending; }; =20 +/** + * struct sensor_hub_cb_devres - devres data for sensor hub callbacks + * @hsdev: Hub device instance. + * @usage_id: Usage ID associated with registered callback + */ +struct sensor_hub_cb_devres { + struct hid_sensor_hub_device *hsdev; + u32 usage_id; +}; + /** * struct hid_sensor_hub_callbacks - Client callback functions * @pdev: Platform device instance of the client driver. @@ -139,6 +149,20 @@ int sensor_hub_register_callback(struct hid_sensor_hub= _device *hsdev, int sensor_hub_remove_callback(struct hid_sensor_hub_device *hsdev, u32 usage_id); =20 +/** + * devm_sensor_hub_register_callback() - Managed register client callbacks + * @dev: Device for resource management + * @hsdev: Hub device instance + * @usage_id: Usage id of the client (e.g. 0x200076 for Gyro) + * @usage_callback: Callback function storage + * + * This is the devres (managed) version of sensor_hub_register_callback(). + * The callback will be automatically unregistered when the device is deta= ched. + */ +int devm_sensor_hub_register_callback(struct device *dev, + struct hid_sensor_hub_device *hsdev, + u32 usage_id, + struct hid_sensor_hub_callbacks *usage_callback); =20 /* Hid sensor hub core interfaces */ =20 --=20 2.34.1 From nobody Fri Oct 2 01:19:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 AAAD047D468; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019204; cv=none; b=mIwi801wH++o52IyGDjJyAPY8k1gIsav0OOEDeL13qpcARWq3+zTtBY5zRv+VvnuqBmyYAvW+66vtFwIaNeJyibabhHPRo2rUnNHDhazlMD1MAYqwUljbmY/fK2SAS6MfGuZgGX2DRRJ00CLOqwGEXQclvO6Rtxo2NY5vBNkuVk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019204; c=relaxed/simple; bh=XodsOen8Wvzg78o0lwyC8zvGmdjAid2TnVU+SOWZRpc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cg0BxJGHxnWDDabZ4K5NI+bAi6u9Z1nS9aB3kTtkS/fO8zs+f8kYTxqX4OlVSUIsjc/sP8SCyEVBls/kWZqsmqzd1gl54kBZys+coV+/D9+ROF1ekPPDb1NpcdUL/7b1PD76lbLqXm4+yGRptzZntTebI6HNPeOxZ0X1/RgoI7k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=d7ViTu5T; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="d7ViTu5T" Received: by smtp.kernel.org (Postfix) with ESMTPS id E0318C2BCF7; Thu, 6 Aug 2026 12:26:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786019203; bh=XodsOen8Wvzg78o0lwyC8zvGmdjAid2TnVU+SOWZRpc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=d7ViTu5TUespo5kCkTWdLVDXPhE31f7bd5KV+viZj9Csp0KiR/yrHp1jC69K7pmdk 1wLfrl/HC43Z6nAC38r8KU4IGc+NliwY7x2Z4/9F+iemC5a5WjqnDPOsmMQEcpTGT7 7L+P32ciOxT6K8FYIoABucTk6OXbs7DctgZADSw8toggIftJ2neKjRL03rSvi1NCpI MlWx8tRGuzgA2v0Tuk44m523MpiJyUFgIatVttLf/ZqlcYdQx+Q6P6D0hBQiKrfJhv Rr2yQGkIyXLa9pqysc6vKY1BAlevK1wDKov96DGQFBU8RIAofl2Sy/wshgondZjm+K B+d6GKECBIVtw== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC799C5AC7A; Thu, 6 Aug 2026 12:26:43 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Thu, 06 Aug 2026 17:55:50 +0530 Subject: [PATCH v5 04/13] iio: gyro: hid-sensor-gyro-3d: convert probe and teardown to devm-managed resources Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-4-f1f92c1d830f@gmail.com> References: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> In-Reply-To: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jiri Kosina , Srinivas Pandruvada , Benjamin Tissoires Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sanjay Chitroda X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786019201; l=3576; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=93lHICIbaqkhzBStetBiddfJA0a+d0oJo1BZpquDDZw=; b=nd3GPjtbCy3xPC/pFnqY3PhBohtwqr33T8ott9DtmgItLuVHqIKRtGjDC42zeI5Ctjk8OZlpE vzJ9G81aSxPBRy46QoEBR+rDDWTVmuXb/FzV7XH2NV7HNZIpv6sIHRr X-Developer-Key: i=sanjayembeddedse@gmail.com; a=ed25519; pk=PcneEFtkmY+Ldl+KmOTpB/Q/HDsqko6Fb0/Z/5cuycI= X-Endpoint-Received: by B4 Relay for sanjayembeddedse@gmail.com/20260702 with auth_id=848 X-Original-From: Sanjay Chitroda Reply-To: sanjayembeddedse@gmail.com From: Sanjay Chitroda Convert HID IIO driver resource management to use devm-managed helpers, tying the lifetime of all resources to the device. HID trigger setup, IIO registration, and sensor hub callback resource are now managed using devm APIs. Cleanup logic previously handled explicitly in probe error and teardown paths. This simplifies the probe path by removing goto-based error handling, eliminates the remove callback entirely. Signed-off-by: Sanjay Chitroda --- drivers/iio/gyro/hid-sensor-gyro-3d.c | 41 ++++++++-----------------------= ---- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/drivers/iio/gyro/hid-sensor-gyro-3d.c b/drivers/iio/gyro/hid-s= ensor-gyro-3d.c index cf049700d415..66778315e86d 100644 --- a/drivers/iio/gyro/hid-sensor-gyro-3d.c +++ b/drivers/iio/gyro/hid-sensor-gyro-3d.c @@ -264,7 +264,8 @@ static int gyro_3d_parse_report(struct platform_device = *pdev, /* Function to initialize the processing for usage id */ static int hid_gyro_3d_probe(struct platform_device *pdev) { - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); + struct device *dev =3D &pdev->dev; + struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(dev); int ret =3D 0; static const char *name =3D "gyro_3d"; struct iio_dev *indio_dev; @@ -311,8 +312,8 @@ static int hid_gyro_3d_probe(struct platform_device *pd= ev) =20 atomic_set(&gyro_state->common_attributes.data_ready, 0); =20 - ret =3D hid_sensor_setup_trigger(indio_dev, name, - &gyro_state->common_attributes); + ret =3D devm_hid_sensor_setup_trigger(dev, indio_dev, name, + &gyro_state->common_attributes); if (ret < 0) { dev_err(&pdev->dev, "trigger setup failed\n"); return ret; @@ -321,38 +322,15 @@ static int hid_gyro_3d_probe(struct platform_device *= pdev) gyro_state->callbacks.send_event =3D gyro_3d_proc_event; gyro_state->callbacks.capture_sample =3D gyro_3d_capture_sample; gyro_state->callbacks.pdev =3D pdev; - ret =3D sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_GYRO_3D, - &gyro_state->callbacks); + ret =3D devm_sensor_hub_register_callback(dev, hsdev, + HID_USAGE_SENSOR_GYRO_3D, + &gyro_state->callbacks); if (ret < 0) { dev_err(&pdev->dev, "callback reg failed\n"); - goto error_remove_trigger; - } - - ret =3D iio_device_register(indio_dev); - if (ret) { - dev_err(&pdev->dev, "device register failed\n"); - goto error_remove_callback; + return ret; } =20 - return ret; - -error_remove_callback: - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_GYRO_3D); -error_remove_trigger: - hid_sensor_remove_trigger(&gyro_state->common_attributes); - return ret; -} - -/* Function to deinitialize the processing for usage id */ -static void hid_gyro_3d_remove(struct platform_device *pdev) -{ - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); - struct iio_dev *indio_dev =3D platform_get_drvdata(pdev); - struct gyro_3d_state *gyro_state =3D iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_GYRO_3D); - hid_sensor_remove_trigger(&gyro_state->common_attributes); + return devm_iio_device_register(dev, indio_dev); } =20 static const struct platform_device_id hid_gyro_3d_ids[] =3D { @@ -371,7 +349,6 @@ static struct platform_driver hid_gyro_3d_platform_driv= er =3D { .pm =3D &hid_sensor_pm_ops, }, .probe =3D hid_gyro_3d_probe, - .remove =3D hid_gyro_3d_remove, }; module_platform_driver(hid_gyro_3d_platform_driver); =20 --=20 2.34.1 From nobody Fri Oct 2 01:19:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 1980C47D93E; Thu, 6 Aug 2026 12:26:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019205; cv=none; b=YaYaFGlpQfRZIacEz5r21TwLqRNqbH+PgVjOShuhFBSm/LAeleYtstyTsRfEfX2Iu5i40p9Z2v2wQN7zTLnG/8ISBD/zl3fILy98f9/jTJyJmSjjhyA5lLlKxysUQOEiPBrCxYsd68kg3wEYes7h599j/HXTecKnazOS96yujxk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019205; c=relaxed/simple; bh=tq/IbJVpEbqrjPtNTxWQz6KzoyoryI8jJvw3bm2ttI4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=abbi/cbMJ9yGv8Z9wCs5rmuDmYh19rTyraSKl6IwY1d5Y8kB6b/fWr/d4b5Ec0/qgjaXz01a3jn7OvVpb/3qCBTqIN0k76QnzKLTijgcHUAgrizqNPNhUecLpvItNdXmlC0s1hnYm/o9RvPim0N3ulptFGG99iLBIZru/OqDMuo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NfmBTfiw; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="NfmBTfiw" Received: by smtp.kernel.org (Postfix) with ESMTPS id F3AAFC2BCF4; Thu, 6 Aug 2026 12:26:43 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786019204; bh=tq/IbJVpEbqrjPtNTxWQz6KzoyoryI8jJvw3bm2ttI4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=NfmBTfiwLMVesuqAc0iPUN7WjuRz+tLQ8hqEqLsAn8bMrUbQIHkfugZztDclltliw wFSHaI8ExfiqM2IvyK1LyFz+G9mIzuzueSchjdtuIIHYhxaWHFrx4PATuVtzGvVw+e 1bCPLYow3EECgIOFjlrEvqqym8c4htUkHkfsbeEWZjtyidyPwOCNhCIt++hFk4v9CR IWmqA/AzT4K5uWhnSwtnudboMrr5TKoMPZHoAgA93Tce1YO/Ezy8G3tWVGu6b3/YqH X0XRTW0NotItfo+667At6vvZdnlbB1wzh+JC+Ngo/T45frDhEnpQy+88fciAxz8KhZ Mvcc6a+O+uM1w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id DDD0CC56208; Thu, 6 Aug 2026 12:26:43 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Thu, 06 Aug 2026 17:55:51 +0530 Subject: [PATCH v5 05/13] iio: accel: hid-sensor-accel-3d: convert probe and teardown to devm-managed resources Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-5-f1f92c1d830f@gmail.com> References: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> In-Reply-To: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jiri Kosina , Srinivas Pandruvada , Benjamin Tissoires Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sanjay Chitroda X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786019201; l=3533; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=8MWI/12hlI4M9yhRZDPc0n3MB0pcjTD/Emba1guoIhc=; b=MZal0cvwGDtehKVxt7L/TWs+AfT6QAVJEnhx70adYXeoGXjpnpCSjODYESYM5q1u1LzIqtCdT h+8IhyEJc9qCVMLEF6+IoRoNN9BQjKrD0Od2ZoEe8U0olL+8gueI86S X-Developer-Key: i=sanjayembeddedse@gmail.com; a=ed25519; pk=PcneEFtkmY+Ldl+KmOTpB/Q/HDsqko6Fb0/Z/5cuycI= X-Endpoint-Received: by B4 Relay for sanjayembeddedse@gmail.com/20260702 with auth_id=848 X-Original-From: Sanjay Chitroda Reply-To: sanjayembeddedse@gmail.com From: Sanjay Chitroda Convert HID IIO driver resource management to use devm-managed helpers, tying the lifetime of all resources to the device. HID trigger setup, IIO registration, and sensor hub callback resource are now managed using devm APIs. Cleanup logic previously handled explicitly in probe error and teardown paths. This simplifies the probe path by removing goto-based error handling, eliminates the remove callback entirely. Signed-off-by: Sanjay Chitroda --- drivers/iio/accel/hid-sensor-accel-3d.c | 40 +++++++----------------------= ---- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/drivers/iio/accel/hid-sensor-accel-3d.c b/drivers/iio/accel/hi= d-sensor-accel-3d.c index a7cccbaa82f8..7ba0228f18b4 100644 --- a/drivers/iio/accel/hid-sensor-accel-3d.c +++ b/drivers/iio/accel/hid-sensor-accel-3d.c @@ -314,7 +314,8 @@ static int accel_3d_parse_report(struct platform_device= *pdev, /* Function to initialize the processing for usage id */ static int hid_accel_3d_probe(struct platform_device *pdev) { - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); + struct device *dev =3D &pdev->dev; + struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(dev); int ret =3D 0; const char *name; struct iio_dev *indio_dev; @@ -374,8 +375,8 @@ static int hid_accel_3d_probe(struct platform_device *p= dev) =20 atomic_set(&accel_state->common_attributes.data_ready, 0); =20 - ret =3D hid_sensor_setup_trigger(indio_dev, name, - &accel_state->common_attributes); + ret =3D devm_hid_sensor_setup_trigger(dev, indio_dev, name, + &accel_state->common_attributes); if (ret < 0) { dev_err(&pdev->dev, "trigger setup failed\n"); return ret; @@ -384,38 +385,14 @@ static int hid_accel_3d_probe(struct platform_device = *pdev) accel_state->callbacks.send_event =3D accel_3d_proc_event; accel_state->callbacks.capture_sample =3D accel_3d_capture_sample; accel_state->callbacks.pdev =3D pdev; - ret =3D sensor_hub_register_callback(hsdev, hsdev->usage, - &accel_state->callbacks); + ret =3D devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage, + &accel_state->callbacks); if (ret < 0) { dev_err(&pdev->dev, "callback reg failed\n"); - goto error_remove_trigger; - } - - ret =3D iio_device_register(indio_dev); - if (ret) { - dev_err(&pdev->dev, "device register failed\n"); - goto error_remove_callback; + return ret; } =20 - return ret; - -error_remove_callback: - sensor_hub_remove_callback(hsdev, hsdev->usage); -error_remove_trigger: - hid_sensor_remove_trigger(&accel_state->common_attributes); - return ret; -} - -/* Function to deinitialize the processing for usage id */ -static void hid_accel_3d_remove(struct platform_device *pdev) -{ - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); - struct iio_dev *indio_dev =3D platform_get_drvdata(pdev); - struct accel_3d_state *accel_state =3D iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - sensor_hub_remove_callback(hsdev, hsdev->usage); - hid_sensor_remove_trigger(&accel_state->common_attributes); + return devm_iio_device_register(dev, indio_dev); } =20 static const struct platform_device_id hid_accel_3d_ids[] =3D { @@ -437,7 +414,6 @@ static struct platform_driver hid_accel_3d_platform_dri= ver =3D { .pm =3D &hid_sensor_pm_ops, }, .probe =3D hid_accel_3d_probe, - .remove =3D hid_accel_3d_remove, }; module_platform_driver(hid_accel_3d_platform_driver); =20 --=20 2.34.1 From nobody Fri Oct 2 01:19:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 B124A47D929; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019204; cv=none; b=Vc7gxdxBD4Kn/vpkiIMSRc+rCPhBlZ/iqa+NCKoduFetMmu24+otjXWifa9bbKew92DiBm5fiIhhtGH0N0qzAVb3FCVF+zIU6xABd5XmmkKxF1eVVfKSeoz31tcNR5jTBM9d03E7kjqu+g0nfMJ3oFBTGgM8xtHXAHQqAXSizOk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019204; c=relaxed/simple; bh=QpjVvJ9+DS2Q2uKPLWC5fqkfnG8PzhLU5vAJoczIpNU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gdo1M63w/J35pfHbrWDvOyusya0rU7NRz8IPcFvXdzvV9mcrIw3gqPSBZ6fvuQt6YsnvuUQizU0/xcmFeWm7G4vn1XOQACNBGiWB5RoaaBxNCFl6uQV2+PurbXKpuoSF/w0DAFf+uwsoQpLRbo9eH4MBtg2qQV4IVhqHJIJsmWo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=llfpIwTd; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="llfpIwTd" Received: by smtp.kernel.org (Postfix) with ESMTPS id 10DEBC2BCFC; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786019204; bh=QpjVvJ9+DS2Q2uKPLWC5fqkfnG8PzhLU5vAJoczIpNU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=llfpIwTdTSPHAmLzs32objNVE2Ag/2IFSF0/o/BqXuv571Rb8QvNfnC6Ko+zF5slp cYnqDbdU+YLPt9+FZ8EM7NEqkeRlaFRteiRDGCPXdYcFIo2w0Bu1NiwTI8UCLJjmI9 q5WkxRZ0sP3LmyeMFBTMWubcS5kovcW2Rj0RS/g4jDKCUH4yWONmveOdekBf5IIR97 LayOCaPAV17z2+8Ti7mXCwONI/8KGrhNQjFNch9pNt7bUpkpyGNsYdzpxMCrJCFLFJ /O2diDuIEc0USBTnyTwpsRbU79LiAcgQrWpCp8nhRl/EUx6i48TT6kacxL3bZyl5n1 8DR9n8rwEBibA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id F0A0EC56205; Thu, 6 Aug 2026 12:26:43 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Thu, 06 Aug 2026 17:55:52 +0530 Subject: [PATCH v5 06/13] iio: humidity: hid-sensor-humidity: convert probe and teardown to devm-managed resources Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-6-f1f92c1d830f@gmail.com> References: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> In-Reply-To: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jiri Kosina , Srinivas Pandruvada , Benjamin Tissoires Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sanjay Chitroda X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786019201; l=3821; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=HqyYHVuWmDcuCY2uw/mZntv1xCDdrJhZceeQRiOBrc0=; b=faTu/9zW6rjlr2K4q/vw1kw3M8o6o/tfLJKCyhdkJinkRWnWvTxLhdXOMz4Iw9uW+f1H3jDPK B87nbgz5sMZAt1VdxrcH9/kINL0/AVDelcOmatPx/cXYrupgPLmzUxE X-Developer-Key: i=sanjayembeddedse@gmail.com; a=ed25519; pk=PcneEFtkmY+Ldl+KmOTpB/Q/HDsqko6Fb0/Z/5cuycI= X-Endpoint-Received: by B4 Relay for sanjayembeddedse@gmail.com/20260702 with auth_id=848 X-Original-From: Sanjay Chitroda Reply-To: sanjayembeddedse@gmail.com From: Sanjay Chitroda Convert HID IIO driver resource management to use devm-managed helpers, tying the lifetime of all resources to the device. HID trigger setup, IIO registration, and sensor hub callback resource are now managed using devm APIs. Cleanup logic previously handled explicitly in probe error and teardown paths. This simplifies the probe path by removing goto-based error handling, eliminates the remove callback entirely. Signed-off-by: Sanjay Chitroda --- changes in v5: - Fully convert driver to devm usage, dropped Tested-by tag changes in v4: - No update in change, added Tested-by tag changes in v3: - Update commit message based on review comment from Andy - Based on discussion using parent device of HID platform driver used with devres framework for this driver - v2 link -> https://lore.kernel.org/all/20260429175918.2541914-5-sanjayemb= edded@gmail.com/ --- drivers/iio/humidity/hid-sensor-humidity.c | 38 +++++++-------------------= ---- 1 file changed, 8 insertions(+), 30 deletions(-) diff --git a/drivers/iio/humidity/hid-sensor-humidity.c b/drivers/iio/humid= ity/hid-sensor-humidity.c index 89daf9d534d1..12c88efe66be 100644 --- a/drivers/iio/humidity/hid-sensor-humidity.c +++ b/drivers/iio/humidity/hid-sensor-humidity.c @@ -192,11 +192,12 @@ static struct hid_sensor_hub_callbacks humidity_callb= acks =3D { /* Function to initialize the processing for usage id */ static int hid_humidity_probe(struct platform_device *pdev) { + struct device *dev =3D &pdev->dev; + struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(dev); static const char *name =3D "humidity"; struct iio_dev *indio_dev; struct hid_humidity_state *humid_st; struct iio_chan_spec *humid_chans; - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); int ret; =20 indio_dev =3D devm_iio_device_alloc(&pdev->dev, sizeof(*humid_st)); @@ -233,42 +234,20 @@ static int hid_humidity_probe(struct platform_device = *pdev) =20 atomic_set(&humid_st->common_attributes.data_ready, 0); =20 - ret =3D hid_sensor_setup_trigger(indio_dev, name, - &humid_st->common_attributes); + ret =3D devm_hid_sensor_setup_trigger(dev, indio_dev, name, + &humid_st->common_attributes); if (ret) return ret; =20 platform_set_drvdata(pdev, indio_dev); =20 humidity_callbacks.pdev =3D pdev; - ret =3D sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_HUMIDITY, - &humidity_callbacks); + ret =3D devm_sensor_hub_register_callback(dev, hsdev, HID_USAGE_SENSOR_HU= MIDITY, + &humidity_callbacks); if (ret) - goto error_remove_trigger; - - ret =3D iio_device_register(indio_dev); - if (ret) - goto error_remove_callback; - - return ret; - -error_remove_callback: - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_HUMIDITY); -error_remove_trigger: - hid_sensor_remove_trigger(&humid_st->common_attributes); - return ret; -} - -/* Function to deinitialize the processing for usage id */ -static void hid_humidity_remove(struct platform_device *pdev) -{ - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); - struct iio_dev *indio_dev =3D platform_get_drvdata(pdev); - struct hid_humidity_state *humid_st =3D iio_priv(indio_dev); + return ret; =20 - iio_device_unregister(indio_dev); - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_HUMIDITY); - hid_sensor_remove_trigger(&humid_st->common_attributes); + return devm_iio_device_register(dev, indio_dev); } =20 static const struct platform_device_id hid_humidity_ids[] =3D { @@ -287,7 +266,6 @@ static struct platform_driver hid_humidity_platform_dri= ver =3D { .pm =3D &hid_sensor_pm_ops, }, .probe =3D hid_humidity_probe, - .remove =3D hid_humidity_remove, }; module_platform_driver(hid_humidity_platform_driver); =20 --=20 2.34.1 From nobody Fri Oct 2 01:19:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E36E3477295; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019205; cv=none; b=KiwHQmYjnaXq7dky9MZ9QB5InxYHLS/zOvAwlEnj5yH37INGvWnwiXfK+KAD8Vqto4aFkxm+XI65L6yNpsiW7gOU7h0oSmJ+HE3bpHVQJxdhYFJcE8V1TzhXz2x9qJc5PCQqjluVVOkY6JuscnR2eDndhwB2pNUP4+kA6pcT+UM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019205; c=relaxed/simple; bh=/O/jwNr8U2kz2vrQ2d9Bz7kTcnnb1Lw0rPParIURebQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=T1uUcZU7YG7jpqmx+vehNgTFdUOQ67xiYyA28iOnVMl47wumA/N0JuHE7XvAErIMe/AA9PszmOXXTtLdLmt4bopKsLByWuXOQC/34JvwBYJU0zbjy4PR1WvgKnEP0clOLBN06hiOOEJXZwfjhnLOsqhiAkSQLcbRY1my9DjcEp4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=fyRrwyP7; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="fyRrwyP7" Received: by smtp.kernel.org (Postfix) with ESMTPS id 26007C2BCFF; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786019204; bh=/O/jwNr8U2kz2vrQ2d9Bz7kTcnnb1Lw0rPParIURebQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=fyRrwyP7j84n1q9Y0dUvC5VolfHIbQkQy+oiVau+5sJk1uCcpaLFuwZB9NLrUdGzH r7j7KH5FEIM4IMVMWUAxmQwr1joFhPl9ge1VW2bPX17aCGfz/Ei7b2ArB9unWQo+vO ZoVQTlb/m0Rry09IVLxsgSX8onRcoIvi/m1/rUedtQ0ai+KSZyOuDuGAOUdxb1Ta98 R2eJFYw6dJIUwGimZUUrpcMMnuUHRsqdDoggmWW9aHaeWMaN+nFJKqFawdH4uVkXY3 5uQCrHp7XHk4vJajSUZhhMzpvoUMCDBTqeyYTkT7CAnWg8btkDHRgBS22RMJUWtwAE cITbk9v4HhqWA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1367AC55ABF; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Thu, 06 Aug 2026 17:55:53 +0530 Subject: [PATCH v5 07/13] iio: light: hid-sensor-prox: convert probe and teardown to devm-managed resources Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-7-f1f92c1d830f@gmail.com> References: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> In-Reply-To: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jiri Kosina , Srinivas Pandruvada , Benjamin Tissoires Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sanjay Chitroda X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786019201; l=3466; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=LYf4T3sDm8ysK9zTki2uYUQRgyfp4w+aSKgDHMnP8Yw=; b=tZ7ihwnmYXghwsv1eHM0z1NFRQinJrKR11vATpzlopL/Vch3Lk9VkUI4wPn4SbcpifMOGzcVl 8mjVh8zQc8oCAQyrRgS1XIee0fk01AR4AzE3Mm6Nc4hv3d/snn5cwJg X-Developer-Key: i=sanjayembeddedse@gmail.com; a=ed25519; pk=PcneEFtkmY+Ldl+KmOTpB/Q/HDsqko6Fb0/Z/5cuycI= X-Endpoint-Received: by B4 Relay for sanjayembeddedse@gmail.com/20260702 with auth_id=848 X-Original-From: Sanjay Chitroda Reply-To: sanjayembeddedse@gmail.com From: Sanjay Chitroda Convert HID IIO driver resource management to use devm-managed helpers, tying the lifetime of all resources to the device. HID trigger setup, IIO registration, and sensor hub callback resource are now managed using devm APIs. Cleanup logic previously handled explicitly in probe error and teardown paths. This simplifies the probe path by removing goto-based error handling, eliminates the remove callback entirely. Signed-off-by: Sanjay Chitroda --- drivers/iio/light/hid-sensor-prox.c | 40 ++++++++-------------------------= ---- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/drivers/iio/light/hid-sensor-prox.c b/drivers/iio/light/hid-se= nsor-prox.c index 5e28f9b7f40a..355b7b02868c 100644 --- a/drivers/iio/light/hid-sensor-prox.c +++ b/drivers/iio/light/hid-sensor-prox.c @@ -260,7 +260,8 @@ static int prox_parse_report(struct platform_device *pd= ev, /* Function to initialize the processing for usage id */ static int hid_prox_probe(struct platform_device *pdev) { - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); + struct device *dev =3D &pdev->dev; + struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(dev); int ret =3D 0; static const char *name =3D "prox"; struct iio_dev *indio_dev; @@ -299,8 +300,8 @@ static int hid_prox_probe(struct platform_device *pdev) =20 atomic_set(&prox_state->common_attributes.data_ready, 0); =20 - ret =3D hid_sensor_setup_trigger(indio_dev, name, - &prox_state->common_attributes); + ret =3D devm_hid_sensor_setup_trigger(dev, indio_dev, name, + &prox_state->common_attributes); if (ret) { dev_err(&pdev->dev, "trigger setup failed\n"); return ret; @@ -309,38 +310,14 @@ static int hid_prox_probe(struct platform_device *pde= v) prox_state->callbacks.send_event =3D prox_proc_event; prox_state->callbacks.capture_sample =3D prox_capture_sample; prox_state->callbacks.pdev =3D pdev; - ret =3D sensor_hub_register_callback(hsdev, hsdev->usage, - &prox_state->callbacks); + ret =3D devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage, + &prox_state->callbacks); if (ret < 0) { dev_err(&pdev->dev, "callback reg failed\n"); - goto error_remove_trigger; - } - - ret =3D iio_device_register(indio_dev); - if (ret) { - dev_err(&pdev->dev, "device register failed\n"); - goto error_remove_callback; + return ret; } =20 - return ret; - -error_remove_callback: - sensor_hub_remove_callback(hsdev, hsdev->usage); -error_remove_trigger: - hid_sensor_remove_trigger(&prox_state->common_attributes); - return ret; -} - -/* Function to deinitialize the processing for usage id */ -static void hid_prox_remove(struct platform_device *pdev) -{ - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); - struct iio_dev *indio_dev =3D platform_get_drvdata(pdev); - struct prox_state *prox_state =3D iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - sensor_hub_remove_callback(hsdev, hsdev->usage); - hid_sensor_remove_trigger(&prox_state->common_attributes); + return devm_iio_device_register(dev, indio_dev); } =20 static const struct platform_device_id hid_prox_ids[] =3D { @@ -363,7 +340,6 @@ static struct platform_driver hid_prox_platform_driver = =3D { .pm =3D &hid_sensor_pm_ops, }, .probe =3D hid_prox_probe, - .remove =3D hid_prox_remove, }; module_platform_driver(hid_prox_platform_driver); =20 --=20 2.34.1 From nobody Fri Oct 2 01:19:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E3E3347987B; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019205; cv=none; b=CuFpjGf6vNJNYblrcmFzH2lKXAO6IhkSiZGZf7ZJBYrTtjWoMRj5jVKkMiUTD68/TCVBBDqor9B679g/aiQKHvmH1yk9KSjYXZRkb266qza23p4a4idxKa5T/DwxsrxQIDdJERv4sSAxDn8O4724mW1E2fxKMRduscmiaOMA96c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019205; c=relaxed/simple; bh=txus2AJE/kVu+dxppUJupcIuWbp4gFKzp2cIZUvkXBc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HYTHlqgPzIE2iVRIO9lc176cvXd6CbuOHG7+zXE+j/Hz/asVSTH74Dqmd9zEqgcF+VdzbDUqGIVRydiYBxP5MSnk03sNxQjehxgF3hnibzeB3FfuUoVtQlH5fz06IB4Td6uyGs1E2GgjurI4GWOaZC8r4ISBLWBQW+fZZrdnB4g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=izvSidW2; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="izvSidW2" Received: by smtp.kernel.org (Postfix) with ESMTPS id 41973C2BD05; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786019204; bh=txus2AJE/kVu+dxppUJupcIuWbp4gFKzp2cIZUvkXBc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=izvSidW2Yuoxnf/6SOo3zXsgv6M+D9rNSH6WH8CgsO+SH0nk4edBNgYAfNXuULVkr +h5THcZmt4McABAzTnIFkTz/S7aj3kOSy+860eQiKExPTOiH5sMeizN5wI2+GMv6Rw gUOu+2cLkInHDwh2zB3Od8iyKKayvKFD7u+08UOOCSjrGHLyPC5aPM5vYCiEXY3cHL YSGtGZ+gVe+U5KF/UauG2wkYwgGsyEuhM8u7IYsp3I6TsPIVyAPCVvSSHi5k2Kxx55 ozeh2634yTGcb2dJ7aju0MBODeFK5v0T3JvWZhrXMoj9o2RHv+jONqvayitd40bKW+ cJmCzpgNv/kzg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2AF50C56205; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Thu, 06 Aug 2026 17:55:54 +0530 Subject: [PATCH v5 08/13] iio: light: hid-sensor-als: convert probe and teardown to devm-managed resources Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-8-f1f92c1d830f@gmail.com> References: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> In-Reply-To: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jiri Kosina , Srinivas Pandruvada , Benjamin Tissoires Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sanjay Chitroda X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786019201; l=3431; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=YJB29GHZCncYhwv+cTV1yg7AaHm7y9Zh7SdPyAgjnjg=; b=NikBq7UJpPp8X7NGx+AaCNQef0VI7JcmDeAJcpODreC6j6ehFwt/kKIhlN0dTKi8vvtC9embd rWXc92la3HRBrxjPuOgITnrS53EphDSHLoNvawwRbsFVavlw7F15igg X-Developer-Key: i=sanjayembeddedse@gmail.com; a=ed25519; pk=PcneEFtkmY+Ldl+KmOTpB/Q/HDsqko6Fb0/Z/5cuycI= X-Endpoint-Received: by B4 Relay for sanjayembeddedse@gmail.com/20260702 with auth_id=848 X-Original-From: Sanjay Chitroda Reply-To: sanjayembeddedse@gmail.com From: Sanjay Chitroda Convert HID IIO driver resource management to use devm-managed helpers, tying the lifetime of all resources to the device. HID trigger setup, IIO registration, and sensor hub callback resource are now managed using devm APIs. Cleanup logic previously handled explicitly in probe error and teardown paths. This simplifies the probe path by removing goto-based error handling, eliminates the remove callback entirely. Signed-off-by: Sanjay Chitroda --- drivers/iio/light/hid-sensor-als.c | 39 ++++++++--------------------------= ---- 1 file changed, 8 insertions(+), 31 deletions(-) diff --git a/drivers/iio/light/hid-sensor-als.c b/drivers/iio/light/hid-sen= sor-als.c index 10bf46ea4f47..633fd1569987 100644 --- a/drivers/iio/light/hid-sensor-als.c +++ b/drivers/iio/light/hid-sensor-als.c @@ -348,7 +348,8 @@ static int als_parse_report(struct platform_device *pde= v, /* Function to initialize the processing for usage id */ static int hid_als_probe(struct platform_device *pdev) { - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); + struct device *dev =3D &pdev->dev; + struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(dev); int ret =3D 0; static const char *name =3D "als"; struct iio_dev *indio_dev; @@ -396,8 +397,8 @@ static int hid_als_probe(struct platform_device *pdev) =20 atomic_set(&als_state->common_attributes.data_ready, 0); =20 - ret =3D hid_sensor_setup_trigger(indio_dev, name, - &als_state->common_attributes); + ret =3D devm_hid_sensor_setup_trigger(dev, indio_dev, name, + &als_state->common_attributes); if (ret < 0) { dev_err(&pdev->dev, "trigger setup failed\n"); return ret; @@ -406,37 +407,14 @@ static int hid_als_probe(struct platform_device *pdev) als_state->callbacks.send_event =3D als_proc_event; als_state->callbacks.capture_sample =3D als_capture_sample; als_state->callbacks.pdev =3D pdev; - ret =3D sensor_hub_register_callback(hsdev, hsdev->usage, &als_state->cal= lbacks); + ret =3D devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage, + &als_state->callbacks); if (ret < 0) { dev_err(&pdev->dev, "callback reg failed\n"); - goto error_remove_trigger; - } - - ret =3D iio_device_register(indio_dev); - if (ret) { - dev_err(&pdev->dev, "device register failed\n"); - goto error_remove_callback; + return ret; } =20 - return ret; - -error_remove_callback: - sensor_hub_remove_callback(hsdev, hsdev->usage); -error_remove_trigger: - hid_sensor_remove_trigger(&als_state->common_attributes); - return ret; -} - -/* Function to deinitialize the processing for usage id */ -static void hid_als_remove(struct platform_device *pdev) -{ - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); - struct iio_dev *indio_dev =3D platform_get_drvdata(pdev); - struct als_state *als_state =3D iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - sensor_hub_remove_callback(hsdev, hsdev->usage); - hid_sensor_remove_trigger(&als_state->common_attributes); + return devm_iio_device_register(dev, indio_dev); } =20 static const struct platform_device_id hid_als_ids[] =3D { @@ -459,7 +437,6 @@ static struct platform_driver hid_als_platform_driver = =3D { .pm =3D &hid_sensor_pm_ops, }, .probe =3D hid_als_probe, - .remove =3D hid_als_remove, }; module_platform_driver(hid_als_platform_driver); =20 --=20 2.34.1 From nobody Fri Oct 2 01:19:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E870E47A87C; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019205; cv=none; b=uwsszv7pw8E/7r2HHTq8N2AS2uqBST54p77LogfXK2G2rkE6dMSyJqd626NgncrHzsyxdUIsQIL9ipSAyPWJzPJuUYjW6pxh3Jo2NNmmbNN2LWwWN30w44mOluuMUfkYqxmPcunfM2hTuYQ1d/dwD5e6/L2U9OPhd11j59v5wBA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019205; c=relaxed/simple; bh=AWnCnKefvG4UVNmB6J2v9FQ7IUmYciYkW+vBmT2hi64=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=kEuRBeWNxLtb962oyYldVIfJ3l36iOuotIgVyeJsq6lH/7k2dCFfoPRntEGcAhrIut4A5Xu45ULb4pghvwCuWBeRaN+PP9fP7etrUFnP3P4Aqfd9kM1s3qctpqa61yNB0f3HAh/Otn9oqxBz5CmCJDY50ot5xgh1gUYUKfpzwgc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=VC+jdcej; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="VC+jdcej" Received: by smtp.kernel.org (Postfix) with ESMTPS id 54EEEC2BD01; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786019204; bh=AWnCnKefvG4UVNmB6J2v9FQ7IUmYciYkW+vBmT2hi64=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=VC+jdcejkGeD2hBJBrytRCJFdIAksFu4v7bgc0G+jnnM8uEg0C3pK2HhHl8xjtqmL x2+bWty9fJaGBebg0zeKBmJQ4/IKE/IsuOJ4XHYSPstUq2dwm5GiD//PgeYUbCpddu YACD/01hEEWJeO5bL4fPTSFv2zBpjA/nkOduA/WCRJ3y78+rrzduYhKZF+F6ziIzxV kuN6PKlJhqXJmlEmzEuTimiDjBVMJa17utuXgMKkX1TbwM96rtIf8PGIHIhvltynW0 OtdY/MjknOLsevd/5KSt1mRvMsj5eTUoPlfCLZa3KaTyALcldG5anzR8iceYDsFyUW ZH1c7sHOE481w== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 429ACC56208; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Thu, 06 Aug 2026 17:55:55 +0530 Subject: [PATCH v5 09/13] iio: magnetometer: hid-sensor-magn-3d: convert probe and teardown to devm-managed resources Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-9-f1f92c1d830f@gmail.com> References: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> In-Reply-To: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jiri Kosina , Srinivas Pandruvada , Benjamin Tissoires Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sanjay Chitroda X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786019201; l=3629; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=psVvPChQvmnDeqq5c0sAzyCmhiEktLAbJoySPLiD/3g=; b=JtmCBV4eRexLF3nQbqCZPGXDJ+m0LWy9uJ7HS+T109gjkI2MPjw4XbwnB3NtiCCKh3iPppLI7 ithdY7N7IYHDiuNlj1utSJUSzElVk4zSPD4mNuT1AgTV1FaQV0o7I7w X-Developer-Key: i=sanjayembeddedse@gmail.com; a=ed25519; pk=PcneEFtkmY+Ldl+KmOTpB/Q/HDsqko6Fb0/Z/5cuycI= X-Endpoint-Received: by B4 Relay for sanjayembeddedse@gmail.com/20260702 with auth_id=848 X-Original-From: Sanjay Chitroda Reply-To: sanjayembeddedse@gmail.com From: Sanjay Chitroda Convert HID IIO driver resource management to use devm-managed helpers, tying the lifetime of all resources to the device. HID trigger setup, IIO registration, and sensor hub callback resource are now managed using devm APIs. Cleanup logic previously handled explicitly in probe error and teardown paths. This simplifies the probe path by removing goto-based error handling, eliminates the remove callback entirely. Signed-off-by: Sanjay Chitroda --- drivers/iio/magnetometer/hid-sensor-magn-3d.c | 41 ++++++-----------------= ---- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/drivers/iio/magnetometer/hid-sensor-magn-3d.c b/drivers/iio/ma= gnetometer/hid-sensor-magn-3d.c index 5402cffa8326..c8b4fa7785c9 100644 --- a/drivers/iio/magnetometer/hid-sensor-magn-3d.c +++ b/drivers/iio/magnetometer/hid-sensor-magn-3d.c @@ -450,7 +450,8 @@ static int magn_3d_parse_report(struct platform_device = *pdev, /* Function to initialize the processing for usage id */ static int hid_magn_3d_probe(struct platform_device *pdev) { - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); + struct device *dev =3D &pdev->dev; + struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(dev); int ret =3D 0; static char *name =3D "magn_3d"; struct iio_dev *indio_dev; @@ -498,8 +499,8 @@ static int hid_magn_3d_probe(struct platform_device *pd= ev) =20 atomic_set(&magn_state->magn_flux_attributes.data_ready, 0); =20 - ret =3D hid_sensor_setup_trigger(indio_dev, name, - &magn_state->magn_flux_attributes); + ret =3D devm_hid_sensor_setup_trigger(dev, indio_dev, name, + &magn_state->magn_flux_attributes); if (ret < 0) { dev_err(&pdev->dev, "trigger setup failed\n"); return ret; @@ -508,38 +509,15 @@ static int hid_magn_3d_probe(struct platform_device *= pdev) magn_state->callbacks.send_event =3D magn_3d_proc_event; magn_state->callbacks.capture_sample =3D magn_3d_capture_sample; magn_state->callbacks.pdev =3D pdev; - ret =3D sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_COMPASS_3D, - &magn_state->callbacks); + ret =3D devm_sensor_hub_register_callback(dev, hsdev, + HID_USAGE_SENSOR_COMPASS_3D, + &magn_state->callbacks); if (ret < 0) { dev_err(&pdev->dev, "callback reg failed\n"); - goto error_remove_trigger; - } - - ret =3D iio_device_register(indio_dev); - if (ret) { - dev_err(&pdev->dev, "device register failed\n"); - goto error_remove_callback; + return ret; } =20 - return ret; - -error_remove_callback: - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_COMPASS_3D); -error_remove_trigger: - hid_sensor_remove_trigger(&magn_state->magn_flux_attributes); - return ret; -} - -/* Function to deinitialize the processing for usage id */ -static void hid_magn_3d_remove(struct platform_device *pdev) -{ - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); - struct iio_dev *indio_dev =3D platform_get_drvdata(pdev); - struct magn_3d_state *magn_state =3D iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_COMPASS_3D); - hid_sensor_remove_trigger(&magn_state->magn_flux_attributes); + return devm_iio_device_register(dev, indio_dev); } =20 static const struct platform_device_id hid_magn_3d_ids[] =3D { @@ -558,7 +536,6 @@ static struct platform_driver hid_magn_3d_platform_driv= er =3D { .pm =3D &hid_sensor_pm_ops, }, .probe =3D hid_magn_3d_probe, - .remove =3D hid_magn_3d_remove, }; module_platform_driver(hid_magn_3d_platform_driver); =20 --=20 2.34.1 From nobody Fri Oct 2 01:19:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 DF12847DD47; Thu, 6 Aug 2026 12:26:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019206; cv=none; b=S47SadqiSC4CNIP0SNWDE9lSNOaS8unbIWBzxiAN0NaY6c3h6X9WGRpD8ymn+60Cb11GFdJ1ALzzFmF1QfhBkS9BSLoP/G4XeQsuLGDA5Ux5Tcob6MQ9itqQw7dbOPqeTsqYKeWsvZdTesnBOF+NVjV0otGxxNlhypfODr5ehLc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019206; c=relaxed/simple; bh=1+LATJmQfGnsPHSpLjng0/+Dl6/lw5qZw/neErfDwj4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BfMXlDuCu1cQmO56hYqVVntR1mO1xSb/Vv+bvRtfMRkaoe21onRzoMwxZcuPDSBBsSOBG9RJebY6RZMyLcZU2GObUw4fCipM/sv64SvK9IOoEC0p+F4Y3fEzIcCuQFv/rfJ1wMMtJXq4MwVBMG6sRK/Sum6sQ/nMyTlVHzzC6BU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XrlemY6A; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XrlemY6A" Received: by smtp.kernel.org (Postfix) with ESMTPS id 989A1C2BCB9; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786019204; bh=1+LATJmQfGnsPHSpLjng0/+Dl6/lw5qZw/neErfDwj4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=XrlemY6AtthOmGBHlo6lIF3rlxNv14xcG5wKybg554+vxKt92QLovpLSxxltO5YDq 4HCLD37jeiycg2T+hDP6MwtJr8ju+hz38JMvHuyIJG0PL3HflZKaTLaEV8CbzeqxGR I3QYcS00d8aHX7UFYswJNkA5KmZus1SXjLZ9zIicfO4DRBkYEHK5oWxs4oPiZiJX4x 98mR4J+bHsu9LQDGGaSw+PUYOhbkgrJaDG3VwdeBN+H4xRVI2kuN9hmxfUWqcdXP0c f4Ej8Q2aVUKr0Xq/y/2B8SFq57uJ+iACkYmEz3vFkY1OCKq4/2Hx374aHHQQqsyveC BfxXsnjXfwgfg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 83517C56205; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Thu, 06 Aug 2026 17:55:56 +0530 Subject: [PATCH v5 10/13] iio: orientation: hid-sensor-incl-3d: convert probe and teardown to devm-managed resources Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-10-f1f92c1d830f@gmail.com> References: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> In-Reply-To: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jiri Kosina , Srinivas Pandruvada , Benjamin Tissoires Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sanjay Chitroda X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786019201; l=3627; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=Db8QZy6XNbEvWiQnvLmsz7HdMBrrBkrM5ikOGII6cRw=; b=u4vtChtzjG31PLfSYHpd7//v35p3JZfN0ANroW2BkOL5UmX7WXi0pjiTdMWZEFdT6Qxp1WkMV RCMBAqnWprzDEvqdqMHUSBUdRx2wm9pL943BHbZAZLI/qM6f+R5QEDC X-Developer-Key: i=sanjayembeddedse@gmail.com; a=ed25519; pk=PcneEFtkmY+Ldl+KmOTpB/Q/HDsqko6Fb0/Z/5cuycI= X-Endpoint-Received: by B4 Relay for sanjayembeddedse@gmail.com/20260702 with auth_id=848 X-Original-From: Sanjay Chitroda Reply-To: sanjayembeddedse@gmail.com From: Sanjay Chitroda Convert HID IIO driver resource management to use devm-managed helpers, tying the lifetime of all resources to the device. HID trigger setup, IIO registration, and sensor hub callback resource are now managed using devm APIs. Cleanup logic previously handled explicitly in probe error and teardown paths. This simplifies the probe path by removing goto-based error handling, eliminates the remove callback entirely. Signed-off-by: Sanjay Chitroda --- drivers/iio/orientation/hid-sensor-incl-3d.c | 42 ++++++------------------= ---- 1 file changed, 9 insertions(+), 33 deletions(-) diff --git a/drivers/iio/orientation/hid-sensor-incl-3d.c b/drivers/iio/ori= entation/hid-sensor-incl-3d.c index 435e70557721..b5f70732d035 100644 --- a/drivers/iio/orientation/hid-sensor-incl-3d.c +++ b/drivers/iio/orientation/hid-sensor-incl-3d.c @@ -293,7 +293,8 @@ static int incl_3d_parse_report(struct platform_device = *pdev, /* Function to initialize the processing for usage id */ static int hid_incl_3d_probe(struct platform_device *pdev) { - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); + struct device *dev =3D &pdev->dev; + struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(dev); int ret; static char *name =3D "incli_3d"; struct iio_dev *indio_dev; @@ -343,8 +344,8 @@ static int hid_incl_3d_probe(struct platform_device *pd= ev) =20 atomic_set(&incl_state->common_attributes.data_ready, 0); =20 - ret =3D hid_sensor_setup_trigger(indio_dev, name, - &incl_state->common_attributes); + ret =3D devm_hid_sensor_setup_trigger(dev, indio_dev, name, + &incl_state->common_attributes); if (ret) { dev_err(&pdev->dev, "trigger setup failed\n"); return ret; @@ -353,39 +354,15 @@ static int hid_incl_3d_probe(struct platform_device *= pdev) incl_state->callbacks.send_event =3D incl_3d_proc_event; incl_state->callbacks.capture_sample =3D incl_3d_capture_sample; incl_state->callbacks.pdev =3D pdev; - ret =3D sensor_hub_register_callback(hsdev, - HID_USAGE_SENSOR_INCLINOMETER_3D, - &incl_state->callbacks); + ret =3D devm_sensor_hub_register_callback(dev, hsdev, + HID_USAGE_SENSOR_INCLINOMETER_3D, + &incl_state->callbacks); if (ret) { dev_err(&pdev->dev, "callback reg failed\n"); - goto error_remove_trigger; - } - - ret =3D iio_device_register(indio_dev); - if (ret) { - dev_err(&pdev->dev, "device register failed\n"); - goto error_remove_callback; + return ret; } =20 - return 0; - -error_remove_callback: - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_INCLINOMETER_3D); -error_remove_trigger: - hid_sensor_remove_trigger(&incl_state->common_attributes); - return ret; -} - -/* Function to deinitialize the processing for usage id */ -static void hid_incl_3d_remove(struct platform_device *pdev) -{ - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); - struct iio_dev *indio_dev =3D platform_get_drvdata(pdev); - struct incl_3d_state *incl_state =3D iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_INCLINOMETER_3D); - hid_sensor_remove_trigger(&incl_state->common_attributes); + return devm_iio_device_register(dev, indio_dev); } =20 static const struct platform_device_id hid_incl_3d_ids[] =3D { @@ -404,7 +381,6 @@ static struct platform_driver hid_incl_3d_platform_driv= er =3D { .pm =3D &hid_sensor_pm_ops, }, .probe =3D hid_incl_3d_probe, - .remove =3D hid_incl_3d_remove, }; module_platform_driver(hid_incl_3d_platform_driver); =20 --=20 2.34.1 From nobody Fri Oct 2 01:19:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 CF5E547CC97; Thu, 6 Aug 2026 12:26:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019205; cv=none; b=OgW5VbKme5LlkfQBaEnJY4nQlyEZ5HYVlpzh+a1YxwnyFmOkbcO/HvMFXkjz5uIGg8bZz0uS25LTthnnKWmOfzcswd/9u0VgTPHSF383IxOFXVt/o4GqWorQcX67uJddK/SEAQTXLHRBS5POXHAx53IvWuvowUNQdDE0tIOUcHE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019205; c=relaxed/simple; bh=C1GqCMMKb48DecNRwGf3L/dSBBcDqYr6g0ke2uxiX4M=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GfcgpIVKVWHCYvJlhvOtHoDYD1QcZ0W+tknueZHbnYANe3BHzUzmTow1hswh63NwfUUPRvtSPP8BI5Qq3JYzcNS+xaaLD+FDfWzJRduaLPooEeOVh7eryQf1z8NNZxZumptLAV/N0yGgwN6UhbY5ygOX89eiF2rJJ2UvRT8jDcs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=YzNert9h; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="YzNert9h" Received: by smtp.kernel.org (Postfix) with ESMTPS id B1E64C2BCFA; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786019204; bh=C1GqCMMKb48DecNRwGf3L/dSBBcDqYr6g0ke2uxiX4M=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=YzNert9h8bAGynBNa3Rfwa7T+/XRZr7U8e7S5rPKQFWbHC+qefT31Vob3y+Vl/1S/ XLEK/jDUYGRgYqYSSLgi4/ah/AXUAzCEQuas9Itu0UV++lndWNNVS6UTg3J3E48mnH oSkwGptZMTPL8rh7bIqTsSsa09GnMp8mQmiX97LexB5rSoc1xb+HLW55APLRnwqfWx 3o3tabrLUer6kejjXROhx/Jj6h1W7VwGD9n1BGBQdHurum2lu/c1A4VIic96toRag9 Ox1Bx9dUZuGAtShw8rNXCRZOO3rIuAuKkx6TBnTaJVbzH0SKHblcn/uszfjXtICPyj wZ4IiTS4RBd+A== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9CB0BC5AC7A; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Thu, 06 Aug 2026 17:55:57 +0530 Subject: [PATCH v5 11/13] iio: orientation: hid-sensor-rotation: convert probe and teardown to devm-managed resources Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-11-f1f92c1d830f@gmail.com> References: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> In-Reply-To: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jiri Kosina , Srinivas Pandruvada , Benjamin Tissoires Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sanjay Chitroda X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786019201; l=3506; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=BDVC86SZvqLOX2iVvgiEQXnwTwUQvLH+wAp8Ce5SNu8=; b=POpxieaUSfErrLm07+SE0/fFgAB6I9DGXqqZuytIsGxlSKHqjDh7kp0seki4jebEjmbTopDwf TqnXkUZ1F4qBQYNt5gotKr4GdKirpcx4L2y23OzsRL2sA4OiWVJxsIr X-Developer-Key: i=sanjayembeddedse@gmail.com; a=ed25519; pk=PcneEFtkmY+Ldl+KmOTpB/Q/HDsqko6Fb0/Z/5cuycI= X-Endpoint-Received: by B4 Relay for sanjayembeddedse@gmail.com/20260702 with auth_id=848 X-Original-From: Sanjay Chitroda Reply-To: sanjayembeddedse@gmail.com From: Sanjay Chitroda Convert HID IIO driver resource management to use devm-managed helpers, tying the lifetime of all resources to the device. HID trigger setup, IIO registration, and sensor hub callback resource are now managed using devm APIs. Cleanup logic previously handled explicitly in probe error and teardown paths. This simplifies the probe path by removing goto-based error handling, eliminates the remove callback entirely. Signed-off-by: Sanjay Chitroda --- drivers/iio/orientation/hid-sensor-rotation.c | 40 ++++++-----------------= ---- 1 file changed, 8 insertions(+), 32 deletions(-) diff --git a/drivers/iio/orientation/hid-sensor-rotation.c b/drivers/iio/or= ientation/hid-sensor-rotation.c index 67ffa4f4075e..3ef89d66a88f 100644 --- a/drivers/iio/orientation/hid-sensor-rotation.c +++ b/drivers/iio/orientation/hid-sensor-rotation.c @@ -265,7 +265,8 @@ static int dev_rot_parse_report(struct platform_device = *pdev, /* Function to initialize the processing for usage id */ static int hid_dev_rot_probe(struct platform_device *pdev) { - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); + struct device *dev =3D &pdev->dev; + struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(dev); int ret; char *name; struct iio_dev *indio_dev; @@ -320,8 +321,8 @@ static int hid_dev_rot_probe(struct platform_device *pd= ev) =20 atomic_set(&rot_state->common_attributes.data_ready, 0); =20 - ret =3D hid_sensor_setup_trigger(indio_dev, name, - &rot_state->common_attributes); + ret =3D devm_hid_sensor_setup_trigger(dev, indio_dev, name, + &rot_state->common_attributes); if (ret) { dev_err(&pdev->dev, "trigger setup failed\n"); return ret; @@ -330,38 +331,14 @@ static int hid_dev_rot_probe(struct platform_device *= pdev) rot_state->callbacks.send_event =3D dev_rot_proc_event; rot_state->callbacks.capture_sample =3D dev_rot_capture_sample; rot_state->callbacks.pdev =3D pdev; - ret =3D sensor_hub_register_callback(hsdev, hsdev->usage, - &rot_state->callbacks); + ret =3D devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage, + &rot_state->callbacks); if (ret) { dev_err(&pdev->dev, "callback reg failed\n"); - goto error_remove_trigger; - } - - ret =3D iio_device_register(indio_dev); - if (ret) { - dev_err(&pdev->dev, "device register failed\n"); - goto error_remove_callback; + return ret; } =20 - return 0; - -error_remove_callback: - sensor_hub_remove_callback(hsdev, hsdev->usage); -error_remove_trigger: - hid_sensor_remove_trigger(&rot_state->common_attributes); - return ret; -} - -/* Function to deinitialize the processing for usage id */ -static void hid_dev_rot_remove(struct platform_device *pdev) -{ - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); - struct iio_dev *indio_dev =3D platform_get_drvdata(pdev); - struct dev_rot_state *rot_state =3D iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - sensor_hub_remove_callback(hsdev, hsdev->usage); - hid_sensor_remove_trigger(&rot_state->common_attributes); + return devm_iio_device_register(dev, indio_dev); } =20 static const struct platform_device_id hid_dev_rot_ids[] =3D { @@ -388,7 +365,6 @@ static struct platform_driver hid_dev_rot_platform_driv= er =3D { .pm =3D &hid_sensor_pm_ops, }, .probe =3D hid_dev_rot_probe, - .remove =3D hid_dev_rot_remove, }; module_platform_driver(hid_dev_rot_platform_driver); =20 --=20 2.34.1 From nobody Fri Oct 2 01:19:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E54C847A86C; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019205; cv=none; b=uN+ByH0b6OjgjKKevXIuJU1o48Wz8jXqzApn0loo3L5yEY02KvMtHMeMyQi9SyokzdPTpQHqxy1xX5BcPWF/dzipO5hRTc4WniLv2iT8pTGYNpu5UNaKey2rtd5R+/fiBt7vD8Pu2kJ6BYZMmZDtDiiJAHbWUAEdmAOpdVL3agk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019205; c=relaxed/simple; bh=d0a1H9PELbVmQhNglK5y5FtIcmnFR2yg9BW8d3/JhTY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eP5Nbbop4d5ULJ+7ZDvgzLb19LKDHc6JCHO0I8DYfWCr3AVDKUvLHDv9ME/GmUcXj2XJppj0Ez5dXrDjNdJijOyU7EPy1w2VOstWR/ilSNrvQ/3fVGUt85bKEkDg/UgkSCTxXhhlMTMTdnwyW07tP6HLCDyoHEu5oko/0g/BkIc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=GP5AsiyJ; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="GP5AsiyJ" Received: by smtp.kernel.org (Postfix) with ESMTPS id C976FC2BCC7; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786019204; bh=d0a1H9PELbVmQhNglK5y5FtIcmnFR2yg9BW8d3/JhTY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=GP5AsiyJtxfXyd+36tOMhpKyOHictjJQtRSRU0RzjFlpCxgu0a9jTd58lT8pJR24/ /V43PKpQ4wVhH2VqrEr/lQpkxqLgFWtO5QYw4Doudwo8cNZY7pnMyPQS9h8UNVzxg+ lQ5xp55LygwFHIgJb5BmQWrOMryg0Gye9ZO9Cl1wF33bQsuDWYkXwuivn70rYOkzWv +KmoRe9MTDcby7NuCuiV8tU1xIthI+oGzikNl38QoH6bZE4x2FP90ab85JRpSCmnjQ TJevYO/NxP9fWmOo5KyuOZhE9PKZV3MMsfWeT8EMEULB0jJ+sHMq2G7+mjawcb6kOU qJyebnsMqiJgg== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id B4F2EC56208; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Thu, 06 Aug 2026 17:55:58 +0530 Subject: [PATCH v5 12/13] iio: position: hid-sensor-custom-intel-hinge: convert probe and teardown to devm-managed resources Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-12-f1f92c1d830f@gmail.com> References: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> In-Reply-To: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jiri Kosina , Srinivas Pandruvada , Benjamin Tissoires Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sanjay Chitroda X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786019201; l=3491; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=i4Tkmjvqq1X1HXfT1Ajunvn9KfzjkXAM5FZZp1If76U=; b=g9Qs3oAR/8y07kBUhgIdBKN8jyEfSALZp3YeMKjflozG38xbGe7blLrKmZsxHls9w8o7LxIui ZhXklD+Qdy8BwvaT+ZOt9nPlHksb7doMYNwPPVgDePCVJVUjWy/9TTG X-Developer-Key: i=sanjayembeddedse@gmail.com; a=ed25519; pk=PcneEFtkmY+Ldl+KmOTpB/Q/HDsqko6Fb0/Z/5cuycI= X-Endpoint-Received: by B4 Relay for sanjayembeddedse@gmail.com/20260702 with auth_id=848 X-Original-From: Sanjay Chitroda Reply-To: sanjayembeddedse@gmail.com From: Sanjay Chitroda Convert HID IIO driver resource management to use devm-managed helpers, tying the lifetime of all resources to the device. HID trigger setup, IIO registration, and sensor hub callback resource are now managed using devm APIs. Cleanup logic previously handled explicitly in probe error and teardown paths. This simplifies the probe path by removing goto-based error handling, eliminates the remove callback entirely. Signed-off-by: Sanjay Chitroda --- .../iio/position/hid-sensor-custom-intel-hinge.c | 38 ++++--------------= ---- 1 file changed, 7 insertions(+), 31 deletions(-) diff --git a/drivers/iio/position/hid-sensor-custom-intel-hinge.c b/drivers= /iio/position/hid-sensor-custom-intel-hinge.c index 7f6186fea004..101d84b533c9 100644 --- a/drivers/iio/position/hid-sensor-custom-intel-hinge.c +++ b/drivers/iio/position/hid-sensor-custom-intel-hinge.c @@ -263,7 +263,8 @@ static int hinge_parse_report(struct platform_device *p= dev, /* Function to initialize the processing for usage id */ static int hid_hinge_probe(struct platform_device *pdev) { - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); + struct device *dev =3D &pdev->dev; + struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(dev); struct hinge_state *st; struct iio_dev *indio_dev; int ret; @@ -310,8 +311,8 @@ static int hid_hinge_probe(struct platform_device *pdev) indio_dev->modes =3D INDIO_DIRECT_MODE; =20 atomic_set(&st->common_attributes.data_ready, 0); - ret =3D hid_sensor_setup_trigger(indio_dev, indio_dev->name, - &st->common_attributes); + ret =3D devm_hid_sensor_setup_trigger(dev, indio_dev, indio_dev->name, + &st->common_attributes); if (ret < 0) { dev_err(&pdev->dev, "trigger setup failed\n"); return ret; @@ -320,37 +321,13 @@ static int hid_hinge_probe(struct platform_device *pd= ev) st->callbacks.send_event =3D hinge_proc_event; st->callbacks.capture_sample =3D hinge_capture_sample; st->callbacks.pdev =3D pdev; - ret =3D sensor_hub_register_callback(hsdev, hsdev->usage, &st->callbacks); + ret =3D devm_sensor_hub_register_callback(dev, hsdev, hsdev->usage, &st->= callbacks); if (ret < 0) { dev_err(&pdev->dev, "callback reg failed\n"); - goto error_remove_trigger; - } - - ret =3D iio_device_register(indio_dev); - if (ret) { - dev_err(&pdev->dev, "device register failed\n"); - goto error_remove_callback; + return ret; } =20 - return ret; - -error_remove_callback: - sensor_hub_remove_callback(hsdev, hsdev->usage); -error_remove_trigger: - hid_sensor_remove_trigger(&st->common_attributes); - return ret; -} - -/* Function to deinitialize the processing for usage id */ -static void hid_hinge_remove(struct platform_device *pdev) -{ - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); - struct iio_dev *indio_dev =3D platform_get_drvdata(pdev); - struct hinge_state *st =3D iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - sensor_hub_remove_callback(hsdev, hsdev->usage); - hid_sensor_remove_trigger(&st->common_attributes); + return devm_iio_device_register(dev, indio_dev); } =20 static const struct platform_device_id hid_hinge_ids[] =3D { @@ -369,7 +346,6 @@ static struct platform_driver hid_hinge_platform_driver= =3D { .pm =3D &hid_sensor_pm_ops, }, .probe =3D hid_hinge_probe, - .remove =3D hid_hinge_remove, }; module_platform_driver(hid_hinge_platform_driver); =20 --=20 2.34.1 From nobody Fri Oct 2 01:19:58 2026 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 E4E0847DD4B; Thu, 6 Aug 2026 12:26:45 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019206; cv=none; b=n65pBFA+0CibRO/dkC9luAwwHEHCwIfv+zMAjsI/FlD9KD2MKBGfml53s2N8l47GurUHIxGcuaj5k3ImE/oSOKGXn49mZPXWclO6WAzzhrb32Pv0DiVENMwDh2ZxpdXrl3gGHbp0YvPdp0fKs0n6aTJB1c7KW0OVBmzoYydNFWw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1786019206; c=relaxed/simple; bh=HIza9tj31a3mKUDaV4RrpZ7yKRed7YCVQhRCqLix2bc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=YetiNYPHffRdxZn7DF3+UKycNHYiac2K3fL6Nj07+sPsRaBzprOs7DQH0z+4pMaKWs1argEXP8cD6FMoBmnL1nJhbHCqvJZHmVz3cVTUef4AENQroHPArXLAXEg7AUwGmrhDkU1jf87SRE6TBfGMT5B4OxrAL+a3tF1v4OBpINQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=r2Cid4Cy; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="r2Cid4Cy" Received: by smtp.kernel.org (Postfix) with ESMTPS id E0C7CC2BCF7; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1786019204; bh=HIza9tj31a3mKUDaV4RrpZ7yKRed7YCVQhRCqLix2bc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=r2Cid4CyhP4Ua9WPLmHig5zSE9rTaJ6tSBf8TlobYmSNQlswC6ZK8JRce428/f1F6 B7qujg7ZMhV2ui8DDrDNkK59qgj9ihmKCti2dVBDh/Vrrc4Zk1M5ZchDQP5JCFHIIB USXEq7/aGymAO2PgpcwW9p6/ozYwcBuWsWVo6jNreEnSJwOfIMIRRXA5un/1WbcESi gSVW+Gv0LlZAliRwgUh+erewxLCc7L3wJ5rSobbUG4RePB742rdN1x6++nv3yFivxb C3yW+jXmtod6jjIhS0dKMVdwnf0fFZdtXSRtE3meCJKlHtoAt+AFyZDB/y/jNr47W0 YpMBUoYuAKUfA== Received: from aws-us-west-2-korg-lkml-1.web.codeaurora.org (localhost.localdomain [127.0.0.1]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB6BEC5AC7A; Thu, 6 Aug 2026 12:26:44 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Thu, 06 Aug 2026 17:55:59 +0530 Subject: [PATCH v5 13/13] iio: pressure: hid-sensor-press: convert probe and teardown to devm-managed resources Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-13-f1f92c1d830f@gmail.com> References: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> In-Reply-To: <20260806-28-apr-iio-redundant-argument-v5-temp-v5-0-f1f92c1d830f@gmail.com> To: Jonathan Cameron , David Lechner , =?utf-8?q?Nuno_S=C3=A1?= , Andy Shevchenko , Jiri Kosina , Srinivas Pandruvada , Benjamin Tissoires Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-input@vger.kernel.org, Sanjay Chitroda X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1786019201; l=3567; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=7y381boWRDonXbz69DqfU+M5uO8NaOORx2X9lVUSvzQ=; b=VbJXO2qfYqwuadYA/xMfWfNI/w8vbPxCxiUlguopP/lJvDSsVzsXyCP/0jU+8Lr0kYKUr7wA1 PwbpgjMSEIaDd5RE7dMwP6dd4fnZMDH5B5nygzhxcaaYvSXLTyhF/OZ X-Developer-Key: i=sanjayembeddedse@gmail.com; a=ed25519; pk=PcneEFtkmY+Ldl+KmOTpB/Q/HDsqko6Fb0/Z/5cuycI= X-Endpoint-Received: by B4 Relay for sanjayembeddedse@gmail.com/20260702 with auth_id=848 X-Original-From: Sanjay Chitroda Reply-To: sanjayembeddedse@gmail.com From: Sanjay Chitroda Convert HID IIO driver resource management to use devm-managed helpers, tying the lifetime of all resources to the device. HID trigger setup, IIO registration, and sensor hub callback resource are now managed using devm APIs. Cleanup logic previously handled explicitly in probe error and teardown paths. This simplifies the probe path by removing goto-based error handling, eliminates the remove callback entirely. Signed-off-by: Sanjay Chitroda --- drivers/iio/pressure/hid-sensor-press.c | 41 ++++++++---------------------= ---- 1 file changed, 9 insertions(+), 32 deletions(-) diff --git a/drivers/iio/pressure/hid-sensor-press.c b/drivers/iio/pressure= /hid-sensor-press.c index 4e0f42fefd6b..8ebb8f54a0cb 100644 --- a/drivers/iio/pressure/hid-sensor-press.c +++ b/drivers/iio/pressure/hid-sensor-press.c @@ -230,7 +230,8 @@ static int press_parse_report(struct platform_device *p= dev, /* Function to initialize the processing for usage id */ static int hid_press_probe(struct platform_device *pdev) { - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); + struct device *dev =3D &pdev->dev; + struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(dev); int ret =3D 0; static const char *name =3D "press"; struct iio_dev *indio_dev; @@ -278,8 +279,8 @@ static int hid_press_probe(struct platform_device *pdev) =20 atomic_set(&press_state->common_attributes.data_ready, 0); =20 - ret =3D hid_sensor_setup_trigger(indio_dev, name, - &press_state->common_attributes); + ret =3D devm_hid_sensor_setup_trigger(dev, indio_dev, name, + &press_state->common_attributes); if (ret) { dev_err(&pdev->dev, "trigger setup failed\n"); return ret; @@ -288,38 +289,15 @@ static int hid_press_probe(struct platform_device *pd= ev) press_state->callbacks.send_event =3D press_proc_event; press_state->callbacks.capture_sample =3D press_capture_sample; press_state->callbacks.pdev =3D pdev; - ret =3D sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_PRESSURE, - &press_state->callbacks); + ret =3D devm_sensor_hub_register_callback(dev, hsdev, + HID_USAGE_SENSOR_PRESSURE, + &press_state->callbacks); if (ret < 0) { dev_err(&pdev->dev, "callback reg failed\n"); - goto error_remove_trigger; - } - - ret =3D iio_device_register(indio_dev); - if (ret) { - dev_err(&pdev->dev, "device register failed\n"); - goto error_remove_callback; + return ret; } =20 - return ret; - -error_remove_callback: - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_PRESSURE); -error_remove_trigger: - hid_sensor_remove_trigger(&press_state->common_attributes); - return ret; -} - -/* Function to deinitialize the processing for usage id */ -static void hid_press_remove(struct platform_device *pdev) -{ - struct hid_sensor_hub_device *hsdev =3D dev_get_platdata(&pdev->dev); - struct iio_dev *indio_dev =3D platform_get_drvdata(pdev); - struct press_state *press_state =3D iio_priv(indio_dev); - - iio_device_unregister(indio_dev); - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_PRESSURE); - hid_sensor_remove_trigger(&press_state->common_attributes); + return devm_iio_device_register(dev, indio_dev); } =20 static const struct platform_device_id hid_press_ids[] =3D { @@ -338,7 +316,6 @@ static struct platform_driver hid_press_platform_driver= =3D { .pm =3D &hid_sensor_pm_ops, }, .probe =3D hid_press_probe, - .remove =3D hid_press_remove, }; module_platform_driver(hid_press_platform_driver); =20 --=20 2.34.1