All of lore.kernel.org
 help / color / mirror / Atom feed
From: Simon Horman <horms@verge.net.au>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: gregkh@linuxfoundation.org, robh+dt@kernel.org,
	mark.rutland@arm.com, heikki.krogerus@linux.intel.com,
	hdegoede@redhat.com, andy.shevchenko@gmail.com,
	linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH/RFC v3 3/4] usb: gadget: udc: renesas_usb3: use usb role switch API
Date: Tue, 15 May 2018 09:54:28 +0200	[thread overview]
Message-ID: <20180515075428.6fvkwv2tz6v7cnyj@verge.net.au> (raw)
In-Reply-To: <1526289360-3997-4-git-send-email-yoshihiro.shimoda.uh@renesas.com>

On Mon, May 14, 2018 at 06:15:59PM +0900, Yoshihiro Shimoda wrote:
> This patch uses usb role switch API if the register suceeeded.
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  drivers/usb/gadget/udc/renesas_usb3.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
> index c878449..bfb5803 100644
> --- a/drivers/usb/gadget/udc/renesas_usb3.c
> +++ b/drivers/usb/gadget/udc/renesas_usb3.c
> @@ -657,7 +657,11 @@ static void _usb3_set_mode(struct renesas_usb3 *usb3, bool host)
>  
>  static void usb3_set_mode(struct renesas_usb3 *usb3, bool host)
>  {
> -	_usb3_set_mode(usb3, host);
> +	if (usb3->role_sw)
> +		usb_role_switch_set_role(usb3->role_sw, host ?
> +					 USB_ROLE_HOST : USB_ROLE_DEVICE);
> +	else
> +		_usb3_set_mode(usb3, host);
>  }
>  
>  static void usb3_vbus_out(struct renesas_usb3 *usb3, bool enable)
> @@ -672,8 +676,8 @@ static void usb3_mode_config(struct renesas_usb3 *usb3, bool host, bool a_dev)
>  {
>  	unsigned long flags;
>  
> -	spin_lock_irqsave(&usb3->lock, flags);
>  	usb3_set_mode(usb3, host);
> +	spin_lock_irqsave(&usb3->lock, flags);

Hi Shimoda-san,

could you clarify why moving this lock is safe?

>  	usb3_vbus_out(usb3, a_dev);
>  	/* for A-Peripheral or forced B-device mode */
>  	if ((!host && a_dev) ||
> -- 
> 1.9.1
> 

WARNING: multiple messages have this Message-ID (diff)
From: Simon Horman <horms@verge.net.au>
To: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
Cc: gregkh@linuxfoundation.org, robh+dt@kernel.org,
	mark.rutland@arm.com, heikki.krogerus@linux.intel.com,
	hdegoede@redhat.com, andy.shevchenko@gmail.com,
	linux-usb@vger.kernel.org, linux-renesas-soc@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: [PATCH/RFC,v3,3/4] usb: gadget: udc: renesas_usb3: use usb role switch API
Date: Tue, 15 May 2018 09:54:28 +0200	[thread overview]
Message-ID: <20180515075428.6fvkwv2tz6v7cnyj@verge.net.au> (raw)

On Mon, May 14, 2018 at 06:15:59PM +0900, Yoshihiro Shimoda wrote:
> This patch uses usb role switch API if the register suceeeded.
> 
> Signed-off-by: Yoshihiro Shimoda <yoshihiro.shimoda.uh@renesas.com>
> ---
>  drivers/usb/gadget/udc/renesas_usb3.c | 8 ++++++--
>  1 file changed, 6 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/usb/gadget/udc/renesas_usb3.c b/drivers/usb/gadget/udc/renesas_usb3.c
> index c878449..bfb5803 100644
> --- a/drivers/usb/gadget/udc/renesas_usb3.c
> +++ b/drivers/usb/gadget/udc/renesas_usb3.c
> @@ -657,7 +657,11 @@ static void _usb3_set_mode(struct renesas_usb3 *usb3, bool host)
>  
>  static void usb3_set_mode(struct renesas_usb3 *usb3, bool host)
>  {
> -	_usb3_set_mode(usb3, host);
> +	if (usb3->role_sw)
> +		usb_role_switch_set_role(usb3->role_sw, host ?
> +					 USB_ROLE_HOST : USB_ROLE_DEVICE);
> +	else
> +		_usb3_set_mode(usb3, host);
>  }
>  
>  static void usb3_vbus_out(struct renesas_usb3 *usb3, bool enable)
> @@ -672,8 +676,8 @@ static void usb3_mode_config(struct renesas_usb3 *usb3, bool host, bool a_dev)
>  {
>  	unsigned long flags;
>  
> -	spin_lock_irqsave(&usb3->lock, flags);
>  	usb3_set_mode(usb3, host);
> +	spin_lock_irqsave(&usb3->lock, flags);

Hi Shimoda-san,

could you clarify why moving this lock is safe?

>  	usb3_vbus_out(usb3, a_dev);
>  	/* for A-Peripheral or forced B-device mode */
>  	if ((!host && a_dev) ||
> -- 
> 1.9.1
>
---
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

  reply	other threads:[~2018-05-15  7:54 UTC|newest]

Thread overview: 27+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-05-14  9:15 [PATCH/RFC v3 0/4] usb: role: rcar-usb3-role-switch: add support for R-Car SoCs Yoshihiro Shimoda
2018-05-14  9:15 ` [PATCH/RFC v3 1/4] base: devcon: add a new API to find the graph Yoshihiro Shimoda
2018-05-14  9:15   ` [PATCH/RFC,v3,1/4] " Yoshihiro Shimoda
2018-05-14 13:27   ` [PATCH/RFC v3 1/4] " Heikki Krogerus
2018-05-14 13:27     ` [PATCH/RFC,v3,1/4] " Heikki Krogerus
2018-05-15  2:19     ` [PATCH/RFC v3 1/4] " Yoshihiro Shimoda
2018-05-15  2:19       ` [PATCH/RFC,v3,1/4] " Yoshihiro Shimoda
2018-05-15  8:29       ` [PATCH/RFC v3 1/4] " Heikki Krogerus
2018-05-15  8:29         ` [PATCH/RFC,v3,1/4] " Heikki Krogerus
2018-05-15 11:02         ` [PATCH/RFC v3 1/4] " Yoshihiro Shimoda
2018-05-15 11:02           ` [PATCH/RFC,v3,1/4] " Yoshihiro Shimoda
2018-05-14 15:09   ` [PATCH/RFC v3 1/4] " Randy Dunlap
2018-05-14 15:09     ` [PATCH/RFC,v3,1/4] " Randy Dunlap
2018-05-14  9:15 ` [PATCH/RFC v3 2/4] usb: gadget: udc: renesas_usb3: Add register of usb role switch Yoshihiro Shimoda
2018-05-14  9:15   ` [PATCH/RFC,v3,2/4] " Yoshihiro Shimoda
2018-05-14  9:15 ` [PATCH/RFC v3 3/4] usb: gadget: udc: renesas_usb3: use usb role switch API Yoshihiro Shimoda
2018-05-14  9:15   ` [PATCH/RFC,v3,3/4] " Yoshihiro Shimoda
2018-05-15  7:54   ` Simon Horman [this message]
2018-05-15  7:54     ` Simon Horman
2018-05-15  8:02     ` [PATCH/RFC v3 3/4] " Yoshihiro Shimoda
2018-05-15  8:02       ` [PATCH/RFC,v3,3/4] " Yoshihiro Shimoda
2018-05-15  8:03       ` [PATCH/RFC v3 3/4] " Simon Horman
2018-05-15  8:03         ` [PATCH/RFC,v3,3/4] " Simon Horman
2018-05-15  8:32         ` [PATCH/RFC v3 3/4] " Yoshihiro Shimoda
2018-05-15  8:32           ` [PATCH/RFC,v3,3/4] " Yoshihiro Shimoda
2018-05-14  9:16 ` [PATCH/RFC v3 4/4] arm64: dts: renesas: r8a7795: add OF graph for usb role switch Yoshihiro Shimoda
2018-05-14  9:16   ` [PATCH/RFC,v3,4/4] " Yoshihiro Shimoda

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20180515075428.6fvkwv2tz6v7cnyj@verge.net.au \
    --to=horms@verge.net.au \
    --cc=andy.shevchenko@gmail.com \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hdegoede@redhat.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-renesas-soc@vger.kernel.org \
    --cc=linux-usb@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=robh+dt@kernel.org \
    --cc=yoshihiro.shimoda.uh@renesas.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.