Skip to contentSkip to conversation

spi: spi-ep93xx: use devm_clk_get()

PATCH Applied H Hartley Sweeten 3 participants 6 messages Jul 2, 2013 – Jul 3, 2013 SPI

lore
Share & tools
lore
#0 lore raw

PATCH v2 5/11 spi: spi-ep93xx: use devm_clk_get()

Use devm_clk_get() so that the clk_put() happens automatically when the last reference to this driver is dropped.

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(-)
drivers/spi/spi-ep93xx.c +3 -6
index c2660c2..c1a610e 100644
@@ -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;
Signature · 9 lines
1.8.1.4


------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev
Acked-by on v2 5/11
#1 lore raw
Quoted 6 lines · H Hartley Sweeten

Use devm_clk_get() so that the clk_put() happens automatically when the last reference to this driver is dropped.

Cc Ryan Mallon <[email protected]>
Cc Mika Westerberg <[email protected]>

------------------------------------------------------------------------------
This SF.net email is sponsored by Windows:

Build for Windows Store.

http://p.sf.net/sfu/windows-dev2dev

maintainer
#2 lore raw
In reply to H Hartley Sweeten
Quoted 2 lines · H Hartley Sweeten

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.

#3 lore raw
Quoted 7 lines · Mark Brown
Quoted 2 lines · H Hartley Sweeten

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

#4 lore raw
In reply to Mark Brown
Quoted 7 lines · Mark Brown
Quoted 2 lines · H Hartley Sweeten

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

maintainer
#5 lore raw
Quoted 2 lines · H Hartley Sweeten

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.

Quoted 4 lines

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.