diff mbox

mfd: Fix usbhs_enable error handling

Message ID 1303395763-8702-1-git-send-email-keshava_mgowda@ti.com (mailing list archive)
State New, archived
Headers show

Commit Message

Munegowda, Keshava April 21, 2011, 2:22 p.m. UTC
From: Axel Lin <axel.lin@gmail.com>

In the case of missing platform_data we do not hold a spin_lock,
thus we should not call spin_unlock_irqrestore in the error path.

Also simplify the error handling by separating the successful path
from error path. I think this change improves readability.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/mfd/omap-usb-host.c |    8 +++-----
 1 files changed, 3 insertions(+), 5 deletions(-)

Comments

Felipe Balbi April 26, 2011, 8:58 a.m. UTC | #1
Hi,

On Thu, Apr 21, 2011 at 07:52:41PM +0530, Keshava Munegowda wrote:
> From: Axel Lin <axel.lin@gmail.com>
> 
> In the case of missing platform_data we do not hold a spin_lock,
> thus we should not call spin_unlock_irqrestore in the error path.
> 
> Also simplify the error handling by separating the successful path
> from error path. I think this change improves readability.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

Can someone give me a Tested-by so I can take these patches.
Munegowda, Keshava April 26, 2011, 9:02 a.m. UTC | #2
> -----Original Message-----
> From: Felipe Balbi [mailto:balbi@ti.com]
> Sent: Tuesday, April 26, 2011 2:29 PM
> To: Keshava Munegowda
> Cc: linux-usb@vger.kernel.org; linux-omap@vger.kernel.org; balbi@ti.com;
gadiyar@ti.com; p-
> basak2@ti.com; axel.lin@gmail.com; johnstul@us.ibm.com;
mpfj-list@mimc.co.uk
> Subject: Re: [PATCH] mfd: Fix usbhs_enable error handling
>
> Hi,
>
> On Thu, Apr 21, 2011 at 07:52:41PM +0530, Keshava Munegowda wrote:
> > From: Axel Lin <axel.lin@gmail.com>
> >
> > In the case of missing platform_data we do not hold a spin_lock,
> > thus we should not call spin_unlock_irqrestore in the error path.
> >
> > Also simplify the error handling by separating the successful path
> > from error path. I think this change improves readability.
> >
> > Signed-off-by: Axel Lin <axel.lin@gmail.com>
>
> Can someone give me a Tested-by so I can take these patches.
>
> --
> Balbi

Hi Balbi

I have validated this patch and it works :)

Tested-by: Keshava Munegowda <keshava_mgowda@ti.com>
--
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 April 26, 2011, 9:04 a.m. UTC | #3
On Tue, Apr 26, 2011 at 02:32:04PM +0530, Keshava Munegowda wrote:
> > -----Original Message-----
> > From: Felipe Balbi [mailto:balbi@ti.com]
> > Sent: Tuesday, April 26, 2011 2:29 PM
> > To: Keshava Munegowda
> > Cc: linux-usb@vger.kernel.org; linux-omap@vger.kernel.org; balbi@ti.com;
> gadiyar@ti.com; p-
> > basak2@ti.com; axel.lin@gmail.com; johnstul@us.ibm.com;
> mpfj-list@mimc.co.uk
> > Subject: Re: [PATCH] mfd: Fix usbhs_enable error handling
> >
> > Hi,
> >
> > On Thu, Apr 21, 2011 at 07:52:41PM +0530, Keshava Munegowda wrote:
> > > From: Axel Lin <axel.lin@gmail.com>
> > >
> > > In the case of missing platform_data we do not hold a spin_lock,
> > > thus we should not call spin_unlock_irqrestore in the error path.
> > >
> > > Also simplify the error handling by separating the successful path
> > > from error path. I think this change improves readability.
> > >
> > > Signed-off-by: Axel Lin <axel.lin@gmail.com>
> >
> > Can someone give me a Tested-by so I can take these patches.
> >
> > --
> > Balbi
> 
> Hi Balbi
> 
> I have validated this patch and it works :)
> 
> Tested-by: Keshava Munegowda <keshava_mgowda@ti.com>

what about the others ?
Steve Calfee April 26, 2011, 3:09 p.m. UTC | #4
On Tue, Apr 26, 2011 at 2:04 AM, Felipe Balbi <balbi@ti.com> wrote:
> On Tue, Apr 26, 2011 at 02:32:04PM +0530, Keshava Munegowda wrote:
>> > -----Original Message-----
>> > From: Felipe Balbi [mailto:balbi@ti.com]
>> > Sent: Tuesday, April 26, 2011 2:29 PM
>> > To: Keshava Munegowda
>> > Cc: linux-usb@vger.kernel.org; linux-omap@vger.kernel.org; balbi@ti.com;
>> gadiyar@ti.com; p-
>> > basak2@ti.com; axel.lin@gmail.com; johnstul@us.ibm.com;
>> mpfj-list@mimc.co.uk
>> > Subject: Re: [PATCH] mfd: Fix usbhs_enable error handling
>> >
>> > Hi,
>> >
>> > On Thu, Apr 21, 2011 at 07:52:41PM +0530, Keshava Munegowda wrote:
>> > > From: Axel Lin <axel.lin@gmail.com>
>> > >
>> > > In the case of missing platform_data we do not hold a spin_lock,
>> > > thus we should not call spin_unlock_irqrestore in the error path.
>> > >
>> > > Also simplify the error handling by separating the successful path
>> > > from error path. I think this change improves readability.
>> > >
>> > > Signed-off-by: Axel Lin <axel.lin@gmail.com>
>> >
>> > Can someone give me a Tested-by so I can take these patches.
>> >
>> > --
>> > Balbi
>>
>> Hi Balbi
>>
>> I have validated this patch and it works :)
>>
>> Tested-by: Keshava Munegowda <keshava_mgowda@ti.com>
>
> what about the others ?
>
> --
> balbi

