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: ad9523: add dev variable

Introduce a local struct device variable in ad9523_probe() to simplify
subsequent conversions and improve code readability.

Split pdata declaration and assignment since the result is validated
immediately after.

No functional change.

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
9582a65e 7428168f

+9 -7
+9 -7
drivers/iio/frequency/ad9523.c
··· 948 948 949 949 static int ad9523_probe(struct spi_device *spi) 950 950 { 951 - struct ad9523_platform_data *pdata = dev_get_platdata(&spi->dev); 951 + struct device *dev = &spi->dev; 952 + struct ad9523_platform_data *pdata; 952 953 struct iio_dev *indio_dev; 953 954 struct ad9523_state *st; 954 955 int ret; 955 956 957 + pdata = dev_get_platdata(dev); 956 958 if (!pdata) { 957 959 dev_err(&spi->dev, "no platform data?\n"); 958 960 return -EINVAL; 959 961 } 960 962 961 - indio_dev = devm_iio_device_alloc(&spi->dev, sizeof(*st)); 963 + indio_dev = devm_iio_device_alloc(dev, sizeof(*st)); 962 964 if (indio_dev == NULL) 963 965 return -ENOMEM; 964 966 ··· 968 966 969 967 mutex_init(&st->lock); 970 968 971 - ret = devm_regulator_get_enable(&spi->dev, "vcc"); 969 + ret = devm_regulator_get_enable(dev, "vcc"); 972 970 if (ret) 973 971 return ret; 974 972 975 - st->pwrdown_gpio = devm_gpiod_get_optional(&spi->dev, "powerdown", 973 + st->pwrdown_gpio = devm_gpiod_get_optional(dev, "powerdown", 976 974 GPIOD_OUT_HIGH); 977 975 if (IS_ERR(st->pwrdown_gpio)) 978 976 return PTR_ERR(st->pwrdown_gpio); 979 977 980 - st->reset_gpio = devm_gpiod_get_optional(&spi->dev, "reset", 978 + st->reset_gpio = devm_gpiod_get_optional(dev, "reset", 981 979 GPIOD_OUT_LOW); 982 980 if (IS_ERR(st->reset_gpio)) 983 981 return PTR_ERR(st->reset_gpio); ··· 987 985 gpiod_direction_output(st->reset_gpio, 1); 988 986 } 989 987 990 - st->sync_gpio = devm_gpiod_get_optional(&spi->dev, "sync", 988 + st->sync_gpio = devm_gpiod_get_optional(dev, "sync", 991 989 GPIOD_OUT_HIGH); 992 990 if (IS_ERR(st->sync_gpio)) 993 991 return PTR_ERR(st->sync_gpio); ··· 1007 1005 if (ret < 0) 1008 1006 return ret; 1009 1007 1010 - return devm_iio_device_register(&spi->dev, indio_dev); 1008 + return devm_iio_device_register(dev, indio_dev); 1011 1009 } 1012 1010 1013 1011 static const struct spi_device_id ad9523_id[] = {