Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp10525779imu; Thu, 6 Dec 2018 02:37:12 -0800 (PST) X-Google-Smtp-Source: AFSGD/VtQuMExqrJnEHxq6pF/xDiOl6jAZ4KpjXW0Ak1zK/kvkNww4tTFBA+5az+pkDGhLKU+Y7V X-Received: by 2002:a65:610d:: with SMTP id z13mr23875619pgu.427.1544092632144; Thu, 06 Dec 2018 02:37:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544092632; cv=none; d=google.com; s=arc-20160816; b=BBv/tjNXfZFU01tnBerNm463fURsiUyAmfO/A1biipGJITyk4nA4Tw5OIlF3rZYYwM ED1Mgcue/l4naocWq3gAeBtM8YWNYN4oQRur3sXqbOEVr25LwhSWD32flXjx6SXiREQc ncvrNZ/BSRzQlr9ZKVS4AKq2e3yfUjw87s7ZN9cRYHYUtcFwiuGBPImHXjIknqgmK2PD f7mqAcMXsySNMkjSQHr0OLK3MfpXj+sCpuqG87JZ0Iju+Y2kSIn/xUqIx+Zn2eDXE48b AcEf9Bvi9lA4pMaRBCgytcIZUanw/ArTVfMdBYoU7teHy2WllWpMzHrS9Gr5VCY9wt7q NrkA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=d+/GUmCkbo3RTaGZaaGGWOQOCvcKYchqGp74Q1Zh9Uc=; b=pKGX5Ijwr248GSox9aMPMP+0FZzDmPyAiZOH7fcc2DAXhlmC1Em7Kq7ugC+OLjVSQI keeyF/WolIHVEvG/Xwsgh27P2OCayVHuTgSM5VWh1Trk10XjfN54Ki3rPsOJ5OD8u76R GhX3Yv04iw64vHyBGzOWV++gA74p3QJzxbWSzQI1Jjb+JzH9syS3nmKIj46bauyh2utI 2OW96DmE7taJrtGoQU27OERA7NCEGrBZA7nmrOnsTJLty87xn+qTctfafIFucjxbnO5k Ht8BjeDBX1r9RAk6T+NcXxjgZ5K9Ln3l/upD3OKxpGPRs6aHT0Wvukb8JYZXJcdPA0lX oTsw== 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t19si22003719pgk.163.2018.12.06.02.36.55; Thu, 06 Dec 2018 02:37:12 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729403AbeLFKen (ORCPT + 99 others); Thu, 6 Dec 2018 05:34:43 -0500 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:48532 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727575AbeLFKem (ORCPT ); Thu, 6 Dec 2018 05:34:42 -0500 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wB6ATB6k005816; Thu, 6 Dec 2018 04:34:32 -0600 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail1.cirrus.com (mail1.cirrus.com [141.131.3.20]) by mx0b-001ae601.pphosted.com with ESMTP id 2p3qktrnnh-1; Thu, 06 Dec 2018 04:34:32 -0600 Received: from EX17.ad.cirrus.com (unknown [172.20.9.81]) by mail1.cirrus.com (Postfix) with ESMTP id 9FAE8611C8B7; Thu, 6 Dec 2018 04:34:31 -0600 (CST) Received: from imbe.wolfsonmicro.main (198.61.95.81) by EX17.ad.cirrus.com (172.20.9.81) with Microsoft SMTP Server id 14.3.408.0; Thu, 6 Dec 2018 10:34:31 +0000 Received: from imbe.wolfsonmicro.main (imbe.wolfsonmicro.main [198.61.95.81]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id wB6AYUU7025419; Thu, 6 Dec 2018 10:34:30 GMT Date: Thu, 6 Dec 2018 10:34:30 +0000 From: Charles Keepax To: Linus Walleij CC: Liam Girdwood , Mark Brown , "linux-kernel@vger.kernel.org" , Bartosz Golaszewski , Marek Szyprowski Subject: Re: [PATCH 06/15 v3] regulator: max8973: Let core handle GPIO descriptor Message-ID: <20181206103430.GH16508@imbe.wolfsonmicro.main> 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> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.20 (2009-12-10) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=669 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1812060095 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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. Thanks, Charles