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:	Mon, 13 Jul 2015 15:22:59 +0000
From:	Phil Edworthy <phil.edworthy@...esas.com>
To:	Laurent Pinchart <laurent.pinchart@...asonboard.com>
CC:	Yoshihiro Shimoda <yoshihiro.shimoda.uh@...esas.com>,
	Kuninori Morimoto <kuninori.morimoto.gx@...esas.com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Felipe Balbi <balbi@...com>,
	Ulrich Hecht <ulrich.hecht@...il.com>,
	Kishon Vijay Abraham I <kishon@...com>,
	"Sergei Shtylyov" <sergei.shtylyov@...entembedded.com>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
	"linux-sh@...r.kernel.org" <linux-sh@...r.kernel.org>
Subject: RE: [PATCH v5] usb: renesas_usbhs: Allow an OTG PHY driver to provide
 VBUS

Hi Laurent,

On 09 July 2015 02:03, Laurent wrote:
> Hi Phil,
> 
> On Wednesday 08 July 2015 08:08:27 Phil Edworthy wrote:
> > On 08 July 2015 00:08, Laurent wrote:
> > > On Tuesday 07 July 2015 12:52:43 Phil Edworthy wrote:
> > > > These changes allow a PHY driver to trigger a VBUS interrupt and
> > > > to provide the value of VBUS.
> > > >
> > > > Signed-off-by: Phil Edworthy <phil.edworthy@...esas.com>
> > >
> > > This looks much better to me. I just have two comments, please see below.
> > >
> > > > ---
> > > >
> > > > v5:
> > > >   - Avoid race when vbus_is_indirect may or may not be read
> > > >
> > > >     before the phy has called vbus_session. In doing so, the
> > > >     changes have also been isolated to mod_gadget.c
> > > >
> > > > v4:
> > > >   - Use true/false with bool vars.
> > > >   - Clean up "transceiver found" message.
> > > >
> > > > v3:
> > > >   - Changed how indirect vbus is plumbed in.
> > > >   - Removed unnecessary (void) on call to otg_set_peripheral.
> > > >   - Moved code that connects to bus through transceiver so it
> > > >
> > > >     is before setting gpriv->driver.
> > > >
> > > > v2:
> > > >   - vbus variables changed from int to bool.
> > > >   - dev_info() changed to dev_err()
> > > >
> > > > ---
> > > >
> > > >  drivers/usb/renesas_usbhs/mod_gadget.c | 62
> +++++++++++++++++++++++++++
> > > >  1 file changed, 62 insertions(+)
> > > >
> > > > diff --git a/drivers/usb/renesas_usbhs/mod_gadget.c
> > > > b/drivers/usb/renesas_usbhs/mod_gadget.c index dc2aa32..19a22a3
> 100644
> > > > --- a/drivers/usb/renesas_usbhs/mod_gadget.c
> > > > +++ b/drivers/usb/renesas_usbhs/mod_gadget.c
> 
> [snip]
> 
> > > > @@ -882,12 +906,28 @@ static int usbhsg_gadget_start(struct usb_gadget
> > > > *gadget,
> > > >  {
> > > >  	struct usbhsg_gpriv *gpriv = usbhsg_gadget_to_gpriv(gadget);
> > > >  	struct usbhs_priv *priv = usbhsg_gpriv_to_priv(gpriv);
> > > > +	struct device *dev = usbhs_priv_to_dev(priv);
> > > > +	int ret;
> > > >
> > > >  	if (!driver		||
> > > >  	    !driver->setup	||
> > > >  	    driver->max_speed < USB_SPEED_FULL)
> > > >  		return -EINVAL;
> > > >
> > > > +	/* connect to bus through transceiver */
> > > > +	if (!IS_ERR_OR_NULL(gpriv->transceiver)) {
> > > > +		ret = otg_set_peripheral(gpriv->transceiver->otg,
> > > > +					&gpriv->gadget);
> > > > +		if (ret) {
> > > > +			dev_err(dev, "%s: can't bind to transceiver\n",
> > > > +				gpriv->gadget.name);
> > > > +			return ret;
> > > > +		}
> > > > +
> > > > +		/* get vbus using phy versions */
> > > > +		usbhs_mod_phy_mode(priv);
> > >
> > > Given that the presence of an external PHY is known at probe time,
> > > couldn't this call be moved to the probe function ? It would then probably
> > > conflict with the usbhs_mod_autonomy_mode() call from usbhs_probe(),
> which
> > > would need to be fixed.
> >
> > You could do this, but as you say it would conflict with usbhs_probe(). I
> > can't see a simple way to check for the external phy connection, so I would
> > prefer to keep it here.
> > Is that ok?
> 
> I can live with that, but I can't help feeling that it's not the best
> architecture. Coming to think about it, why do we get the transceiver (by
> calling usb_get_phy) in the gadget code ? Isn't the transceiver shared between
> host and peripheral modes ? Shouldn't it be handled by core code then ? I
> might miss something as my knowledge of the USB subsystem isn't perfect.
I suspect your knowledge of it is much better than mine!

 
> If we decide to refactor the code it can be done in a follow-up patch, this
> patch has been delayed for long enough.
Ok, thanks. I'll fix the variable name and re-post.

> > > > +	}
> > > > +
> > > >
> > > >  	/* first hook up the driver ... */
> > > >  	gpriv->driver = driver;
> 
> --
> Regards,
> 
> Laurent Pinchart

Thanks
Phil
--
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