Received: by 10.192.165.148 with SMTP id m20csp3089486imm; Sun, 22 Apr 2018 23:47:34 -0700 (PDT) X-Google-Smtp-Source: AIpwx4/vZFTn2bWiGmFmuso/RJP8X/iQ6frq5u+upcU++yx9y3C125Is4xLW0VCNU0axSz2SXxDQ X-Received: by 10.98.204.8 with SMTP id a8mr18030246pfg.219.1524466054497; Sun, 22 Apr 2018 23:47:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524466054; cv=none; d=google.com; s=arc-20160816; b=AKW1+W0ODcqOPKw2rRPYc7s5umMKXZqeRv440JieFWtNGQ2pha6Kt/mdNcgncggMqZ HOYmWQzSBWKGdrPNPpOnRAdOLJ6porNkBrB7nx7jRKCVf+XXYXpsa1j5gPMQqLDu0V2u DAarzqq7u3Z/k8FHa9oevOCWu2xQHDZbWwPpdy27E/R7VnvplMwUo/kbYZ4TYcQHQSOL pI0IrdsWBstQCVhP7bNvD7qINebPafE23FkML7Y1HOuSmkfIcQOfh55Le/LOLm9NJtw8 js9jrmVf53Sz1N2tCBOtqVcJ3qtFN6iq8GwgziIGxkH3IBXamNGMdzTB2fui+Zto8Nvn GC0Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dmarc-filter :arc-authentication-results; bh=FbZxbDUFvCeGpgWHc+pPTPfXcKf5qKfi7rAymr/xlaE=; b=CsR+y1WoPhOzZRGjHk1Ezb2YN94DP3E3Ang83B1qSzcQeHs0fXuDXY9yRPssrK71+K 02fI0Uk9t2/F5Ijmsbmy/zAbNBBVK4PF0j6lwL1tYLBA87wMFpDL6iRKQDd94WnfI738 M46J+f/AhoT9+8gEN4UfLo+cHRVfjGCnw2DZIn7NtJFZEbqCBAJoEaNLD6ur3BWUsz0G bNA1HVIUtTUErT2tFcXKn8baxTtcwLs4nQ6igMfWQySYD3smOIMtJj8ltXzLhlzM3Z/x SHS0ekWzZE187frATdC9Bmku4071rvxeGmTG9ywB6degtcu47GvAlsTuN92ZjOm9qrG5 tsMg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u13si9455345pgq.232.2018.04.22.23.47.20; Sun, 22 Apr 2018 23:47:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753007AbeDWGqP (ORCPT + 99 others); Mon, 23 Apr 2018 02:46:15 -0400 Received: from mail.kernel.org ([198.145.29.99]:39300 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751324AbeDWGqO (ORCPT ); Mon, 23 Apr 2018 02:46:14 -0400 Received: from mail-wr0-f171.google.com (mail-wr0-f171.google.com [209.85.128.171]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 9075F217BA for ; Mon, 23 Apr 2018 06:46:13 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9075F217BA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=krzk@kernel.org Received: by mail-wr0-f171.google.com with SMTP id f14-v6so37916512wre.4 for ; Sun, 22 Apr 2018 23:46:13 -0700 (PDT) X-Gm-Message-State: ALQs6tBkkge1eHYJWNJcOCbxXqdii2PpIy0Ww5bMl7hLFbH7sq6oa/bM wJmGiasX5/e1kGc4gSzy4Ge1A6p5SKN8jSY7Ygs= X-Received: by 10.28.238.2 with SMTP id m2mr8140561wmh.135.1524465972059; Sun, 22 Apr 2018 23:46:12 -0700 (PDT) MIME-Version: 1.0 Received: by 10.223.199.7 with HTTP; Sun, 22 Apr 2018 23:46:11 -0700 (PDT) In-Reply-To: <20180422230742.3729-5-linus.walleij@linaro.org> References: <20180422230742.3729-1-linus.walleij@linaro.org> <20180422230742.3729-5-linus.walleij@linaro.org> From: Krzysztof Kozlowski Date: Mon, 23 Apr 2018 08:46:11 +0200 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 05/18 v2] regulator: max77686: Pass descriptor instead of GPIO number To: Linus Walleij Cc: Liam Girdwood , Mark Brown , linux-kernel@vger.kernel.org, Chanwoo Choi , Bartlomiej Zolnierkiewicz Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 23, 2018 at 1:07 AM, Linus Walleij wrote: > Instead of passing a global GPIO number, pass a descriptor looked > up from the device tree configuration node. > > Cc: Chanwoo Choi > Cc: Krzysztof Kozlowski > Cc: Bartlomiej Zolnierkiewicz > Signed-off-by: Linus Walleij > --- > ChangeLog v1->v2: > - Rebase the patch on the other changes. > --- > drivers/regulator/max77686-regulator.c | 19 ++++++++++++------- > 1 file changed, 12 insertions(+), 7 deletions(-) > > diff --git a/drivers/regulator/max77686-regulator.c b/drivers/regulator/max77686-regulator.c > index c301f3733475..5ebd06f47e6a 100644 > --- a/drivers/regulator/max77686-regulator.c > +++ b/drivers/regulator/max77686-regulator.c > @@ -25,8 +25,7 @@ > #include > #include > #include > -#include > -#include > +#include > #include > #include > #include > @@ -90,6 +89,7 @@ enum max77686_ramp_rate { > }; > > struct max77686_data { > + struct device *dev; > DECLARE_BITMAP(gpio_enabled, MAX77686_REGULATORS); > > /* Array indexed by regulator id */ > @@ -269,16 +269,20 @@ static int max77686_of_parse_cb(struct device_node *np, > case MAX77686_BUCK8: > case MAX77686_BUCK9: > case MAX77686_LDO20 ... MAX77686_LDO22: > - config->ena_gpio = of_get_named_gpio(np, > - "maxim,ena-gpios", 0); > - config->ena_gpio_flags = GPIOF_OUT_INIT_HIGH; > - config->ena_gpio_initialized = true; > + config->ena_gpiod = devm_gpiod_get_from_of_node(max77686->dev, > + np, > + "maxim,ena", > + 0, > + GPIOD_OUT_HIGH, > + "max77686-LDO"); > + if (IS_ERR(config->ena_gpiod)) > + return PTR_ERR(config->ena_gpiod); Both my previous comments remain not addressed: 1. Name: This is also for bucks so how about naming it "max77686-regulator"? 2. Error path here is not equivalent to old code and results in using default driver's init data. Instead I would prefer to just ignore the gpio. Best regards, Krzysztof > break; > default: > return 0; > } > > - if (gpio_is_valid(config->ena_gpio)) { > + if (config->ena_gpiod) { > set_bit(desc->id, max77686->gpio_enabled); > > return regmap_update_bits(config->regmap, desc->enable_reg, > @@ -521,6 +525,7 @@ static int max77686_pmic_probe(struct platform_device *pdev) > if (!max77686) > return -ENOMEM; > > + max77686->dev = &pdev->dev; > config.dev = iodev->dev; > config.regmap = iodev->regmap; > config.driver_data = max77686; > -- > 2.14.3 >