Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

iio: frequency: admv1014: 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-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Andy Shevchenko and committed by
Jonathan Cameron
f993267a 7829a9d7

+12 -19
+12 -19
drivers/iio/frequency/admv1014.c
··· 710 710 711 711 static int admv1014_properties_parse(struct admv1014_state *st) 712 712 { 713 - const char *str; 714 713 unsigned int i; 715 714 struct spi_device *spi = st->spi; 716 715 int ret; ··· 718 719 719 720 st->p1db_comp = device_property_read_bool(&spi->dev, "adi,p1db-compensation-enable"); 720 721 721 - ret = device_property_read_string(&spi->dev, "adi,input-mode", &str); 722 - if (ret) { 723 - st->input_mode = ADMV1014_IQ_MODE; 724 - } else { 725 - ret = match_string(input_mode_names, ARRAY_SIZE(input_mode_names), str); 726 - if (ret < 0) 727 - return ret; 728 - 722 + ret = device_property_match_property_string(&spi->dev, "adi,input-mode", 723 + input_mode_names, 724 + ARRAY_SIZE(input_mode_names)); 725 + if (ret >= 0) 729 726 st->input_mode = ret; 730 - } 727 + else 728 + st->input_mode = ADMV1014_IQ_MODE; 731 729 732 - ret = device_property_read_string(&spi->dev, "adi,quad-se-mode", &str); 733 - if (ret) { 734 - st->quad_se_mode = ADMV1014_SE_MODE_POS; 735 - } else { 736 - ret = match_string(quad_se_mode_names, ARRAY_SIZE(quad_se_mode_names), str); 737 - if (ret < 0) 738 - return ret; 739 - 730 + ret = device_property_match_property_string(&spi->dev, "adi,quad-se-mode", 731 + quad_se_mode_names, 732 + ARRAY_SIZE(quad_se_mode_names)); 733 + if (ret >= 0) 740 734 st->quad_se_mode = ADMV1014_SE_MODE_POS + (ret * 3); 741 - } 735 + else 736 + st->quad_se_mode = ADMV1014_SE_MODE_POS; 742 737 743 738 for (i = 0; i < ADMV1014_NUM_REGULATORS; ++i) 744 739 st->regulators[i].supply = admv1014_reg_name[i];