Re: [PATCH v1 10/22] iio: dac: max517: Get platform data via dev_get_platdata()
From: Jonathan Cameron
Date: Tue Sep 03 2024 - 15:47:56 EST
On Tue, 3 Sep 2024 01:16:55 +0300
Andy Shevchenko <andy.shevchenko@xxxxxxxxx> wrote:
> From: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
>
> Access to platform data via dev_get_platdata() getter to make code cleaner.
>
> Signed-off-by: Andy Shevchenko <andy.shevchenko@xxxxxxxxx>
> ---
> drivers/iio/dac/max517.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/dac/max517.c b/drivers/iio/dac/max517.c
> index 685980184d3c..96781ae04f9d 100644
> --- a/drivers/iio/dac/max517.c
> +++ b/drivers/iio/dac/max517.c
> @@ -143,10 +143,10 @@ static const struct iio_chan_spec max517_channels[] = {
>
> static int max517_probe(struct i2c_client *client)
> {
> + const struct max517_platform_data *platform_data = dev_get_platdata(&client->dev);
> const struct i2c_device_id *id = i2c_client_get_device_id(client);
> struct max517_data *data;
> struct iio_dev *indio_dev;
> - struct max517_platform_data *platform_data = client->dev.platform_data;
> int chan;
>
> indio_dev = devm_iio_device_alloc(&client->dev, sizeof(*data));
> @@ -176,7 +176,7 @@ static int max517_probe(struct i2c_client *client)
>
> /*
> * Reference voltage on MAX518 and default is 5V, else take vref_mv
> - * from platform_data
> + * from platform_data.
I guess this is accidental?
J
> */
> for (chan = 0; chan < indio_dev->num_channels; chan++) {
> if (id->driver_data == ID_MAX518 || !platform_data)