diff options
author | Julia Lawall <julia@diku.dk> | 2008-12-29 19:49:22 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2008-12-30 06:40:40 -0500 |
commit | 134179823b3ca9c8b98e0631906459dbb022ff9b (patch) | |
tree | 9dd65815e669074a080d0abe4033dbebe832e699 /drivers/media/video/em28xx/em28xx-cards.c | |
parent | cec73844a91017f9b84ca1d665feb8fc714c8410 (diff) |
V4L/DVB (10130): 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_is_isoc_in(epd)
usb_endpoint_is_isoc_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)
// </smpl>
Signed-off-by: Julia Lawall <julia@diku.dk>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/em28xx/em28xx-cards.c')
-rw-r--r-- | drivers/media/video/em28xx/em28xx-cards.c | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/media/video/em28xx/em28xx-cards.c b/drivers/media/video/em28xx/em28xx-cards.c index 84191c9dc54d..e776699b62f9 100644 --- a/drivers/media/video/em28xx/em28xx-cards.c +++ b/drivers/media/video/em28xx/em28xx-cards.c | |||
@@ -1981,8 +1981,8 @@ static int em28xx_usb_probe(struct usb_interface *interface, | |||
1981 | endpoint = &interface->cur_altsetting->endpoint[0].desc; | 1981 | endpoint = &interface->cur_altsetting->endpoint[0].desc; |
1982 | 1982 | ||
1983 | /* check if the device has the iso in endpoint at the correct place */ | 1983 | /* check if the device has the iso in endpoint at the correct place */ |
1984 | if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == | 1984 | if (usb_endpoint_xfer_isoc(endpoint) |
1985 | USB_ENDPOINT_XFER_ISOC && | 1985 | && |
1986 | (interface->altsetting[1].endpoint[0].desc.wMaxPacketSize == 940)) { | 1986 | (interface->altsetting[1].endpoint[0].desc.wMaxPacketSize == 940)) { |
1987 | /* It's a newer em2874/em2875 device */ | 1987 | /* It's a newer em2874/em2875 device */ |
1988 | isoc_pipe = 0; | 1988 | isoc_pipe = 0; |
@@ -1990,11 +1990,11 @@ static int em28xx_usb_probe(struct usb_interface *interface, | |||
1990 | int check_interface = 1; | 1990 | int check_interface = 1; |
1991 | isoc_pipe = 1; | 1991 | isoc_pipe = 1; |
1992 | endpoint = &interface->cur_altsetting->endpoint[1].desc; | 1992 | endpoint = &interface->cur_altsetting->endpoint[1].desc; |
1993 | if ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) != | 1993 | if (usb_endpoint_type(endpoint) != |
1994 | USB_ENDPOINT_XFER_ISOC) | 1994 | USB_ENDPOINT_XFER_ISOC) |
1995 | check_interface = 0; | 1995 | check_interface = 0; |
1996 | 1996 | ||
1997 | if ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT) | 1997 | if (usb_endpoint_dir_out(endpoint)) |
1998 | check_interface = 0; | 1998 | check_interface = 0; |
1999 | 1999 | ||
2000 | if (!check_interface) { | 2000 | if (!check_interface) { |