[PATCH v5 4/7] iio: potentiometer: Change to firmware provided data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
---
 drivers/iio/potentiometer/ds1803.c | 5 ++++-
 1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/iio/potentiometer/ds1803.c b/drivers/iio/potentiometer/ds1803.c
index f93cd342e09a..aeb74ee46fbc 100644
--- a/drivers/iio/potentiometer/ds1803.c
+++ b/drivers/iio/potentiometer/ds1803.c
@@ -15,6 +15,7 @@
 #include <linux/iio/iio.h>
 #include <linux/module.h>
 #include <linux/mod_devicetable.h>
+#include <linux/property.h>
 
 #define DS1803_WIPER_0         0xA9
 #define DS1803_WIPER_1         0xAA
@@ -166,7 +167,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;
-- 
2.17.1




[Index of Archives]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Input]     [Linux Kernel]     [Linux SCSI]     [X.org]

  Powered by Linux