소스 검색

USB: core: remove CONFIG_USB_DEBUG usage

CONFIG_USB_DEBUG is going away, so remove the few places in the USB core
that relied on them.

This means that we always now do the "debug" checks for every urb
submitted, which is a good idea, as who knows how many driver bugs we
have been ignoring when people forget to enable this option.  Also, with
the overall speed of USB, doing these extra checks should not cause any
additional overhead.

Also, no longer announce all devices being added to the system if
CONFIG_USB_DEBUG is enabled, as it's not going to be around much longer.

Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Greg Kroah-Hartman 11 년 전
부모
커밋
3482528e9a
3개의 변경된 파일7개의 추가작업 그리고 18개의 파일을 삭제
  1. 0 2
      drivers/usb/core/Makefile
  2. 0 7
      drivers/usb/core/hub.c
  3. 7 9
      drivers/usb/core/urb.c

+ 0 - 2
drivers/usb/core/Makefile

@@ -2,8 +2,6 @@
 # Makefile for USB Core files and filesystem
 # Makefile for USB Core files and filesystem
 #
 #
 
 
-ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG
-
 usbcore-y := usb.o hub.o hcd.o urb.o message.o driver.o
 usbcore-y := usb.o hub.o hcd.o urb.o message.o driver.o
 usbcore-y += config.o file.o buffer.o sysfs.o endpoint.o
 usbcore-y += config.o file.o buffer.o sysfs.o endpoint.o
 usbcore-y += devio.o notify.o generic.o quirks.o devices.o
 usbcore-y += devio.o notify.o generic.o quirks.o devices.o

+ 0 - 7
drivers/usb/core/hub.c

@@ -33,13 +33,6 @@
 
 
 #include "hub.h"
 #include "hub.h"
 
 
-/* if we are in debug mode, always announce new devices */
-#ifdef DEBUG
-#ifndef CONFIG_USB_ANNOUNCE_NEW_DEVICES
-#define CONFIG_USB_ANNOUNCE_NEW_DEVICES
-#endif
-#endif
-
 #define USB_VENDOR_GENESYS_LOGIC		0x05e3
 #define USB_VENDOR_GENESYS_LOGIC		0x05e3
 #define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND	0x01
 #define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND	0x01
 
 

+ 7 - 9
drivers/usb/core/urb.c

@@ -325,10 +325,14 @@ EXPORT_SYMBOL_GPL(usb_unanchor_urb);
  */
  */
 int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
 int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
 {
 {
+	static int			pipetypes[4] = {
+		PIPE_CONTROL, PIPE_ISOCHRONOUS, PIPE_BULK, PIPE_INTERRUPT
+	};
 	int				xfertype, max;
 	int				xfertype, max;
 	struct usb_device		*dev;
 	struct usb_device		*dev;
 	struct usb_host_endpoint	*ep;
 	struct usb_host_endpoint	*ep;
 	int				is_out;
 	int				is_out;
+	unsigned int			allowed;
 
 
 	if (!urb || !urb->complete)
 	if (!urb || !urb->complete)
 		return -EINVAL;
 		return -EINVAL;
@@ -436,15 +440,10 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
 	if (urb->transfer_buffer_length > INT_MAX)
 	if (urb->transfer_buffer_length > INT_MAX)
 		return -EMSGSIZE;
 		return -EMSGSIZE;
 
 
-#ifdef DEBUG
-	/* stuff that drivers shouldn't do, but which shouldn't
+	/*
+	 * stuff that drivers shouldn't do, but which shouldn't
 	 * cause problems in HCDs if they get it wrong.
 	 * cause problems in HCDs if they get it wrong.
 	 */
 	 */
-	{
-	unsigned int	allowed;
-	static int pipetypes[4] = {
-		PIPE_CONTROL, PIPE_ISOCHRONOUS, PIPE_BULK, PIPE_INTERRUPT
-	};
 
 
 	/* Check that the pipe's type matches the endpoint's type */
 	/* Check that the pipe's type matches the endpoint's type */
 	if (usb_pipetype(urb->pipe) != pipetypes[xfertype])
 	if (usb_pipetype(urb->pipe) != pipetypes[xfertype])
@@ -476,8 +475,7 @@ int usb_submit_urb(struct urb *urb, gfp_t mem_flags)
 	if (allowed != urb->transfer_flags)
 	if (allowed != urb->transfer_flags)
 		dev_WARN(&dev->dev, "BOGUS urb flags, %x --> %x\n",
 		dev_WARN(&dev->dev, "BOGUS urb flags, %x --> %x\n",
 			urb->transfer_flags, allowed);
 			urb->transfer_flags, allowed);
-	}
-#endif
+
 	/*
 	/*
 	 * Force periodic transfer intervals to be legal values that are
 	 * Force periodic transfer intervals to be legal values that are
 	 * a power of two (so HCDs don't need to).
 	 * a power of two (so HCDs don't need to).