[PATCH v4 04/19] iio: accel: bma220: shorten spi->dev calls

Petre Rodan
2025-10-05T13:20:13Z

Provide functions easier access to device struct.

Signed-off-by: Petre Rodan <petre.rodan@subdimension.ro>
---
v4 - split from bigger patch (Andy)
---
drivers/iio/accel/bma220_spi.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)

diff --git a/drivers/iio/accel/bma220_spi.c b/drivers/iio/accel/bma220_spi.c
index 8c313debc1dff7f4bae7c165bc555ee190996291..a5d2906321ae5fc67c0e1dc44651833c5e7fcb39 100644
--- a/drivers/iio/accel/bma220_spi.c
+++ b/drivers/iio/accel/bma220_spi.c
@@ -258,8 +258,9 @@ static int bma220_probe(struct spi_device *spi)
int ret;
struct iio_dev *indio_dev;
struct bma220_data *data;
+ struct device *dev = &spi->dev;

- indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*data));
+ indio_dev = devm_iio_device_alloc(dev, sizeof(*data));
if (!indio_dev)
return -ENOMEM;

@@ -278,19 +279,19 @@ static int bma220_probe(struct spi_device *spi)
if (ret)
return ret;

- ret = devm_add_action_or_reset(&spi->dev, bma220_deinit, spi);
+ ret = devm_add_action_or_reset(dev, bma220_deinit, spi);
if (ret)
return ret;

- ret = devm_iio_triggered_buffer_setup(&spi->dev, indio_dev,
+ ret = devm_iio_triggered_buffer_setup(dev, indio_dev,
iio_pollfunc_store_time,
bma220_trigger_handler, NULL);
if (ret < 0) {
- dev_err(&spi->dev, "iio triggered buffer setup failed\n");
+ dev_err(dev, "iio triggered buffer setup failed\n");
return ret;
}

- return devm_iio_device_register(&spi->dev, indio_dev);
+ return devm_iio_device_register(dev, indio_dev);
}

static int bma220_suspend(struct device *dev)

--
2.49.1