From patchwork Wed Nov 28 10:43:44 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Linus Walleij X-Patchwork-Id: 152242 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp923522ljp; Wed, 28 Nov 2018 02:44:09 -0800 (PST) X-Google-Smtp-Source: AFSGD/UXzg1zcXkT9prG+oZD4mtdEsRWg9fZtMEtkTmbCLCNR1C+ehcOSrzqXHQwdHKAGyjxTzQ1 X-Received: by 2002:a63:920a:: with SMTP id o10mr31688731pgd.141.1543401849226; Wed, 28 Nov 2018 02:44:09 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543401849; cv=none; d=google.com; s=arc-20160816; b=TdCODtleO2rZX47SK/DmilfYzQYeVvlX4YN4JCTqRons05kARONh9tGi4lXRwasDaf jarRiVlXXk2eM9HUvQOqs/qlJV8ERNYyGk4PjT8Rw640F6pBYaCLl5nLUT9TcyX8m+7S VExpzEwNquIA8Aa/8egI8AJ6AEyrJ7hNd4TPdr6fo6x/ysHACBs4syMPUdjxYE9PccpO enDfzXIyd7Y+7846wUpfsEZc+QlSCEgZUGavLhgf/S0acICGgWo1GP/TVP7jhZOkgfuX zk66EvRpHVwMeIDVXT9SJlYnmAa2U9nEUtWyRFdVcJ7OspsRCh/JpUbSMgS+dsW+idwn LV9w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=uFUKjxTT9vhRdoORnKcL1go1+WQ1lrKrvE6sIAkGI9I=; b=nQcRmylpmtYcsk3IPazbHvjuvlV02bxwablBzHPxUl37iyqM6PMqUsVhn2rhg6200U uI39OR8DEz5J/wny1Mgmzda/HEERIBacn8XfOsvMS04jyS2PEjfCc1sT9b40f+RaiLUi JR+iZQo7QBRmN5w2TReqonxR3FdySPR49av0JHX+H8RUvhw5hFpDvUvf+Awy36XDLAzC gk6iC7fSIPHX3cRwQEzc0b1+xFje3x1Xs9Iv1laGrJZEK1WYduDUomlYG+QqfdzBwmox q8EaJXaijnoMJJRtQ1p7tDeYb/CmD0OZgQy0xEQY474oR2N7fqKRtSvoEMC7zJS8ZiH+ Pcyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Nz0VKdjC; 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 bj7-v6si6872718plb.193.2018.11.28.02.44.08; Wed, 28 Nov 2018 02:44:09 -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=Nz0VKdjC; 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 S1728190AbeK1VpT (ORCPT + 32 others); Wed, 28 Nov 2018 16:45:19 -0500 Received: from mail-lj1-f193.google.com ([209.85.208.193]:34897 "EHLO mail-lj1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728119AbeK1VpT (ORCPT ); Wed, 28 Nov 2018 16:45:19 -0500 Received: by mail-lj1-f193.google.com with SMTP id x85-v6so22982008ljb.2 for ; Wed, 28 Nov 2018 02:44:05 -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 :mime-version:content-transfer-encoding; bh=uFUKjxTT9vhRdoORnKcL1go1+WQ1lrKrvE6sIAkGI9I=; b=Nz0VKdjCMqLGPbYKRJYOxaVnpQh1k58x0DVVOkjpY1BI3lwBX4HROZeN1QPA8vhlwp Xjg2dlpHd+vr6o2tPZT4t1T9ZjTOcMsmCdDC+dmQX/6YjAMaAqmlYtFYfvfBRtNo3bdZ D7pR+uGNDF41vynPtMgm0C+Z3M58qyv7tSPQU= 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:mime-version:content-transfer-encoding; bh=uFUKjxTT9vhRdoORnKcL1go1+WQ1lrKrvE6sIAkGI9I=; b=jhg1CJj/XtFu9RKpjhAjkUZFS7Nb1uHqu/NeP8hW7X7aJRFBdPzFNBEBjUg8NVMR48 aDdzm7NHA8v3+ECuTmR4jRDVU5kqfvl7p0KbK38OPFn8I7ArT7E1kyCLkdTI5tqjRFpO GIn9zYDWZVLb1Tzr/Myw0KKQYgiGaXp8FtjutT1eQ1DjZWwI7R2utfLYpXXnzDSmW7W9 lkfACSHL56it/xd4kEnfm9TixYM7P7aeGyycBdVb0D2qhWQbmUyhBPISQ6Kgjeeh64J1 dleXLdb1m7S8d2lDr4lsW+feOpmPQQfuiQXbSz+kZP671uCkT9WbSM0aF94dYBiA6rJx /TeA== X-Gm-Message-State: AA+aEWYIfMFD86aIRgW1xHqDzSzYFPGM3qoyOXCewdvIlJghV+khJLui 2jq/ihAMQDFbDqZruQqfvEeqYnzKi4IDmA== X-Received: by 2002:a2e:5054:: with SMTP id v20-v6mr22072216ljd.45.1543401844472; Wed, 28 Nov 2018 02:44:04 -0800 (PST) Received: from genomnajs.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id c20sm1095101lfj.67.2018.11.28.02.44.03 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 28 Nov 2018 02:44:03 -0800 (PST) From: Linus Walleij To: Liam Girdwood , Mark Brown Cc: linux-kernel@vger.kernel.org, Charles Keepax , Bartosz Golaszewski , Linus Walleij Subject: [PATCH 04/10] regulator: max8952: Let core handle GPIO descriptor Date: Wed, 28 Nov 2018 11:43:44 +0100 Message-Id: <20181128104350.31902-5-linus.walleij@linaro.org> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181128104350.31902-1-linus.walleij@linaro.org> References: <20181128104350.31902-1-linus.walleij@linaro.org> MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use the gpiod_get() rather than the devm_* version so that the regulator core can handle the lifecycle of these descriptors. Fixes: d7a261c2d1f2 ("regulator: max8952: Pass descriptor instead of GPIO number") Signed-off-by: Linus Walleij --- drivers/regulator/max8952.c | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) -- 2.19.1 diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c index 6c39fff73b8a..baa8b771a6e4 100644 --- a/drivers/regulator/max8952.c +++ b/drivers/regulator/max8952.c @@ -231,9 +231,9 @@ static int max8952_pmic_probe(struct i2c_client *client, else gflags = GPIOD_OUT_LOW; gflags |= GPIOD_FLAGS_BIT_NONEXCLUSIVE; - gpiod = devm_gpiod_get_optional(&client->dev, - "max8952,en", - gflags); + gpiod = gpiod_get_optional(&client->dev, + "max8952,en", + gflags); if (IS_ERR(gpiod)) return PTR_ERR(gpiod); if (gpiod) @@ -241,6 +241,8 @@ static int max8952_pmic_probe(struct i2c_client *client, rdev = devm_regulator_register(&client->dev, ®ulator, &config); if (IS_ERR(rdev)) { + if (gpiod) + gpiod_put(gpiod); ret = PTR_ERR(rdev); dev_err(&client->dev, "regulator init failed (%d)\n", ret); return ret;