All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] usb/hcd: remove unnecessary local_irq_save
@ 2013-10-13  7:14 Michael Opdenacker
  2013-10-13 15:35 ` Alan Stern
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Opdenacker @ 2013-10-13  7:14 UTC (permalink / raw)
  To: gregkh
  Cc: stern, sarah.a.sharp, tianyu.lan, broonie, linux-usb,
	linux-kernel, Michael Opdenacker

Remove the use of local_irq_save() and IRQF_DISABLED, no longer needed since
interrupt handlers are always run with interrupts disabled on the
current CPU.

Tested successfully with 3.12.0-rc4 on my PC. Didn't find
any issue because of this change.

Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
---
 drivers/usb/core/hcd.c | 15 ---------------
 1 file changed, 15 deletions(-)

diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c
index d6a8d23..1c309f1 100644
--- a/drivers/usb/core/hcd.c
+++ b/drivers/usb/core/hcd.c
@@ -2324,15 +2324,8 @@ EXPORT_SYMBOL_GPL(usb_bus_start_enum);
 irqreturn_t usb_hcd_irq (int irq, void *__hcd)
 {
 	struct usb_hcd		*hcd = __hcd;
-	unsigned long		flags;
 	irqreturn_t		rc;
 
-	/* IRQF_DISABLED doesn't work correctly with shared IRQs
-	 * when the first handler doesn't use it.  So let's just
-	 * assume it's never used.
-	 */
-	local_irq_save(flags);
-
 	if (unlikely(HCD_DEAD(hcd) || !HCD_HW_ACCESSIBLE(hcd)))
 		rc = IRQ_NONE;
 	else if (hcd->driver->irq(hcd) == IRQ_NONE)
@@ -2340,7 +2333,6 @@ irqreturn_t usb_hcd_irq (int irq, void *__hcd)
 	else
 		rc = IRQ_HANDLED;
 
-	local_irq_restore(flags);
 	return rc;
 }
 EXPORT_SYMBOL_GPL(usb_hcd_irq);
@@ -2547,13 +2539,6 @@ static int usb_hcd_request_irqs(struct usb_hcd *hcd,
 
 	if (hcd->driver->irq) {
 
-		/* IRQF_DISABLED doesn't work as advertised when used together
-		 * with IRQF_SHARED. As usb_hcd_irq() will always disable
-		 * interrupts we can remove it here.
-		 */
-		if (irqflags & IRQF_SHARED)
-			irqflags &= ~IRQF_DISABLED;
-
 		snprintf(hcd->irq_descr, sizeof(hcd->irq_descr), "%s:usb%d",
 				hcd->driver->description, hcd->self.busnum);
 		retval = request_irq(irqnum, &usb_hcd_irq, irqflags,
-- 
1.8.1.2


^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb/hcd: remove unnecessary local_irq_save
  2013-10-13  7:14 [PATCH] usb/hcd: remove unnecessary local_irq_save Michael Opdenacker
@ 2013-10-13 15:35 ` Alan Stern
  2013-10-14  3:23   ` Michael Opdenacker
  0 siblings, 1 reply; 4+ messages in thread
From: Alan Stern @ 2013-10-13 15:35 UTC (permalink / raw)
  To: Michael Opdenacker
  Cc: gregkh, sarah.a.sharp, tianyu.lan, broonie, linux-usb, linux-kernel

On Sun, 13 Oct 2013, Michael Opdenacker wrote:

> Remove the use of local_irq_save() and IRQF_DISABLED, no longer needed since
> interrupt handlers are always run with interrupts disabled on the
> current CPU.
> 
> Tested successfully with 3.12.0-rc4 on my PC. Didn't find
> any issue because of this change.
> 
> Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
> ---
>  drivers/usb/core/hcd.c | 15 ---------------
>  1 file changed, 15 deletions(-)

How about removing all the other unnecessary usages of IRQF_DISABLED
under drivers/usb while you're at it?

Alan Stern


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb/hcd: remove unnecessary local_irq_save
  2013-10-13 15:35 ` Alan Stern
