From mboxrd@z Thu Jan 1 00:00:00 1970 From: =?utf-8?Q?Ond=C5=99ej?= Jirman Subject: Re: [PATCH 3/6] net: stmmac: sun8i: Use devm_regulator_get for PHY regulator Date: Tue, 20 Aug 2019 17:47:14 +0200 Message-ID: <20190820154714.2rt4ctovil5ol3u2@core.my.home> References: <20190820145343.29108-1-megous@megous.com> <20190820145343.29108-4-megous@megous.com> <20190820153939.GL29991@lunn.ch> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: <20190820153939.GL29991@lunn.ch> Sender: netdev-owner@vger.kernel.org To: Andrew Lunn Cc: "David S. Miller" , Rob Herring , Mark Rutland , Maxime Ripard , Chen-Yu Tsai , Giuseppe Cavallaro , Alexandre Torgue , Jose Abreu , Maxime Coquelin , devicetree@vger.kernel.org, netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-stm32@st-md-mailman.stormreply.com, linux-arm-kernel@lists.infradead.org List-Id: devicetree@vger.kernel.org Hi Andrew, On Tue, Aug 20, 2019 at 05:39:39PM +0200, Andrew Lunn wrote: > On Tue, Aug 20, 2019 at 04:53:40PM +0200, megous@megous.com wrote: > > From: Ondrej Jirman > > > > Use devm_regulator_get instead of devm_regulator_get_optional and rely > > on dummy supply. This avoids NULL checks before regulator_enable/disable > > calls. > > Hi Ondrej > > What do you mean by a dummy supply? I'm just trying to make sure you > are not breaking backwards compatibility. Sorry, I mean dummy regulator. See: https://elixir.bootlin.com/linux/latest/source/drivers/regulator/core.c#L1874 On systems that use DT (i.e. have_full_constraints() == true), when the regulator is not found (ENODEV, not specified in DT), regulator_get will return a fake dummy regulator that can be enabled/disabled, but doesn't do anything real. This can be used to avoid NULL checks and make the code simpler. regards, Ondrej > Thanks > Andrew