From mboxrd@z Thu Jan 1 00:00:00 1970 From: Felipe Balbi Subject: Re: [v3 PATCH] usb: create usb_debug_root for gadget only Date: Tue, 28 May 2019 11:11:50 +0300 Message-ID: <87k1ebj8vt.fsf@linux.intel.com> References: Mime-Version: 1.0 Content-Type: text/plain Return-path: In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org To: Greg Kroah-Hartman Cc: Matthias Brugger , Randy Dunlap , Chunfeng Yun , linux-usb@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org List-Id: linux-mediatek@lists.infradead.org Hi, Chunfeng Yun writes: > diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c > index 7fcb9f782931..88b3ee03a12d 100644 > --- a/drivers/usb/core/usb.c > +++ b/drivers/usb/core/usb.c > @@ -1190,7 +1190,7 @@ EXPORT_SYMBOL_GPL(usb_debug_root); > > static void usb_debugfs_init(void) > { > - usb_debug_root = debugfs_create_dir("usb", NULL); > + usb_debug_root = debugfs_create_dir(USB_DEBUG_ROOT_NAME, NULL); > debugfs_create_file("devices", 0444, usb_debug_root, NULL, > &usbfs_devices_fops); > } might be a better idea to move this to usb common. Then have a function which can be called by both host and gadget to maybe create the directory: static struct dentry *usb_debug_root; struct dentry *usb_debugfs_init(void) { if (!usb_debug_root) usb_debug_root = debugfs_create_dir("usb", NULL); return usb_debug_root; } Then usb core would be updated to something like: static void usb_core_debugfs_init(void) { struct dentry *root = usb_debugfs_init(); debugfs_create_file("devices", 0444, root, NULL, &usbfs_devices_fops); } -- balbi