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: admv1014: 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
4ced084b 6faa4194

+16 -13
+16 -13
drivers/iio/frequency/admv1014.c
··· 610 610 { 611 611 unsigned int chip_id, enable_reg, enable_reg_msk; 612 612 struct spi_device *spi = st->spi; 613 + struct device *dev = &spi->dev; 613 614 int ret; 614 615 615 616 ret = regulator_bulk_enable(ADMV1014_NUM_REGULATORS, st->regulators); ··· 619 618 return ret; 620 619 } 621 620 622 - ret = devm_add_action_or_reset(&spi->dev, admv1014_reg_disable, st->regulators); 621 + ret = devm_add_action_or_reset(dev, admv1014_reg_disable, st->regulators); 623 622 if (ret) 624 623 return ret; 625 624 ··· 627 626 if (ret) 628 627 return ret; 629 628 630 - ret = devm_add_action_or_reset(&spi->dev, admv1014_clk_disable, st->clkin); 629 + ret = devm_add_action_or_reset(dev, admv1014_clk_disable, st->clkin); 631 630 if (ret) 632 631 return ret; 633 632 634 633 st->nb.notifier_call = admv1014_freq_change; 635 - ret = devm_clk_notifier_register(&spi->dev, st->clkin, &st->nb); 634 + ret = devm_clk_notifier_register(dev, st->clkin, &st->nb); 636 635 if (ret) 637 636 return ret; 638 637 639 - ret = devm_add_action_or_reset(&spi->dev, admv1014_powerdown, st); 638 + ret = devm_add_action_or_reset(dev, admv1014_powerdown, st); 640 639 if (ret) 641 640 return ret; 642 641 ··· 713 712 { 714 713 unsigned int i; 715 714 struct spi_device *spi = st->spi; 715 + struct device *dev = &spi->dev; 716 716 int ret; 717 717 718 - st->det_en = device_property_read_bool(&spi->dev, "adi,detector-enable"); 718 + st->det_en = device_property_read_bool(dev, "adi,detector-enable"); 719 719 720 - st->p1db_comp = device_property_read_bool(&spi->dev, "adi,p1db-compensation-enable"); 720 + st->p1db_comp = device_property_read_bool(dev, "adi,p1db-compensation-enable"); 721 721 722 - ret = device_property_match_property_string(&spi->dev, "adi,input-mode", 722 + ret = device_property_match_property_string(dev, "adi,input-mode", 723 723 input_mode_names, 724 724 ARRAY_SIZE(input_mode_names)); 725 725 if (ret >= 0) ··· 728 726 else 729 727 st->input_mode = ADMV1014_IQ_MODE; 730 728 731 - ret = device_property_match_property_string(&spi->dev, "adi,quad-se-mode", 729 + ret = device_property_match_property_string(dev, "adi,quad-se-mode", 732 730 quad_se_mode_names, 733 731 ARRAY_SIZE(quad_se_mode_names)); 734 732 if (ret >= 0) ··· 739 737 for (i = 0; i < ADMV1014_NUM_REGULATORS; ++i) 740 738 st->regulators[i].supply = admv1014_reg_name[i]; 741 739 742 - ret = devm_regulator_bulk_get(&st->spi->dev, ADMV1014_NUM_REGULATORS, 740 + ret = devm_regulator_bulk_get(dev, ADMV1014_NUM_REGULATORS, 743 741 st->regulators); 744 742 if (ret) { 745 743 dev_err(&spi->dev, "Failed to request regulators"); 746 744 return ret; 747 745 } 748 746 749 - st->clkin = devm_clk_get(&spi->dev, "lo_in"); 747 + st->clkin = devm_clk_get(dev, "lo_in"); 750 748 if (IS_ERR(st->clkin)) 751 - return dev_err_probe(&spi->dev, PTR_ERR(st->clkin), 749 + return dev_err_probe(dev, PTR_ERR(st->clkin), 752 750 "failed to get the LO input clock\n"); 753 751 754 752 return 0; ··· 758 756 { 759 757 struct iio_dev *indio_dev; 760 758 struct admv1014_state *st; 759 + struct device *dev = &spi->dev; 761 760 int ret; 762 761 763 - indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); 762 + indio_dev = devm_iio_device_alloc(dev, sizeof(*st)); 764 763 if (!indio_dev) 765 764 return -ENOMEM; 766 765 ··· 790 787 if (ret) 791 788 return ret; 792 789 793 - return devm_iio_device_register(&spi->dev, indio_dev); 790 + return devm_iio_device_register(dev, indio_dev); 794 791 } 795 792 796 793 static const struct spi_device_id admv1014_id[] = {