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

Configure Feed

Select the types of activity you want to include in your feed.

iio: frequency: adf4377: add dev variable

Introduce a local struct device pointer in functions that reference
&spi->dev for device-managed resource calls and device property reads,
improving code readability.

Signed-off-by: Antoniu Miclaus <antoniu.miclaus@analog.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>

authored by

Antoniu Miclaus and committed by
Jonathan Cameron
b2d2a6ea 9e9f38c4

+14 -13
+14 -13
drivers/iio/frequency/adf4377.c
··· 882 882 883 883 static int adf4377_properties_parse(struct adf4377_state *st) 884 884 { 885 - struct spi_device *spi = st->spi; 885 + struct device *dev = &st->spi->dev; 886 886 int ret; 887 887 888 - st->clkin = devm_clk_get_enabled(&spi->dev, "ref_in"); 888 + st->clkin = devm_clk_get_enabled(dev, "ref_in"); 889 889 if (IS_ERR(st->clkin)) 890 - return dev_err_probe(&spi->dev, PTR_ERR(st->clkin), 890 + return dev_err_probe(dev, PTR_ERR(st->clkin), 891 891 "failed to get the reference input clock\n"); 892 892 893 - st->gpio_ce = devm_gpiod_get_optional(&st->spi->dev, "chip-enable", 893 + st->gpio_ce = devm_gpiod_get_optional(dev, "chip-enable", 894 894 GPIOD_OUT_LOW); 895 895 if (IS_ERR(st->gpio_ce)) 896 - return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_ce), 896 + return dev_err_probe(dev, PTR_ERR(st->gpio_ce), 897 897 "failed to get the CE GPIO\n"); 898 898 899 - st->gpio_enclk1 = devm_gpiod_get_optional(&st->spi->dev, "clk1-enable", 899 + st->gpio_enclk1 = devm_gpiod_get_optional(dev, "clk1-enable", 900 900 GPIOD_OUT_LOW); 901 901 if (IS_ERR(st->gpio_enclk1)) 902 - return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_enclk1), 902 + return dev_err_probe(dev, PTR_ERR(st->gpio_enclk1), 903 903 "failed to get the CE GPIO\n"); 904 904 905 905 if (st->chip_info->has_gpio_enclk2) { 906 - st->gpio_enclk2 = devm_gpiod_get_optional(&st->spi->dev, "clk2-enable", 906 + st->gpio_enclk2 = devm_gpiod_get_optional(dev, "clk2-enable", 907 907 GPIOD_OUT_LOW); 908 908 if (IS_ERR(st->gpio_enclk2)) 909 - return dev_err_probe(&spi->dev, PTR_ERR(st->gpio_enclk2), 909 + return dev_err_probe(dev, PTR_ERR(st->gpio_enclk2), 910 910 "failed to get the CE GPIO\n"); 911 911 } 912 912 913 - ret = device_property_match_property_string(&spi->dev, "adi,muxout-select", 913 + ret = device_property_match_property_string(dev, "adi,muxout-select", 914 914 adf4377_muxout_modes, 915 915 ARRAY_SIZE(adf4377_muxout_modes)); 916 916 if (ret >= 0) ··· 1055 1055 struct iio_dev *indio_dev; 1056 1056 struct regmap *regmap; 1057 1057 struct adf4377_state *st; 1058 + struct device *dev = &spi->dev; 1058 1059 int ret; 1059 1060 1060 - indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); 1061 + indio_dev = devm_iio_device_alloc(dev, sizeof(*st)); 1061 1062 if (!indio_dev) 1062 1063 return -ENOMEM; 1063 1064 ··· 1081 1080 return ret; 1082 1081 1083 1082 st->nb.notifier_call = adf4377_freq_change; 1084 - ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb); 1083 + ret = devm_clk_notifier_register(dev, st->clkin, &st->nb); 1085 1084 if (ret) 1086 1085 return ret; 1087 1086 ··· 1098 1097 indio_dev->num_channels = ARRAY_SIZE(adf4377_channels); 1099 1098 } 1100 1099 1101 - return devm_iio_device_register(&spi->dev, indio_dev); 1100 + return devm_iio_device_register(dev, indio_dev); 1102 1101 } 1103 1102 1104 1103 static const struct spi_device_id adf4377_id[] = {