alistair23-linux/drivers
Julia Lawall f201a8a451 drivers/net/usb: use USB API functions rather than constants
This set of patches introduces calls to the following set of functions:

usb_endpoint_dir_in(epd)
usb_endpoint_dir_out(epd)
usb_endpoint_is_bulk_in(epd)
usb_endpoint_is_bulk_out(epd)
usb_endpoint_is_int_in(epd)
usb_endpoint_is_int_out(epd)
usb_endpoint_num(epd)
usb_endpoint_type(epd)
usb_endpoint_xfer_bulk(epd)
usb_endpoint_xfer_control(epd)
usb_endpoint_xfer_int(epd)
usb_endpoint_xfer_isoc(epd)

In some cases, introducing one of these functions is not possible, and it
just replaces an explicit integer value by one of the following constants:

USB_ENDPOINT_XFER_BULK
USB_ENDPOINT_XFER_CONTROL
USB_ENDPOINT_XFER_INT
USB_ENDPOINT_XFER_ISOC

In drivers/net/wireless/zd1211rw/zd_usb.c the code:

(endpoint->bEndpointAddress & USB_TYPE_MASK) == USB_DIR_OUT

is suspicious.  If it is intended to use USB_ENDPOINT_DIR_MASK rather than
USB_TYPE_MASK, then the whole conditional test could be converted to a call
to usb_endpoint_is_bulk_in.

An extract of the semantic patch that makes these changes is as follows:
(http://www.emn.fr/x-info/coccinelle/)

// <smpl>
@r1@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bmAttributes & \(USB_ENDPOINT_XFERTYPE_MASK\|3\)) ==
- \(USB_ENDPOINT_XFER_CONTROL\|0\))
+ usb_endpoint_xfer_control(epd)

@r5@ struct usb_endpoint_descriptor *epd; @@

- ((epd->bEndpointAddress & \(USB_ENDPOINT_DIR_MASK\|0x80\)) ==
-  \(USB_DIR_IN\|0x80\))
+ usb_endpoint_dir_in(epd)

@inc@
@@

#include <linux/usb.h>

@depends on !inc && (r1||r5)@
@@

+ #include <linux/usb.h>
  #include <linux/usb/...>
// </smpl>

Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: David S. Miller <davem@davemloft.net>
2008-12-29 19:40:47 -08:00
..
accessibility
acpi Merge branches 'tracing/ftrace', 'tracing/hw-branch-tracing' and 'tracing/ring-buffer'; commit 'v2.6.28' into tracing/core 2008-12-25 13:11:00 +01:00
amba
ata powerpc/mpc5200: Add MDMA/UDMA support to MPC5200 ATA driver 2008-12-21 02:54:29 -07:00
atm atm: Driver for Solos PCI ADSL2+ card. 2008-12-26 01:26:11 -08:00
auxdisplay
base
block Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2008-12-28 12:49:40 -08:00
bluetooth Bluetooth: Enable per-module dynamic debug messages 2008-11-30 12:17:28 +01:00
cdrom Commands needing to be retried require a complete re-initialization. 2008-12-12 16:04:26 +01:00
char Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-12-28 16:54:33 -08:00
clocksource
connector
cpufreq
cpuidle
crypto crypto: talitos - Ack done interrupt in isr instead of tasklet 2008-12-25 11:02:33 +11:00
dca
dio
dma async_xor: dma_map destination DMA_BIDIRECTIONAL 2008-12-08 13:46:00 -07:00
edac Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-12-28 16:54:33 -08:00
eisa
firewire firewire: fw-ohci: fix IOMMU resource exhaustion 2008-12-10 12:45:34 +01:00
firmware Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2008-12-28 12:49:40 -08:00
gpio gpiolib: extend gpio label column width in debugfs file 2008-11-19 18:49:57 -08:00
gpu drm/radeon: fix correctness of irq_enabled check for radeon. 2008-12-23 10:50:12 +10:00
hid HID: Apple ALU wireless keyboards are bluetooth devices 2008-11-28 15:09:26 +01:00
hwmon hwmon: applesmc: make applesmc load automatically on startup 2008-12-01 19:55:24 -08:00
i2c sh: sh_mobile i2c clock framework support 2008-12-22 18:42:51 +09:00
ide m68k: machw.h cleanup 2008-12-28 20:00:03 +01:00
idle
ieee1394 ieee1394: add quirk fix for Freecom HDD 2008-12-14 01:13:13 +01:00
infiniband Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2008-12-28 12:49:40 -08:00
input sh: sh_mobile keysc clock framework support 2008-12-22 18:42:51 +09:00
isdn Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2008-12-28 12:49:40 -08:00
leds
lguest
macintosh Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-12-28 16:54:33 -08:00
mca
md Merge branch 'linus' into tracing/hw-branch-tracing 2008-12-24 21:08:26 +01:00
media Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2008-12-28 12:49:40 -08:00
memstick
message Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2008-12-28 12:49:40 -08:00
mfd mfd: Correct WM8350 I2C return code usage 2008-11-16 19:58:47 +01:00
misc Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2008-12-28 12:49:40 -08:00
mmc
mtd Merge git://git.infradead.org/mtd-2.6 2008-12-09 08:28:36 -08:00
net drivers/net/usb: use USB API functions rather than constants 2008-12-29 19:40:47 -08:00
nubus
of of/gpio: Implement of_gpio_count() 2008-12-21 14:21:14 +11:00
oprofile
parisc netdev: introduce dev_get_stats() 2008-11-19 21:40:23 -08:00
parport parport_serial: fix array overflow 2008-12-01 19:55:24 -08:00
pci Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-12-28 16:54:33 -08:00
pcmcia pcmcia: blackfin: fix bug - add missing ; to MODULE macro 2008-12-15 16:27:06 -08:00
pnp
power
ps3 powerpc/ps3: Replace the flip_ctl logic in ps3av and ps3fb by a mutex 2008-11-19 16:03:54 +11:00
rapidio rapidio: struct device - replace bus_id with dev_name(), dev_set_name() 2008-12-16 15:53:41 +11:00
regulator
rtc rtc: rtc-isl1208: reject invalid dates 2008-12-23 15:58:21 -08:00
s390 Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2008-12-28 12:49:40 -08:00
sbus Revert "of_platform_driver noise on sparce" 2008-12-01 07:55:14 -08:00
scsi Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/geert/linux-m68k 2008-12-28 12:54:07 -08:00
serial Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-12-28 16:54:33 -08:00
sh sh: maple: Do not pass SLAB_POISON to kmem_cache_create() 2008-12-16 16:40:32 +09:00
sn
spi spi: fix spi_s3c24xx_gpio num_chipselect 2008-12-01 19:55:24 -08:00
ssb ssb: struct device - replace bus_id with dev_name(), dev_set_name() 2008-11-21 11:06:03 -05:00
staging Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2008-12-28 12:49:40 -08:00
tc
telephony
thermal
uio
usb Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next-2.6 2008-12-28 12:49:40 -08:00
uwb
video Merge branch 'next' of git://git.kernel.org/pub/scm/linux/kernel/git/paulus/powerpc 2008-12-28 16:54:33 -08:00
virtio
w1 w1: fix slave selection on big-endian systems 2008-12-23 15:58:21 -08:00
watchdog iTCO_wdt: fix typo when setting TCO_EN bit 2008-12-03 16:20:19 -08:00
xen xen: clean up asm/xen/hypervisor.h 2008-12-16 21:50:31 +01:00
zorro
Kconfig
Makefile