Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+7 -18
-2
drivers/usb/core/Makefile
··· 2 2 # Makefile for USB Core files and filesystem 3 3 # 4 4 5 - ccflags-$(CONFIG_USB_DEBUG) := -DDEBUG 6 - 7 5 usbcore-y := usb.o hub.o hcd.o urb.o message.o driver.o 8 6 usbcore-y += config.o file.o buffer.o sysfs.o endpoint.o 9 7 usbcore-y += devio.o notify.o generic.o quirks.o devices.o
-7
drivers/usb/core/hub.c
··· 33 33 34 34 #include "hub.h" 35 35 36 - /* if we are in debug mode, always announce new devices */ 37 - #ifdef DEBUG 38 - #ifndef CONFIG_USB_ANNOUNCE_NEW_DEVICES 39 - #define CONFIG_USB_ANNOUNCE_NEW_DEVICES 40 - #endif 41 - #endif 42 - 43 36 #define USB_VENDOR_GENESYS_LOGIC 0x05e3 44 37 #define HUB_QUIRK_CHECK_PORT_AUTOSUSPEND 0x01 45 38
+7 -9
drivers/usb/core/urb.c
··· 325 325 */ 326 326 int usb_submit_urb(struct urb *urb, gfp_t mem_flags) 327 327 { 328 + static int pipetypes[4] = { 329 + PIPE_CONTROL, PIPE_ISOCHRONOUS, PIPE_BULK, PIPE_INTERRUPT 330 + }; 328 331 int xfertype, max; 329 332 struct usb_device *dev; 330 333 struct usb_host_endpoint *ep; 331 334 int is_out; 335 + unsigned int allowed; 332 336 333 337 if (!urb || !urb->complete) 334 338 return -EINVAL; ··· 440 436 if (urb->transfer_buffer_length > INT_MAX) 441 437 return -EMSGSIZE; 442 438 443 - #ifdef DEBUG 444 - /* stuff that drivers shouldn't do, but which shouldn't 439 + /* 440 + * stuff that drivers shouldn't do, but which shouldn't 445 441 * cause problems in HCDs if they get it wrong. 446 442 */ 447 - { 448 - unsigned int allowed; 449 - static int pipetypes[4] = { 450 - PIPE_CONTROL, PIPE_ISOCHRONOUS, PIPE_BULK, PIPE_INTERRUPT 451 - }; 452 443 453 444 /* Check that the pipe's type matches the endpoint's type */ 454 445 if (usb_pipetype(urb->pipe) != pipetypes[xfertype]) ··· 475 476 if (allowed != urb->transfer_flags) 476 477 dev_WARN(&dev->dev, "BOGUS urb flags, %x --> %x\n", 477 478 urb->transfer_flags, allowed); 478 - } 479 - #endif 479 + 480 480 /* 481 481 * Force periodic transfer intervals to be legal values that are 482 482 * a power of two (so HCDs don't need to).