summaryrefslogtreecommitdiffstats
path: root/drivers/iio/adc/cc10001_adc.c
diff options
context:
space:
mode:
authorJonathan Cameron <Jonathan.Cameron@huawei.com>2022-10-16 19:09:46 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2022-11-23 20:44:04 +0100
commit26bfb581931a020eaf560612f01009b3e179db0a (patch)
treeba16930df71e731f16bdff7916bb29e029ec4bc1 /drivers/iio/adc/cc10001_adc.c
parentiio: Don't silently expect attribute types (diff)
downloadlinux-26bfb581931a020eaf560612f01009b3e179db0a.tar.xz
linux-26bfb581931a020eaf560612f01009b3e179db0a.zip
iio: adc: cc10001: Add local struct device *dev variable to avoid repitition
There are lots of uses of this in probe() and we are about to introduce some more, so add a local variable to simplify this. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Reviewed-by: Nuno Sá <nuno.sa@analog.com> Link: https://lore.kernel.org/r/20221016170950.387751-2-jic23@kernel.org
Diffstat (limited to '')
-rw-r--r--drivers/iio/adc/cc10001_adc.c17
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/iio/adc/cc10001_adc.c b/drivers/iio/adc/cc10001_adc.c
index e16ac935693b..eeaea1362ed1 100644
--- a/drivers/iio/adc/cc10001_adc.c
+++ b/drivers/iio/adc/cc10001_adc.c
@@ -307,14 +307,15 @@ static int cc10001_adc_channel_init(struct iio_dev *indio_dev,
static int cc10001_adc_probe(struct platform_device *pdev)
{
- struct device_node *node = pdev->dev.of_node;
+ struct device *dev = &pdev->dev;
+ struct device_node *node = dev->of_node;
struct cc10001_adc_device *adc_dev;
unsigned long adc_clk_rate;
struct iio_dev *indio_dev;
unsigned long channel_map;
int ret;
- indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*adc_dev));
+ indio_dev = devm_iio_device_alloc(dev, sizeof(*adc_dev));
if (indio_dev == NULL)
return -ENOMEM;
@@ -326,7 +327,7 @@ static int cc10001_adc_probe(struct platform_device *pdev)
channel_map &= ~ret;
}
- adc_dev->reg = devm_regulator_get(&pdev->dev, "vref");
+ adc_dev->reg = devm_regulator_get(dev, "vref");
if (IS_ERR(adc_dev->reg))
return PTR_ERR(adc_dev->reg);
@@ -334,7 +335,7 @@ static int cc10001_adc_probe(struct platform_device *pdev)
if (ret)
return ret;
- indio_dev->name = dev_name(&pdev->dev);
+ indio_dev->name = dev_name(dev);
indio_dev->info = &cc10001_adc_info;
indio_dev->modes = INDIO_DIRECT_MODE;
@@ -344,23 +345,23 @@ static int cc10001_adc_probe(struct platform_device *pdev)
goto err_disable_reg;
}
- adc_dev->adc_clk = devm_clk_get(&pdev->dev, "adc");
+ adc_dev->adc_clk = devm_clk_get(dev, "adc");
if (IS_ERR(adc_dev->adc_clk)) {
- dev_err(&pdev->dev, "failed to get the clock\n");
+ dev_err(dev, "failed to get the clock\n");
ret = PTR_ERR(adc_dev->adc_clk);
goto err_disable_reg;
}
ret = clk_prepare_enable(adc_dev->adc_clk);
if (ret) {
- dev_err(&pdev->dev, "failed to enable the clock\n");
+ dev_err(dev, "failed to enable the clock\n");
goto err_disable_reg;
}
adc_clk_rate = clk_get_rate(adc_dev->adc_clk);
if (!adc_clk_rate) {
ret = -EINVAL;
- dev_err(&pdev->dev, "null clock rate!\n");
+ dev_err(dev, "null clock rate!\n");
goto err_disable_clk;
}