Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10594790imu; Thu, 6 Dec 2018 03:50:52 -0800 (PST) X-Google-Smtp-Source: AFSGD/WEBes5RIssgKhnQ+G1/qa530ZAWlke18iHVq80IvcY157jp6QAT9iq6kXCCIqBjAfWnZPv X-Received: by 2002:a17:902:43e4:: with SMTP id j91mr27255775pld.147.1544097052261; Thu, 06 Dec 2018 03:50:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544097052; cv=none; d=google.com; s=arc-20160816; b=euliaBZkj/ZkL2wjcdxXUSci9gaRVc7ejMRuUI6kGxFZwbAgvRPklnDAkTYxe4uBeF j+6q3ocb+ntyXNH5xVh5haoFHmibJAreg1eRoQ9WlRfXPbJzFpuiqGTW6kOnX9smno+I yrqqZUlafinK9AstHEet24v+L5UwI1dbD3CgTVM3mHx2+qsEEGMnvNwjU087K76d0gi+ IZh5uklWSMlhAU7aK+l8JFoHksRRptdGhdypfpW01t6aveUeZfA28FTvze+9MzxItvpx Paz/MYpNAWsXxsKYsqmWrJS/YcoKApjkSA7yJRnF9HzJrt3IxWkwJl/XWWcVtMYrzsSI hhNg== 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=b+DyQNtTkJ3/ZpvBP6CwoAz3Thk3r1Lx9oLMIY32EoY=; b=YXpV9VtPvAOJBtWF0Hrbow6s0iSK2unEQ0u4uup4SncP7vDGApF8Wvf+I86Q3JIwKV h8Xsb1YPJPueG+Pq138vn05FmKQkROZ080MPT8XYe9PljORL8cxv539b9yNZ37TdlVX0 1KCez2RwpRN0rGPTm6kJ5oJfEHl4lytB3G1KAnQrxg3MmC42XBF57SB7RCQ5EhOuMzgc WR/BrrPYQnAvUT+S7+bYEaMsbRQwN0mS0A0v9lvaJ1nH9kyQX9SIFC0VUyEQvKTZVGZT 5vrTQsG5bPQsGpEuLvl0E8Y+VjyTN5nidGoI70vHVCNdtDsj30K8bAFCd+BpJ3W057M4 yoQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=hclKqM9B; 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 w11si75727plz.327.2018.12.06.03.50.36; Thu, 06 Dec 2018 03:50:52 -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=hclKqM9B; 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 S1729398AbeLFLsB (ORCPT + 99 others); Thu, 6 Dec 2018 06:48:01 -0500 Received: from mail-lf1-f66.google.com ([209.85.167.66]:40416 "EHLO mail-lf1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727832AbeLFLsB (ORCPT ); Thu, 6 Dec 2018 06:48:01 -0500 Received: by mail-lf1-f66.google.com with SMTP id v5so112481lfe.7 for ; Thu, 06 Dec 2018 03:48:00 -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=b+DyQNtTkJ3/ZpvBP6CwoAz3Thk3r1Lx9oLMIY32EoY=; b=hclKqM9BlWwm814zOS0to4aCCL5BDy5tnjfTu2vdGlxzaBTI8lCcQXIR16b8CrJwqd h6RZxcM3MlU+LJ+Mc4GBmehKsuJuKmw3b+HtMyl0Nns01gc4YuqPQcpSZa/GRNur39sG /bevJgygIbXnkrCM53YBKPFvosZR4XGJ1wM80= 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=b+DyQNtTkJ3/ZpvBP6CwoAz3Thk3r1Lx9oLMIY32EoY=; b=SryVFtOeeoKGGU/7t+N3ZhMnjf0hwr15L48CNXVvwWv+muSeKi0uYc6LT+bTX6v0iS vQsHWUlnBKavIRNTOa1naa1F1UQeMu5LTa4IeIGNMxmRlQSuarmpYmDI9qLCo7xtdSUS 5DUxSzsZCqHXZDpv7pP5YU8mDnhEXlb+86WRlkhtzNv9JwJiaVHe/TP2DzBqINySudxQ Ra5bRc78FpsUTBWdND2AFeU078mcYFPjDHmYGqU1BnySMgxBiNYzjfSdiCaT/JOqCqRw 1AHZYr6Bo7B6BNY1SugiEoDTXzROCm5Rs5Fus98KlLxtggCKOHp0mndejF9IBOlB3ylj /QSA== X-Gm-Message-State: AA+aEWamN+40/js7DEOEwnJv/eC4jtCJx5L80+O3eJgq4fF0h+CgdHHp b8+eqEFnZaMb07b4hJwYRNnQ1c2vyXfNaotwOfFoCw== X-Received: by 2002:a19:c801:: with SMTP id y1mr16153304lff.53.1544096878959; Thu, 06 Dec 2018 03:47:58 -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> <20181205153331.GG16508@imbe.wolfsonmicro.main> <20181206103430.GH16508@imbe.wolfsonmicro.main> In-Reply-To: <20181206103430.GH16508@imbe.wolfsonmicro.main> From: Linus Walleij Date: Thu, 6 Dec 2018 12:47:46 +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 Thu, Dec 6, 2018 at 11:34 AM Charles Keepax wrote: > On Thu, Dec 06, 2018 at 09:58:30AM +0100, Linus Walleij wrote: > > On Wed, Dec 5, 2018 at 4:33 PM Charles Keepax > > wrote: > > > On Wed, Dec 05, 2018 at 03:42:06PM +0100, Linus Walleij wrote: > > > > 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: > > > > > > @@ -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? > > > > > > Yeah, patch 1 makes the regulator core consistently handle GPIOs > > > that are passed into it. > > > > Sorry. I confused this patch for the max77686 patch. That > > one was fixed with patch 01... > > > > > However, on the MAX77621 path in this > > > switch statement the GPIO is never passed into the regulator > > > core, so the core never takes ownership of it, so the driver still > > > needs to manage the lifetime. > > > > > > It should be a pretty easy fix though as commented on v2, again > > > apologies for the slow review. > > > > OK I switch it to devm_ as you suggested, as we implemented > > gpiod_unhinge it's a piece of cake nowadays. > > > > You shouldn't really need to use unhinge, you can just use devm > on the path that doesn't pass it to the core and not on the > one that does. You just need to update the error case below it to > use config->ena_gpiod rather than gpiod. Indeed I just think it will be confusing when people read the code. It's better consistency if its just devm_* and the we unhinge the one we pass to the regulator core IMO. Yours, Linus Walleij