Received: by 2002:a25:ab43:0:0:0:0:0 with SMTP id u61csp5163852ybi; Tue, 4 Jun 2019 02:15:14 -0700 (PDT) X-Google-Smtp-Source: APXvYqxRGr+SdbdYLsIkS5fYATnZQP30xCJf91c235NK8NQDnsGZfNwDJNDa4COIypmW4ibIKHoy X-Received: by 2002:a17:902:868f:: with SMTP id g15mr34986889plo.67.1559639714072; Tue, 04 Jun 2019 02:15:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1559639714; cv=none; d=google.com; s=arc-20160816; b=X/+RPls3rWg6MeM7Xd86mw+M+Zn5jgXo3Q4uvTS0BKGGdljfDfwkpfUAJVqLwUbS8h QVndVQQ5yt1SnRjwmsswvRGPFVOt4oEwqIpsM/PhOeFnFXn5SqRAylEQHf1zSZC/zbCU KWRgmuh484eNyfSOEXnEUuluMksV5FI4lK/ZsSPPb96uIr+zrC6edLAxqWcBUJmRYHTk WoLFgcC3hhjkNFD/8grc79lvb1spXNFFBklQaDRdWK3nIb91t/Z4RUthAFqcy0O1d2mO YbJCNzzECHAjIYC0Gh2BiXYT72d0mdEVyw6tXjMP4e/sDNF/FwwYHDKa6PyJVRMt0SXa b8Hg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :references:in-reply-to:date:cc:to:from:subject:message-id; bh=JZUoUza0NiQX5E2fj6EF26jIGwflCXXvfyEHhls7ftw=; b=V2raY0AI8l1EeZIY6KKvi6djchf7N1UE0fppj/EWABlvxOs/LmhDgiWy9o5Sc9iw4F 4OBEQ4WOjLzdcJIj7dIs0VNsOpLf2ljNBVHTDC6gs6I9q7zrrSUyibIIJ7gt6/4yYBOY krWtFIITK2j5T1BMEMUaPNzO55eQMJaef7XFG93/ebH36C9ASQj9Pzk9TqvSJaQtahFT fvf9dO5snU5ntSyRst83fcgV6oE1J4dIuVbWrnGxB1wLXhUKKUSLnQyqPIbSCiNljAat hQOo9yXN/TTOvqQ2YnaE1nnDRuBpZwW5TyDgyNzXJqSrgLjGsWHjJhDSOaYoGlZFjEI4 2qGQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id e24si20585496pjr.91.2019.06.04.02.14.57; Tue, 04 Jun 2019 02:15:14 -0700 (PDT) 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727216AbfFDJNQ (ORCPT + 99 others); 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