Skip to content

Commit 3f6e7aa

Browse files
andy-shevjic23
authored andcommitted
iio: frequency: adf4377: Switch to device_property_match_property_string()
Replace open coded device_property_match_property_string(). Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Link: https://lore.kernel.org/r/20230808162800.61651-4-andriy.shevchenko@linux.intel.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
1 parent de135d7 commit 3f6e7aa

File tree

1 file changed

+6
-10
lines changed

1 file changed

+6
-10
lines changed

drivers/iio/frequency/adf4377.c

Lines changed: 6 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -870,7 +870,6 @@ static const struct iio_chan_spec adf4377_channels[] = {
870870
static int adf4377_properties_parse(struct adf4377_state *st)
871871
{
872872
struct spi_device *spi = st->spi;
873-
const char *str;
874873
int ret;
875874

876875
st->clkin = devm_clk_get_enabled(&spi->dev, "ref_in");
@@ -896,16 +895,13 @@ static int adf4377_properties_parse(struct adf4377_state *st)
896895
return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_enclk2),
897896
"failed to get the CE GPIO\n");
898897

899-
ret = device_property_read_string(&spi->dev, "adi,muxout-select", &str);
900-
if (ret) {
901-
st->muxout_select = ADF4377_MUXOUT_HIGH_Z;
902-
} else {
903-
ret = match_string(adf4377_muxout_modes, ARRAY_SIZE(adf4377_muxout_modes), str);
904-
if (ret < 0)
905-
return ret;
906-
898+
ret = device_property_match_property_string(&spi->dev, "adi,muxout-select",
899+
adf4377_muxout_modes,
900+
ARRAY_SIZE(adf4377_muxout_modes));
901+
if (ret >= 0)
907902
st->muxout_select = ret;
908-
}
903+
else
904+
st->muxout_select = ADF4377_MUXOUT_HIGH_Z;
909905

910906
return 0;
911907
}

0 commit comments

Comments
 (0)