Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp1692347pxb; Sat, 23 Jan 2021 02:31:58 -0800 (PST) X-Google-Smtp-Source: ABdhPJy8U1J5YlUugaGNyhFa1UHmtOzhyMkdyBPO+4pU12GmbG+G90HsWRJrPWHB9hrYlFw928ll X-Received: by 2002:aa7:d1d4:: with SMTP id g20mr6499966edp.244.1611397918544; Sat, 23 Jan 2021 02:31:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1611397918; cv=none; d=google.com; s=arc-20160816; b=0rZpDk02rIJSpyAmG6hWtyUk4O/MZ4PomyI8bx6z8s6ATEvHQufiMVyLEB6QZb9iVj BTrunMJ1wzG37FeG5ILp4j58Voc5wdW9Gqz+BPbZ7/vXxn68NU/dEaGncJwbRNoCTavF JA8anvDAJ8vSDQZV1/utGvLU1MuX2KKJELH3c7lWlBfEzPkPyW2sq//a0dQwoy+KXHRS Z8Kmwi3HWZonKKi2JDRthPcxp8bJRslKo4c5ysVm5WDvPNNMla2BdyEoS//e3J1J4GQE Xw+0eDionLM3fldD/yOHW52I2dIjpg4U/gzDeBETlfMOF77pN0OTezEOdQzEn2/RS/bm /81A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=N8VY8ZhWw1Ykg91W9SCMQqQirNkeklf/Pp6cfAv8oAc=; b=WSRs+HYMM6lkQuT0GKhybww0dKXU1Lg7y+8MhtoRQ6GGOiIeISCFbGEWoQHFsTD1yf N87aNXM2Qgioe+X2q3RjBA0ybKaNc24Ct/3HBKx8p0X/yAJteJOVLdoFucBYDinwdaxn T2M1YKSHglEATQpRO1gSvWWNGvKedutY8adGr4YrayT+hlPzT2IgVOCa2oS1JkZjgWoc wpTaE+NDUd2TCDsXvB5ayGXmc13zIO1Kv8ilTK98ssrNWHbng58zVqDafDz7Ak2dRY/q ueeedxRTdJ7j3sXEy8MvfKnKmRmfXVP1TuOM+ZfYYJN25NvYM69wpgV0L9oTdVvIwNYo W2tw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=bIBBSZdB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t4si4624225edw.62.2021.01.23.02.31.34; Sat, 23 Jan 2021 02:31:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=bIBBSZdB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726388AbhAWKa3 (ORCPT + 99 others); Sat, 23 Jan 2021 05:30:29 -0500 Received: from mx0b-001ae601.pphosted.com ([67.231.152.168]:45456 "EHLO mx0b-001ae601.pphosted.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725769AbhAWKa1 (ORCPT ); Sat, 23 Jan 2021 05:30:27 -0500 Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.16.0.43/8.16.0.43) with SMTP id 10NALX5K000499; Sat, 23 Jan 2021 04:29:42 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=date : from : to : cc : subject : message-id : references : mime-version : content-type : in-reply-to; s=PODMain02222019; bh=N8VY8ZhWw1Ykg91W9SCMQqQirNkeklf/Pp6cfAv8oAc=; b=bIBBSZdBg2XOpW560XKbUEBfVSoV6EZAtbiJBavKNt89VAB9O5PmdYmZqd4HNGbcuOoa TmFYxCMS7Z0vv8xLUyE8v8wilS+Yqyjp2ry/Ds0422rsP52Oxr3FkzM92HaVye4F6LAo QN+YfuyuaGDzyaU5aXn4YjUOmtFJRNdZ1cSh8/YxrihKy004ydJNZkLGZiFDHvBJy2E6 5eJoa2PE61kVjd5rl35w9YKX/y8H7itOZO/PJDNvt/hmlffEIUbbVB2h/Nd4/uewCb1i ULibYZipch9LV2Dl4ePV9nyEG+ZCMGHc7dfQX0z3+Izz+k+/UEWPeH0JqBdMe75SM8kp kg== Received: from ediex01.ad.cirrus.com ([87.246.76.36]) by mx0b-001ae601.pphosted.com with ESMTP id 368h3u0186-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128 verify=NOT); Sat, 23 Jan 2021 04:29:42 -0600 Received: from EDIEX01.ad.cirrus.com (198.61.84.80) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.1913.5; Sat, 23 Jan 2021 10:29:41 +0000 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by EDIEX01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.1.1913.5 via Frontend Transport; Sat, 23 Jan 2021 10:29:41 +0000 Received: from ediswmail.ad.cirrus.com (ediswmail.ad.cirrus.com [198.61.86.93]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 6214945; Sat, 23 Jan 2021 10:29:41 +0000 (UTC) Date: Sat, 23 Jan 2021 10:29:41 +0000 From: Charles Keepax To: Hans de Goede CC: Mark Brown , Liam Girdwood , Subject: Re: [PATCH] regulator: core: Avoid debugfs: Directory ... already present! error Message-ID: <20210123102941.GK106851@ediswmail.ad.cirrus.com> References: <20210122183250.370571-1-hdegoede@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Disposition: inline In-Reply-To: <20210122183250.370571-1-hdegoede@redhat.com> User-Agent: Mutt/1.5.21 (2010-09-15) X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 bulkscore=0 priorityscore=1501 adultscore=0 suspectscore=0 lowpriorityscore=0 spamscore=0 phishscore=0 clxscore=1015 mlxlogscore=999 mlxscore=0 malwarescore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2101230056 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Jan 22, 2021 at 07:32:50PM +0100, Hans de Goede wrote: > Sometimes regulator_get() gets called twice for the same supply on the > same device. This may happen e.g. when a framework / library is used > which uses the regulator; and the driver itself also needs to enable > the regulator in some cases where the framework will not enable it. > > Commit ff268b56ce8c ("regulator: core: Don't spew backtraces on > duplicate sysfs") already takes care of the backtrace which would > trigger when creating a duplicate consumer symlink under > /sys/class/regulator/regulator.%d in this scenario. > > Commit c33d442328f5 ("debugfs: make error message a bit more verbose") > causes a new error to get logged in this scenario: > > [ 26.938425] debugfs: Directory 'wm5102-codec-MICVDD' with parent 'spi-WM510204:00-MICVDD' already present! > > There is no _nowarn variant of debugfs_create_dir(), but we can detect > and avoid this problem by checking the return value of the earlier > sysfs_create_link_nowarn() call. > > Add a check for the earlier sysfs_create_link_nowarn() failing with > -EEXIST and skip the debugfs_create_dir() call in that case, avoiding > this error getting logged. > > Fixes: c33d442328f5 ("debugfs: make error message a bit more verbose") > Cc: Charles Keepax > Signed-off-by: Hans de Goede > --- Reviewed-by: Charles Keepax Thanks, Charles > - int err; > + int err = 0; > > @@ -1663,8 +1663,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev, > > - regulator->debugfs = debugfs_create_dir(supply_name, > - rdev->debugfs); > + if (err != -EEXIST) > + regulator->debugfs = debugfs_create_dir(supply_name, rdev->debugfs); There is a slight oddity here in that if this regulator has no struct device we will still get the warning. However, I am totally not clear on when/why a regulator might not have a dev, and am fairly sure it isn't common. So my vote would be to cross that bridge if we ever come to it. Thanks, Charles