[PATCH v6 6/8] iio: adc: at91_adc: pass struct device to at91_ts_register()

From: Abdelnasser Hussein

Date: Thu Dec 03 2026 - 12:33:56 EST


at91_ts_register() only needs the parent struct device. Pass it
directly from at91_adc_probe() and drop the platform_device round-trip.

Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxx>
Reviewed-by: Joshua Crofts <crofts@xxxxxxxxxx>
Signed-off-by: Abdelnasser Hussein <abdelnasserhussein11@xxxxxxxxx>
---
drivers/iio/adc/at91_adc.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/adc/at91_adc.c b/drivers/iio/adc/at91_adc.c
index 2d49fb98fa47..ca998dc91af4 100644
--- a/drivers/iio/adc/at91_adc.c
+++ b/drivers/iio/adc/at91_adc.c
@@ -939,8 +939,7 @@ static int at91_ts_hw_init(struct iio_dev *idev, u32 adc_clk_khz)
return 0;
}

-static int at91_ts_register(struct iio_dev *idev,
- struct platform_device *pdev)
+static int at91_ts_register(struct iio_dev *idev, struct device *dev)
{
struct at91_adc_state *st = iio_priv(idev);
struct input_dev *input;
@@ -954,7 +953,7 @@ static int at91_ts_register(struct iio_dev *idev,

input->name = DRIVER_NAME;
input->id.bustype = BUS_HOST;
- input->dev.parent = &pdev->dev;
+ input->dev.parent = dev;
input->open = atmel_ts_open;
input->close = atmel_ts_close;

@@ -969,7 +968,7 @@ static int at91_ts_register(struct iio_dev *idev,
input_set_abs_params(input, ABS_PRESSURE, 0, 0xffffff, 0, 0);
} else {
if (st->touchscreen_type != ATMEL_ADC_TOUCHSCREEN_4WIRE) {
- dev_err(&pdev->dev,
+ dev_err(dev,
"This touchscreen controller only support 4 wires\n");
ret = -EINVAL;
goto err;
@@ -1173,7 +1172,7 @@ static int at91_adc_probe(struct platform_device *pdev)
return ret;
}
} else {
- ret = at91_ts_register(idev, pdev);
+ ret = at91_ts_register(idev, dev);
if (ret)
return ret;


--
2.56.0