iio: imx7d_adc: Add local struct device pointer in imx7d_adc_probe()

Use a local "struct device *dev" in imx7d_adc_probe() for brevity. No
functional change intended.

Signed-off-by: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Jonathan Cameron <jic23@kernel.org>
Cc: Hartmut Knaack <knaack.h@gmx.de>
Cc: Lars-Peter Clausen <lars@metafoo.de>
Cc: Peter Meerwald-Stadler <pmeerw@pmeerw.net>
Cc: Chris Healy <cphealy@gmail.com>
Cc: linux-iio@vger.kernel.org
Cc: linux-kernel@vger.kernel.org
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
This commit is contained in:
Andrey Smirnov 2019-04-03 00:03:20 -07:00 committed by Jonathan Cameron
parent 3e5ffe47ed
commit aa21a28e90
1 changed files with 18 additions and 19 deletions

View File

@ -438,51 +438,51 @@ static int imx7d_adc_probe(struct platform_device *pdev)
struct imx7d_adc *info; struct imx7d_adc *info;
struct iio_dev *indio_dev; struct iio_dev *indio_dev;
struct resource *mem; struct resource *mem;
struct device *dev = &pdev->dev;
int irq; int irq;
int ret; int ret;
indio_dev = devm_iio_device_alloc(&pdev->dev, sizeof(*info)); indio_dev = devm_iio_device_alloc(dev, sizeof(*info));
if (!indio_dev) { if (!indio_dev) {
dev_err(&pdev->dev, "Failed allocating iio device\n"); dev_err(&pdev->dev, "Failed allocating iio device\n");
return -ENOMEM; return -ENOMEM;
} }
info = iio_priv(indio_dev); info = iio_priv(indio_dev);
info->dev = &pdev->dev; info->dev = dev;
mem = platform_get_resource(pdev, IORESOURCE_MEM, 0); mem = platform_get_resource(pdev, IORESOURCE_MEM, 0);
info->regs = devm_ioremap_resource(&pdev->dev, mem); info->regs = devm_ioremap_resource(dev, mem);
if (IS_ERR(info->regs)) { if (IS_ERR(info->regs)) {
ret = PTR_ERR(info->regs); ret = PTR_ERR(info->regs);
dev_err(&pdev->dev, dev_err(dev, "Failed to remap adc memory, err = %d\n", ret);
"Failed to remap adc memory, err = %d\n", ret);
return ret; return ret;
} }
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq < 0) { if (irq < 0) {
dev_err(&pdev->dev, "No irq resource?\n"); dev_err(dev, "No irq resource?\n");
return irq; return irq;
} }
info->clk = devm_clk_get(&pdev->dev, "adc"); info->clk = devm_clk_get(dev, "adc");
if (IS_ERR(info->clk)) { if (IS_ERR(info->clk)) {
ret = PTR_ERR(info->clk); ret = PTR_ERR(info->clk);
dev_err(&pdev->dev, "Failed getting clock, err = %d\n", ret); dev_err(dev, "Failed getting clock, err = %d\n", ret);
return ret; return ret;
} }
info->vref = devm_regulator_get(&pdev->dev, "vref"); info->vref = devm_regulator_get(dev, "vref");
if (IS_ERR(info->vref)) { if (IS_ERR(info->vref)) {
ret = PTR_ERR(info->vref); ret = PTR_ERR(info->vref);
dev_err(&pdev->dev, dev_err(dev,
"Failed getting reference voltage, err = %d\n", ret); "Failed getting reference voltage, err = %d\n", ret);
return ret; return ret;
} }
ret = regulator_enable(info->vref); ret = regulator_enable(info->vref);
if (ret) { if (ret) {
dev_err(&pdev->dev, dev_err(dev,
"Can't enable adc reference top voltage, err = %d\n", "Can't enable adc reference top voltage, err = %d\n",
ret); ret);
return ret; return ret;
@ -492,8 +492,8 @@ static int imx7d_adc_probe(struct platform_device *pdev)
init_completion(&info->completion); init_completion(&info->completion);
indio_dev->name = dev_name(&pdev->dev); indio_dev->name = dev_name(dev);
indio_dev->dev.parent = &pdev->dev; indio_dev->dev.parent = dev;
indio_dev->info = &imx7d_adc_iio_info; indio_dev->info = &imx7d_adc_iio_info;
indio_dev->modes = INDIO_DIRECT_MODE; indio_dev->modes = INDIO_DIRECT_MODE;
indio_dev->channels = imx7d_adc_iio_channels; indio_dev->channels = imx7d_adc_iio_channels;
@ -501,16 +501,15 @@ static int imx7d_adc_probe(struct platform_device *pdev)
ret = clk_prepare_enable(info->clk); ret = clk_prepare_enable(info->clk);
if (ret) { if (ret) {
dev_err(&pdev->dev, dev_err(dev, "Could not prepare or enable the clock.\n");
"Could not prepare or enable the clock.\n");
goto error_adc_clk_enable; goto error_adc_clk_enable;
} }
ret = devm_request_irq(info->dev, irq, ret = devm_request_irq(dev, irq,
imx7d_adc_isr, 0, imx7d_adc_isr, 0,
dev_name(&pdev->dev), info); dev_name(dev), info);
if (ret < 0) { if (ret < 0) {
dev_err(&pdev->dev, "Failed requesting irq, irq = %d\n", irq); dev_err(dev, "Failed requesting irq, irq = %d\n", irq);
goto error_iio_device_register; goto error_iio_device_register;
} }