diff mbox

[13/16] mfd: omap-usb-host: Get rid of unnecessary spinlock

Message ID 1352990054-14680-14-git-send-email-rogerq@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Roger Quadros Nov. 15, 2012, 2:34 p.m. UTC
We don't really need a spinlock here, so get rid of it.

Signed-off-by: Roger Quadros <rogerq@ti.com>
---
 drivers/mfd/omap-usb-host.c |   16 ----------------
 1 files changed, 0 insertions(+), 16 deletions(-)

Comments

Felipe Balbi Nov. 21, 2012, 1:57 p.m. UTC | #1
Hi,

On Thu, Nov 15, 2012 at 04:34:11PM +0200, Roger Quadros wrote:
> We don't really need a spinlock here, so get rid of it.

can you prove it ? what if an IRQ happens right after disabling clocks
on ->runtime_suspend() but before it returns ? Will this not cause a
problem for you ?

(note that I have not dug pm_runtime code to make sure this wouldn't
cause a race).
Roger Quadros Nov. 21, 2012, 3:55 p.m. UTC | #2
On 11/21/2012 03:57 PM, Felipe Balbi wrote:
> Hi,
> 
> On Thu, Nov 15, 2012 at 04:34:11PM +0200, Roger Quadros wrote:
>> We don't really need a spinlock here, so get rid of it.
> 
> can you prove it ? what if an IRQ happens right after disabling clocks
> on ->runtime_suspend() but before it returns ? Will this not cause a
> problem for you ?
>

Which IRQ are you referring to? I don't see any IRQ handler in
omap-usb-hot.c

In the original code, the spinlock is used only in
runtime_suspend/resume and probe functions and it didn't make any sense
to me why it was there in the first place.

> (note that I have not dug pm_runtime code to make sure this wouldn't
> cause a race).
> 

cheers,
-roger
--
To unsubscribe from this list: send the line "unsubscribe linux-omap" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Felipe Balbi Nov. 21, 2012, 7:50 p.m. UTC | #3
Hi,

On Wed, Nov 21, 2012 at 05:55:19PM +0200, Roger Quadros wrote:
> On 11/21/2012 03:57 PM, Felipe Balbi wrote:
> > Hi,
> > 
> > On Thu, Nov 15, 2012 at 04:34:11PM +0200, Roger Quadros wrote:
> >> We don't really need a spinlock here, so get rid of it.
> > 
> > can you prove it ? what if an IRQ happens right after disabling clocks
> > on ->runtime_suspend() but before it returns ? Will this not cause a
> > problem for you ?
> >
> 
> Which IRQ are you referring to? I don't see any IRQ handler in
> omap-usb-hot.c

oops, silly old me ;-)

> In the original code, the spinlock is used only in
> runtime_suspend/resume and probe functions and it didn't make any sense
> to me why it was there in the first place.

fair enough, I should've looked at the code before assuming there was an
IRQ handler. Carry on :-)
diff mbox

Patch

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index e5ba193..4289847 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -23,7 +23,6 @@ 
 #include <linux/delay.h>
 #include <linux/clk.h>
 #include <linux/dma-mapping.h>
-#include <linux/spinlock.h>
 #include <linux/gpio.h>
 #include <plat/cpu.h>
 #include <plat/usb.h>
@@ -106,7 +105,6 @@  struct usbhs_hcd_omap {
 	struct usbhs_omap_platform_data	*pdata;
 
 	u32				usbhs_rev;
-	spinlock_t			lock;
 };
 /*-------------------------------------------------------------------------*/
 
@@ -279,14 +277,12 @@  static bool is_ohci_port(enum usbhs_omap_port_mode pmode)
 static int usbhs_runtime_resume(struct device *dev)
 {
 	struct usbhs_hcd_omap		*omap = dev_get_drvdata(dev);
-	unsigned long			flags;
 	struct usbhs_omap_platform_data *pdata = omap->pdata;
 	int i, r;
 
 	dev_dbg(dev, "usbhs_runtime_resume\n");
 
 	omap_tll_enable();
-	spin_lock_irqsave(&omap->lock, flags);
 
 	if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
 		clk_enable(omap->ehci_logic_fck);
@@ -324,22 +320,17 @@  static int usbhs_runtime_resume(struct device *dev)
 		}
 	}
 
-	spin_unlock_irqrestore(&omap->lock, flags);
-
 	return 0;
 }
 
 static int usbhs_runtime_suspend(struct device *dev)
 {
 	struct usbhs_hcd_omap		*omap = dev_get_drvdata(dev);
-	unsigned long			flags;
 	struct usbhs_omap_platform_data *pdata = omap->pdata;
 	int i;
 
 	dev_dbg(dev, "usbhs_runtime_suspend\n");
 
-	spin_lock_irqsave(&omap->lock, flags);
-
 	for (i = 0; i < omap->nports; i++) {
 		if (is_ehci_tll_mode(pdata->port_mode[i])) {
 			if (omap->port[i].utmi_clk)
@@ -358,7 +349,6 @@  static int usbhs_runtime_suspend(struct device *dev)
 	if (omap->ehci_logic_fck && !IS_ERR(omap->ehci_logic_fck))
 		clk_disable(omap->ehci_logic_fck);
 
-	spin_unlock_irqrestore(&omap->lock, flags);
 	omap_tll_disable();
 
 	return 0;
@@ -368,7 +358,6 @@  static void omap_usbhs_init(struct device *dev)
 {
 	struct usbhs_hcd_omap		*omap = dev_get_drvdata(dev);
 	struct usbhs_omap_platform_data	*pdata = omap->pdata;
-	unsigned long			flags;
 	unsigned			reg;
 	int i;
 
@@ -388,7 +377,6 @@  static void omap_usbhs_init(struct device *dev)
 	}
 
 	pm_runtime_get_sync(dev);
-	spin_lock_irqsave(&omap->lock, flags);
 
 	reg = usbhs_read(omap->uhh_base, OMAP_UHH_HOSTCONFIG);
 	/* setup ULPI bypass and burst configurations */
@@ -446,8 +434,6 @@  static void omap_usbhs_init(struct device *dev)
 	usbhs_write(omap->uhh_base, OMAP_UHH_HOSTCONFIG, reg);
 	dev_dbg(dev, "UHH setup done, uhh_hostconfig=%x\n", reg);
 
-	spin_unlock_irqrestore(&omap->lock, flags);
-
 	pm_runtime_put_sync(dev);
 	if (pdata->ehci_data->phy_reset) {
 		/* Hold the PHY in RESET for enough time till
@@ -519,8 +505,6 @@  static int __devinit usbhs_omap_probe(struct platform_device *pdev)
 		goto err_remap;
 	}
 
-	spin_lock_init(&omap->lock);
-
 	omap->pdata = pdata;
 	platform_set_drvdata(pdev, omap);
 	pm_runtime_enable(dev);