From patchwork Mon Feb 12 13:17:05 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 128059 Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp3201104ljc; Mon, 12 Feb 2018 05:18:02 -0800 (PST) X-Google-Smtp-Source: AH8x226Qe4+gxnE3UCaHghNB4XFwNnl3c3U8jdxn20NcJtuSPozicdV0qCOqNPKPOkvVuggiaKkt X-Received: by 10.98.171.12 with SMTP id p12mr11578757pff.71.1518441482523; Mon, 12 Feb 2018 05:18:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518441482; cv=none; d=google.com; s=arc-20160816; b=CehVHM2oq27YWtRGzQI/P7pz1E3Q8Ynlpz3xVs4FqgyHh0D7Gq1S2B3no0Mj19SVdw gFQYalHe/sybJYUT/y4cKkW3vzW0Rf45hJ8KqvX3b5zrDceyhfhuoyyYQJjYPRbzAWO4 478w3Q8Yt+DAa9uDVaJjiZKdjbQyQWSO5hJccOWaXLv4POUQwQLC4HaZVcNHXF7WJNo8 d4Moier94MoWH9vsNobFQLbeWlQv1uYD4H8sMfmUP52gbpQNVxmXuO+t9uXV+7f3A1UT LJ527m/p8YuS6VwQrVQ03+Rx8InR+4bCvZkC/BAdfml8uw8r+IxKiylKaXNMx4cgIO2e KlEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=tqXpUwKG6hUpLmNnwuDZ8Xb8+RGj4kJMQ0JC7BLEzCw=; b=JaDTWL84yr96cZ7x9vwGfS/4A9/ONreJPHYL4GQt8fB7KWuI6DIF8/ls4VlnJ9dIdu sGChHIMmthPcR6GtlE/zMsTdsM9VEDEpzsmUN42JGlqUNw5o/Lqi5b3KfPDZO3rVr4hi R0VJD1BiPi93xcizHIS2Pc/+KGY/Vf5LSrbb9rtCbnOqvwJ+yOAi/yvQP/SX+UvYWpoA wEaLArOzFsJZFEq1zTsIL53M2jl6rH0XPinj0r0OuVuD9L5powPykvEE0NDnCFgbLjT2 dswI8l3C048VYT808YUE7b70PfA+lMSS52fgOlcvDibYE3sMeRqn1dpx02W2pB5oWtE5 p8Kg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=LYDZuGHD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id j15si3605235pgt.173.2018.02.12.05.18.02; Mon, 12 Feb 2018 05:18:02 -0800 (PST) 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; dkim=pass header.i=@linaro.org header.s=google header.b=LYDZuGHD; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S935285AbeBLNR4 (ORCPT + 13 others); Mon, 12 Feb 2018 08:17:56 -0500 Received: from mail-lf0-f66.google.com ([209.85.215.66]:37354 "EHLO mail-lf0-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S935244AbeBLNRv (ORCPT ); Mon, 12 Feb 2018 08:17:51 -0500 Received: by mail-lf0-f66.google.com with SMTP id f137so20387209lfe.4 for ; Mon, 12 Feb 2018 05:17:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=tqXpUwKG6hUpLmNnwuDZ8Xb8+RGj4kJMQ0JC7BLEzCw=; b=LYDZuGHDpqpwvqZZpV2OaM+7xSu5HBjTglqbgpoxcVRe70ctxh4PzInrE2eOp7nSmz Oc5OOZQofniAT3HMP8ZcEgx0t7P35DBsdSvZUXNs9/8d7YvoEg0FZIrP8CAg2QQfhSlT RV4BPhbuxDTMkGe1clxyNPYcDwvYrgXWjWgUg= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=tqXpUwKG6hUpLmNnwuDZ8Xb8+RGj4kJMQ0JC7BLEzCw=; b=W+vvlZn3RC7gTKv7sAlQS+8dg5AkffkOp3/4xyIVysPc9hT39Nd8Pv0SdZofm2iBON gVEnn6kIsE1UHLv2hQYHnOeuObryZGXB2hDkRWccZj8dXpbcMdDEGSrwamYLWDdDQ0rE ZnegM6nUbBoLuJYiOV/z+T+VzU/HNCScFe6Kmi8kRWqFLQGy/P0VPct1r7H7J40ByKTg mq5kalAXI4KpyPkoPjp0b8e2ZF1+tBrnbtHKHR97ZzMfyhme+ANA3PhgIBOSWxI/RK9S 0gG2KdJTzqEkQFcWq2fcCy/vLORwC/6ZKyr50ppRB27DgS6wNoYOZONbeqDwQ+ki2qzH EMAA== X-Gm-Message-State: APf1xPA5aWYRcrXX2WgxjHTpw15ERwpIPBMZHmMbCQdaeEiEJ3ro+Hdn ZamwksB/GhzM34/sP4BzrhBFig== X-Received: by 10.25.196.9 with SMTP id u9mr2925309lff.108.1518441469836; Mon, 12 Feb 2018 05:17:49 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id r88sm1584648lje.30.2018.02.12.05.17.48 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 12 Feb 2018 05:17:49 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, linux-gpio@vger.kernel.org, Linus Walleij , Milo Kim Subject: [PATCH 09/21] regulator: lm363x: Pass descriptor instead of GPIO number Date: Mon, 12 Feb 2018 14:17:05 +0100 Message-Id: <20180212131717.27193-10-linus.walleij@linaro.org> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180212131717.27193-1-linus.walleij@linaro.org> References: <20180212131717.27193-1-linus.walleij@linaro.org> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Instead of passing a global GPIO number, pass a descriptor looked up with the standard devm_gpiod_get_index_optional() call. Cc: Milo Kim Signed-off-by: Linus Walleij --- drivers/regulator/lm363x-regulator.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) -- 2.14.3 diff --git a/drivers/regulator/lm363x-regulator.c b/drivers/regulator/lm363x-regulator.c index ce5f7d9ad475..b615a413ca9f 100644 --- a/drivers/regulator/lm363x-regulator.c +++ b/drivers/regulator/lm363x-regulator.c @@ -16,7 +16,7 @@ #include #include #include -#include +#include #include #include #include @@ -219,7 +219,7 @@ static const struct regulator_desc lm363x_regulator_desc[] = { }, }; -static int lm363x_regulator_of_get_enable_gpio(struct device_node *np, int id) +static struct gpio_desc *lm363x_regulator_of_get_enable_gpio(struct device *dev, int id) { /* * Check LCM_EN1/2_GPIO is configured. @@ -227,11 +227,11 @@ static int lm363x_regulator_of_get_enable_gpio(struct device_node *np, int id) */ switch (id) { case LM3632_LDO_POS: - return of_get_named_gpio(np, "enable-gpios", 0); + return devm_gpiod_get_index_optional(dev, "enable", 0, GPIOD_OUT_LOW); case LM3632_LDO_NEG: - return of_get_named_gpio(np, "enable-gpios", 1); + return devm_gpiod_get_index_optional(dev, "enable", 1, GPIOD_OUT_LOW); default: - return -EINVAL; + return NULL; } } @@ -243,7 +243,8 @@ static int lm363x_regulator_probe(struct platform_device *pdev) struct regulator_dev *rdev; struct device *dev = &pdev->dev; int id = pdev->id; - int ret, ena_gpio; + struct gpio_desc *gpiod; + int ret; cfg.dev = dev; cfg.regmap = regmap; @@ -252,10 +253,9 @@ static int lm363x_regulator_probe(struct platform_device *pdev) * LM3632 LDOs can be controlled by external pin. * Register update is required if the pin is used. */ - ena_gpio = lm363x_regulator_of_get_enable_gpio(dev->of_node, id); - if (gpio_is_valid(ena_gpio)) { - cfg.ena_gpio = ena_gpio; - cfg.ena_gpio_flags = GPIOF_OUT_INIT_LOW; + gpiod = lm363x_regulator_of_get_enable_gpio(dev, id); + if (gpiod) { + cfg.ena_gpiod = gpiod; ret = regmap_update_bits(regmap, LM3632_REG_BIAS_CONFIG, LM3632_EXT_EN_MASK,