lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 30 Oct 2014 09:00:43 -0500
From:	Felipe Balbi <balbi@...com>
To:	<dinguyen@...nsource.altera.com>
CC:	<paulz@...opsys.com>, <balbi@...com>, <dinh.linux@...il.com>,
	<swarren@...dotorg.org>, <b.zolnierkie@...sung.com>,
	<matthijs@...in.nl>, <r.baldyga@...sung.com>,
	<jg1.han@...sung.com>, <sachin.kamat@...aro.org>,
	<ben-linux@...ff.org>, <dianders@...omium.org>,
	<kever.yang@...k-chips.com>, <linux-usb@...r.kernel.org>,
	<linux-kernel@...r.kernel.org>
Subject: Re: [PATCHv6 4/8] usb: dwc2: Update common interrupt handler to call
 gadget interrupt handler

Hi,

On Tue, Oct 28, 2014 at 06:25:45PM -0500, dinguyen@...nsource.altera.com wrote:
> From: Dinh Nguyen <dinguyen@...nsource.altera.com>
> 
> 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.
> 
> Move the registeration of the IRQ to common code for platform and PCI.
> 
> Remove duplicate interrupt conditions that was in gadget, as those are handled
> by dwc2 common interrupt handler.
> 
> Signed-off-by: Dinh Nguyen <dinguyen@...nsource.altera.com>
> Acked-by: Paul Zimmerman <paulz@...opsys.com>
> ---
> v5: remove individual devm_request_irq from gadget and hcd, and place a
>     single devm_request_irq in platform and pci.
> v2: Keep interrupt handler for host and peripheral modes separate
> ---
>  drivers/usb/dwc2/core.c      | 10 --------
>  drivers/usb/dwc2/core.h      |  3 +++
>  drivers/usb/dwc2/core_intr.c |  3 +++
>  drivers/usb/dwc2/gadget.c    | 57 ++------------------------------------------
>  drivers/usb/dwc2/pci.c       |  6 +++++
>  drivers/usb/dwc2/platform.c  |  9 +++++++
>  6 files changed, 23 insertions(+), 65 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/core.c b/drivers/usb/dwc2/core.c
> index d926945..7605850b 100644
> --- a/drivers/usb/dwc2/core.c
> +++ b/drivers/usb/dwc2/core.c
> @@ -458,16 +458,6 @@ int dwc2_core_init(struct dwc2_hsotg *hsotg, bool select_phy, int irq)
>  	/* Clear the SRP success bit for FS-I2c */
>  	hsotg->srp_success = 0;
>  
> -	if (irq >= 0) {
> -		dev_dbg(hsotg->dev, "registering common handler for irq%d\n",
> -			irq);
> -		retval = devm_request_irq(hsotg->dev, irq,
> -					  dwc2_handle_common_intr, IRQF_SHARED,
> -					  dev_name(hsotg->dev), hsotg);
> -		if (retval)
> -			return retval;
> -	}
> -
>  	/* Enable common interrupts */
>  	dwc2_enable_common_interrupts(hsotg);
>  
> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> index 80d29c7..ec70862 100644
> --- a/drivers/usb/dwc2/core.h
> +++ b/drivers/usb/dwc2/core.h
> @@ -967,6 +967,7 @@ extern int s3c_hsotg_suspend(struct dwc2_hsotg *dwc2);
>  extern int s3c_hsotg_resume(struct dwc2_hsotg *dwc2);
>  extern int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq);
>  extern void s3c_hsotg_core_init(struct dwc2_hsotg *dwc2);
> +irqreturn_t s3c_hsotg_irq(int irq, void *pw);
>  #else
>  static inline int s3c_hsotg_remove(struct dwc2_hsotg *dwc2)
>  { return 0; }
> @@ -977,6 +978,8 @@ static inline int s3c_hsotg_resume(struct dwc2_hsotg *dwc2)
>  static inline int dwc2_gadget_init(struct dwc2_hsotg *hsotg, int irq)
>  { return 0; }
>  static inline void s3c_hsotg_core_init(struct dwc2_hsotg *dwc2) {}
> +static inline irqreturn_t s3c_hsotg_irq(int irq, void *pw)
> +{ return IRQ_HANDLED; }
>  #endif
>  
>  #if IS_ENABLED(CONFIG_USB_DWC2_HOST) || IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)
> diff --git a/drivers/usb/dwc2/core_intr.c b/drivers/usb/dwc2/core_intr.c
> index b176c2f..b0c14e0 100644
> --- a/drivers/usb/dwc2/core_intr.c
> +++ b/drivers/usb/dwc2/core_intr.c
> @@ -474,6 +474,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);
> +
>  	gintsts = dwc2_read_common_intr(hsotg);
>  	if (gintsts & ~GINTSTS_PRTINT)
>  		retval = IRQ_HANDLED;
> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> index 19d1b03..202f8cc 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -2257,14 +2257,13 @@ void s3c_hsotg_core_init(struct dwc2_hsotg *hsotg)
>   * @irq: The IRQ number triggered
>   * @pw: The pw value when registered the handler.
>   */
> -static irqreturn_t s3c_hsotg_irq(int irq, void *pw)
> +irqreturn_t s3c_hsotg_irq(int irq, void *pw)

why ? It would've been a lot easier to just make the IRQ line shared.

-- 
balbi

Download attachment "signature.asc" of type "application/pgp-signature" (820 bytes)

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