Use devm_clk_get() so that the clk_put() happens automatically when
the last reference to this driver is dropped.
Signed-off-by: H Hartley Sweeten <[email protected]>
Cc: Ryan Mallon <[email protected]>
Cc: Mika Westerberg <[email protected]>
Cc: Mark Brown <[email protected]>
Cc: Grant Likely <[email protected]>
---
drivers/spi/spi-ep93xx.c | 9 +++------
1 file changed, 3 insertions(+), 6 deletions(-)
diff --git a/drivers/spi/spi-ep93xx.c b/drivers/spi/spi-ep93xx.c
index c2660c2..c1a610e 100644
--- a/drivers/spi/spi-ep93xx.c
+++ b/drivers/spi/spi-ep93xx.c
@@ -1021,7 +1021,7 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
espi = spi_master_get_devdata(master);
- espi->clk = clk_get(&pdev->dev, NULL);
+ espi->clk = devm_clk_get(&pdev->dev, NULL);
if (IS_ERR(espi->clk)) {
dev_err(&pdev->dev, "unable to get spi clock\n");
error = PTR_ERR(espi->clk);
@@ -1044,14 +1044,14 @@ static int ep93xx_spi_probe(struct platform_device *pdev)
espi->regs_base = devm_ioremap_resource(&pdev->dev, res);
if (IS_ERR(espi->regs_base)) {
error = PTR_ERR(espi->regs_base);
- goto fail_put_clock;
+ goto fail_release_master;
}
error = devm_request_irq(&pdev->dev, irq, ep93xx_spi_interrupt,
0, "ep93xx-spi", espi);
if (error) {
dev_err(&pdev->dev, "failed to request irq\n");
- goto fail_put_clock;
+ goto fail_release_master;
}
if (info->use_dma && ep93xx_spi_setup_dma(espi))
@@ -1085,8 +1085,6 @@ fail_free_queue:
destroy_workqueue(espi->wq);
fail_free_dma:
ep93xx_spi_release_dma(espi);
-fail_put_clock:
- clk_put(espi->clk);
fail_release_master:
spi_master_put(master);
@@ -1122,7 +1120,6 @@ static int ep93xx_spi_remove(struct platform_device *pdev)
spin_unlock_irq(&espi->lock);
ep93xx_spi_release_dma(espi);
- clk_put(espi->clk);
spi_unregister_master(master);
return 0;
--
1.8.1.4
On Tue, Jul 02, 2013 at 10:08:21AM -0700, H Hartley Sweeten wrote:
> Use devm_clk_get() so that the clk_put() happens automatically when
> the last reference to this driver is dropped.
>
> Signed-off-by: H Hartley Sweeten <[email protected]>
> Cc: Ryan Mallon <[email protected]>
> Cc: Mika Westerberg <[email protected]>
Acked-by: Mika Westerberg <[email protected]>
On Tue, Jul 02, 2013 at 10:08:21AM -0700, H Hartley Sweeten wrote:
> Use devm_clk_get() so that the clk_put() happens automatically when
> the last reference to this driver is dropped.
This doesn't apply against current code - always submit against the
relevant development tree, in this case topic/ep93xx. I've applied it
with a manual fixup.
On Wednesday, July 03, 2013 11:21 AM, Mark Brown wrote:
> On Tue, Jul 02, 2013 at 10:08:21AM -0700, H Hartley Sweeten wrote:
>> Use devm_clk_get() so that the clk_put() happens automatically when
>> the last reference to this driver is dropped.
>
> This doesn't apply against current code - always submit against the
> relevant development tree, in this case topic/ep93xx. I've applied it
> with a manual fixup.
Sorry about the trouble. Thanks for fixing it.
Regards,
Hartley
On Wednesday, July 03, 2013 11:21 AM, Mark Brown wrote:
> On Tue, Jul 02, 2013 at 10:08:21AM -0700, H Hartley Sweeten wrote:
>> Use devm_clk_get() so that the clk_put() happens automatically when
>> the last reference to this driver is dropped.
>
> This doesn't apply against current code - always submit against the
> relevant development tree, in this case topic/ep93xx. I've applied it
> with a manual fixup.
Hello Mark,
It appears your topic/ep93xx branch is missing this:
commit 24778be20f87d5aadb19624fc768b3159fa43efc
Author: Stephen Warren <[email protected]>
Date: Tue May 21 20:36:35 2013 -0600
spi: convert drivers to use bits_per_word_mask
This commit is in linux-next which is what the patch series was based on.
I'm not sure what branch you applied that patch to.
If you need to drop my previous patches that you applied to topic/ep93xx
in order to sync things up please let me know how to proceed. There are
four more patches pending for spi-ep93xx to finish the cleanup and convert
it to the SPI queued driver infrastructure.
These are the relevant commits in topic/spi-ep93xx:
kernel / pub/scm/linux/kernel/git/broonie/spi / topic/ep93xx / drivers / spi / spi-ep93xx.c
3051c43 spi: spi-ep93xx: use devm_clk_get() by H Hartley Sweeten - 28 hours ago topic/ep93xx
e5ae625 spi: spi-ep93xx: remove 'dss' from per chip private data by H Hartley Sweeten - 28 hours ago
4af59ef spi: spi-ep93xx: remove dev_err() for kzalloc() failure by H Hartley Sweeten - 28 hours ago
8b9d957 spi: spi-ep93xx: get platform resources early in (*probe) by H Hartley Sweeten - 28 hours ago
c6b7f14 spi: spi-ep93xx: remove bits_per_word() helper by H Hartley Sweeten - 28 hours ago
75c7444 spi: spi-ep93xx: use read,write instead of __raw_* variants by H Hartley Sweeten - 28 hours ago
eb41eeb spi: spi-ep93xx: always handle transfer specific settings by H Hartley Sweeten - 5 days ago
Sorry about the trouble. I don't have your tree pulled so I was starting
from linux-next under the assumption that it was current to your tree.
Regards,
Hartley
On Wed, Jul 03, 2013 at 04:12:39PM -0500, H Hartley Sweeten wrote:
> This commit is in linux-next which is what the patch series was based on.
> I'm not sure what branch you applied that patch to.
I'll apply anything to topic/ep83xx branch. Which I'll probably rebase
against spi-v3.11 now since Linus pulled the tree for the merge window.
The bits per word change was a cross subsystem thing so ended up on its
own topic branch.
> If you need to drop my previous patches that you applied to topic/ep93xx
> in order to sync things up please let me know how to proceed. There are
> four more patches pending for spi-ep93xx to finish the cleanup and convert
> it to the SPI queued driver infrastructure.
I'm waiting for others to review and/or test them since there seem to be
several interested people.