Re: [PATCHv2 07/13] usb: dwc2: Update common interrupt handler to call gadget interrupt handler

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Jul 30, 2014 at 1:38 PM, Paul Zimmerman
<Paul.Zimmerman@xxxxxxxxxxxx> wrote:
>> From: linux-usb-owner@xxxxxxxxxxxxxxx [mailto:linux-usb-owner@xxxxxxxxxxxxxxx] On Behalf Of dinguyen@xxxxxxxxxx
>> Sent: Wednesday, July 30, 2014 8:21 AM
>>
>> Make dwc2_handle_common_intr call the gadget interrupt function when operating
>> in peripheral mode. Remove the spinlock functions in s3c_hsotg_irq as
>> dwc2_handle_common_intr() already has the spinlocks.
>>
>> Remove duplicate interrupt conditions that was in gadget, as those are handled
>> by dwc2 common interrupt handler.
>>
>> Signed-off-by: Dinh Nguyen <dinguyen@xxxxxxxxxx>
>> ---
>> v2: Keep interrupt handler for host and peripheral modes separate
>> ---
>>  drivers/usb/dwc2/core.h      |    3 +++
>>  drivers/usb/dwc2/core_intr.c |    3 +++
>>  drivers/usb/dwc2/gadget.c    |   50 ++++--------------------------------------
>>  3 files changed, 10 insertions(+), 46 deletions(-)
>>
>> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
>> index 28541a8..b86673c 100644
>> --- a/drivers/usb/dwc2/core.h
>> +++ b/drivers/usb/dwc2/core.h
>> @@ -961,12 +961,15 @@ extern u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg);
>>  extern int s3c_hsotg_remove(struct dwc2_hsotg *hsotg);
>>  extern void s3c_hsotg_core_init(struct dwc2_hsotg *dwc2);
>>  extern int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq);
>> +irqreturn_t s3c_hsotg_irq(int irq, void *pw);
>>  #else
>>  static inline void s3c_hsotg_core_init(struct dwc2_hsotg *dwc2) {}
>>  static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2)
>>  { return 0; }
>>  static inline int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
>>  { return 0; }
>> +static inline irqreturn_t s3c_hsotg_irq(int irq, void *pw)
>> +{ return IRQ_HANDLED; }
>>  #endif
>>
>>  #if defined(CONFIG_USB_DWC2_HOST) || defined(CONFIG_USB_DWC2_DUAL_ROLE)
>> diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
>> index c93918b..24d4c0d 100644
>> --- a/drivers/usb/dwc2/core_intr.c
>> +++ b/drivers/usb/dwc2/core_intr.c
>> @@ -472,6 +472,9 @@ irqreturn_t dwc2_handle_common_intr(int irq, void *dev)
>>
>>       spin_lock(&hsotg->lock);
>>
>> +     if (dwc2_is_device_mode(hsotg))
>> +             retval = s3c_hsotg_irq(irq, dev);
>> +
>
> Don't you want to release the spinlock and exit the function here if in
> device mode? Otherwise it continues on and does a bunch of checks for
> things that should only happen in host mode.
>

This part handles common interrupts for the core that can happen
regardless of what mode it's operating in. Things such as disconnect,
connect ID change are handle here.

Dinh
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Linux Media]     [Linux Input]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Old Linux USB Devel Archive]

  Powered by Linux