diff options
author | Julia Lawall <julia@diku.dk> | 2008-12-29 05:22:14 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-03-24 19:20:28 -0400 |
commit | 2e0fe709687470637a0709b930ccc9e993d2dad5 (patch) | |
tree | 97bd47eee757905185ac8341fe350e046d027aa3 /drivers/usb/storage/usb.c | |
parent | 00185a60c37549531b9eee562d3eba19020875d5 (diff) |
USB: drivers: 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
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: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/storage/usb.c')
-rw-r--r-- | drivers/usb/storage/usb.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/drivers/usb/storage/usb.c b/drivers/usb/storage/usb.c index 4becf495ca2d..b01dade63cb3 100644 --- a/drivers/usb/storage/usb.c +++ b/drivers/usb/storage/usb.c | |||
@@ -846,12 +846,12 @@ static int get_pipes(struct us_data *us) | |||
846 | us->send_ctrl_pipe = usb_sndctrlpipe(us->pusb_dev, 0); | 846 | us->send_ctrl_pipe = usb_sndctrlpipe(us->pusb_dev, 0); |
847 | us->recv_ctrl_pipe = usb_rcvctrlpipe(us->pusb_dev, 0); | 847 | us->recv_ctrl_pipe = usb_rcvctrlpipe(us->pusb_dev, 0); |
848 | us->send_bulk_pipe = usb_sndbulkpipe(us->pusb_dev, | 848 | us->send_bulk_pipe = usb_sndbulkpipe(us->pusb_dev, |
849 | ep_out->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); | 849 | usb_endpoint_num(ep_out)); |
850 | us->recv_bulk_pipe = usb_rcvbulkpipe(us->pusb_dev, | 850 | us->recv_bulk_pipe = usb_rcvbulkpipe(us->pusb_dev, |
851 | ep_in->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); | 851 | usb_endpoint_num(ep_in)); |
852 | if (ep_int) { | 852 | if (ep_int) { |
853 | us->recv_intr_pipe = usb_rcvintpipe(us->pusb_dev, | 853 | us->recv_intr_pipe = usb_rcvintpipe(us->pusb_dev, |
854 | ep_int->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); | 854 | usb_endpoint_num(ep_int)); |
855 | us->ep_bInterval = ep_int->bInterval; | 855 | us->ep_bInterval = ep_int->bInterval; |
856 | } | 856 | } |
857 | return 0; | 857 | return 0; |