@ 2013-10-14  3:23   ` Michael Opdenacker
  2013-10-14 19:48     ` Alan Stern
  0 siblings, 1 reply; 4+ messages in thread
From: Michael Opdenacker @ 2013-10-14  3:23 UTC (permalink / raw)
  To: Alan Stern
  Cc: gregkh, sarah.a.sharp, tianyu.lan, broonie, linux-usb, linux-kernel

Hi Alan,

On 10/13/2013 05:35 PM, Alan Stern wrote:
> On Sun, 13 Oct 2013, Michael Opdenacker wrote:
>
>> Remove the use of local_irq_save() and IRQF_DISABLED, no longer needed since
>> interrupt handlers are always run with interrupts disabled on the
>> current CPU.
>>
>> Tested successfully with 3.12.0-rc4 on my PC. Didn't find
>> any issue because of this change.
>>
>> Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
>> ---
>>  drivers/usb/core/hcd.c | 15 ---------------
>>  1 file changed, 15 deletions(-)
> How about removing all the other unnecessary usages of IRQF_DISABLED
> under drivers/usb while you're at it?
I believe I already did, through patches sent on Oct. 6:

drivers/usb/gadget/mv_u3d_core.c:               IRQF_DISABLED |
IRQF_SHARED, driver_name, u3d)) {
=> Sent fix on Oct. 6, 2013

drivers/usb/host/uhci-platform.c:       ret = usb_add_hcd(hcd,
pdev->resource[1].start, IRQF_DISABLED |
=> Sent fix on Oct. 6, 2013

Cheers,

Michael.

-- 
Michael Opdenacker, CEO, Free Electrons
Embedded Linux, Kernel and Android engineering
http://free-electrons.com
+33 484 258 098


^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] usb/hcd: remove unnecessary local_irq_save
  2013-10-14  3:23   ` Michael Opdenacker
@ 2013-10-14 19:48     ` Alan Stern
  0 siblings, 0 replies; 4+ messages in thread
From: Alan Stern @ 2013-10-14 19:48 UTC (permalink / raw)
  To: Michael Opdenacker
  Cc: gregkh, sarah.a.sharp, tianyu.lan, broonie, linux-usb, linux-kernel

On Mon, 14 Oct 2013, Michael Opdenacker wrote:

> Hi Alan,
> 
> On 10/13/2013 05:35 PM, Alan Stern wrote:
> > On Sun, 13 Oct 2013, Michael Opdenacker wrote:
> >
> >> Remove the use of local_irq_save() and IRQF_DISABLED, no longer needed since
> >> interrupt handlers are always run with interrupts disabled on the
> >> current CPU.
> >>
> >> Tested successfully with 3.12.0-rc4 on my PC. Didn't find
> >> any issue because of this change.
> >>
> >> Signed-off-by: Michael Opdenacker <michael.opdenacker@free-electrons.com>
> >> ---
> >>  drivers/usb/core/hcd.c | 15 ---------------
> >>  1 file changed, 15 deletions(-)
> > How about removing all the other unnecessary usages of IRQF_DISABLED
> > under drivers/usb while you're at it?
> I believe I already did, through patches sent on Oct. 6:
> 
> drivers/usb/gadget/mv_u3d_core.c:               IRQF_DISABLED |
> IRQF_SHARED, driver_name, u3d)) {
> => Sent fix on Oct. 6, 2013
> 
> drivers/usb/host/uhci-platform.c:       ret = usb_add_hcd(hcd,
> pdev->resource[1].start, IRQF_DISABLED |
> => Sent fix on Oct. 6, 2013

Ah, I had forgotten about those submissions.  No further objections.

Alan Stern


^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2013-10-14 19:48 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-10-13  7:14 [PATCH] usb/hcd: remove unnecessary local_irq_save Michael Opdenacker
2013-10-13 15:35 ` Alan Stern
2013-10-14  3:23   ` Michael Opdenacker
2013-10-14 19:48     ` Alan Stern

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.