Commit 7cd11203 authored by Andy Shevchenko's avatar Andy Shevchenko Committed by Jonathan Cameron

iio: proximity: sx9324: Switch to device_property_match_property_string()

Replace open coded device_property_match_property_string().
Signed-off-by: default avatarAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://lore.kernel.org/r/20230808162800.61651-7-andriy.shevchenko@linux.intel.comSigned-off-by: default avatarJonathan Cameron <Jonathan.Cameron@huawei.com>
parent 2a5239b6
...@@ -888,7 +888,6 @@ sx9324_get_default_reg(struct device *dev, int idx, ...@@ -888,7 +888,6 @@ sx9324_get_default_reg(struct device *dev, int idx,
char prop[] = SX9324_PROXRAW_DEF; char prop[] = SX9324_PROXRAW_DEF;
u32 start = 0, raw = 0, pos = 0; u32 start = 0, raw = 0, pos = 0;
int ret, count, ph, pin; int ret, count, ph, pin;
const char *res;
memcpy(reg_def, &sx9324_default_regs[idx], sizeof(*reg_def)); memcpy(reg_def, &sx9324_default_regs[idx], sizeof(*reg_def));
...@@ -915,24 +914,21 @@ sx9324_get_default_reg(struct device *dev, int idx, ...@@ -915,24 +914,21 @@ sx9324_get_default_reg(struct device *dev, int idx,
reg_def->def = raw; reg_def->def = raw;
break; break;
case SX9324_REG_AFE_CTRL0: case SX9324_REG_AFE_CTRL0:
ret = device_property_read_string(dev, ret = device_property_match_property_string(dev, "semtech,cs-idle-sleep",
"semtech,cs-idle-sleep", &res); sx9324_csidle,
if (!ret) ARRAY_SIZE(sx9324_csidle));
ret = match_string(sx9324_csidle, ARRAY_SIZE(sx9324_csidle), res);
if (ret >= 0) { if (ret >= 0) {
reg_def->def &= ~SX9324_REG_AFE_CTRL0_CSIDLE_MASK; reg_def->def &= ~SX9324_REG_AFE_CTRL0_CSIDLE_MASK;
reg_def->def |= ret << SX9324_REG_AFE_CTRL0_CSIDLE_SHIFT; reg_def->def |= ret << SX9324_REG_AFE_CTRL0_CSIDLE_SHIFT;
} }
ret = device_property_read_string(dev, ret = device_property_match_property_string(dev, "semtech,int-comp-resistor",
"semtech,int-comp-resistor", &res); sx9324_rints,
if (ret) ARRAY_SIZE(sx9324_rints));
break; if (ret >= 0) {
ret = match_string(sx9324_rints, ARRAY_SIZE(sx9324_rints), res); reg_def->def &= ~SX9324_REG_AFE_CTRL0_RINT_MASK;
if (ret < 0) reg_def->def |= ret << SX9324_REG_AFE_CTRL0_RINT_SHIFT;
break; }
reg_def->def &= ~SX9324_REG_AFE_CTRL0_RINT_MASK;
reg_def->def |= ret << SX9324_REG_AFE_CTRL0_RINT_SHIFT;
break; break;
case SX9324_REG_AFE_CTRL4: case SX9324_REG_AFE_CTRL4:
case SX9324_REG_AFE_CTRL7: case SX9324_REG_AFE_CTRL7:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment