From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.6 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_2 autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CB9B8C2D0D2 for ; Mon, 23 Dec 2019 17:29:33 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 9CDE720715 for ; Mon, 23 Dec 2019 17:29:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577122173; bh=OhBJDQuvvBQRwwpX9+apVAcfuyIsDuFNSzitpLw6gDg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:List-ID:From; b=TqTkZAT2PzTEDA2BRrmNfA6lPrCmtptjWWYMS1UbJVIq3SGX2Z+SZrQFk8P+uxrDY O5xL0GpUaOS1Qg9IK0b1CjHdffnRttT2fONgcd4TJEDX8WGYpstsCHdWEkIHIbjE0u 1CwiJae95vtSp2/RAenFr4JYti1gzQfkskC0zXsQ= Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726882AbfLWR3c (ORCPT ); Mon, 23 Dec 2019 12:29:32 -0500 Received: from mail.kernel.org ([198.145.29.99]:55926 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726783AbfLWR3c (ORCPT ); Mon, 23 Dec 2019 12:29:32 -0500 Received: from archlinux (cpc149474-cmbg20-2-0-cust94.5-4.cable.virginm.net [82.4.196.95]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id EE559206CB; Mon, 23 Dec 2019 17:29:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1577122171; bh=OhBJDQuvvBQRwwpX9+apVAcfuyIsDuFNSzitpLw6gDg=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=hGjGa7kn159KcoYs07EoVhDAvpjg/dCbpae9Snkz0JnwzGXuIfM5dXtQcHYK9IJtt pMRghJK2u/9o9OEeA2OESfb5tQ/ZLw2tIXWNlLUrCxDRMeGCWkSh4hixly/aRDw10v u2ey43L3MYnQm7acFUNXavlKy44Ap1/3k7jM0omg= Date: Mon, 23 Dec 2019 17:29:27 +0000 From: Jonathan Cameron To: "Ardelean, Alexandru" Cc: "linux-kernel@vger.kernel.org" , "linux-iio@vger.kernel.org" , "lars@metafoo.de" Subject: Re: [PATCH] iio: core: use debugfs_remove_recursive() on IIO unload Message-ID: <20191223172927.1d7eee6f@archlinux> In-Reply-To: <4728487938a37207f20cc5d4cb6fbbdd04f56358.camel@analog.com> References: <20191211145903.22395-1-alexandru.ardelean@analog.com> <20191215162525.56516ce4@archlinux> <4728487938a37207f20cc5d4cb6fbbdd04f56358.camel@analog.com> X-Mailer: Claws Mail 3.17.4 (GTK+ 2.24.32; x86_64-pc-linux-gnu) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 16 Dec 2019 07:43:30 +0000 "Ardelean, Alexandru" wrote: > On Sun, 2019-12-15 at 16:25 +0000, Jonathan Cameron wrote: > > [External] > > > > On Wed, 11 Dec 2019 16:59:03 +0200 > > Alexandru Ardelean wrote: > > > > > From: Lars-Peter Clausen > > > > > > The debugfs dir may have multiple files/dirs attached to it. Use > > > debugfs_remove_recursive() to clean it up when the IIO module unloads. > > > > > > Signed-off-by: Lars-Peter Clausen > > > Signed-off-by: Alexandru Ardelean > > > --- > > > > > > Note: note sure if this needs a Fixes tag. It's been in here for ages > > > now, > > > so it may not be a big issue. > > > > There is some argument in favour of doing this as a defensive measure, > > but > > in current IIO debugfs directories are only created by drivers that call > > (indirectly) iio_device_register_debugfs and those must call > > (again indirectly) iio_device_unregister_debugfs which has called > > the recursive free on everything in their directories. So unless > > something > > very odd is going on this isn't a bug. > > > > Am I missing something? > > So, I admit my note is open for interpretation. > [ Rergarding the "Fixes" tag, I'm still not super-clear on when/why/how > it's needed. I'll get there soon though. ] > > This patch has been in our tree since 2012, and I'm not sure why it's using > debugfs_remove_recursive() vs plain debugfs_remove(). > > I sometimes take a look at these old patches, try to make some sense of > them and upstream them, or override them with the version of upstream code. > My intent is to sync ADI code [for IIO] closer to upstream. Which would > make it easier to track any divergence. > > We're not seeing any bug with/without this. > I guess my note about the "Fixes" tag may be a bit clumsy. > > From my side, both debugfs_remove_recursive() & plain debugfs_remove() are > fine. I'd rather leave it be as it kind of avoids people thinking they can get away without cleaning up properly at the higher levels. Thanks, Jonathan > > Thanks > Alex > > > > > > > > drivers/iio/industrialio-core.c | 2 +- > > > 1 file changed, 1 insertion(+), 1 deletion(-) > > > > > > diff --git a/drivers/iio/industrialio-core.c > > > b/drivers/iio/industrialio-core.c > > > index 9a3579943574..dab67cb69fe6 100644 > > > --- a/drivers/iio/industrialio-core.c > > > +++ b/drivers/iio/industrialio-core.c > > > @@ -292,7 +292,7 @@ static void __exit iio_exit(void) > > > if (iio_devt) > > > unregister_chrdev_region(iio_devt, IIO_DEV_MAX); > > > bus_unregister(&iio_bus_type); > > > - debugfs_remove(iio_debugfs_dentry); > > > + debugfs_remove_recursive(iio_debugfs_dentry); > > > } > > > > > > #if defined(CONFIG_DEBUG_FS)