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, 26 Jan 2015 13:35:28 -0600
From:	Felipe Balbi <balbi@...com>
To:	Heikki Krogerus <heikki.krogerus@...ux.intel.com>
CC:	Felipe Balbi <balbi@...com>,
	Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
	Baolu Lu <baolu.lu@...ux.intel.com>,
	<linux-usb@...r.kernel.org>, <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH 6/8] usb: dwc3: add ULPI interface support

On Mon, Jan 26, 2015 at 01:46:10PM +0200, Heikki Krogerus wrote:
> On Fri, Jan 23, 2015 at 10:24:43AM -0600, Felipe Balbi wrote:
> > On Fri, Jan 23, 2015 at 05:12:56PM +0200, Heikki Krogerus wrote:
> > > +int dwc3_ulpi_init(struct dwc3 *dwc)
> > > +{
> > > +	u32 reg;
> > > +
> > > +	/* First check USB2 PHY interface type */
> > > +	switch (DWC3_GHWPARAMS3_HSPHY_IFC(dwc->hwparams.hwparams3)) {
> > > +	case DWC3_GHWPARAMS3_HSPHY_IFC_UTMI_ULPI:
> > > +		/* Select ULPI Interface */
> > > +		reg = dwc3_readl(dwc->regs, DWC3_GUSB2PHYCFG(0));
> > > +		reg |= DWC3_GUSB2PHYCFG_ULPI_UTMI;
> > > +		dwc3_writel(dwc->regs, DWC3_GUSB2PHYCFG(0), reg);
> > > +		/* FALLTHROUGH */
> > > +	case DWC3_GHWPARAMS3_HSPHY_IFC_ULPI:
> > > +		break;
> > > +	default:
> > > +		return 0;
> > > +	}
> > > +
> > > +	/* Register the interface */
> > > +	dwc->ulpi = ulpi_register_interface(dwc->dev, &dwc3_ulpi);
> > > +	if (IS_ERR(dwc->ulpi)) {
> > 
> > so, this will only build and link if DWC3_ULPI is enabled, in case of
> > error you return early...
> > 
> > > +		dev_err(dwc->dev, "failed to register ULPI interface");
> > > +		return PTR_ERR(dwc->ulpi);
> > > +	}
> > > +
> > > +	return 0;
> > > +}
> > > +
> > > +void dwc3_ulpi_exit(struct dwc3 *dwc)
> > > +{
> > > +	if (dwc->ulpi) {
> > 
> > ... looks like this branch is unnecessary.
> 
> We can't do that, or distros that select DWC3_ULPI option can only use
> dwc3 with hardware that really has ULPI PHY. So I guess we'll drop the
> DWC3_ULPI option and build the dwc3 ulpi support always if ULPI bus is
> enabled. OK?

look at your patch again. In case DWC3_ULPI isn't enabled, this file
won't be linked at all. You're using stubs, so taht's fine.

In case it _is_ enabled, you're breaking out early if you can't register
ulpi interface, meaning you're exitting probe() (which, in fact, seems
wrong as I want to be able to run dwc3 with ULPI enabled on a platform
that was configured with ULPI+UTMI, but uses UTMI PHY).

I still think this patch won't work in all cases.

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