Commit b8cc27ca authored by Gujulan Elango, Hari Prasath (H.)'s avatar Gujulan Elango, Hari Prasath (H.) Committed by Jonathan Cameron

staging: iio: replace clk_get() with devm_clk_get()

This patch replaces the clk_get() with devm_clk_get().Accordingly,modified
the error paths,rename error labels and removed clk_put() in probe() &
remove functions.
Signed-off-by: default avatarHari Prasath Gujulan Elango <hgujulan@visteon.com>
Signed-off-by: default avatarJonathan Cameron <jic23@kernel.org>
parent 3b31b783
...@@ -288,7 +288,7 @@ static int spear_adc_probe(struct platform_device *pdev) ...@@ -288,7 +288,7 @@ static int spear_adc_probe(struct platform_device *pdev)
st->adc_base_spear3xx = st->adc_base_spear3xx =
(struct adc_regs_spear3xx __iomem *)st->adc_base_spear6xx; (struct adc_regs_spear3xx __iomem *)st->adc_base_spear6xx;
st->clk = clk_get(dev, NULL); st->clk = devm_clk_get(dev, NULL);
if (IS_ERR(st->clk)) { if (IS_ERR(st->clk)) {
dev_err(dev, "failed getting clock\n"); dev_err(dev, "failed getting clock\n");
goto errout1; goto errout1;
...@@ -297,28 +297,28 @@ static int spear_adc_probe(struct platform_device *pdev) ...@@ -297,28 +297,28 @@ static int spear_adc_probe(struct platform_device *pdev)
ret = clk_prepare_enable(st->clk); ret = clk_prepare_enable(st->clk);
if (ret) { if (ret) {
dev_err(dev, "failed enabling clock\n"); dev_err(dev, "failed enabling clock\n");
goto errout2; goto errout1;
} }
irq = platform_get_irq(pdev, 0); irq = platform_get_irq(pdev, 0);
if (irq <= 0) { if (irq <= 0) {
dev_err(dev, "failed getting interrupt resource\n"); dev_err(dev, "failed getting interrupt resource\n");
ret = -EINVAL; ret = -EINVAL;
goto errout3; goto errout2;
} }
ret = devm_request_irq(dev, irq, spear_adc_isr, 0, SPEAR_ADC_MOD_NAME, ret = devm_request_irq(dev, irq, spear_adc_isr, 0, SPEAR_ADC_MOD_NAME,
st); st);
if (ret < 0) { if (ret < 0) {
dev_err(dev, "failed requesting interrupt\n"); dev_err(dev, "failed requesting interrupt\n");
goto errout3; goto errout2;
} }
if (of_property_read_u32(np, "sampling-frequency", if (of_property_read_u32(np, "sampling-frequency",
&st->sampling_freq)) { &st->sampling_freq)) {
dev_err(dev, "sampling-frequency missing in DT\n"); dev_err(dev, "sampling-frequency missing in DT\n");
ret = -EINVAL; ret = -EINVAL;
goto errout3; goto errout2;
} }
/* /*
...@@ -348,16 +348,14 @@ static int spear_adc_probe(struct platform_device *pdev) ...@@ -348,16 +348,14 @@ static int spear_adc_probe(struct platform_device *pdev)
ret = iio_device_register(indio_dev); ret = iio_device_register(indio_dev);
if (ret) if (ret)
goto errout3; goto errout2;
dev_info(dev, "SPEAR ADC driver loaded, IRQ %d\n", irq); dev_info(dev, "SPEAR ADC driver loaded, IRQ %d\n", irq);
return 0; return 0;
errout3:
clk_disable_unprepare(st->clk);
errout2: errout2:
clk_put(st->clk); clk_disable_unprepare(st->clk);
errout1: errout1:
iounmap(st->adc_base_spear6xx); iounmap(st->adc_base_spear6xx);
return ret; return ret;
...@@ -370,7 +368,6 @@ static int spear_adc_remove(struct platform_device *pdev) ...@@ -370,7 +368,6 @@ static int spear_adc_remove(struct platform_device *pdev)
iio_device_unregister(indio_dev); iio_device_unregister(indio_dev);
clk_disable_unprepare(st->clk); clk_disable_unprepare(st->clk);
clk_put(st->clk);
iounmap(st->adc_base_spear6xx); iounmap(st->adc_base_spear6xx);
return 0; return 0;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment