Commit 969ab2ee authored by Greg Kroah-Hartman's avatar Greg Kroah-Hartman

USB: fix codingstyle issues in include/linux/usb.h

No logical code changes were made, but checkpatch.pl is much happier now.
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@suse.de>
parent 782e70c6
...@@ -162,19 +162,19 @@ struct usb_interface { ...@@ -162,19 +162,19 @@ struct usb_interface {
unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */ unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */
struct device dev; /* interface specific device info */ struct device dev; /* interface specific device info */
struct device *usb_dev; /* pointer to the usb class's device, if any */ struct device *usb_dev;
int pm_usage_cnt; /* usage counter for autosuspend */ int pm_usage_cnt; /* usage counter for autosuspend */
}; };
#define to_usb_interface(d) container_of(d, struct usb_interface, dev) #define to_usb_interface(d) container_of(d, struct usb_interface, dev)
#define interface_to_usbdev(intf) \ #define interface_to_usbdev(intf) \
container_of(intf->dev.parent, struct usb_device, dev) container_of(intf->dev.parent, struct usb_device, dev)
static inline void *usb_get_intfdata (struct usb_interface *intf) static inline void *usb_get_intfdata(struct usb_interface *intf)
{ {
return dev_get_drvdata (&intf->dev); return dev_get_drvdata(&intf->dev);
} }
static inline void usb_set_intfdata (struct usb_interface *intf, void *data) static inline void usb_set_intfdata(struct usb_interface *intf, void *data)
{ {
dev_set_drvdata(&intf->dev, data); dev_set_drvdata(&intf->dev, data);
} }
...@@ -275,9 +275,10 @@ struct usb_host_config { ...@@ -275,9 +275,10 @@ struct usb_host_config {
int __usb_get_extra_descriptor(char *buffer, unsigned size, int __usb_get_extra_descriptor(char *buffer, unsigned size,
unsigned char type, void **ptr); unsigned char type, void **ptr);
#define usb_get_extra_descriptor(ifpoint,type,ptr)\ #define usb_get_extra_descriptor(ifpoint, type, ptr) \
__usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\ __usb_get_extra_descriptor((ifpoint)->extra, \
type,(void**)ptr) (ifpoint)->extralen, \
type, (void **)ptr)
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
...@@ -388,7 +389,7 @@ struct usb_device { ...@@ -388,7 +389,7 @@ struct usb_device {
unsigned can_submit:1; /* URBs may be submitted */ unsigned can_submit:1; /* URBs may be submitted */
unsigned discon_suspended:1; /* Disconnected while suspended */ unsigned discon_suspended:1; /* Disconnected while suspended */
unsigned have_langid:1; /* whether string_langid is valid */ unsigned have_langid:1; /* whether string_langid is valid */
unsigned authorized:1; /* Policy has determined we can use it */ unsigned authorized:1; /* Policy has said we can use it */
unsigned wusb:1; /* Device is Wireless USB */ unsigned wusb:1; /* Device is Wireless USB */
int string_langid; /* language ID for strings */ int string_langid; /* language ID for strings */
...@@ -417,7 +418,8 @@ struct usb_device { ...@@ -417,7 +418,8 @@ struct usb_device {
int pm_usage_cnt; /* usage counter for autosuspend */ int pm_usage_cnt; /* usage counter for autosuspend */
u32 quirks; /* quirks of the whole device */ u32 quirks; /* quirks of the whole device */
atomic_t urbnum; /* number of URBs submitted for the whole device */ atomic_t urbnum; /* number of URBs submitted for
the whole device */
unsigned long active_duration; /* total time device is not suspended */ unsigned long active_duration; /* total time device is not suspended */
...@@ -501,11 +503,11 @@ static inline void usb_mark_last_busy(struct usb_device *udev) ...@@ -501,11 +503,11 @@ static inline void usb_mark_last_busy(struct usb_device *udev)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
/* for drivers using iso endpoints */ /* for drivers using iso endpoints */
extern int usb_get_current_frame_number (struct usb_device *usb_dev); extern int usb_get_current_frame_number(struct usb_device *usb_dev);
/* used these for multi-interface device registration */ /* used these for multi-interface device registration */
extern int usb_driver_claim_interface(struct usb_driver *driver, extern int usb_driver_claim_interface(struct usb_driver *driver,
struct usb_interface *iface, void* priv); struct usb_interface *iface, void *priv);
/** /**
* usb_interface_claimed - returns true iff an interface is claimed * usb_interface_claimed - returns true iff an interface is claimed
...@@ -517,7 +519,8 @@ extern int usb_driver_claim_interface(struct usb_driver *driver, ...@@ -517,7 +519,8 @@ extern int usb_driver_claim_interface(struct usb_driver *driver,
* may need to explicitly claim that lock. * may need to explicitly claim that lock.
* *
*/ */
static inline int usb_interface_claimed(struct usb_interface *iface) { static inline int usb_interface_claimed(struct usb_interface *iface)
{
return (iface->dev.driver != NULL); return (iface->dev.driver != NULL);
} }
...@@ -560,12 +563,11 @@ extern struct usb_host_interface *usb_altnum_to_altsetting( ...@@ -560,12 +563,11 @@ extern struct usb_host_interface *usb_altnum_to_altsetting(
* USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are
* high speed, and a different one if they are full or low speed. * high speed, and a different one if they are full or low speed.
*/ */
static inline int usb_make_path (struct usb_device *dev, char *buf, static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)
size_t size)
{ {
int actual; int actual;
actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name, actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name,
dev->devpath); dev->devpath);
return (actual >= (int)size) ? -1 : actual; return (actual >= (int)size) ? -1 : actual;
} }
...@@ -611,7 +613,8 @@ static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd) ...@@ -611,7 +613,8 @@ static inline int usb_endpoint_dir_in(const struct usb_endpoint_descriptor *epd)
* *
* Returns true if the endpoint is of type OUT, otherwise it returns false. * Returns true if the endpoint is of type OUT, otherwise it returns false.
*/ */
static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd) static inline int usb_endpoint_dir_out(
const struct usb_endpoint_descriptor *epd)
{ {
return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
} }
...@@ -622,7 +625,8 @@ static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd ...@@ -622,7 +625,8 @@ static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd
* *
* Returns true if the endpoint is of type bulk, otherwise it returns false. * Returns true if the endpoint is of type bulk, otherwise it returns false.
*/ */
static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd) static inline int usb_endpoint_xfer_bulk(
const struct usb_endpoint_descriptor *epd)
{ {
return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_BULK); USB_ENDPOINT_XFER_BULK);
...@@ -634,7 +638,8 @@ static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *e ...@@ -634,7 +638,8 @@ static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *e
* *
* Returns true if the endpoint is of type control, otherwise it returns false. * Returns true if the endpoint is of type control, otherwise it returns false.
*/ */
static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor *epd) static inline int usb_endpoint_xfer_control(
const struct usb_endpoint_descriptor *epd)
{ {
return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_CONTROL); USB_ENDPOINT_XFER_CONTROL);
...@@ -647,7 +652,8 @@ static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor ...@@ -647,7 +652,8 @@ static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor
* Returns true if the endpoint is of type interrupt, otherwise it returns * Returns true if the endpoint is of type interrupt, otherwise it returns
* false. * false.
*/ */
static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd) static inline int usb_endpoint_xfer_int(
const struct usb_endpoint_descriptor *epd)
{ {
return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_INT); USB_ENDPOINT_XFER_INT);
...@@ -660,7 +666,8 @@ static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *ep ...@@ -660,7 +666,8 @@ static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *ep
* Returns true if the endpoint is of type isochronous, otherwise it returns * Returns true if the endpoint is of type isochronous, otherwise it returns
* false. * false.
*/ */
static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd) static inline int usb_endpoint_xfer_isoc(
const struct usb_endpoint_descriptor *epd)
{ {
return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==
USB_ENDPOINT_XFER_ISOC); USB_ENDPOINT_XFER_ISOC);
...@@ -673,7 +680,8 @@ static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *e ...@@ -673,7 +680,8 @@ static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *e
* Returns true if the endpoint has bulk transfer type and IN direction, * Returns true if the endpoint has bulk transfer type and IN direction,
* otherwise it returns false. * otherwise it returns false.
*/ */
static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd) static inline int usb_endpoint_is_bulk_in(
const struct usb_endpoint_descriptor *epd)
{ {
return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd)); return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));
} }
...@@ -685,7 +693,8 @@ static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor * ...@@ -685,7 +693,8 @@ static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *
* Returns true if the endpoint has bulk transfer type and OUT direction, * Returns true if the endpoint has bulk transfer type and OUT direction,
* otherwise it returns false. * otherwise it returns false.
*/ */
static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd) static inline int usb_endpoint_is_bulk_out(
const struct usb_endpoint_descriptor *epd)
{ {
return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd)); return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));
} }
...@@ -697,7 +706,8 @@ static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor ...@@ -697,7 +706,8 @@ static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor
* Returns true if the endpoint has interrupt transfer type and IN direction, * Returns true if the endpoint has interrupt transfer type and IN direction,
* otherwise it returns false. * otherwise it returns false.
*/ */
static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd) static inline int usb_endpoint_is_int_in(
const struct usb_endpoint_descriptor *epd)
{ {
return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd)); return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));
} }
...@@ -709,7 +719,8 @@ static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *e ...@@ -709,7 +719,8 @@ static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *e
* Returns true if the endpoint has interrupt transfer type and OUT direction, * Returns true if the endpoint has interrupt transfer type and OUT direction,
* otherwise it returns false. * otherwise it returns false.
*/ */
static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd) static inline int usb_endpoint_is_int_out(
const struct usb_endpoint_descriptor *epd)
{ {
return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd)); return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));
} }
...@@ -721,7 +732,8 @@ static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor * ...@@ -721,7 +732,8 @@ static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *
* Returns true if the endpoint has isochronous transfer type and IN direction, * Returns true if the endpoint has isochronous transfer type and IN direction,
* otherwise it returns false. * otherwise it returns false.
*/ */
static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd) static inline int usb_endpoint_is_isoc_in(
const struct usb_endpoint_descriptor *epd)
{ {
return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd)); return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));
} }
...@@ -733,7 +745,8 @@ static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor * ...@@ -733,7 +745,8 @@ static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *
* Returns true if the endpoint has isochronous transfer type and OUT direction, * Returns true if the endpoint has isochronous transfer type and OUT direction,
* otherwise it returns false. * otherwise it returns false.
*/ */
static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd) static inline int usb_endpoint_is_isoc_out(
const struct usb_endpoint_descriptor *epd)
{ {
return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd)); return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));
} }
...@@ -764,8 +777,9 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor ...@@ -764,8 +777,9 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
* specific device. * specific device.
*/ */
#define USB_DEVICE(vend,prod) \ #define USB_DEVICE(vend,prod) \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), \ .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \
.idProduct = (prod) .idVendor = (vend), \
.idProduct = (prod)
/** /**
* USB_DEVICE_VER - macro used to describe a specific usb device with a * USB_DEVICE_VER - macro used to describe a specific usb device with a
* version range * version range
...@@ -777,10 +791,12 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor ...@@ -777,10 +791,12 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
* This macro is used to create a struct usb_device_id that matches a * This macro is used to create a struct usb_device_id that matches a
* specific device, with a version range. * specific device, with a version range.
*/ */
#define USB_DEVICE_VER(vend,prod,lo,hi) \ #define USB_DEVICE_VER(vend, prod, lo, hi) \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \ .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \
.idVendor = (vend), .idProduct = (prod), \ .idVendor = (vend), \
.bcdDevice_lo = (lo), .bcdDevice_hi = (hi) .idProduct = (prod), \
.bcdDevice_lo = (lo), \
.bcdDevice_hi = (hi)
/** /**
* USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb
...@@ -792,8 +808,9 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor ...@@ -792,8 +808,9 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
* This macro is used to create a struct usb_device_id that matches a * This macro is used to create a struct usb_device_id that matches a
* specific interface protocol of devices. * specific interface protocol of devices.
*/ */
#define USB_DEVICE_INTERFACE_PROTOCOL(vend,prod,pr) \ #define USB_DEVICE_INTERFACE_PROTOCOL(vend, prod, pr) \
.match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_PROTOCOL, \ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \
USB_DEVICE_ID_MATCH_INT_PROTOCOL, \
.idVendor = (vend), \ .idVendor = (vend), \
.idProduct = (prod), \ .idProduct = (prod), \
.bInterfaceProtocol = (pr) .bInterfaceProtocol = (pr)
...@@ -807,12 +824,14 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor ...@@ -807,12 +824,14 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
* This macro is used to create a struct usb_device_id that matches a * This macro is used to create a struct usb_device_id that matches a
* specific class of devices. * specific class of devices.
*/ */
#define USB_DEVICE_INFO(cl,sc,pr) \ #define USB_DEVICE_INFO(cl, sc, pr) \
.match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), \ .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, \
.bDeviceSubClass = (sc), .bDeviceProtocol = (pr) .bDeviceClass = (cl), \
.bDeviceSubClass = (sc), \
.bDeviceProtocol = (pr)
/** /**
* USB_INTERFACE_INFO - macro used to describe a class of usb interfaces * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces
* @cl: bInterfaceClass value * @cl: bInterfaceClass value
* @sc: bInterfaceSubClass value * @sc: bInterfaceSubClass value
* @pr: bInterfaceProtocol value * @pr: bInterfaceProtocol value
...@@ -820,9 +839,11 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor ...@@ -820,9 +839,11 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
* This macro is used to create a struct usb_device_id that matches a * This macro is used to create a struct usb_device_id that matches a
* specific class of interfaces. * specific class of interfaces.
*/ */
#define USB_INTERFACE_INFO(cl,sc,pr) \ #define USB_INTERFACE_INFO(cl, sc, pr) \
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, \
.bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) .bInterfaceClass = (cl), \
.bInterfaceSubClass = (sc), \
.bInterfaceProtocol = (pr)
/** /**
* USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device
...@@ -839,12 +860,14 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor ...@@ -839,12 +860,14 @@ static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor
* This is especially useful when explicitly matching devices that have * This is especially useful when explicitly matching devices that have
* vendor specific bDeviceClass values, but standards-compliant interfaces. * vendor specific bDeviceClass values, but standards-compliant interfaces.
*/ */
#define USB_DEVICE_AND_INTERFACE_INFO(vend,prod,cl,sc,pr) \ #define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \
.match_flags = USB_DEVICE_ID_MATCH_INT_INFO \ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \
| USB_DEVICE_ID_MATCH_DEVICE, \ | USB_DEVICE_ID_MATCH_DEVICE, \
.idVendor = (vend), .idProduct = (prod), \ .idVendor = (vend), \
.idProduct = (prod), \
.bInterfaceClass = (cl), \ .bInterfaceClass = (cl), \
.bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr) .bInterfaceSubClass = (sc), \
.bInterfaceProtocol = (pr)
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
...@@ -1122,7 +1145,7 @@ typedef void (*usb_complete_t)(struct urb *); ...@@ -1122,7 +1145,7 @@ typedef void (*usb_complete_t)(struct urb *);
* transferred. It will normally be the same as requested, unless * transferred. It will normally be the same as requested, unless
* either an error was reported or a short read was performed. * either an error was reported or a short read was performed.
* The URB_SHORT_NOT_OK transfer flag may be used to make such * The URB_SHORT_NOT_OK transfer flag may be used to make such
* short reads be reported as errors. * short reads be reported as errors.
* @setup_packet: Only used for control transfers, this points to eight bytes * @setup_packet: Only used for control transfers, this points to eight bytes
* of setup data. Control transfers always start by sending this data * of setup data. Control transfers always start by sending this data
* to the device. Then transfer_buffer is read or written, if needed. * to the device. Then transfer_buffer is read or written, if needed.
...@@ -1141,7 +1164,7 @@ typedef void (*usb_complete_t)(struct urb *); ...@@ -1141,7 +1164,7 @@ typedef void (*usb_complete_t)(struct urb *);
* @complete: Completion handler. This URB is passed as the parameter to the * @complete: Completion handler. This URB is passed as the parameter to the
* completion function. The completion function may then do what * completion function. The completion function may then do what
* it likes with the URB, including resubmitting or freeing it. * it likes with the URB, including resubmitting or freeing it.
* @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to
* collect the transfer status for each buffer. * collect the transfer status for each buffer.
* *
* This structure identifies USB transfer requests. URBs must be allocated by * This structure identifies USB transfer requests. URBs must be allocated by
...@@ -1245,8 +1268,7 @@ typedef void (*usb_complete_t)(struct urb *); ...@@ -1245,8 +1268,7 @@ typedef void (*usb_complete_t)(struct urb *);
* when the urb is owned by the hcd, that is, since the call to * when the urb is owned by the hcd, that is, since the call to
* usb_submit_urb() till the entry into the completion routine. * usb_submit_urb() till the entry into the completion routine.
*/ */
struct urb struct urb {
{
/* private: usb core and host controller only fields in the urb */ /* private: usb core and host controller only fields in the urb */
struct kref kref; /* reference count of the URB */ struct kref kref; /* reference count of the URB */
void *hcpriv; /* private data for host controller */ void *hcpriv; /* private data for host controller */
...@@ -1257,10 +1279,10 @@ struct urb ...@@ -1257,10 +1279,10 @@ struct urb
/* public: documented fields in the urb that can be used by drivers */ /* public: documented fields in the urb that can be used by drivers */
struct list_head urb_list; /* list head for use by the urb's struct list_head urb_list; /* list head for use by the urb's
* current owner */ * current owner */
struct list_head anchor_list; /* the URB may be anchored by the driver */ struct list_head anchor_list; /* the URB may be anchored */
struct usb_anchor *anchor; struct usb_anchor *anchor;
struct usb_device *dev; /* (in) pointer to associated device */ struct usb_device *dev; /* (in) pointer to associated device */
struct usb_host_endpoint *ep; /* (internal) pointer to endpoint struct */ struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */
unsigned int pipe; /* (in) pipe information */ unsigned int pipe; /* (in) pipe information */
int status; /* (return) non-ISO status */ int status; /* (return) non-ISO status */
unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/ unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/
...@@ -1297,14 +1319,14 @@ struct urb ...@@ -1297,14 +1319,14 @@ struct urb
* Initializes a control urb with the proper information needed to submit * Initializes a control urb with the proper information needed to submit
* it to a device. * it to a device.
*/ */
static inline void usb_fill_control_urb (struct urb *urb, static inline void usb_fill_control_urb(struct urb *urb,
struct usb_device *dev, struct usb_device *dev,
unsigned int pipe, unsigned int pipe,
unsigned char *setup_packet, unsigned char *setup_packet,
void *transfer_buffer, void *transfer_buffer,
int buffer_length, int buffer_length,
usb_complete_t complete_fn, usb_complete_t complete_fn,
void *context) void *context)
{ {
urb->dev = dev; urb->dev = dev;
urb->pipe = pipe; urb->pipe = pipe;
...@@ -1328,13 +1350,13 @@ static inline void usb_fill_control_urb (struct urb *urb, ...@@ -1328,13 +1350,13 @@ static inline void usb_fill_control_urb (struct urb *urb,
* Initializes a bulk urb with the proper information needed to submit it * Initializes a bulk urb with the proper information needed to submit it
* to a device. * to a device.
*/ */
static inline void usb_fill_bulk_urb (struct urb *urb, static inline void usb_fill_bulk_urb(struct urb *urb,
struct usb_device *dev, struct usb_device *dev,
unsigned int pipe, unsigned int pipe,
void *transfer_buffer, void *transfer_buffer,
int buffer_length, int buffer_length,
usb_complete_t complete_fn, usb_complete_t complete_fn,
void *context) void *context)
{ {
urb->dev = dev; urb->dev = dev;
urb->pipe = pipe; urb->pipe = pipe;
...@@ -1362,14 +1384,14 @@ static inline void usb_fill_bulk_urb (struct urb *urb, ...@@ -1362,14 +1384,14 @@ static inline void usb_fill_bulk_urb (struct urb *urb,
* the endpoint interval, and express polling intervals in microframes * the endpoint interval, and express polling intervals in microframes
* (eight per millisecond) rather than in frames (one per millisecond). * (eight per millisecond) rather than in frames (one per millisecond).
*/ */
static inline void usb_fill_int_urb (struct urb *urb, static inline void usb_fill_int_urb(struct urb *urb,
struct usb_device *dev, struct usb_device *dev,
unsigned int pipe, unsigned int pipe,
void *transfer_buffer, void *transfer_buffer,
int buffer_length, int buffer_length,
usb_complete_t complete_fn, usb_complete_t complete_fn,
void *context, void *context,
int interval) int interval)
{ {
urb->dev = dev; urb->dev = dev;
urb->pipe = pipe; urb->pipe = pipe;
...@@ -1422,15 +1444,15 @@ static inline int usb_urb_dir_out(struct urb *urb) ...@@ -1422,15 +1444,15 @@ static inline int usb_urb_dir_out(struct urb *urb)
return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT; return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;
} }
void *usb_buffer_alloc (struct usb_device *dev, size_t size, void *usb_buffer_alloc(struct usb_device *dev, size_t size,
gfp_t mem_flags, dma_addr_t *dma); gfp_t mem_flags, dma_addr_t *dma);
void usb_buffer_free (struct usb_device *dev, size_t size, void usb_buffer_free(struct usb_device *dev, size_t size,
void *addr, dma_addr_t dma); void *addr, dma_addr_t dma);
#if 0 #if 0
struct urb *usb_buffer_map (struct urb *urb); struct urb *usb_buffer_map(struct urb *urb);
void usb_buffer_dmasync (struct urb *urb); void usb_buffer_dmasync(struct urb *urb);
void usb_buffer_unmap (struct urb *urb); void usb_buffer_unmap(struct urb *urb);
#endif #endif
struct scatterlist; struct scatterlist;
...@@ -1502,7 +1524,7 @@ struct usb_sg_request { ...@@ -1502,7 +1524,7 @@ struct usb_sg_request {
int status; int status;
size_t bytes; size_t bytes;
/* /*
* members below are private: to usbcore, * members below are private: to usbcore,
* and are not provided for driver access! * and are not provided for driver access!
*/ */
...@@ -1520,18 +1542,18 @@ struct usb_sg_request { ...@@ -1520,18 +1542,18 @@ struct usb_sg_request {
struct completion complete; struct completion complete;
}; };
int usb_sg_init ( int usb_sg_init(
struct usb_sg_request *io, struct usb_sg_request *io,
struct usb_device *dev, struct usb_device *dev,
unsigned pipe, unsigned pipe,
unsigned period, unsigned period,
struct scatterlist *sg, struct scatterlist *sg,
int nents, int nents,
size_t length, size_t length,
gfp_t mem_flags gfp_t mem_flags
); );
void usb_sg_cancel (struct usb_sg_request *io); void usb_sg_cancel(struct usb_sg_request *io);
void usb_sg_wait (struct usb_sg_request *io); void usb_sg_wait(struct usb_sg_request *io);
/* ----------------------------------------------------------------------- */ /* ----------------------------------------------------------------------- */
...@@ -1588,21 +1610,21 @@ static inline unsigned int __create_pipe(struct usb_device *dev, ...@@ -1588,21 +1610,21 @@ static inline unsigned int __create_pipe(struct usb_device *dev,
/* Create various pipes... */ /* Create various pipes... */
#define usb_sndctrlpipe(dev,endpoint) \ #define usb_sndctrlpipe(dev,endpoint) \
((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint)) ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint))
#define usb_rcvctrlpipe(dev,endpoint) \ #define usb_rcvctrlpipe(dev,endpoint) \
((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
#define usb_sndisocpipe(dev,endpoint) \ #define usb_sndisocpipe(dev,endpoint) \
((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint)) ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint))
#define usb_rcvisocpipe(dev,endpoint) \ #define usb_rcvisocpipe(dev,endpoint) \
((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
#define usb_sndbulkpipe(dev,endpoint) \ #define usb_sndbulkpipe(dev,endpoint) \
((PIPE_BULK << 30) | __create_pipe(dev,endpoint)) ((PIPE_BULK << 30) | __create_pipe(dev, endpoint))
#define usb_rcvbulkpipe(dev,endpoint) \ #define usb_rcvbulkpipe(dev,endpoint) \
((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
#define usb_sndintpipe(dev,endpoint) \ #define usb_sndintpipe(dev,endpoint) \
((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint)) ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint))
#define usb_rcvintpipe(dev,endpoint) \ #define usb_rcvintpipe(dev,endpoint) \
((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN) ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)
/*-------------------------------------------------------------------------*/ /*-------------------------------------------------------------------------*/
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment