Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp9554946imu; Wed, 5 Dec 2018 06:43:30 -0800 (PST) X-Google-Smtp-Source: AFSGD/U7Ao9ojN3dqpn9dH0A5a+awaknZ6tEivGUbsUrt54+FhzhoeAnhMaxe+ldYKxeqvqqCDW+ X-Received: by 2002:a17:902:59d6:: with SMTP id d22mr25027759plj.10.1544021010747; Wed, 05 Dec 2018 06:43:30 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544021010; cv=none; d=google.com; s=arc-20160816; b=EcdBeTXcaopzo+U8fv2YHStMdTr7PKU3uZiYlEqN36KKo1OjMnul6S5RJ8tbmsnLNM Lea86pfCXjfxoe0HN4pvPpB6InZN+LEaO0EjZYaoZb3mKLDblwdiSQGdTLFz+9mf6plR Wa0q5//JKqvgd1BYWLQDcN0QZIxU/W2Af33AgQ6STfQym+O2OmbUXinYyphAH8XQDcVD nHGdijqNApfYwlM4jViZC6Y+psGgYoAp9sSyC7LlGFLPJm7rT7EFUO+Pu5sedi2+TRm5 gSm7KFLdBvCOLbRmA+v7eGbaLs8M2zGF78zzxwwrI3+uIIcDGp70DZ3IsJgK+BMc24VS zQIA== 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 :in-reply-to:references:mime-version:dkim-signature; bh=7/daZjlGPJkP5yUOOonDeceHjcq70T3cl4IR+HFP00I=; b=b9wxzJc+5EMwG0mnq3Ox2WRXrGNnZjUokiikilQacqzHo1NQNKAuW3a7wRr5jiOqTR JbnQmAUikmEiIGkCwygy5u2g79euln+G52mH2JyLZofGj96zh/6bfp7tUGlynJ2wjxCN MiM7YrlzKI5jvAvhS4m//8vloJ/dS1xcDLhu1bW/vH6ZwbXkabsLsRhZG551YoG7UKqT n2AfFBuMtIXxBoSEM8YTPb9LQLCFfjtZ7sGwbt48Odw0buM+szKileEkCEZdK28NhK8o +dtU92j1G237v20gfAesFoZKYB1loP6zD7nPHBtfDaCW8VQJEctXzDnd7iGn3tG2yqTp kcgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=Va19WB5z; 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 v5si18607730pgg.1.2018.12.05.06.43.15; Wed, 05 Dec 2018 06:43:30 -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=Va19WB5z; 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 S1727659AbeLEOmW (ORCPT + 99 others); Wed, 5 Dec 2018 09:42:22 -0500 Received: from mail-lf1-f67.google.com ([209.85.167.67]:33163 "EHLO mail-lf1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726918AbeLEOmW (ORCPT ); Wed, 5 Dec 2018 09:42:22 -0500 Received: by mail-lf1-f67.google.com with SMTP id i26so14924129lfc.0 for ; Wed, 05 Dec 2018 06:42:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=7/daZjlGPJkP5yUOOonDeceHjcq70T3cl4IR+HFP00I=; b=Va19WB5zXFoIzn0B33xxAh62knuZjW7N4GYY27TAkagk2o5Csz+7UQzKw/cYYs7akK I+YgTu/0Whyzr6nLnpj7VBvSx8Mygbn6798c1PELCTt8Vs2KP4WLdCzYgLVflyCecyff Dg91LX64GqY/Dl7Sxyg8o3+qdTjgyT136tkIo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=7/daZjlGPJkP5yUOOonDeceHjcq70T3cl4IR+HFP00I=; b=VY0XEservR3Qurd1CC+89LeTZVk62OBaNKj7fzSIcQSoSL0nzMOCiAdyQQG4e4Dlp7 1g37f6OsIkgN9nlndq7Pw6vsSvMnjLIXVb6aXpHZ0ubR+YsqK2QT0eUfSAjLgarlPyt9 zhhB6U7mMmtp1lixEPPQVVEdrP0uTDAoMIbic8vr8qD8MF4MMAnAy1Pxt9ujhw0dVGes Vge+hHP8nsmboKYK2YOlKC3MMnDzbElKHNEwip+SF8uteCE8C+rcpk2G97Dp5d91OJPs v04KpoO62S2Z/dCLw5F7e7dEbeNfuTiqSpbDUhFSlgt1keR9uC9omtrEPN/ixJVvbUrF 007w== X-Gm-Message-State: AA+aEWZjJTSH1JucPnEb55OIiRNAPSbyMo8TaRx7CVX80Nqm9enslUp7 jI6GfJ8E14uXYrcK7qicwdYvJeJtTyYJP3Wg2oR1kA== X-Received: by 2002:a19:f813:: with SMTP id a19mr13943266lff.67.1544020940246; Wed, 05 Dec 2018 06:42:20 -0800 (PST) MIME-Version: 1.0 References: <20181205124721.26624-1-linus.walleij@linaro.org> <20181205124721.26624-7-linus.walleij@linaro.org> <20181205134345.GF16508@imbe.wolfsonmicro.main> In-Reply-To: <20181205134345.GF16508@imbe.wolfsonmicro.main> From: Linus Walleij Date: Wed, 5 Dec 2018 15:42:06 +0100 Message-ID: Subject: Re: [PATCH 06/15 v3] regulator: max8973: Let core handle GPIO descriptor To: Charles Keepax Cc: Liam Girdwood , Mark Brown , "linux-kernel@vger.kernel.org" , Bartosz Golaszewski , Marek Szyprowski 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 Wed, Dec 5, 2018 at 2:43 PM Charles Keepax wrote: > On Wed, Dec 05, 2018 at 01:47:12PM +0100, Linus Walleij wrote: > > Use the gpiod_get() rather than the devm_* version so that the > > regulator core can handle the lifecycle of these descriptors. > > > > Fixes: e7d2be696faa ("regulator: max8973: Pass descriptor instead of GPIO number") > > Signed-off-by: Linus Walleij > > --- > > ChangeLog v2->v3: > > - Resending. > > ChangeLog v1->v2: > > - Drop the gpiod_put() on the errorpath after devm_regulator_register() > > as this will be handled by the regulator core. > > - Fix the second case of devm_gpiod_get() > > - Put a comment in the code so maintainers knows not to > > use managed resources (devm*) > > --- > > @@ -775,10 +779,13 @@ static int max8973_probe(struct i2c_client *client, > > /* > > * We do not let the core switch this regulator on/off, > > * we just leave it on. > > + * > > + * Do not use devm* here: the regulator core takes over the > > + * lifecycle management of the GPIO descriptor. > > */ > > - gpiod = devm_gpiod_get_optional(&client->dev, > > - "maxim,enable", > > - GPIOD_OUT_HIGH); > > + gpiod = gpiod_get_optional(&client->dev, > > + "maxim,enable", > > + GPIOD_OUT_HIGH); > > My comment on v2 still stands here, the GPIO is not passed to > the regulator core on this path. Patch 01 should take care of that, did you check it? Yours, Linus Walleij