diff mbox series

[v1,10/22] iio: dac: max517: Get platform data via dev_get_platdata()

Message ID 20240902222824.1145571-11-andy.shevchenko@gmail.com (mailing list archive)
State New
Headers show
Series iio: use dev_get_platdata() to access platform_data | expand

Commit Message

Andy Shevchenko Sept. 2, 2024, 10:16 p.m. UTC
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>

Access to platform data via dev_get_platdata() getter to make code cleaner.

Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
---
 drivers/iio/dac/max517.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jonathan Cameron Sept. 3, 2024, 7:47 p.m. UTC | #1
On Tue,  3 Sep 2024 01:16:55 +0300
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> 
> Access to platform data via dev_get_platdata() getter to make code cleaner.
> 
> Signed-off-by: Andy Shevchenko <andy.shevchenko@gmail.com>
> ---
>  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)
Andy Shevchenko Sept. 3, 2024, 8:02 p.m. UTC | #2
On Tue, Sep 03, 2024 at 08:47:37PM +0100, Jonathan Cameron wrote:
> On Tue,  3 Sep 2024 01:16:55 +0300
> Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

...

> >  	 * Reference voltage on MAX518 and default is 5V, else take vref_mv
> > -	 * from platform_data
> > +	 * from platform_data.
> 
> I guess this is accidental?

It can be dropped.
diff mbox series

Patch

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.
 	 */
 	for (chan = 0; chan < indio_dev->num_channels; chan++) {
 		if (id->driver_data == ID_MAX518 || !platform_data)