diff mbox series

[v3,4/6] iio: potentiometer: Change to firmware provided data

Message ID 20220218042038.15176-5-jagathjog1996@gmail.com (mailing list archive)
State Changes Requested
Headers show
Series iio: potentiometer: Add support for DS3502 | expand

Commit Message

Jagath Jog J Feb. 18, 2022, 4:20 a.m. UTC
Using firmware provided data to get the device specific
structure, if not available fall back to id->driver_data.

Signed-off-by: Jagath Jog J <jagathjog1996@gmail.com>
---
 drivers/iio/potentiometer/ds1803.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

Comments

Andy Shevchenko Feb. 21, 2022, 8:42 p.m. UTC | #1
On Fri, Feb 18, 2022 at 5:20 AM Jagath Jog J <jagathjog1996@gmail.com> wrote:
>
> Using firmware provided data to get the device specific
> structure, if not available fall back to id->driver_data.

You probably will need to add

#include <linux/property.h>
diff mbox series

Patch

diff --git a/drivers/iio/potentiometer/ds1803.c b/drivers/iio/potentiometer/ds1803.c
index 0ef3acb13c79..ca28ad147402 100644
--- a/drivers/iio/potentiometer/ds1803.c
+++ b/drivers/iio/potentiometer/ds1803.c
@@ -152,7 +152,9 @@  static int ds1803_probe(struct i2c_client *client, const struct i2c_device_id *i
 
 	data = iio_priv(indio_dev);
 	data->client = client;
-	data->cfg = &ds1803_cfg[id->driver_data];
+	data->cfg = device_get_match_data(dev);
+	if (!data->cfg)
+		data->cfg = &ds1803_cfg[id->driver_data];
 
 	indio_dev->info = &ds1803_info;
 	indio_dev->channels = data->cfg->channels;