lkml.org 
[lkml]   [2020]   [Oct]   [16]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
Subject[PATCH] iio: light: tsl2563 change of_property_read to device_property_read

This patch aims to replace the of_property_read_u32 for reading
the amstaos,cover-comp-gain property with device_property_read_u32

Thanks and Regards,
Vaishnav M A

Signed-off-by: Vaishnav M A <vaishnav@beagleboard.org>
---
drivers/iio/light/tsl2563.c | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)

diff --git a/drivers/iio/light/tsl2563.c b/drivers/iio/light/tsl2563.c
index abc8d7db8dc1..1f1b8b7cefa4 100644
--- a/drivers/iio/light/tsl2563.c
+++ b/drivers/iio/light/tsl2563.c
@@ -703,7 +703,6 @@ static int tsl2563_probe(struct i2c_client *client,
struct iio_dev *indio_dev;
struct tsl2563_chip *chip;
struct tsl2563_platform_data *pdata = client->dev.platform_data;
- struct device_node *np = client->dev.of_node;
int err = 0;
u8 id = 0;

@@ -738,13 +737,14 @@ static int tsl2563_probe(struct i2c_client *client,
chip->calib0 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);
chip->calib1 = tsl2563_calib_from_sysfs(CALIB_BASE_SYSFS);

- if (pdata)
+ if (pdata) {
chip->cover_comp_gain = pdata->cover_comp_gain;
- else if (np)
- of_property_read_u32(np, "amstaos,cover-comp-gain",
- &chip->cover_comp_gain);
- else
- chip->cover_comp_gain = 1;
+ } else {
+ err = device_property_read_u32(&client->dev, "amstaos,cover-comp-gain",
+ &chip->cover_comp_gain);
+ if (err)
+ chip->cover_comp_gain = 1;
+ }

dev_info(&client->dev, "model %d, rev. %d\n", id >> 4, id & 0x0f);
indio_dev->name = client->name;
--
2.25.1
\
 
 \ /
  Last update: 2020-10-16 20:35    [W:0.074 / U:0.356 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site