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>
This commit is contained in:
parent
d8f2d8ae94
commit
ce17861c86
1 changed files with 3 additions and 10 deletions
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue