aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/block/ub.c
diff options
context:
space:
mode:
authorJulia Lawall <julia@diku.dk>2008-12-29 05:19:10 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-03-24 19:20:27 -0400
commitdb5e6df172309c382982790aafa8cd87dc0b6292 (patch)
tree9f182622af951d2eee77ecc04c992f1c1c71c810 /drivers/block/ub.c
parent4d6914b72966862f37de634299a80ca2a4b1829f (diff)
USB: ub: 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/block/ub.c')
-rw-r--r--drivers/block/ub.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/block/ub.c b/drivers/block/ub.c
index 12fb816db7b0..b36b84fbe390 100644
--- a/drivers/block/ub.c
+++ b/drivers/block/ub.c
@@ -2146,10 +2146,9 @@ static int ub_get_pipes(struct ub_dev *sc, struct usb_device *dev,
2146 ep = &altsetting->endpoint[i].desc; 2146 ep = &altsetting->endpoint[i].desc;
2147 2147
2148 /* Is it a BULK endpoint? */ 2148 /* Is it a BULK endpoint? */
2149 if ((ep->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) 2149 if (usb_endpoint_xfer_bulk(ep)) {
2150 == USB_ENDPOINT_XFER_BULK) {
2151 /* BULK in or out? */ 2150 /* BULK in or out? */
2152 if (ep->bEndpointAddress & USB_DIR_IN) { 2151 if (usb_endpoint_dir_in(ep)) {
2153 if (ep_in == NULL) 2152 if (ep_in == NULL)
2154 ep_in = ep; 2153 ep_in = ep;
2155 } else { 2154 } else {
@@ -2168,9 +2167,9 @@ static int ub_get_pipes(struct ub_dev *sc, struct usb_device *dev,
2168 sc->send_ctrl_pipe = usb_sndctrlpipe(dev, 0); 2167 sc->send_ctrl_pipe = usb_sndctrlpipe(dev, 0);
2169 sc->recv_ctrl_pipe = usb_rcvctrlpipe(dev, 0); 2168 sc->recv_ctrl_pipe = usb_rcvctrlpipe(dev, 0);
2170 sc->send_bulk_pipe = usb_sndbulkpipe(dev, 2169 sc->send_bulk_pipe = usb_sndbulkpipe(dev,
2171 ep_out->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); 2170 usb_endpoint_num(ep_out));
2172 sc->recv_bulk_pipe = usb_rcvbulkpipe(dev, 2171 sc->recv_bulk_pipe = usb_rcvbulkpipe(dev,
2173 ep_in->bEndpointAddress & USB_ENDPOINT_NUMBER_MASK); 2172 usb_endpoint_num(ep_in));
2174 2173
2175 return 0; 2174 return 0;
2176} 2175}