Hi Felipe,

I responded on another thread. I tested this on a beagleboardxm on
version 2.6.39-rc4

> Hi Keshava,
>
> I rebuilt my system to boot from flash and now I see what happened. I
> even remember it being discussed on this list. Someone renamed my usb
> ethernet device from usb0 to eth0 !!! The boot log shows it on this
line:
>
> > [    4.596130] smsc95xx 1-2.1:1.0: eth0: register 'smsc95xx' at
> > usb-ehci-omap.0d
>
>
> So this broke my init scripts and uboot script... OK, so I can live with
> this (I hope the name doesn't change too often though).
>
> So I can manually configure my system to use eth0 and use the network. I
> am sure I will get nfs working shortly.
>
> I am using the 2.6.39-rc4 with your 3 patches. So from the Beagleboard
> XM perspective it works and you can include my
>
> Tested-by: Steve Calfee <stevecalfee@gmail.com>
--
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 April 26, 2011, 7:34 p.m. UTC | #5
On Tue, Apr 26, 2011 at 08:09:17AM -0700, Steve Calfee wrote:
> On Tue, Apr 26, 2011 at 2:04 AM, Felipe Balbi <balbi@ti.com> wrote:
> > On Tue, Apr 26, 2011 at 02:32:04PM +0530, Keshava Munegowda wrote:
> >> > -----Original Message-----
> >> > From: Felipe Balbi [mailto:balbi@ti.com]
> >> > Sent: Tuesday, April 26, 2011 2:29 PM
> >> > To: Keshava Munegowda
> >> > Cc: linux-usb@vger.kernel.org; linux-omap@vger.kernel.org; balbi@ti.com;
> >> gadiyar@ti.com; p-
> >> > basak2@ti.com; axel.lin@gmail.com; johnstul@us.ibm.com;
> >> mpfj-list@mimc.co.uk
> >> > Subject: Re: [PATCH] mfd: Fix usbhs_enable error handling
> >> >
> >> > Hi,
> >> >
> >> > On Thu, Apr 21, 2011 at 07:52:41PM +0530, Keshava Munegowda wrote:
> >> > > From: Axel Lin <axel.lin@gmail.com>
> >> > >
> >> > > In the case of missing platform_data we do not hold a spin_lock,
> >> > > thus we should not call spin_unlock_irqrestore in the error path.
> >> > >
> >> > > Also simplify the error handling by separating the successful path
> >> > > from error path. I think this change improves readability.
> >> > >
> >> > > Signed-off-by: Axel Lin <axel.lin@gmail.com>
> >> >
> >> > Can someone give me a Tested-by so I can take these patches.
> >> >
> >> > --
> >> > Balbi
> >>
> >> Hi Balbi
> >>
> >> I have validated this patch and it works :)
> >>
> >> Tested-by: Keshava Munegowda <keshava_mgowda@ti.com>
> >
> > what about the others ?
> >
> > --
> > balbi
> 
> Hi Felipe,
> 
> I responded on another thread. I tested this on a beagleboardxm on
> version 2.6.39-rc4

care to reply to this one with your Tested-by so I add to all patches
and queue them to Greg ?
Steve Calfee April 26, 2011, 8:57 p.m. UTC | #6
On 04/26/11 12:34, Felipe Balbi wrote:
> 
> care to reply to this one with your Tested-by so I add to all patches
> and queue them to Greg ?
> 
I just checked and these changes were part of the 3 patch set from
Keshava, and from the Beagleboard XM perspective it works and you can
include my

Tested-by: Steve Calfee <stevecalfee@gmail.com>

--
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 May 2, 2011, 9:37 a.m. UTC | #7
On Thu, Apr 21, 2011 at 07:52:41PM +0530, Keshava Munegowda wrote:
> From: Axel Lin <axel.lin@gmail.com>
> 
> In the case of missing platform_data we do not hold a spin_lock,
> thus we should not call spin_unlock_irqrestore in the error path.
> 
> Also simplify the error handling by separating the successful path
> from error path. I think this change improves readability.
> 
> Signed-off-by: Axel Lin <axel.lin@gmail.com>

applied, thanks
diff mbox

Patch

diff --git a/drivers/mfd/omap-usb-host.c b/drivers/mfd/omap-usb-host.c
index 53450f4..b3bb3ac 100644
--- a/drivers/mfd/omap-usb-host.c
+++ b/drivers/mfd/omap-usb-host.c
@@ -700,8 +700,7 @@  static int usbhs_enable(struct device *dev)
 	dev_dbg(dev, "starting TI HSUSB Controller\n");
 	if (!pdata) {
 		dev_dbg(dev, "missing platform_data\n");
-		ret =  -ENODEV;
-		goto end_enable;
+		return  -ENODEV;
 	}
 
 	spin_lock_irqsave(&omap->lock, flags);
@@ -915,7 +914,8 @@  static int usbhs_enable(struct device *dev)
 
 end_count:
 	omap->count++;
-	goto end_enable;
+	spin_unlock_irqrestore(&omap->lock, flags);
+	return 0;
 
 err_tll:
 	if (pdata->ehci_data->phy_reset) {
@@ -931,8 +931,6 @@  err_tll:
 	clk_disable(omap->usbhost_fs_fck);
 	clk_disable(omap->usbhost_hs_fck);
 	clk_disable(omap->usbhost_ick);
-
-end_enable:
 	spin_unlock_irqrestore(&omap->lock, flags);
 	return ret;
 }