Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3164236imu; Fri, 23 Nov 2018 23:05:54 -0800 (PST) X-Google-Smtp-Source: AJdET5dJAWdqqXTizCZB2OCKg4EB+5RaBsIEBAW/3t9qz3CzhXgetTZCZYBsEmL6hxhWBnLF9qlR X-Received: by 2002:a62:647:: with SMTP id 68-v6mr19912151pfg.42.1543043154580; Fri, 23 Nov 2018 23:05:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543043154; cv=none; d=google.com; s=arc-20160816; b=hCOKsYV8ab+Yl5rggQU4WbWBV9dR4EReFKi9p+lsujXgnY02Nfu6C3ZfbTplf0CQ3i M0Q2CoTQl5t6K3pS2D1goIliWY4+bbAaV///MF9pUGCo9UgjIJTSVJki5xwsExBNIc3C 89kNx/kMBhkwYxgf/ZGY1zMwEn7q7ysFSpoJKOFifLtnAqbTYGxGrSjR13egCHDVVFUT gRfc/SxW6AEvCUdx7euKjurtmfXDtIn/Tg9FR/2rwtSUCD8Y2aNjrUj/jXeDV4Klq8m2 BsMkXeAqSbhjhTVV6VQNhawG5IHrNfeY02s5D0mUo8zWOgJ0jG9eXSrHTCt785a5dUb9 cVXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:message-id:date:subject:cc :to:from; bh=BCxeAZCm7txkePNC26P9VoYgMmEF2H0SmzYin5FBJ7Y=; b=J73Tvj5PtLA7KQIP3sr+lht5izukGsXUw3DY49JEMyV0YuRoU8eoI1IMCtKP1sJt2J VBl+ZT+cLoR1G5LLYOwSdNX3No4E0z30f87iaUB31SzrvAYzg+sAfVZkEX/LRxWkcwET C/MHMtBsTU9wj0zJMaJVWdZqo8uc//tI6kdsXUEbInLPpTuWzkfPpAyQ3/u4URKZHGC6 gxD0SHj0Iya7CdJDlpfA93nzTuF7pStGbEPPlhcWOUZiTuUe6apLUbvwil7AGw/GmcVZ E0EkIGKpp5p4hR0IRsDGodZhE2BAEw5r6knMD8E8z5AU4QnWnJe7J5jXnFsYZhOoP+0T sc5g== 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 t74si45517193pgc.150.2018.11.23.23.05.40; Fri, 23 Nov 2018 23:05:54 -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 S2406372AbeKWEKm (ORCPT + 99 others); Thu, 22 Nov 2018 23:10:42 -0500 Received: from mx0a-001ae601.pphosted.com ([67.231.149.25]:50772 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S2406344AbeKWEKl (ORCPT ); Thu, 22 Nov 2018 23:10:41 -0500 Received: from pps.filterd (m0077473.ppops.net [127.0.0.1]) by mx0a-001ae601.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id wAMHNwLZ012358; Thu, 22 Nov 2018 11:30:18 -0600 Authentication-Results: ppops.net; spf=none smtp.mailfrom=ckeepax@opensource.cirrus.com Received: from mail4.cirrus.com ([87.246.98.35]) by mx0a-001ae601.pphosted.com with ESMTP id 2nth9891d7-1; Thu, 22 Nov 2018 11:30:17 -0600 Received: from EX17.ad.cirrus.com (unknown [172.20.9.81]) by mail4.cirrus.com (Postfix) with ESMTP id BBA99611CE62; Thu, 22 Nov 2018 11:33:41 -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, 22 Nov 2018 17:30:16 +0000 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by imbe.wolfsonmicro.main (8.14.4/8.14.4) with ESMTP id wAMHUFt5029517; Thu, 22 Nov 2018 17:30:15 GMT From: Charles Keepax To: CC: , , , , Subject: [PATCH 1/3] regulator: wm8994: Revert back to using devres Date: Thu, 22 Nov 2018 17:30:13 +0000 Message-ID: <20181122173015.23905-1-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.11.0 MIME-Version: 1.0 Content-Type: text/plain X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 priorityscore=1501 malwarescore=0 suspectscore=3 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1811220155 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org This reverts commit 466affa06703 ("regulator: wm8994: Don't use devres for enable GPIOs"). Whilst that did work around the issue in question there are complications on the error paths of regulator_register. In the success case clearly the regulator core owns the GPIO, however, in the failure case it is unclear what should happen. The regulator core could always free the GPIO but that may not make sense from the perspective of the calling code. Alternatively the regulator core could never free the GPIO but that makes the handling in the regulator core rather complex. Ultimately it makes more sense to handle the shared GPIO in the core. Reported-by: Marek Szyprowski Signed-off-by: Charles Keepax --- drivers/regulator/wm8994-regulator.c | 14 +++++--------- 1 file changed, 5 insertions(+), 9 deletions(-) diff --git a/drivers/regulator/wm8994-regulator.c b/drivers/regulator/wm8994-regulator.c index 46e6b4ee1491a..d7fec533c4032 100644 --- a/drivers/regulator/wm8994-regulator.c +++ b/drivers/regulator/wm8994-regulator.c @@ -147,14 +147,11 @@ static int wm8994_ldo_probe(struct platform_device *pdev) config.regmap = wm8994->regmap; config.init_data = &ldo->init_data; - /* - * Look up LDO enable GPIO from the parent device node, we don't - * use devm because the regulator core will free the GPIO - */ - gpiod = gpiod_get_optional(pdev->dev.parent, - id ? "wlf,ldo2ena" : "wlf,ldo1ena", - GPIOD_OUT_LOW | - GPIOD_FLAGS_BIT_NONEXCLUSIVE); + /* Look up LDO enable GPIO from the parent device node */ + gpiod = devm_gpiod_get_optional(pdev->dev.parent, + id ? "wlf,ldo2ena" : "wlf,ldo1ena", + GPIOD_OUT_LOW | + GPIOD_FLAGS_BIT_NONEXCLUSIVE); if (IS_ERR(gpiod)) return PTR_ERR(gpiod); config.ena_gpiod = gpiod; @@ -187,7 +184,6 @@ static int wm8994_ldo_probe(struct platform_device *pdev) return 0; err: - gpiod_put(gpiod); return ret; } -- 2.11.0