Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756996AbcC2MA5 (ORCPT ); Tue, 29 Mar 2016 08:00:57 -0400 Received: from mail-io0-f196.google.com ([209.85.223.196]:33014 "EHLO mail-io0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752975AbcC2MAy (ORCPT ); Tue, 29 Mar 2016 08:00:54 -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: Tue, 29 Mar 2016 14:00:52 +0200 X-Google-Sender-Auth: uU79_yy9B2cQWC1vRHKVIfxV8_M Message-ID: Subject: Re: [PATCH 2/2] regulator: core: Ensure we are at least in bounds for our constraints From: Geert Uytterhoeven 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 , linux-renesas-soc@vger.kernel.org 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: 3266 Lines: 80 Hi Mark, On Sun, Mar 27, 2016 at 11: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. Has the fix really been pushed out? With commit fa93fd4ecc9c58475abac6db93a797bff893bc16 Author: Mark Brown Date: Mon Mar 21 18:12:52 2016 +0000 regulator: core: Ensure we are at least in bounds for our constraints I see a few cases of ------------[ cut here ]------------ WARNING: CPU: 1 PID: 31 at drivers/regulator/core.c:2223 _regulator_disable+0x2c/0x128 unbalanced disables for SDHI0 VccQ Modules linked in: CPU: 1 PID: 31 Comm: kworker/1:1 Not tainted 4.6.0-rc1-koelsch-00724-g58d619227282dc16 #2422 Hardware name: Generic R8A7791 (Flattened Device Tree) Workqueue: events_freezable mmc_rescan sh_mobile_sdhi ee140000.sd: could not set regulator OCR (-22) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack+0x7c/0x9c) [] (dump_stack) from [] (__warn+0xcc/0xfc) [] (__warn) from [] (warn_slowpath_fmt+0x34/0x44) [] (warn_slowpath_fmt) from [] (_regulator_disable+0x2c/0x128) [] (_regulator_disable) from [] (regulator_disable+0x30/0x60) [] (regulator_disable) from [] (tmio_mmc_set_ios+0xb8/0x1d4) [] (tmio_mmc_set_ios) from [] (mmc_power_off+0x34/0x54) [] (mmc_power_off) from [] (mmc_rescan+0x214/0x30c) [] (mmc_rescan) from [] (process_one_work+0x1bc/0x2f4) [] (process_one_work) from [] (worker_thread+0x2a8/0x3d0) [] (worker_thread) from [] (kthread+0xd8/0xec) [] (kthread) from [] (ret_from_fork+0x14/0x2c) ---[ end trace 1c61a7f6221c11ea ]--- when booting on r8a7791/koelsch. I'm a bit confused by the discussion of "&&" vs. "||" vs. "==", but the warnings do go away when using "!=", cfr. the whitespace-damaged patch below. --- a/drivers/regulator/of_regulator.c +++ b/drivers/regulator/of_regulator.c @@ -43,7 +43,7 @@ static void of_get_regulation_constraints(struct device_node * constraints->max_uV = pval; /* Voltage change possible? */ - if (constraints->min_uV && constraints->max_uV) { + if (constraints->min_uV != constraints->max_uV) { constraints->valid_ops_mask |= REGULATOR_CHANGE_VOLTAGE; constraints->apply_uV = true; } Gr{oetje,eeting}s, Geert -- Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org In personal conversations with technical people, I call myself a hacker. But when I'm talking to journalists I just say "programmer" or something like that. -- Linus Torvalds