From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753734AbcD0J5z (ORCPT ); Wed, 27 Apr 2016 05:57:55 -0400 Received: from mezzanine.sirena.org.uk ([106.187.55.193]:47036 "EHLO mezzanine.sirena.org.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752348AbcD0J5v (ORCPT ); Wed, 27 Apr 2016 05:57:51 -0400 Date: Wed, 27 Apr 2016 10:57:39 +0100 From: Mark Brown To: Felipe Balbi Cc: Jisheng Zhang , mathias.nyman@linux.intel.com, gregkh@linuxfoundation.org, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, yendapally.reddy@broadcom.com Message-ID: <20160427095738.GG3217@sirena.org.uk> References: <1461675460-2295-1-git-send-email-jszhang@marvell.com> <1461675460-2295-8-git-send-email-jszhang@marvell.com> <87bn4vpq7j.fsf@intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="l/AiLVCsHv/Uhygu" Content-Disposition: inline In-Reply-To: <87bn4vpq7j.fsf@intel.com> X-Cookie: Tomorrow, you can be anywhere. User-Agent: Mutt/1.5.24 (2015-08-30) X-SA-Exim-Connect-IP: 2a01:348:6:8808:fab::3 X-SA-Exim-Mail-From: broonie@sirena.org.uk Subject: Re: [RESEND PATCH v2 7/7] usb: xhci: plat: add vbus regulator control X-SA-Exim-Version: 4.2.1 (built Mon, 26 Dec 2011 16:24:06 +0000) X-SA-Exim-Scanned: Yes (on mezzanine.sirena.org.uk) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --l/AiLVCsHv/Uhygu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Wed, Apr 27, 2016 at 08:37:20AM +0300, Felipe Balbi wrote: > Jisheng Zhang writes: > > + vbus =3D devm_regulator_get(&pdev->dev, "vbus"); > devm_regulator_get_optional() ?? Does USB work without a VBUS? Unless the answer is yes then I'd expect this to be just a normal regulator_get(). >=20 > > + if (PTR_ERR(vbus) =3D=3D -ENODEV) { > > + vbus =3D NULL; > > + } else if (IS_ERR(vbus)) { > > + ret =3D PTR_ERR(vbus); > > + goto disable_clk; > > + } else if (vbus) { > > + ret =3D regulator_enable(vbus); > > + if (ret) { > > + dev_err(&pdev->dev, > > + "failed to enable usb vbus regulator: %d\n", > > + ret); > > + goto disable_clk; > > + } > > + } This is all completely broken unless the supply is optional. --l/AiLVCsHv/Uhygu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQEcBAEBCAAGBQJXII0RAAoJECTWi3JdVIfQz6UIAILHH8qdLOGgi1kJtJQWXimv zzh6y2cHnTNxxPrPjgy5Ouf6DJv1pzPlzRACNM6Ydjh+jJDJrND32TJE8d8llvQO QWM/VMYYByexVrgXAay89yKZCdTZVqgfcMnFO13ZubLYLRFzQ4YtbK4rtApxZaWv yxFDYQjQzFTnbk1P48lljfqEbeIcbDtLQmwvughxLVVHXwIUCbMBJX8AhGiu93ex SdHZ1aO+0PM0QZq+XOJo+djuPL4AlZ1UeSYzK1pk5xlzByVbHzNTujCWyf4m+FLH 1BID8KXa0LTiVHZ4tysfVP2J/93G90rf+/sXQMlF01DGUuPMKXmrcpQ0pcEkBw0= =J9fR -----END PGP SIGNATURE----- --l/AiLVCsHv/Uhygu-- From mboxrd@z Thu Jan 1 00:00:00 1970 From: broonie@kernel.org (Mark Brown) Date: Wed, 27 Apr 2016 10:57:39 +0100 Subject: [RESEND PATCH v2 7/7] usb: xhci: plat: add vbus regulator control In-Reply-To: <87bn4vpq7j.fsf@intel.com> References: <1461675460-2295-1-git-send-email-jszhang@marvell.com> <1461675460-2295-8-git-send-email-jszhang@marvell.com> <87bn4vpq7j.fsf@intel.com> Message-ID: <20160427095738.GG3217@sirena.org.uk> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On Wed, Apr 27, 2016 at 08:37:20AM +0300, Felipe Balbi wrote: > Jisheng Zhang writes: > > + vbus = devm_regulator_get(&pdev->dev, "vbus"); > devm_regulator_get_optional() ?? Does USB work without a VBUS? Unless the answer is yes then I'd expect this to be just a normal regulator_get(). > > > + if (PTR_ERR(vbus) == -ENODEV) { > > + vbus = NULL; > > + } else if (IS_ERR(vbus)) { > > + ret = PTR_ERR(vbus); > > + goto disable_clk; > > + } else if (vbus) { > > + ret = regulator_enable(vbus); > > + if (ret) { > > + dev_err(&pdev->dev, > > + "failed to enable usb vbus regulator: %d\n", > > + ret); > > + goto disable_clk; > > + } > > + } This is all completely broken unless the supply is optional. -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 473 bytes Desc: not available URL: