Commit 6584ec1a authored by David Brownell's avatar David Brownell Committed by Greg Kroah-Hartman

[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: default avatarDavid Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent e1bf2cc8
......@@ -39,6 +39,17 @@ config USB_GADGET
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
#
......@@ -206,10 +217,6 @@ config USB_OTG
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
config USB_GADGET_DUALSPEED
......
......@@ -1092,13 +1092,7 @@ static inline char *dmastr(void)
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 @@ udc_proc_read(char *buffer, char **start, off_t off, int count,
return count - size;
}
#endif /* UDC_PROC_FILE */
#endif /* CONFIG_USB_GADGET_DEBUG_FILES */
/*-------------------------------------------------------------------------*/
......@@ -1815,7 +1809,7 @@ static void goku_remove(struct pci_dev *pdev)
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 @@ static int goku_probe(struct pci_dev *pdev, const struct pci_device_id *id)
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
......
......@@ -54,7 +54,6 @@ static const char ep0name[] = "ep0-control";
/*
Local definintions.
*/
#define UDC_PROC_FILE
#ifndef NO_STATES
static char *state_names[] = {
......@@ -192,7 +191,7 @@ static __inline__ void usb_clear(u32 val, u32 port)
*/
#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 @@ udc_proc_read(char *page, char **start, off_t off, int count,
#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
......
......@@ -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 @@ module_param (fifo_mode, ushort, 0644);
#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 @@ static const struct usb_gadget_ops net2280_ops = {
/*-------------------------------------------------------------------------*/
#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
......
......@@ -1976,7 +1976,7 @@ EXPORT_SYMBOL(usb_gadget_unregister_driver);
/*-------------------------------------------------------------------------*/
#ifdef CONFIG_USB_OMAP_PROC
#ifdef CONFIG_USB_GADGET_DEBUG_FILES
#include <linux/seq_file.h>
......
......@@ -91,10 +91,6 @@ static const char ep0name [] = "ep0";
// #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 @@ static const char ep0name [] = "ep0";
#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 @@ static const struct usb_gadget_ops pxa2xx_udc_ops = {
/*-------------------------------------------------------------------------*/
#ifdef UDC_PROC_FILE
#ifdef CONFIG_USB_GADGET_DEBUG_FILES
static const char proc_node_name [] = "driver/udc";
......@@ -1367,11 +1357,12 @@ udc_proc_read(char *page, char **start, off_t off, int count,
#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
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment