summaryrefslogtreecommitdiffstats
path: root/drivers/iio
diff options
context:
space:
mode:
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>2024-06-06 16:26:48 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2024-06-13 19:19:24 +0100
commitce17861c8635b4bac5137c2faec3c3a59990f0b1 (patch)
tree82d9a5df27138b4ed33315d82043a00c7fe71ae7 /drivers/iio
parentd8f2d8ae94d1ad6c7c0f2db6e86a37a2e54bd23e (diff)
downloadlinux-stable-ce17861c8635b4bac5137c2faec3c3a59990f0b1.tar.gz
linux-stable-ce17861c8635b4bac5137c2faec3c3a59990f0b1.tar.bz2
linux-stable-ce17861c8635b4bac5137c2faec3c3a59990f0b1.zip
iio: addac: ad74413r: simplify with spi_get_device_match_data()
Use spi_get_device_match_data() helper to simplify a bit the driver. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org> Reviewed-by: Nuno Sa <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20240606-spi-match-data-v1-6-320b291ee1fe@linaro.org Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r--drivers/iio/addac/ad74413r.c13
1 files changed, 3 insertions, 10 deletions
diff --git a/drivers/iio/addac/ad74413r.c b/drivers/iio/addac/ad74413r.c
index cd26a16dc0ff..2410d72da49b 100644
--- a/drivers/iio/addac/ad74413r.c
+++ b/drivers/iio/addac/ad74413r.c
@@ -1365,16 +1365,9 @@ static int ad74413r_probe(struct spi_device *spi)
st->spi = spi;
st->dev = &spi->dev;
- st->chip_info = device_get_match_data(&spi->dev);
- if (!st->chip_info) {
- const struct spi_device_id *id = spi_get_device_id(spi);
-
- if (id)
- st->chip_info =
- (struct ad74413r_chip_info *)id->driver_data;
- if (!st->chip_info)
- return -EINVAL;
- }
+ st->chip_info = spi_get_device_match_data(spi);
+ if (!st->chip_info)
+ return -EINVAL;
mutex_init(&st->lock);
init_completion(&st->adc_data_completion);