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: filter: admv8818: 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
008120ca bbb8e120

+11 -10
+11 -10
drivers/iio/filter/admv8818.c
··· 701 701 702 702 static int admv8818_clk_setup(struct admv8818_state *st) 703 703 { 704 - struct spi_device *spi = st->spi; 704 + struct device *dev = &st->spi->dev; 705 705 int ret; 706 706 707 - st->clkin = devm_clk_get_optional(&spi->dev, "rf_in"); 707 + st->clkin = devm_clk_get_optional(dev, "rf_in"); 708 708 if (IS_ERR(st->clkin)) 709 - return dev_err_probe(&spi->dev, PTR_ERR(st->clkin), 709 + return dev_err_probe(dev, PTR_ERR(st->clkin), 710 710 "failed to get the input clock\n"); 711 711 else if (!st->clkin) 712 712 return 0; ··· 715 715 if (ret) 716 716 return ret; 717 717 718 - ret = devm_add_action_or_reset(&spi->dev, admv8818_clk_disable, st); 718 + ret = devm_add_action_or_reset(dev, admv8818_clk_disable, st); 719 719 if (ret) 720 720 return ret; 721 721 ··· 724 724 if (ret < 0) 725 725 return ret; 726 726 727 - return devm_add_action_or_reset(&spi->dev, admv8818_clk_notifier_unreg, st); 727 + return devm_add_action_or_reset(dev, admv8818_clk_notifier_unreg, st); 728 728 } 729 729 730 730 static int admv8818_read_properties(struct admv8818_state *st) 731 731 { 732 - struct spi_device *spi = st->spi; 732 + struct device *dev = &st->spi->dev; 733 733 u32 mhz; 734 734 int ret; 735 735 736 - ret = device_property_read_u32(&spi->dev, "adi,lpf-margin-mhz", &mhz); 736 + ret = device_property_read_u32(dev, "adi,lpf-margin-mhz", &mhz); 737 737 if (ret == 0) 738 738 st->lpf_margin_hz = (u64)mhz * HZ_PER_MHZ; 739 739 else if (ret == -EINVAL) ··· 742 742 return ret; 743 743 744 744 745 - ret = device_property_read_u32(&spi->dev, "adi,hpf-margin-mhz", &mhz); 745 + ret = device_property_read_u32(dev, "adi,hpf-margin-mhz", &mhz); 746 746 if (ret == 0) 747 747 st->hpf_margin_hz = (u64)mhz * HZ_PER_MHZ; 748 748 else if (ret == -EINVAL) ··· 758 758 struct iio_dev *indio_dev; 759 759 struct regmap *regmap; 760 760 struct admv8818_state *st; 761 + struct device *dev = &spi->dev; 761 762 int ret; 762 763 763 - indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); 764 + indio_dev = devm_iio_device_alloc(dev, sizeof(*st)); 764 765 if (!indio_dev) 765 766 return -ENOMEM; 766 767 ··· 793 792 if (ret) 794 793 return ret; 795 794 796 - return devm_iio_device_register(&spi->dev, indio_dev); 795 + return devm_iio_device_register(dev, indio_dev); 797 796 } 798 797 799 798 static const struct spi_device_id admv8818_id[] = {