From nobody Thu Sep 24 22:21:45 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 A7D1B41BA61; Sat, 19 Sep 2026 10:36:41 +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=1789814201; cv=none; b=eZN89Ur28lCiLON10UDEimLhi66KztW8lj6/0HhhLQ3LEGC1uOmPtrHLfGVFNVr8aZFuHSqbM1FgHbLISqtuTqjdhoJKfGr+WtPc1do+/z8nY2yHsHGApMHPOxGYc0DWXnbsTTgRK5mp8V7QVhONT+JIFW2zid8MCaGKfYR3xEY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814201; c=relaxed/simple; bh=O18yStyg+0jNECHbzI7lZrOLeUlr97Gg6Elbukf+wsg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eofcQEEvapTnNzN8ojKtZ8nSQ5vb6O/fKb1VctGUECjA1dAAQ8vvxoh/CDOE3mOXDHMwRxRBqSkccAMCI9SokWdrYT6ZbUe3wOqnKjeMzNMoJQSBUETsyi/WNRjJDy0wQy4ET0y9vNU3goMKe5ZQCirDBs2epEFkVYJwGbB/gQc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Vm1+AiEL; 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="Vm1+AiEL" Received: by smtp.kernel.org (Postfix) with ESMTPS id 4F2CDC2BCF7; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814201; bh=O18yStyg+0jNECHbzI7lZrOLeUlr97Gg6Elbukf+wsg=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Vm1+AiELKlURFtE1Vcnis2l8fRFu2AZhjt5keEsq0XGF68uhq26KIMGLWxL3nhbpg hNR11PCgnBr1EbMvecDfGvvOssHGDv+59GidX0fl9p7PXzRYszOPrBtiC2qZnq8j3i /Siy7X1l6arYdjcgYkhpTmQaxU/PwqfrcgKDx8rSxSU2xcY0O9XGuPS9DgRaYNyjk4 zETgyDM0i5MApxjUMAuGq3fJ2hu1eVIiJ2h0pcPzqv/q24C78XE4O4ueWQL+Dde3H/ lpyOtkCCL0r3v3GGZ9GtlEKCJk/El26yyAKX2/izned5a9ZC8g95S9kAsoutjacaKL XcNg2GfUcp1sQ== 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 2F554C982D7; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:24 +0530 Subject: [PATCH v6 01/14] 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-1-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=13391; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=/4a5XvzrGD9qk7leUse+2qSMDRnCzVYVj5HBL01UAGE=; b=8K83Jpici1fTya4Cyg6/HFMKUhWb2HT1DNITu/LBI1jJDVHKFO89+gzco83Q4hjlfGscI7rE6 HbKD3nxfb82DZ2xZJtVn30qpjEi2LwJFMWQVZSYJNulNIIpdofT4V/o 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 f8c98f866cb0..061d76310fed 100644 --- a/drivers/iio/orientation/hid-sensor-rotation.c +++ b/drivers/iio/orientation/hid-sensor-rotation.c @@ -384,7 +384,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 @@ -397,7 +397,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 5e3262e461f4..aa5a2b872247 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 @@ -265,7 +265,7 @@ static void hid_temperature_remove(struct platform_devi= ce *pdev) =20 iio_device_unregister(indio_dev); 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 Thu Sep 24 22:21:45 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 A7C77403E8C; Sat, 19 Sep 2026 10:36:41 +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=1789814201; cv=none; b=ctz0PeeHoJrQ639uLsNlzFDgQrIWSuuw7cAXMMlQyGXuQdGhTy4kz99FDUoPpeHfw8wPcBCQH8VoU3WgNFuQlBwzoyZ5AcKNvGUybBfyg0CAQHpjX6MCZi6SKs5J6XL+l1hB6y1aFBGnumw5s/fJxOvasOhqj4lhu8LUjy1gbeo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814201; c=relaxed/simple; bh=G5ZjpCMc41koCIu50EVHnP0iTN4/vsCvxrW/ycokfzA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=onrqQnYQ4xSRX3OHmBnWyKT5dzi8E6NngmYk9lNxINcMQI4UzmEYueC3VTGRd1X8S4PBiRjJIop2/0BIu2TDy+RdXei/klrgGeFxl6RL15SO8GRaMYVWKQW/v+x6iiUTA66dlUkeJNfMVoT169dU7xE1eQj6ObPoS/EPz/pAPRU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=qK6Fkrmt; 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="qK6Fkrmt" Received: by smtp.kernel.org (Postfix) with ESMTPS id 5FEECC2BCF6; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814201; bh=G5ZjpCMc41koCIu50EVHnP0iTN4/vsCvxrW/ycokfzA=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=qK6Fkrmtnw9VIpsLO4mOJiiIORJoKMXrwiY5WmHFoYbY48H8mYB5nUy+BLzqxVNO4 eosglfqnKwXcpYuRzC2arjZPv+EBEpfcVHTQLm28poF1efXPz4e4UZBt/W58MzwXzy Xv4M14vmMR/MC+3gM31DOKFyMgbalUHTXAuiFDvTKpM2E8UNwkmO+NWSgCwsZlldug Q4jYZ7+PRLrtBgfLtBM2qYVW1tXBzUAdo6DYJ8Ab3/GHiKZZBVgMS5LDhWtEfywe4e CUk2g1AibW2MkdWqwIDHorC3zK3oVNKNUzl6OtPfFT1fz7D/8oLyV+0qmIgFpoDs01 0oMv88AWEQ7iw== 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 3EFBBC982CC; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:25 +0530 Subject: [PATCH v6 02/14] 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-2-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=2481; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=XJmRzPXaqhKqM4yIeSm5h1wY7VWEZl4o+Whwft4tGS0=; b=BXwiz67+9jDaGglzVLl6dzedMzSitLjFkaJLSbzCGi14P0Mq8uRfM/tYppwyWbZ+pRWDTPMyE oXr1WVgC4SoBM8BC2AzoN6DRhnb1C2quXz3Tfwz1bST/7lSFkZo19mx 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 Thu Sep 24 22:21:45 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 ACEC445FFC7; Sat, 19 Sep 2026 10:36:41 +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=1789814201; cv=none; b=LYG3/zOmcDC5+TNEKx6CM/1ml83gb4qa3FMP2RomupTu+C5qAkkzhxKCOSIt5QqR9wXvyhBqJFk5SCiUPhMfPJPA0ggXH/r/vnPunHeG7pTOcAcuXJhtXB+zjjs0Y5FSoBf2oMxDkhgQp5bqnIc34GHTQBnG/SBCBRLVevT43Tk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814201; c=relaxed/simple; bh=IjMjUWNEXRYY5wqfhnqbc8zWKm02QgkN8rTn6nVz9QQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VObveLcv4T2G1Es1GQ6YYAiZsrhfpjFBnP+jACwscAGM8hOdmcs2+3Gbzx33w/HNw519scExbxlJ5W2FgR3f0idKIyTbSUBAvHyLAyEz/oYR5XSb9Qif+oVVNhbdafXUj/E0v8VhSJz7FgJDBGWDXNC8YtPTQlzZUDQyPsCt+4s= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Grn/WMT9; 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="Grn/WMT9" Received: by smtp.kernel.org (Postfix) with ESMTPS id 68F04C2BCFB; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814201; bh=IjMjUWNEXRYY5wqfhnqbc8zWKm02QgkN8rTn6nVz9QQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Grn/WMT9aPzecaw+VM3dnAj1M2N6fSkUd5fw40YnkIy/lfEs3OdeXmX8h1sMWLEsk DQQweohySnyXzqxyelfcRp4MmBl0eLdWc/LgkK8MSitQsKfmPRXVfP3n7XGE8l5dut 6MyDBTuw2DaOwsrAK/NFahbikv48KvoFM+Lpg4pJQF/IxGK9zTTILeojsOD5Ad9z2I Zox0nU075XHuyNA8erdI3ytZ+y7jvQDy384a6U9qm5tOo0xrXwx8PSXk6rjCBTEQNy PAedGm0eVaELLn11+2RN9Ac+0AmovzmcRlV0/nmvJ788qtIMercqEAvZs09LvLQjVZ E+Q3nLYasIKOw== 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 4E05FC982E6; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:26 +0530 Subject: [PATCH v6 03/14] 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-3-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=4401; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=X2I8hMTXE1/MLkTlWKifhsxsUQ6NP23KYfZXkjSBpog=; b=ZRinwmoJCRG3gJ5kdyYLdZx5Ac9AWx2SXTQZlP+Zocimt/3x9g7z6i7rH/heYcWUzk+aKvSEv d/WJO12XC4jDC/ztCQSZfhJBrSe/CAURBRv9K1LIyL0dGPp8e8sx+H8 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 resources with devres framework and helper API. Suggested-by: Jonathan Cameron Signed-off-by: Sanjay Chitroda --- Changes in v6: - Add kernel-doc for return statement for the new devm_*() API, as suggested by Andy. - Keep kernel-doc for new devm_*() API in public header file, along side where existing API documentation is available. - With suggestion/input from Jonathan, use devres and cleanup frameworks together to implement device managed API support with less complexity. --- drivers/hid/hid-sensor-hub.c | 35 +++++++++++++++++++++++++++++++++++ include/linux/hid-sensor-hub.h | 26 ++++++++++++++++++++++++++ 2 files changed, 61 insertions(+) diff --git a/drivers/hid/hid-sensor-hub.c b/drivers/hid/hid-sensor-hub.c index 6470a290ebfc..de35e72b4d88 100644 --- a/drivers/hid/hid-sensor-hub.c +++ b/drivers/hid/hid-sensor-hub.c @@ -4,7 +4,9 @@ * Copyright (c) 2012, Intel Corporation. */ =20 +#include #include +#include #include #include #include @@ -187,6 +189,39 @@ int sensor_hub_remove_callback(struct hid_sensor_hub_d= evice *hsdev, } EXPORT_SYMBOL_GPL(sensor_hub_remove_callback); =20 +DEFINE_FREE(devres_free, struct sensor_hub_cb_devres *, if (_T) devres_fre= e(_T)) + +static void devm_sensor_hub_remove_callback(struct device *dev, void *res) +{ + struct sensor_hub_cb_devres *dr =3D res; + + sensor_hub_remove_callback(dr->hsdev, dr->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 *dr __free(devres_free) =3D NULL; + int ret; + + dr =3D devres_alloc(devm_sensor_hub_remove_callback, sizeof(*dr), GFP_KER= NEL); + if (!dr) + return -ENOMEM; + + ret =3D sensor_hub_register_callback(hsdev, usage_id, usage_callback); + if (ret) + return ret; + + dr->hsdev =3D hsdev; + dr->usage_id =3D usage_id; + devres_add(dev, no_free_ptr(dr)); + + return 0; +} +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 ab5cc8db3fbb..aa4ff9a95d86 100644 --- a/include/linux/hid-sensor-hub.h +++ b/include/linux/hid-sensor-hub.h @@ -79,6 +79,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. @@ -143,6 +153,22 @@ 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. + + * Return: 0 on success, negative error code on failure. + */ +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 Thu Sep 24 22:21:45 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 B721A46E01D; Sat, 19 Sep 2026 10:36:41 +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=1789814201; cv=none; b=qemfYDjTotRUxQJpoC8E6nCvyIZrNPzgk2geqWwx0gWzrKbI29oyqAWAZ9m8TxPNTxWD01JJYtyGLlKyz9/d6dzrgqb90jdaRTHHWjnV+0OWNVyK1zx15YIsHogcVKkQIptLkvgIdZKdtdxXp2qItldr6J1gx/PiC07bv7rAgts= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814201; c=relaxed/simple; bh=XodsOen8Wvzg78o0lwyC8zvGmdjAid2TnVU+SOWZRpc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ph8PL3tks+WX7Ta4ymjBqdNjc7lsXeM2CTic8yDnUQrcrWQsE7Xd1+RxSf2LDe0bWrpaep/6tmYyLqZeUWZiiswgiiLvpqPsh8o2YCzyIbjGoWH/pq+HtXN3f1stRhnfp/EhtDjFQgK7HL2tcLpjRoHI0g1ZRlsQrLk5q3fqJUo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Kx3OuD5v; 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="Kx3OuD5v" Received: by smtp.kernel.org (Postfix) with ESMTPS id 714E5C2BCFA; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814201; bh=XodsOen8Wvzg78o0lwyC8zvGmdjAid2TnVU+SOWZRpc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Kx3OuD5vRMrZwKoxv9tBU4hJ0rTG+SrzvM1Ee8R2J3Jb4xPunHfRBblDnbzLh7I32 ZmVKLtCKHJz5jbt0FmPISr8yPG6FPhaRDujZ3Muw6L8clOGZlBgKbJx7VnTTZV7A1Q Dd+B2RbuI31E+2M6b4znOKarmG5ntn01Ag67Fr8qJ0CH5spFy9DM/A+AFL5keOsgBm oKs45jHs5r8wrpxsHU7+j8y3wZUY6HlJ/07U0HZCwK5IJM64sVYBnjkGCBt37ygMQU xZc7a6akUUvCEyLPp1bJRWVfIaF/ehggvEoU6on2/PnAqq943P4yjkZrs5eOBhQcNS T4dNw8JddD1Gg== 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 5C949C982E1; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:27 +0530 Subject: [PATCH v6 04/14] 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-4-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=3576; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=93lHICIbaqkhzBStetBiddfJA0a+d0oJo1BZpquDDZw=; b=iqUP65IV4DsV+LnMmt4WQkl8bdKamEaGRfTjwD+fxuLAWJMJePg4PGF4UAsz7aVh0ForRfDQY DaazhDlZUvsB2C5Zo+1rBSWYpDnqQdXeLklZOtxJpMw1DOYen2u0A5l 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 Thu Sep 24 22:21:45 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 BFB2046F482; Sat, 19 Sep 2026 10:36:41 +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=1789814201; cv=none; b=Lh1BaMti9Nx66WrXGLqgiZzwwOPuMdmKpAKyi6+FZLW4AtnbryVkpRjfnriuZ9xzATSrLsISlwsSggciwTM3nnDESLOzOC5PVCY9QrCoa2Yy8g5g7JuasvbklalrHORGUf4f4stB1aYM0X1/uGYL67t9OdTcmMNJPv01uJiIYjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814201; c=relaxed/simple; bh=tq/IbJVpEbqrjPtNTxWQz6KzoyoryI8jJvw3bm2ttI4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=KE6k+MP6jDvAw+rAJv2IP1BHkSR63epUEwfcBI9D5KrxgtMjDjszaTKpTW/u+uC6E6VdF4STFUfnXzluf2avdmeJ5X/MgZA4iCmVFzOsIvgZ45akpe6NjJapckeXSwFYxY0Yx1cN9jnUhSxNgQF76VyisImALbX8ZKGY2aMrBdg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=CekYx+Gs; 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="CekYx+Gs" Received: by smtp.kernel.org (Postfix) with ESMTPS id 7F6A4C2BD04; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814201; bh=tq/IbJVpEbqrjPtNTxWQz6KzoyoryI8jJvw3bm2ttI4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=CekYx+GsLwXyGPOpgIuMC9CcVnfK5w1132AN4dP/ugOlIxFOmQacYd+YULpOCmNV4 DNe95Gwm5AhMFuwb18mayVZVSRH1tYClC2VK8nCuWkunlraxFDBa/DNqAtsine/Jkw OifOgigKVaxZHIIYfKGL5/XZkk3e/KYCTHGs7jDSlrLQ3Pht2sTebGXaqhCAofl0WW 010pkFjvhZX7dkeccYRJu52iicfIPknQ1mfWWhbb3gm7UVVJYUKAZg8SV3av9p9wYP rHsO5NCfNFuzrPNcDuQ4vydvBldCkdyti01VE3diI0pjuWKpC300Vx2yR2LX0ZaxBA XRdKX9cdX1Y4g== 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 6B6B5C982DA; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:28 +0530 Subject: [PATCH v6 05/14] 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-5-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=3533; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=8MWI/12hlI4M9yhRZDPc0n3MB0pcjTD/Emba1guoIhc=; b=AcQA6LJNF1RR1bNdQBtwbBoOIo6fVqr4hueJwWRKUc/Ay2moHdNyF4GnG2Kh/Xiv2vVVCDAGV +kStYV75q9hCMjAKCHPSNFJGApYMrCR6PRLSV6fITye24oZSMp4cnKq 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 Thu Sep 24 22:21:45 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 C1AE947045C; Sat, 19 Sep 2026 10:36:41 +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=1789814201; cv=none; b=BFYIHMONKd+JKJkMX2c5u/oyUCi+Ntp1aqBtqOjawBknwssol2uhmiSXWK0iV+92Kp89/f/DxgNUYwb3g80Kpe+dyMcShpjouCCFc8os1hTr0DqydnnalegMMJIjwS/+dEXj62T92JU9iO9zRscIj0CZMUl2D/FCaDwaMNSPzjQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814201; c=relaxed/simple; bh=QpjVvJ9+DS2Q2uKPLWC5fqkfnG8PzhLU5vAJoczIpNU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=nRorDEhxSeG/YiQVaWh0YYQnB1GCuRgrximukZj9WXFa1y7KzUXmn7ULK+65RTNIujsTr5O8SBDuE0Rp1l/oJlguVn+/2l2ZFSTZtTVW4d5uziJiBECMGkKAYG9WuzbF9DKZ3Y5EyOuFueJRKYun2+1XD4FcF9b/LnV4FWma2/w= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=NwZWi0ca; 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="NwZWi0ca" Received: by smtp.kernel.org (Postfix) with ESMTPS id 8EA65C4AF10; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814201; bh=QpjVvJ9+DS2Q2uKPLWC5fqkfnG8PzhLU5vAJoczIpNU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=NwZWi0cak1vUhTC/ITMt2je3qssuKKLj9BVeM6pUorjQTSyBE2Ca353IkOrc0Gtb/ 2VkmqLhljB15ulxbKZSRz+NGOTaBbSU742xrnGcfpYIu5+Vxy89NzMnv7ducVyBz1W grdUxar5XC+emXF5wm2e8HBQrBPVujg6Q8s7WW6VkGRdn/ZdTtVoWa8EODthvINoG2 r5JVaMnWFgPmTlQozFZeSN+w+YYPOlk49E+N85cj1eBGO1T/eKpSucB89ebTMWixEA CK6QQIiTSth2bY5klAvH+YzEkJ0UFrBtnMqK1qc1kZCDxIZYjYC6czOLRa3bGrXuGb rFOK3H68X39fA== 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 7A59AC982E7; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:29 +0530 Subject: [PATCH v6 06/14] 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-6-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=3821; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=HqyYHVuWmDcuCY2uw/mZntv1xCDdrJhZceeQRiOBrc0=; b=kb31R6OvQWljNavbbvxbMCpy1KDyonoEqJehLOhz4EpOOnvRO9WqmrpVLiwpLYA1IvJbrjTQV GhDVokh2s5nBGvlirRdQUoe7ysCtFXRq1he6E0vOLEJ9BzZG6YijpWO 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 Thu Sep 24 22:21:45 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 D923A4718E3; Sat, 19 Sep 2026 10:36:41 +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=1789814201; cv=none; b=TxkcSItdwLmHBRRBzjl8UMjMSHhT+8sisvhMyvcYXW6DRAAQ6avZE3AZkHEcaDvCzmYecaaOm71NpCwXKec+OuVxiylr0vEi8qzOcj3jniSRy2P4vjbvgBCcI967Bz4fEp8AqI8kajlKSmSApmdPcpGZboN7fB9COBOt7z0Ua3Q= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814201; c=relaxed/simple; bh=/O/jwNr8U2kz2vrQ2d9Bz7kTcnnb1Lw0rPParIURebQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F2qf73jY7u7Mp7pICME4R/qQH+mGw3lg5FwhHb7B9hIWdDwKUirPTx6Un4/oaSzAaL1tBckb/oBh6h/sORg2bDXsfENn41isLR99fJAQforW6Gt1JxatZQOwHStbqK0AXrllis1TnV6xtlVIjCmSMcD8/ZFSp7D9NFWyuSJb65k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=JCk3TRqZ; 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="JCk3TRqZ" Received: by smtp.kernel.org (Postfix) with ESMTPS id 9CD01C4AF14; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814201; bh=/O/jwNr8U2kz2vrQ2d9Bz7kTcnnb1Lw0rPParIURebQ=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=JCk3TRqZZReRMs4IIs8dLvIRkUlbCQfIMjid81p3Dl1VyOewjKgQi3oeoLykn8dIb x2w47vYL90F3AmNiCmaabhmm/B+jm48SfVXnJq3llrsX6LNNjkgSPxi23acVYpwzXx m9c3M0IqICJYPC9mGsdklwr1XMjGwgZkBdKZSHYqWSuAWLT/CyEJ+W4CGmyJJsdWHM 9tsvd5dAmcz32qVomEqlJrjTweCpu2/A0q7gHjjzA03fsF8pDt2qwG678jVAa8s5cG gLqNgbg0Y266CwEvU27OwGTxZwlgRX7YGqG/SkBbKYTRwtsLZ3yQ1EPzxJs4a54m6u YXllO0jzr9Ppw== 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 8A38DC982CC; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:30 +0530 Subject: [PATCH v6 07/14] 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-7-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=3466; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=LYf4T3sDm8ysK9zTki2uYUQRgyfp4w+aSKgDHMnP8Yw=; b=PAVNfEEax/NnB66nWYareAN7ErVxXsa7HTuJ9eERC4XaQnqPAH++naSjmVyx9M3WncTK9PSzg 7g3TtlF8VNzD5Knnqh3dwxSBefwNj1j2MX4lbH+kzE34XEBADw4AdGe 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 Thu Sep 24 22:21:45 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 D97B74718E4; Sat, 19 Sep 2026 10:36:41 +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=1789814201; cv=none; b=aF0Fr8ovml90U1QuKEOsKhBbAbtwDaxUJAA2mQloVvHJEk+hS2PZTU3UktfriJ45EgIrjneKiU+Rc/Vx+avt6vi2KU+QmDIaMJTnJ3V3Ja2AGv0W0zrK5I/a+Ps5MPfiHt4u1eqnbjx03DHYZpPL4a3Mal5ekNcACVM7x6oHuNw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814201; c=relaxed/simple; bh=txus2AJE/kVu+dxppUJupcIuWbp4gFKzp2cIZUvkXBc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ogj+hqKUcjO1Q3NrzGtTiS3z3ddPc370XmlBCiePZ/9Il36fnXGY0fzhEbZhgPQtHVfMMsBQV8M0lvDm35+pKzmD1sBKQe7D1jKFy+paYrQ0++SnwPzmuMShmqb5rJMbdH7P5nOAJXwTKdyq886W2QX7KGgF+5q57VniURrzgd4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=LgXsPL9Y; 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="LgXsPL9Y" Received: by smtp.kernel.org (Postfix) with ESMTPS id AC36CC32786; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814201; bh=txus2AJE/kVu+dxppUJupcIuWbp4gFKzp2cIZUvkXBc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=LgXsPL9YWSYIasEBpcunT3Qt9voEh7lOnQ722iJx9oCdHYbj5WvjpvivaAGq8YeFW cK9W5KPTPBm8mfrXF8Nf9KIAC61Z55VO5CYsY3g4yV0RA0YJrJp8/8A1GtyTlf6y0Z q5ss1lJoCXJpASzWJml/A7M0KXIBGXIRPxYk/pw0hmTCrmGCQresmMyhLOotujvqBV OzMCWPIh4s9CwcCc8WLbWdjyxuN5YsBV50M2IFb94Ga5bfVn1kCIu4IqWpg+M0i0dA M3Jc+0rjrqCz5XjEr4Ti2TEW7Ri7lYepnc9nm3w0VZxAXbXIFJSLltq9B4f+KxZXFm +UC63QHVeF4gw== 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 99BEFC982E1; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:31 +0530 Subject: [PATCH v6 08/14] 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-8-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=3431; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=YJB29GHZCncYhwv+cTV1yg7AaHm7y9Zh7SdPyAgjnjg=; b=rxTjzmt+VTokVEDbnlBNIeMJPtCUNrZfx8Bx8qIsUGqyGZmNLIt5QzhbzKeIkHZg3W1DpodaD TJNeZ/QGM7oDuDdauJLuXIiOUg0QAwKlcpKj6YNRHdcJcd9oJcn7Py1 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 Thu Sep 24 22:21:45 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 E831F471CEA; Sat, 19 Sep 2026 10:36:41 +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=1789814202; cv=none; b=mKMj8aichIRXBp0vjar30lOhRH3F67Up8NZwERIekSyoLd5hFqeqj+sKnHTjFpnME9GHuhH495UKwMvX3qdp5+Il7wyfi2sEK0QfUV80ZpMcTF2bQFu0mI5prZXAyKVOEmwZ1r8RwlvkASheA2t8QORJ2jAvKinSPV7mBATWBBk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814202; c=relaxed/simple; bh=AWnCnKefvG4UVNmB6J2v9FQ7IUmYciYkW+vBmT2hi64=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=tPL9kDUPSIY79MLf7Hih/LTH2ErieNWQSaaq/D2sG/Qo3mbdzMzhUjk3qyKQJkBGJlnDv0NO0pqDN6XjjNh/ClMaZF0f/Scsf3fL+ClrwxqXlVwBVvxJNTcUhl0uH2HmdfETgPRNA27NuUR9wsVE49LhT4ROStpiOvk1X8GO6bo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=DCRMRYTm; 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="DCRMRYTm" Received: by smtp.kernel.org (Postfix) with ESMTPS id C026AC2BD00; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814201; bh=AWnCnKefvG4UVNmB6J2v9FQ7IUmYciYkW+vBmT2hi64=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=DCRMRYTm/3AMUIw7m9hpe6wRMvlerTjmcoL0BjQr7ChjzOSvOiUkV/zVXMXCK2nki z4intiUO1LzBxTQql8v8qhpmNZuXHPRfiFVaOXoq12oqQOhJi+6K4y6/NDkU/HACh8 VI4kAUpPCnO9m/5DAIr9FrkKTtayTqzMxxy1W0XivjqZD/qRHeXsR1dG21OeOdy76g hnCa8IPmNnXXLdtk8oalG6ySqIFPtV0kEIg0tvCbgBjBpPTH0Qls2/CXl79bUCRuak U9KHfr94+eT54P739oBxe9oRvcPuyZi87jqbK4i7Xg3rZPbIrw2RRgg0SQ7/lhREqe 94zIILMTvoRHQ== 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 AAEA4C982DA; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:32 +0530 Subject: [PATCH v6 09/14] 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-9-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=3629; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=psVvPChQvmnDeqq5c0sAzyCmhiEktLAbJoySPLiD/3g=; b=B4bfzPua1+LKqeLFKtgPlIbWdd2LKh/IsiOhzeELXi4+OYc3ftr6wY+VokQ46Flawi4ngaN9k ogFTEoxCM8wDoxzaleIIl6lvzU1K9MWjHnAUpzemjK2PTKjOIoDBM9m 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 Thu Sep 24 22:21:45 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 EABE1471CEB; Sat, 19 Sep 2026 10:36:41 +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=1789814202; cv=none; b=ACFoISYTWHfkPGJ4Xq64LCbgUijc3qOnh7+IQGB49EDs7VBM7hesUoifvqK2+m2pgj3WosZahVMJ7CKDGMr5EvloKjQLzoAB+zloj9qSEG43q0Q8N7QrS+bMlcS9xCSGapx67y5U+Za1tTeJ60g+OJZGku9mjVTI/aK87R6uEDw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814202; 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=Ta7gWhLer6uB5qX6W6qF28/A6ofJypyQ87m6DhHg0u2CiyYGDMH0qnC2ELPTw0zaF7BBOhfCNl47J7ypwAstboPz+tfIg9Mh2ZjyA1oTmeSyNEREcSzTszAK8OSz91SaRVRjP1KsnTIIjsPSqNVfa7Tz1YtHZQ1p+sDJTxsGf3o= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=EACwITYB; 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="EACwITYB" Received: by smtp.kernel.org (Postfix) with ESMTPS id CC86BC2BCFC; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814201; bh=1+LATJmQfGnsPHSpLjng0/+Dl6/lw5qZw/neErfDwj4=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=EACwITYBCjekTo5/DP26jX7gRWqrWFgB2lWhTpT3AhQIDXblBN8CzOTJ3pCtneOMa 6W/ugYlDgUz12RKNxM3bsxX6lZ7OM/Mv2xdIlzHT3mFfk0xPXTAaz8GB+rOTa7WAEU LCDYoYoJ1Vp3srQxXc3QRVr86KpSFBRfqPsi8tJ5/6GL01pCCYvLpNAY2c98RJQQOe iueRrvwhC/zd44spJ7Gsx8lIgaCAWUOUy8+BRGYa0W9ifnAcswbxieEohSV2pDHLqU Hzm9g+6uz+IXwWN8cSB/MJMvcDJ9LE2eWe1rrZX4RE/GfX03mBze2+VNUHOFa0Xz7u t0oJD46uxHNqw== 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 B9D6BC982D7; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:33 +0530 Subject: [PATCH v6 10/14] 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-10-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=3627; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=Db8QZy6XNbEvWiQnvLmsz7HdMBrrBkrM5ikOGII6cRw=; b=CCMRrubCqlNjcIwmr43ocCUKAfUiLWWhud7I7i7WCw2utA4U2//EBGLCxdDmUE23BYXFstoDJ 2O09aSiAiinCUtbWCOU9e8VQuXyyk5w0Z9m5irGw96j/2kiWvIcyxfy 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 Thu Sep 24 22:21:45 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 01C2E471D0D; Sat, 19 Sep 2026 10:36:42 +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=1789814202; cv=none; b=Wo0nRwrdsIFAMuLBUokl6oJY6o0ab91BwuzRA5y6Md79/LOGXKv1HCBKdCMMRqeJjI+MMYui+REJUnR3JUVMRks1k4xLryl7rDEW4sWydSBmapkdxDFyc4rUETptdaY9Oy+oeDpdvSewQIthvWe6tgKJr4VLlU4QQcPk8gIRXrk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814202; c=relaxed/simple; bh=uC9HTsM+zLwIu+UmBHfWWd7X0n+u8+mFuo1hAIT5/Bs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F/CvODCE767YaqTmMNNxs7RQi4l9E5B77Aqz9izE+W+wuyxrRUMGau9JV3OR21TM+Zq4t4h4hbJ6cxvbyk9TOmDt+7JJQQYqgDBKc2qLZA7Ih4e7K2UKWZYk10iWRANgcTYDCrLALMn2/w3xslfkKJJy8pjkdIuF9xe0VgbxFSs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=gMnARND4; 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="gMnARND4" Received: by smtp.kernel.org (Postfix) with ESMTPS id D9F81C2BCFB; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814201; bh=uC9HTsM+zLwIu+UmBHfWWd7X0n+u8+mFuo1hAIT5/Bs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=gMnARND4knGuPhWDQGku7sucArgNX8n6ZDYJqkAGdckKWeqJlyZTUYD3mUIKLPJdW 5g0zv0cAssMNRBkWc2GcC1C6tSqRj8UqDS8zhhhT7KZjgddZ7ROHUPSUnuBX2UukWF ieUQ0eVX07y9omAuAZO2KteYvo7AXdc9zrhk5SiQ++XDtrzl8NLE4Ro3z4+OL8ubuy XSvRAU1dN3e5haE76gOOq4qUwI41T2sFup6XyIg8tpcUqg+71nb3zpx9VmSVjQ7wx0 2UQ/Z92DGOuK3cjRtWGg0BFUDmsrIv/d8AGzm0wqtBsYcbyanYkX0+f+DNLbUAOtDZ +AGZy6JN9fRzQ== 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 C7A59C982CC; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:34 +0530 Subject: [PATCH v6 11/14] 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-11-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=3506; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=TLV6V3PWBu6QuptSuYx3HwS02UbXDq6dcq/bnuc0xPo=; b=0z8FIMYiJiXoHY0Ebwou1EMKNtVnZ7DUPAPyjVnKSaqWmduafvWBhTBJ5X+jvdwoBf5oMOuL7 OmvlmOrTfxwCPqr1PMyb+KpmexltWPB6NHhy3cOkI4JkcBsG8whmASM 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 061d76310fed..f97c278f16cb 100644 --- a/drivers/iio/orientation/hid-sensor-rotation.c +++ b/drivers/iio/orientation/hid-sensor-rotation.c @@ -301,7 +301,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; @@ -356,8 +357,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; @@ -366,38 +367,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 { @@ -424,7 +401,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 Thu Sep 24 22:21:45 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 1361D472077; Sat, 19 Sep 2026 10:36:42 +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=1789814202; cv=none; b=TIc8JW7jT+DDl4iDSy5c7WrwCr5Iu7HBFHKNsyu3mfsyc7WZBb6J/dXGHpOiCLHrYoa0Qu+jAMYfoURngCGsqFpIDb8ziIRYSuthTAdQhQwfp9N9h/nI/Vbxfn1ns/JEBi8mvP5DyHQIck1huEVNUAyDuOAxfXGSJJHtuv1VDkk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814202; c=relaxed/simple; bh=d0a1H9PELbVmQhNglK5y5FtIcmnFR2yg9BW8d3/JhTY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=es9NQfAUJOLrTFVKMKcilD/HKRwmitKSzYEk8aKIbC5Ls+F7qhYz7vGu3meGosetGMG5+T6UIEkSs++1lwwZYjwuqW5Ge6eeFNpjE01Ym36WZbd0H0nxOxU3fLiDuPYA6uUGeUhndNVEdQE/Z+cfi5XISasy/nI0YmcQ1dDMi+I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=oh04Rm+H; 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="oh04Rm+H" Received: by smtp.kernel.org (Postfix) with ESMTPS id EAEDBC2BCFF; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814202; bh=d0a1H9PELbVmQhNglK5y5FtIcmnFR2yg9BW8d3/JhTY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=oh04Rm+HQ0YywrUUgzTnBVXkeFATIk1Zgx5emYNm3XVGAH/l3Gm0KdogiAU6kl/RI faVS2vFoVlo/f/YnaqUcAIqzVt+pdaYf4koueEZpuFnsHYGhr7NqRSnjU07jnMEymq 1/g+i7n+EM5UFXA6TRKDX3H7W4x5JgJuvvrYISmlcVm3ZOdIi/jZESBLb6yDL1QtVU 3CzZX2xdg5E1rm+lqYjmeQnkRzEi2ogkmrHUQPd63hFFq2ROlSgeW444/peblcSojB DzxMxvAimX7iNywHIfNUrXxbEFAgdBNFkrVLo0U9JBTqTHP17ZGGgGmZ+VHKcE44Yc yoFTHHvK96cSQ== 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 D709EC982E6; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:35 +0530 Subject: [PATCH v6 12/14] 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-12-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=3491; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=i4Tkmjvqq1X1HXfT1Ajunvn9KfzjkXAM5FZZp1If76U=; b=gS8Fb4zew70a/H4h6ClsvQwLV6CFRhIwrtHdzx8LyoAPVjCvG7a1KqKnNsuaLwJBcutMAy1XD pi4YJ8YT+FxBcnhD35ZUO43589rMJRzd0jWFTJiHFU+97KOKQT+WPls 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 Thu Sep 24 22:21:45 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 219F047208E; Sat, 19 Sep 2026 10:36:42 +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=1789814202; cv=none; b=J2+eDQPdxa/SbgSX9OtgLaVWoNSez4uoeU89KcvJDgM71WwSJdW0Fmz1P+oh6lq9NNHap/FxjtUq0298AWjOts6eNl509nbnnUSEkvWNyDClHvaaFKnn9bncDcN6gVjsMyKUfsBzbB6ACMFOJA/N6MyPo06yyKF/94p+PLRophE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814202; c=relaxed/simple; bh=HIza9tj31a3mKUDaV4RrpZ7yKRed7YCVQhRCqLix2bc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BITr1c4FiCXD+t17BqcS11i7BCFmSAIVKstj99afru3Cigy8gI22m4nxmEcX9ZXcFBIWmOil8k18oJamkzsUXFl01jPZnn37GC2mhMSZrpc5P1eFe2DLtbaDXAvPtpiKWY1ZJyql3+Z61pANeXRDXtO1/1yJpJdWl3sBav5+ZA0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=Sc8lthaK; 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="Sc8lthaK" Received: by smtp.kernel.org (Postfix) with ESMTPS id 053CCC2BCF6; Sat, 19 Sep 2026 10:36:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814202; bh=HIza9tj31a3mKUDaV4RrpZ7yKRed7YCVQhRCqLix2bc=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=Sc8lthaKvDCc0By/h1wU8OpEhU9gxMhwRlDFjhvF9i2k1Kg7m42X8b54Zqfm2EwOc ewdogsMBrI+saB6SMI02FQQ7WwNZOqmRjSgJnPqRJFsJlaadB9V7tdKCJIs8roWfKE vSHUyE9OK4a64hK0JVR6GTN7ep4AXTz2VFSpeAexC60+eTAjm4270SCoXBXnm1dsT6 IxM+nC8oH9Uq90V0E6luISRYTnIpRLwN6uHBBAP0LX4cpL9DPx2l9h54qJ/BggSCIQ j3NRQ9ETZRA4QTRUutdwATu5/y9kEUWAMSV8zi9pSHCQPZywOQfePEjuT8UJrAw3Ea lci12z65ZQLUQ== 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 E7A99C982E1; Sat, 19 Sep 2026 10:36:41 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:36 +0530 Subject: [PATCH v6 13/14] 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-13-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=3567; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=7y381boWRDonXbz69DqfU+M5uO8NaOORx2X9lVUSvzQ=; b=boHZOdTP205iq0Sc5GfBv0JdTSA7g3A2vSBVSIW5WmF/tYpw8TDepd/PoJg8Sy48SnspR5gUB U3eKxUFLPVtCjNS15vaS7wcIpvENqsw/OC11ToHBZc+7gs3rShj63zR 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 From nobody Thu Sep 24 22:21:45 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 339B647255C; Sat, 19 Sep 2026 10:36:42 +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=1789814202; cv=none; b=KprbTAuuKsHb27wbkQ6KhwjMC81Gvbyj5Lku3D3qQVjQ1kqbkiRhenxGuR56JYMWITM2L4L4nzTRLNTdTzmZ4npxUiMBENiNXbuVpRj/NwPUQkuDs2IMmJZYt31U2YlskMu64FSqYX9XK+ZRTY1IsYrKsEKlXjh4Cz8ePx2Bwgg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789814202; c=relaxed/simple; bh=6Jh2nVeKWv5uHsIXOSo7+EXH3R1zxIBSFylkX5LiR0g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DQOBHO9v0/eDuHgXhOI8JQb1S5IDXRBU2ohkSIUurjEJ8gYFMAE6a97v1N/1fWoEWxHtrnjd4H2fCSo60HbO7JqY34+AHtId2jr5zTVySIgvGmtELtbHgiSFlZNEvBnHYC19hswmfJHVYC4wPfVZXZMMIgHa0lus9RdtD1PwW6k= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IYg87xH1; 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="IYg87xH1" Received: by smtp.kernel.org (Postfix) with ESMTPS id 15935C2BD00; Sat, 19 Sep 2026 10:36:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1789814202; bh=6Jh2nVeKWv5uHsIXOSo7+EXH3R1zxIBSFylkX5LiR0g=; h=From:Date:Subject:References:In-Reply-To:To:Cc:Reply-To:From; b=IYg87xH1B5cuFQqpacYC2EQe+8Fijhny5m5ahOUEpaoU+iC+Hz5vna1AggNI+got6 +YW2GSheKVeZcGRbByDO+SpqaVC6uvDU2ZW5TOEKPjlKxxsQO4N1E/O4uwlQF8ZGUO UkipoWRfC/K/QyZTCffjxc0aIox3Yh/tvS8gmtPLHFqtYF+wXBEI0diUEGQxQIGHvE o20+1qEcq/UXtLtMg2EvZzxn64/xddSrfEsHT8c3TK8ytmyf791+p7B5lALLHoIprA 5jSuQADqKbeqLRwqGH0snhPcLlz0GeTk+/yeEO9YlHdUMontb4y4CqmaGUOA9AVsH7 JT3P/hXowQ7Ig== 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 02F02C982DA; Sat, 19 Sep 2026 10:36:42 +0000 (UTC) From: Sanjay Chitroda via B4 Relay Date: Sat, 19 Sep 2026 16:06:37 +0530 Subject: [PATCH v6 14/14] iio: temperature: hid-sensor-temperature: 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: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-14-d577b2371b3c@gmail.com> References: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@gmail.com> In-Reply-To: <20260919-28-apr-iio-redundant-argument-v5-temp-v6-0-d577b2371b3c@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=1789814199; l=3471; i=sanjayembeddedse@gmail.com; s=20260702; h=from:subject:message-id; bh=1Xb2KI32YvGlS/Xf3zjMfPomVo3QjnOydjNIX/ii4Sk=; b=PMW2nTN2cnFdguySR2C8vQb0ytoKT1PRHbd3zQGsre6RwZ6Kitm/xx4KDZwGqIEpTTFyqAWkl /dUsZcTaRwkAocZXal0WZte9Sj1FIXoWVTe8y0liH0tpqMlFykzkyVs 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/temperature/hid-sensor-temperature.c | 39 ++++++--------------= ---- 1 file changed, 9 insertions(+), 30 deletions(-) diff --git a/drivers/iio/temperature/hid-sensor-temperature.c b/drivers/iio= /temperature/hid-sensor-temperature.c index aa5a2b872247..ac5a287d1de3 100644 --- a/drivers/iio/temperature/hid-sensor-temperature.c +++ b/drivers/iio/temperature/hid-sensor-temperature.c @@ -189,11 +189,12 @@ static struct hid_sensor_hub_callbacks temperature_ca= llbacks =3D { /* Function to initialize the processing for usage id */ static int hid_temperature_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 "temperature"; struct iio_dev *indio_dev; struct temperature_state *temp_st; struct iio_chan_spec *temp_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(*temp_st)); @@ -230,42 +231,21 @@ static int hid_temperature_probe(struct platform_devi= ce *pdev) =20 atomic_set(&temp_st->common_attributes.data_ready, 0); =20 - ret =3D hid_sensor_setup_trigger(indio_dev, name, - &temp_st->common_attributes); + ret =3D devm_hid_sensor_setup_trigger(dev, indio_dev, name, + &temp_st->common_attributes); if (ret) return ret; =20 platform_set_drvdata(pdev, indio_dev); =20 temperature_callbacks.pdev =3D pdev; - ret =3D sensor_hub_register_callback(hsdev, HID_USAGE_SENSOR_TEMPERATURE, - &temperature_callbacks); + ret =3D devm_sensor_hub_register_callback(dev, hsdev, + HID_USAGE_SENSOR_TEMPERATURE, + &temperature_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_TEMPERATURE); -error_remove_trigger: - hid_sensor_remove_trigger(&temp_st->common_attributes); - return ret; -} - -/* Function to deinitialize the processing for usage id */ -static void hid_temperature_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 temperature_state *temp_st =3D iio_priv(indio_dev); + return ret; =20 - iio_device_unregister(indio_dev); - sensor_hub_remove_callback(hsdev, HID_USAGE_SENSOR_TEMPERATURE); - hid_sensor_remove_trigger(&temp_st->common_attributes); + return devm_iio_device_register(dev, indio_dev); } =20 static const struct platform_device_id hid_temperature_ids[] =3D { @@ -284,7 +264,6 @@ static struct platform_driver hid_temperature_platform_= driver =3D { .pm =3D &hid_sensor_pm_ops, }, .probe =3D hid_temperature_probe, - .remove =3D hid_temperature_remove, }; module_platform_driver(hid_temperature_platform_driver); =20 --=20 2.34.1