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=-1.0 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNPARSEABLE_RELAY autolearn=ham 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 3DF38C282CE for ; Tue, 4 Jun 2019 09:13:17 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 1BCBA21976 for ; Tue, 4 Jun 2019 09:13:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727221AbfFDJNQ (ORCPT ); Tue, 4 Jun 2019 05:13:16 -0400 Received: from mailgw02.mediatek.com ([1.203.163.81]:63272 "EHLO mailgw02.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1727017AbfFDJNP (ORCPT ); Tue, 4 Jun 2019 05:13:15 -0400 X-UUID: f1b8df9676b74030890b8250c336d34e-20190604 X-UUID: f1b8df9676b74030890b8250c336d34e-20190604 Received: from mtkcas32.mediatek.inc [(172.27.4.253)] by mailgw02.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 1895715751; Tue, 04 Jun 2019 17:13:05 +0800 Received: from MTKCAS32.mediatek.inc (172.27.4.184) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Tue, 4 Jun 2019 17:13:03 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS32.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Tue, 4 Jun 2019 17:13:03 +0800 Message-ID: <1559639583.8487.76.camel@mhfsdcap03> Subject: Re: [PATCH v4] usb: create usb_debug_root for gadget only From: Chunfeng Yun To: Greg Kroah-Hartman CC: Felipe Balbi , Matthias Brugger , , , , , Date: Tue, 4 Jun 2019 17:13:03 +0800 In-Reply-To: <20190604082407.GA3783@kroah.com> References: <1559633647-29040-1-git-send-email-chunfeng.yun@mediatek.com> <20190604073706.GA25045@kroah.com> <87k1e123mc.fsf@linux.intel.com> <20190604082407.GA3783@kroah.com> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.2.3-0ubuntu6 Content-Transfer-Encoding: 7bit MIME-Version: 1.0 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, 2019-06-04 at 10:24 +0200, Greg Kroah-Hartman wrote: > On Tue, Jun 04, 2019 at 10:47:55AM +0300, Felipe Balbi wrote: > > > > Hi, > > > > Greg Kroah-Hartman writes: > > >> +struct dentry *usb_debugfs_init(void) > > >> +{ > > >> + if (!usb_debug_root) > > >> + usb_debug_root = debugfs_create_dir("usb", NULL); > > >> + > > >> + atomic_inc(&usb_debug_root_refcnt); > > >> + > > >> + return usb_debug_root; > > >> +} > > >> +EXPORT_SYMBOL_GPL(usb_debugfs_init); > > >> + > > >> +void usb_debugfs_cleanup(void) > > >> +{ > > >> + if (atomic_dec_and_test(&usb_debug_root_refcnt)) { > > >> + debugfs_remove_recursive(usb_debug_root); > > >> + usb_debug_root = NULL; > > >> + } > > >> +} > > >> +EXPORT_SYMBOL_GPL(usb_debugfs_cleanup); > > > > > > Only remove the debugfs subdir if the usbcore module is removed. Create > > > the debugfs subdir when the usbcore module is loaded. No need for any > > > reference counting of any sort at all. No need to overthink this :) > > > > There is a slight need to overthink. He wants to use the same directory > > for gadget-only builds too :-) > > Again, that's fine, this file will be loaded for those builds as well, > right? Yes, either usbcore or gadget will select this file. > Otherwise, how would this code even be present? :) > > thanks, > > greg k-h