All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 01/28] usb: common: change usb_debug_root as static variable
@ 2019-11-06  3:15 Chunfeng Yun
  2019-11-06  3:15 ` [PATCH 02/28] usb: core: use usb_debugfs_create_file() to create debugfs file Chunfeng Yun
                   ` (28 more replies)
  0 siblings, 29 replies; 40+ messages in thread
From: Chunfeng Yun @ 2019-11-06  3:15 UTC (permalink / raw)
  To: Greg Kroah-Hartman, Felipe Balbi
  Cc: Peter Chen, Alexandre Belloni, Heikki Krogerus, Wolfram Sang,
	Yangtao Li, Linus Walleij, linux-kernel, Matthias Brugger,
	Mans Rullgard, Srinivas Kandagatla, Laurent Pinchart,
	Fabio Estevam, Florian Fainelli, Robert Jarzmik, Kevin Cernekee,
	Gustavo A. R. Silva, Ludovic Desroches, Alan Stern,
	NXP Linux Team, Chunfeng Yun, bcm-kernel-feedback-list,
	David Kershner, Hans Ulli Kroll, Cristian Birsan, linux-media,
	Fabrizio Castro, Mathias Payer, Mathias Nyman, Suzuki K Poulose,
	Sascha Hauer, Haojian Zhuang, Stephen Boyd, linux-mediatek,
	Minas Harutyunyan, Simon Horman, Mauro Carvalho Chehab, Bin Liu,
	linux-arm-kernel, Biju Das, Laurentiu Tudor, Yoshihiro Shimoda,
	linux-usb, Nicolas Ferre, Dmitry Torokhov, Guenter Roeck,
	Pengutronix Kernel Team, Colin Ian King, Shawn Guo, Daniel Mack

Try to avoid using extern global variable, and provide two
functions for the usage cases

Signed-off-by: Chunfeng Yun <chunfeng.yun@mediatek.com>
---
 drivers/usb/common/common.c | 16 ++++++++++++++--
 include/linux/usb.h         |  5 ++++-
 2 files changed, 18 insertions(+), 3 deletions(-)

diff --git a/drivers/usb/common/common.c b/drivers/usb/common/common.c
index 1433260d99b4..639ee6d243a2 100644
--- a/drivers/usb/common/common.c
+++ b/drivers/usb/common/common.c
@@ -293,8 +293,20 @@ struct device *usb_of_get_companion_dev(struct device *dev)
 EXPORT_SYMBOL_GPL(usb_of_get_companion_dev);
 #endif
 
-struct dentry *usb_debug_root;
-EXPORT_SYMBOL_GPL(usb_debug_root);
+static struct dentry *usb_debug_root;
+
+struct dentry *usb_debugfs_create_dir(const char *name)
+{
+	return debugfs_create_dir(name, usb_debug_root);
+}
+EXPORT_SYMBOL_GPL(usb_debugfs_create_dir);
+
+struct dentry *usb_debugfs_create_file(const char *name, umode_t mode,
+			void *data, const struct file_operations *fops)
+{
+	return debugfs_create_file(name, mode, usb_debug_root, data, fops);
+}
+EXPORT_SYMBOL_GPL(usb_debugfs_create_file);
 
 static int __init usb_common_init(void)
 {
diff --git a/include/linux/usb.h b/include/linux/usb.h
index e656e7b4b1e4..ad96e0aa0127 100644
--- a/include/linux/usb.h
+++ b/include/linux/usb.h
@@ -2001,7 +2001,10 @@ extern void usb_register_notify(struct notifier_block *nb);
 extern void usb_unregister_notify(struct notifier_block *nb);
 
 /* debugfs stuff */
-extern struct dentry *usb_debug_root;
+extern struct dentry *usb_debugfs_create_dir(const char *name);
+extern struct dentry *
+usb_debugfs_create_file(const char *name, umode_t mode, void *data,
+			const struct file_operations *fops);
 
 /* LED triggers */
 enum usb_led_event {
-- 
2.23.0


_______________________________________________
Linux-mediatek mailing list
Linux-mediatek@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-mediatek

^ permalink raw reply related	[flat|nested] 40+ messages in thread

end of thread, other threads:[~2019-11-07  9:16 UTC | newest]

Thread overview: 40+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-11-06  3:15 [PATCH 01/28] usb: common: change usb_debug_root as static variable Chunfeng Yun
2019-11-06  3:15 ` [PATCH 02/28] usb: core: use usb_debugfs_create_file() to create debugfs file Chunfeng Yun
2019-11-06  3:15 ` [PATCH 03/28] usb: host: sl811: use usb_debugfs_create_file() to create file Chunfeng Yun
2019-11-06  3:15 ` [PATCH 04/28] usb: host: isp1362: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 05/28] usb: typec: tcpm: use usb_debugfs_create_file() to create debugfs file Chunfeng Yun
2019-11-06  3:15 ` [PATCH 06/28] usb: typec: fusb302: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 07/28] usb: ehci-hcd: use usb_debugfs_create_dir() to create directory Chunfeng Yun
2019-11-06  3:15 ` [PATCH 08/28] usb: fhci-hcd: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 09/28] usb: ohci-hcd: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 10/28] usb: uhci-hcd: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 11/28] usb: xhci: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 12/28] usb: host: fotg2: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 13/28] usb: mon: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 14/28] usb: mtu3: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 15/28] media: uvcvideo: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 16/28] media: siano: " Chunfeng Yun
2019-11-06  8:50   ` Greg Kroah-Hartman
2019-11-06  9:55   ` Greg Kroah-Hartman
2019-11-06  3:15 ` [PATCH 17/28] usb: chipidea: debug: create debugfs directory under usb root Chunfeng Yun
2019-11-06  3:15 ` [PATCH 18/28] usb: host: imx21: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 19/28] usb: dwc3: create debugfs subdirectory under usb root directory Chunfeng Yun
2019-11-06  3:15 ` [PATCH 20/28] usb: musb: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 21/28] usb: musb: dsps: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 22/28] usb: dwc2: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 23/28] usb: gadget: bcm63xx_udc: create debugfs directory under usb root Chunfeng Yun
2019-11-06  3:15 ` [PATCH 24/28] usb: gadget: atmel: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 25/28] usb: gadget: udc: renesas_usb3: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 26/28] usb: gadget: pxa27x: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 27/28] usb: gadget: udc: gr_udc: " Chunfeng Yun
2019-11-06  3:15 ` [PATCH 28/28] usb: gadget: udc: s3c2410_udc: " Chunfeng Yun
2019-11-06  4:03 ` [PATCH 01/28] usb: common: change usb_debug_root as static variable Guenter Roeck
2019-11-06  7:33   ` Wolfram Sang
2019-11-06  8:51     ` Greg Kroah-Hartman
2019-11-06  9:25       ` Chunfeng Yun
2019-11-06  9:11   ` Chunfeng Yun
2019-11-06 14:00     ` Guenter Roeck
2019-11-07  9:06       ` Chunfeng Yun
2019-11-07  9:16         ` Greg Kroah-Hartman
2019-11-06  8:51 ` Greg Kroah-Hartman
2019-11-06  9:15   ` Chunfeng Yun

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.