From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755372AbcIFHp7 (ORCPT ); Tue, 6 Sep 2016 03:45:59 -0400 Received: from mga07.intel.com ([134.134.136.100]:45744 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753121AbcIFHp6 (ORCPT ); Tue, 6 Sep 2016 03:45:58 -0400 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.30,291,1470726000"; d="asc'?scan'208";a="1051910839" From: Felipe Balbi To: Stefan Agner Cc: gregkh@linuxfoundation.org, fabio.estevam@nxp.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Stefan Agner , Mark Brown , linux-kernel@vger.kernel.org Subject: Re: [PATCH] usb: phy: generic: request regulator optionally In-Reply-To: <20160904040416.22163-1-stefan@agner.ch> References: <20160904040416.22163-1-stefan@agner.ch> User-Agent: Notmuch/0.22.1+63~g994277e (https://notmuchmail.org) Emacs/25.1.3 (x86_64-pc-linux-gnu) Date: Tue, 06 Sep 2016 10:45:19 +0300 Message-ID: <87mvjlmpyo.fsf@linux.intel.com> MIME-Version: 1.0 Content-Type: multipart/signed; boundary="=-=-="; micalg=pgp-sha256; protocol="application/pgp-signature" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --=-=-= Content-Type: text/plain Content-Transfer-Encoding: quoted-printable Mark, Stefan Agner writes: > According to the device tree bindings the vcc-supply is optional. > So far the driver did request the regulator using devm_regulator_get > which creates a dummy regulator for convenience. Since we can have > the supply unconnected, we should make use of the optional variant > of the regulator call which does not return a dummy regulator but > -ENODEV. The driver already has checks in case the regulator is an > error pointer. > > Note that with this change the behavior is slightly different in > case devm_regulator_get_optional returns -EPROBE_DEFER: The driver > returns -EPROBE_DEFER even if needs_vcc is set false. This is the > correct behavior, since even if the regulator is optional, it might > get initialized later... > > Signed-off-by: Stefan Agner > --- > This gets rid of warnings such as this (seen on i.MX 7): > 30800000.aips-bus:usbphynop1 supply vcc not found, using dummy regulator > > -- > Stefan > > drivers/usb/phy/phy-generic.c | 6 +++--- > 1 file changed, 3 insertions(+), 3 deletions(-) > > diff --git a/drivers/usb/phy/phy-generic.c b/drivers/usb/phy/phy-generic.c > index 980c9de..38ceadc 100644 > --- a/drivers/usb/phy/phy-generic.c > +++ b/drivers/usb/phy/phy-generic.c > @@ -275,12 +275,12 @@ int usb_phy_gen_create_phy(struct device *dev, stru= ct usb_phy_generic *nop, > } > } >=20=20 > - nop->vcc =3D devm_regulator_get(dev, "vcc"); > + nop->vcc =3D devm_regulator_get_optional(dev, "vcc"); > if (IS_ERR(nop->vcc)) { > dev_dbg(dev, "Error getting vcc regulator: %ld\n", > PTR_ERR(nop->vcc)); > - if (needs_vcc) > - return -EPROBE_DEFER; > + if (needs_vcc || PTR_ERR(nop->vcc) =3D=3D -EPROBE_DEFER) > + return PTR_ERR(nop->vcc); does this look okay from a regulator API perspective? =2D-=20 balbi --=-=-= Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIcBAEBCAAGBQJXznQPAAoJEMy+uJnhGpkGnfIQALSjfdqC/+tXkjoepkd/ubBz 872vcbK/qRZIPyhRZxEQlSUJJ/Ad3XkOdEgzQ40Ro+Zg9ArvYHki5EKdCgrvMG0v 1VMm/5fRMsB6hu0FaSyN/GthO+0GGBktV8npr8TzBXqqfEnjCycZwMd7d2Nv3m5L YgW1MvoTLj14wWhtYOTuZpIApB9HV1UCqoToZj6EqNZyQDcrhy+5v9S+JXIL+Cgb tRr//XD/Z+0s9hRd/0gJT2Ofc6aVbDNJqPtRYINsFsccI9AVEIifsvPVAuhvSV3S jFHHM2gHoHwLYmAWELR9Rfce0gsW9dsKx3Q8pwAjG+4z4/mR4/47Tdb7RZUwXBkG 8mT/Xi2aRboVLnKe49su9FjaO6z2N09533mW5qZQUFLissxkFTwVLVDG9gDLqwQM NhkcLrkEkLt0SD8fwbOqwUi6gE2plK6wYybmSFXn4AIz/Jfppa3ISNfXGxZugOns UP5VH1Gz5KTr3vvfWtpZ0jnTbSQQcTCv3sIvXJkF7Lbr6PiWJfmUej5R0Ci4MOM7 m8MvXKqM04c4QutpUFJon3GosYG6ygVqnC2xcCd55xJ1RDHuv/zqUsYQTv/MJrko eY+WBXg4IxQ/B58ixfMzqLpdw8SsSJkHed7Ezsoo1/lzoA/yWw66zAyAwK7LhLac eV7VIAX3HF8jh5m6/T4D =eRyW -----END PGP SIGNATURE----- --=-=-=--