Commit 2ac3ce8a authored by Krzysztof Kozlowski's avatar Krzysztof Kozlowski Committed by Jonathan Cameron

iio: dac: max5522: simplify with spi_get_device_match_data()

Use spi_get_device_match_data() helper to simplify a bit the driver.
Signed-off-by: default avatarKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Reviewed-by: default avatarNuno Sa <nuno.sa@analog.com>
Link: https://lore.kernel.org/r/20240606-spi-match-data-v1-7-320b291ee1fe@linaro.orgSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent ce17861c
...@@ -132,7 +132,6 @@ static const struct regmap_config max5522_regmap_config = { ...@@ -132,7 +132,6 @@ static const struct regmap_config max5522_regmap_config = {
static int max5522_spi_probe(struct spi_device *spi) static int max5522_spi_probe(struct spi_device *spi)
{ {
const struct spi_device_id *id = spi_get_device_id(spi);
struct iio_dev *indio_dev; struct iio_dev *indio_dev;
struct max5522_state *state; struct max5522_state *state;
int ret; int ret;
...@@ -144,13 +143,9 @@ static int max5522_spi_probe(struct spi_device *spi) ...@@ -144,13 +143,9 @@ static int max5522_spi_probe(struct spi_device *spi)
} }
state = iio_priv(indio_dev); state = iio_priv(indio_dev);
state->chip_info = device_get_match_data(&spi->dev); state->chip_info = spi_get_device_match_data(spi);
if (!state->chip_info) {
state->chip_info =
(struct max5522_chip_info *)(id->driver_data);
if (!state->chip_info) if (!state->chip_info)
return -EINVAL; return -EINVAL;
}
state->vrefin_reg = devm_regulator_get(&spi->dev, "vrefin"); state->vrefin_reg = devm_regulator_get(&spi->dev, "vrefin");
if (IS_ERR(state->vrefin_reg)) if (IS_ERR(state->vrefin_reg))
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment