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-next>] [day] [month] [year] [list]
Message-id: <1609564.lrfde17RTW@amdc1032>
Date:	Fri, 12 Sep 2014 18:18:58 +0200
From:	Bartlomiej Zolnierkiewicz <b.zolnierkie@...sung.com>
To:	dinguyen@...nsource.altera.com
Cc:	paulz@...opsys.com, gregkh@...uxfoundation.org, balbi@...com,
	dinh.linux@...il.com, swarren@...dotorg.org, 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: [PATCHv4 04/12] usb: dwc2: Add the appropriate init calls in
 platform code


[ added linux-kernel ML to cc: ]

Hi,

On Tuesday, August 26, 2014 11:19:55 AM dinguyen@...nsource.altera.com wrote:
> From: Dinh Nguyen <dinguyen@...nsource.altera.com>
> 
> Add the proper init calls for either host, gadget or both in platform.c
> 
> Signed-off-by: Dinh Nguyen <dinguyen@...nsource.altera.com>
> Acked-by: Paul Zimmerman <paulz@...opsys.com>
> ---
>  drivers/usb/dwc2/core.h     | 13 +++++++++++++
>  drivers/usb/dwc2/gadget.c   |  2 +-
>  drivers/usb/dwc2/platform.c | 28 ++++++++++++++++++++++++----

Where are correspoding changes to pci.c?

I cannot find them in your patchset.

>  3 files changed, 38 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/usb/dwc2/core.h b/drivers/usb/dwc2/core.h
> index f55e62d..3a49a00 100644
> --- a/drivers/usb/dwc2/core.h
> +++ b/drivers/usb/dwc2/core.h
> @@ -960,6 +960,19 @@ extern void dwc2_dump_global_registers(struct dwc2_hsotg *hsotg);
>   */
>  extern u16 dwc2_get_otg_version(struct dwc2_hsotg *hsotg);
>  
> +/* Gadget defines */
> +#if defined(CONFIG_USB_DWC2_PERIPHERAL) || defined(CONFIG_USB_DWC2_DUAL_ROLE)
> +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);
> +#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; }
> +#endif
> +
>  #if defined(CONFIG_USB_DWC2_HOST) || defined(CONFIG_USB_DWC2_DUAL_ROLE)
>  /**
>   * dwc2_hcd_get_frame_number() - Returns current frame number
> diff --git a/drivers/usb/dwc2/gadget.c b/drivers/usb/dwc2/gadget.c
> index 96f868f..efa68a0 100644
> --- a/drivers/usb/dwc2/gadget.c
> +++ b/drivers/usb/dwc2/gadget.c
> @@ -3572,7 +3572,7 @@ err_clk:
>   * s3c_hsotg_remove - remove function for hsotg driver
>   * @pdev: The platform information for the driver
>   */
> -static int s3c_hsotg_remove(struct dwc2_hsotg *hsotg)
> +int s3c_hsotg_remove(struct dwc2_hsotg *hsotg)
>  {
>  	usb_del_gadget_udc(&hsotg->gadget);
>  
> diff --git a/drivers/usb/dwc2/platform.c b/drivers/usb/dwc2/platform.c
> index dd2f8f5..2871f351 100644
> --- a/drivers/usb/dwc2/platform.c
> +++ b/drivers/usb/dwc2/platform.c
> @@ -92,7 +92,14 @@ static int dwc2_driver_remove(struct platform_device *dev)
>  {
>  	struct dwc2_hsotg *hsotg = platform_get_drvdata(dev);
>  
> -	dwc2_hcd_remove(hsotg);
> +	if (IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL))
> +		s3c_hsotg_remove(hsotg);
> +	else if (IS_ENABLED(CONFIG_USB_DWC2_HOST))
> +		dwc2_hcd_remove(hsotg);
> +	else { /* dual role */
> +		dwc2_hcd_remove(hsotg);
> +		s3c_hsotg_remove(hsotg);

Why not simply always call:

		dwc2_hcd_remove(hsotg);
		s3c_hsotg_remove(hsotg);

and add appropriate stub for dwc2_hcd_remove() for
CONFIG_USB_DWC2_PERIPHERAL=y?

> +	}
>  
>  	return 0;
>  }
> @@ -176,9 +183,22 @@ static int dwc2_driver_probe(struct platform_device *dev)
>  
>  	hsotg->dr_mode = of_usb_get_dr_mode(dev->dev.of_node);
>  
> -	retval = dwc2_hcd_init(hsotg, irq, params);
> -	if (retval)
> -		return retval;
> +	if (IS_ENABLED(CONFIG_USB_DWC2_DUAL_ROLE)) {
> +		retval = dwc2_gadget_init(hsotg, irq);
> +		if (retval)
> +			return retval;
> +		retval = dwc2_hcd_init(hsotg, irq, params);
> +		if (retval)
> +			return retval;
> +	} else if (IS_ENABLED(CONFIG_USB_DWC2_HOST)) {
> +		retval = dwc2_hcd_init(hsotg, irq, params);
> +		if (retval)
> +			return retval;
> +	} else if (IS_ENABLED(CONFIG_USB_DWC2_PERIPHERAL)) {
> +		retval = dwc2_gadget_init(hsotg, irq);
> +		if (retval)
> +			return retval;
> +	}

ditto but for dwc2_hcd_init().

>  	platform_set_drvdata(dev, hsotg);

Best regards,
--
Bartlomiej Zolnierkiewicz
Samsung R&D Institute Poland
Samsung Electronics

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