ChangeSet 1.1939.1.49, 2004/09/29 11:25:54-07:00, [EMAIL PROTECTED]
[PATCH] USB Gadget: debug files now Kconfigured
This adds a new Kconfig option, so now all the usb peripheral
controllers have the same way to enable debug files (or more
typically, disable them).
Several of the USB peripheral controller drivers have a /proc/driver/udc
file that's handy when debugging, but probably not wanted otherwise.
This patch adds CONFIG_USB_GADGET_DEBUG_FILES, and uses it to replace
some driver-internal defines.
Signed-off-by: David Brownell <[EMAIL PROTECTED]>
Signed-off-by: Greg Kroah-Hartman <[EMAIL PROTECTED]>
drivers/usb/gadget/Kconfig | 15 +++++++++++----
drivers/usb/gadget/goku_udc.c | 14 ++++----------
drivers/usb/gadget/lh7a40x_udc.c | 7 +++----
drivers/usb/gadget/net2280.c | 10 +++++++---
drivers/usb/gadget/omap_udc.c | 2 +-
drivers/usb/gadget/pxa2xx_udc.c | 17 ++++-------------
6 files changed, 30 insertions(+), 35 deletions(-)
diff -Nru a/drivers/usb/gadget/Kconfig b/drivers/usb/gadget/Kconfig
--- a/drivers/usb/gadget/Kconfig 2004-10-19 08:09:16 -07:00
+++ b/drivers/usb/gadget/Kconfig 2004-10-19 08:09:16 -07:00
@@ -39,6 +39,17 @@
If in doubt, say "N" and don't enable these drivers; most people
don't have this kind of hardware (except maybe inside Linux PDAs).
+config USB_GADGET_DEBUG_FILES
+ boolean "Debugging information files"
+ depends on USB_GADGET && PROC_FS
+ help
+ Some of the drivers in the "gadget" framework can expose
+ debugging information in files such as /proc/driver/udc
+ (for a peripheral controller). The information in these
+ files may help when you're troubleshooting or bringing up a
+ driver on a new board. Enable these files by choosing "Y"
+ here. If in doubt, or to conserve kernel memory, say "N".
+
#
# USB Peripheral Controller Support
#
@@ -205,10 +216,6 @@
later, when two dual-role devices talk to each other.
Select this only if your OMAP board has a Mini-AB connector.
-
-config USB_OMAP_PROC
- boolean "/proc/driver/udc file"
- depends on USB_GADGET_OMAP
endchoice
diff -Nru a/drivers/usb/gadget/goku_udc.c b/drivers/usb/gadget/goku_udc.c
--- a/drivers/usb/gadget/goku_udc.c 2004-10-19 08:09:16 -07:00
+++ b/drivers/usb/gadget/goku_udc.c 2004-10-19 08:09:16 -07:00
@@ -1092,13 +1092,7 @@
return "(dma IN)";
}
-/* if we're trying to save space, don't bother with this proc file */
-
-#if defined(CONFIG_PROC_FS) && !defined(CONFIG_EMBEDDED)
-# define UDC_PROC_FILE
-#endif
-
-#ifdef UDC_PROC_FILE
+#ifdef CONFIG_USB_GADGET_DEBUG_FILES
static const char proc_node_name [] = "driver/udc";
@@ -1312,7 +1306,7 @@
return count - size;
}
-#endif /* UDC_PROC_FILE */
+#endif /* CONFIG_USB_GADGET_DEBUG_FILES */
/*-------------------------------------------------------------------------*/
@@ -1815,7 +1809,7 @@
usb_gadget_unregister_driver(dev->driver);
}
-#ifdef UDC_PROC_FILE
+#ifdef CONFIG_USB_GADGET_DEBUG_FILES
remove_proc_entry(proc_node_name, NULL);
#endif
if (dev->regs)
@@ -1933,7 +1927,7 @@
pci_set_master(pdev);
-#ifdef UDC_PROC_FILE
+#ifdef CONFIG_USB_GADGET_DEBUG_FILES
create_proc_read_entry(proc_node_name, 0, NULL, udc_proc_read, dev);
#endif
diff -Nru a/drivers/usb/gadget/lh7a40x_udc.c b/drivers/usb/gadget/lh7a40x_udc.c
--- a/drivers/usb/gadget/lh7a40x_udc.c 2004-10-19 08:09:16 -07:00
+++ b/drivers/usb/gadget/lh7a40x_udc.c 2004-10-19 08:09:16 -07:00
@@ -54,7 +54,6 @@
/*
Local definintions.
*/
-#define UDC_PROC_FILE
#ifndef NO_STATES
static char *state_names[] = {
@@ -192,7 +191,7 @@
*/
#define is_usb_connected() get_portc_pdr(2)
-#ifdef UDC_PROC_FILE
+#ifdef CONFIG_USB_GADGET_DEBUG_FILES
static const char proc_node_name[] = "driver/udc";
@@ -248,12 +247,12 @@
#define create_proc_files() create_proc_read_entry(proc_node_name, 0, NULL,
udc_proc_read, dev)
#define remove_proc_files() remove_proc_entry(proc_node_name, NULL)
-#else /* !UDC_PROC_FILE */
+#else /* !CONFIG_USB_GADGET_DEBUG_FILES */
#define create_proc_files() do {} while (0)
#define remove_proc_files() do {} while (0)
-#endif /* UDC_PROC_FILE */
+#endif /* CONFIG_USB_GADGET_DEBUG_FILES */
/*
* udc_disable - disable USB device controller
diff -Nru a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
--- a/drivers/usb/gadget/net2280.c 2004-10-19 08:09:16 -07:00
+++ b/drivers/usb/gadget/net2280.c 2004-10-19 08:09:16 -07:00
@@ -76,7 +76,6 @@
#define EP_DONTUSE 13 /* nonzero */
#define USE_RDK_LEDS /* GPIO pins control three LEDs */
-#define USE_SYSFS_DEBUG_FILES
static const char driver_name [] = "net2280";
@@ -117,7 +116,7 @@
#define DIR_STRING(bAddress) (((bAddress) & USB_DIR_IN) ? "in" : "out")
-#if defined(USE_SYSFS_DEBUG_FILES) || defined (DEBUG)
+#if defined(CONFIG_USB_GADGET_DEBUG_FILES) || defined (DEBUG)
static char *type_string (u8 bmAttributes)
{
switch ((bmAttributes) & USB_ENDPOINT_XFERTYPE_MASK) {
@@ -1449,7 +1448,12 @@
/*-------------------------------------------------------------------------*/
-#ifdef USE_SYSFS_DEBUG_FILES
+#ifdef CONFIG_USB_GADGET_DEBUG_FILES
+
+/* FIXME move these into procfs, and use seq_file.
+ * Sysfs _still_ doesn't behave for arbitrarily sized files,
+ * and also doesn't help products using this with 2.4 kernels.
+ */
/* "function" sysfs attribute */
static ssize_t
diff -Nru a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c
--- a/drivers/usb/gadget/omap_udc.c 2004-10-19 08:09:16 -07:00
+++ b/drivers/usb/gadget/omap_udc.c 2004-10-19 08:09:16 -07:00
@@ -1976,7 +1976,7 @@
/*-------------------------------------------------------------------------*/
-#ifdef CONFIG_USB_OMAP_PROC
+#ifdef CONFIG_USB_GADGET_DEBUG_FILES
#include <linux/seq_file.h>
diff -Nru a/drivers/usb/gadget/pxa2xx_udc.c b/drivers/usb/gadget/pxa2xx_udc.c
--- a/drivers/usb/gadget/pxa2xx_udc.c 2004-10-19 08:09:16 -07:00
+++ b/drivers/usb/gadget/pxa2xx_udc.c 2004-10-19 08:09:16 -07:00
@@ -91,10 +91,6 @@
// #define USE_OUT_DMA
// #define DISABLE_TEST_MODE
-#ifdef CONFIG_PROC_FS
-#define UDC_PROC_FILE
-#endif
-
#ifdef CONFIG_ARCH_IXP4XX
#undef USE_DMA
@@ -108,12 +104,6 @@
#include "pxa2xx_udc.h"
-#ifdef CONFIG_EMBEDDED
-/* few strings, and little code to use them */
-#undef DEBUG
-#undef UDC_PROC_FILE
-#endif
-
#ifdef USE_DMA
static int use_dma = 1;
module_param(use_dma, bool, 0);
@@ -1211,7 +1201,7 @@
/*-------------------------------------------------------------------------*/
-#ifdef UDC_PROC_FILE
+#ifdef CONFIG_USB_GADGET_DEBUG_FILES
static const char proc_node_name [] = "driver/udc";
@@ -1367,11 +1357,12 @@
#define remove_proc_files() \
remove_proc_entry(proc_node_name, NULL)
-#else /* !UDC_PROC_FILE */
+#else /* !CONFIG_USB_GADGET_DEBUG_FILES */
+
#define create_proc_files() do {} while (0)
#define remove_proc_files() do {} while (0)
-#endif /* UDC_PROC_FILE */
+#endif /* CONFIG_USB_GADGET_DEBUG_FILES */
/* "function" sysfs attribute */
static ssize_t
-------------------------------------------------------
This SF.net email is sponsored by: IT Product Guide on ITManagersJournal
Use IT products in your business? Tell us what you think of them. Give us
Your Opinions, Get Free ThinkGeek Gift Certificates! Click to find out more
http://productguide.itmanagersjournal.com/guidepromo.tmpl
_______________________________________________
[EMAIL PROTECTED]
To unsubscribe, use the last form field at:
https://lists.sourceforge.net/lists/listinfo/linux-usb-devel