iio: accel: adxl313: simplify with spi_get_device_match_data()
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Thu, 6 Jun 2024 14:26:43 +0000 (16:26 +0200)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Thu, 13 Jun 2024 18:19:23 +0000 (19:19 +0100)
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-1-320b291ee1fe@linaro.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/iio/accel/adxl313_spi.c

index b7cc156..6f8d73f 100644 (file)
@@ -72,13 +72,7 @@ static int adxl313_spi_probe(struct spi_device *spi)
        if (ret)
                return ret;
 
-       /*
-        * Retrieves device specific data as a pointer to a
-        * adxl313_chip_info structure
-        */
-       chip_data = device_get_match_data(&spi->dev);
-       if (!chip_data)
-               chip_data = (const struct adxl313_chip_info *)spi_get_device_id(spi)->driver_data;
+       chip_data = spi_get_device_match_data(spi);
 
        regmap = devm_regmap_init_spi(spi,
                                      &adxl31x_spi_regmap_config[chip_data->type]);