Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754978AbcC1QQS (ORCPT ); Mon, 28 Mar 2016 12:16:18 -0400 Received: from mail-ob0-f176.google.com ([209.85.214.176]:34890 "EHLO mail-ob0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754505AbcC1QQQ (ORCPT ); Mon, 28 Mar 2016 12:16:16 -0400 MIME-Version: 1.0 In-Reply-To: <20160327090859.GH5028@sirena.org.uk> References: <1458587912-32665-1-git-send-email-broonie@kernel.org> <1458587912-32665-2-git-send-email-broonie@kernel.org> <56F0624C.8010004@gmail.com> <20160327090859.GH5028@sirena.org.uk> Date: Mon, 28 Mar 2016 09:16:15 -0700 Message-ID: Subject: Re: [PATCH 2/2] regulator: core: Ensure we are at least in bounds for our constraints From: Bjorn Andersson To: Mark Brown Cc: Bjorn Andersson , Krzysztof Kozlowski , Ivaylo Dimitrov , Liam Girdwood , "linux-kernel@vger.kernel.org" , Ulf Hansson , linux-mmc , linux-samsung-soc , Javier Martinez Canillas , Marek Szyprowski Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1466 Lines: 37 On Sun, Mar 27, 2016 at 2:08 AM, Mark Brown wrote: > On Sat, Mar 26, 2016 at 04:50:41PM -0700, Bjorn Andersson wrote: > >> Reinstating the following snippet in of_get_regulation_constraints() >> sort this out: > >> if (constraints->min_uV && constraints->max_uV) >> constraints->apply_uV = true; > > The existing check in the patch should be an || not an ==, or possibly > we should just not bother looking for min_uV at all. I just pushed out > a version of that, let's see how that goes. > Either way is fine with me, as long as we either go ahead and apply a voltage setting now or allow a consumer to do so later (your posted patch does both). >> I did look at an alternative of having regulator_set_voltage() pass >> and call set_voltage() if the requested voltage matches the >> constraints, but this does indeed seem to mess things up. So checking >> in with you before continuing on that hack. > > Yes, not everything is writeable. Right, looking at your posted patch [1] we're changing this logic so that normal regulators defined with min == max will be allowed to set_voltage(). Thinking about it that makes sense and cleans the logic up, so I'm in favor of this. I know it's published, but fwiw you have my Acked-by on the posted patch. [1] https://git.kernel.org/cgit/linux/kernel/git/broonie/regulator.git/commit/?h=for-next&id=fa93fd4ecc9c58475abac6db93a797bff893bc16 Regards, Bjorn