···162162 unsigned needs_remote_wakeup:1; /* driver requires remote wakeup */163163164164 struct device dev; /* interface specific device info */165165- struct device *usb_dev; /* pointer to the usb class's device, if any */165165+ struct device *usb_dev;166166 int pm_usage_cnt; /* usage counter for autosuspend */167167};168168#define to_usb_interface(d) container_of(d, struct usb_interface, dev)169169#define interface_to_usbdev(intf) \170170 container_of(intf->dev.parent, struct usb_device, dev)171171172172-static inline void *usb_get_intfdata (struct usb_interface *intf)172172+static inline void *usb_get_intfdata(struct usb_interface *intf)173173{174174- return dev_get_drvdata (&intf->dev);174174+ return dev_get_drvdata(&intf->dev);175175}176176177177-static inline void usb_set_intfdata (struct usb_interface *intf, void *data)177177+static inline void usb_set_intfdata(struct usb_interface *intf, void *data)178178{179179 dev_set_drvdata(&intf->dev, data);180180}···275275276276int __usb_get_extra_descriptor(char *buffer, unsigned size,277277 unsigned char type, void **ptr);278278-#define usb_get_extra_descriptor(ifpoint,type,ptr)\279279- __usb_get_extra_descriptor((ifpoint)->extra,(ifpoint)->extralen,\280280- type,(void**)ptr)278278+#define usb_get_extra_descriptor(ifpoint, type, ptr) \279279+ __usb_get_extra_descriptor((ifpoint)->extra, \280280+ (ifpoint)->extralen, \281281+ type, (void **)ptr)281282282283/* ----------------------------------------------------------------------- */283284···389388 unsigned can_submit:1; /* URBs may be submitted */390389 unsigned discon_suspended:1; /* Disconnected while suspended */391390 unsigned have_langid:1; /* whether string_langid is valid */392392- unsigned authorized:1; /* Policy has determined we can use it */391391+ unsigned authorized:1; /* Policy has said we can use it */393392 unsigned wusb:1; /* Device is Wireless USB */394393 int string_langid; /* language ID for strings */395394···418417419418 int pm_usage_cnt; /* usage counter for autosuspend */420419 u32 quirks; /* quirks of the whole device */421421- atomic_t urbnum; /* number of URBs submitted for the whole device */420420+ atomic_t urbnum; /* number of URBs submitted for421421+ the whole device */422422423423 unsigned long active_duration; /* total time device is not suspended */424424···503501/*-------------------------------------------------------------------------*/504502505503/* for drivers using iso endpoints */506506-extern int usb_get_current_frame_number (struct usb_device *usb_dev);504504+extern int usb_get_current_frame_number(struct usb_device *usb_dev);507505508506/* used these for multi-interface device registration */509507extern int usb_driver_claim_interface(struct usb_driver *driver,510510- struct usb_interface *iface, void* priv);508508+ struct usb_interface *iface, void *priv);511509512510/**513511 * usb_interface_claimed - returns true iff an interface is claimed···519517 * may need to explicitly claim that lock.520518 *521519 */522522-static inline int usb_interface_claimed(struct usb_interface *iface) {520520+static inline int usb_interface_claimed(struct usb_interface *iface)521521+{523522 return (iface->dev.driver != NULL);524523}525524···563560 * USB 2.0 root hubs (EHCI host controllers) will get one path ID if they are564561 * high speed, and a different one if they are full or low speed.565562 */566566-static inline int usb_make_path (struct usb_device *dev, char *buf,567567- size_t size)563563+static inline int usb_make_path(struct usb_device *dev, char *buf, size_t size)568564{569565 int actual;570570- actual = snprintf (buf, size, "usb-%s-%s", dev->bus->bus_name,571571- dev->devpath);566566+ actual = snprintf(buf, size, "usb-%s-%s", dev->bus->bus_name,567567+ dev->devpath);572568 return (actual >= (int)size) ? -1 : actual;573569}574570···613611 *614612 * Returns true if the endpoint is of type OUT, otherwise it returns false.615613 */616616-static inline int usb_endpoint_dir_out(const struct usb_endpoint_descriptor *epd)614614+static inline int usb_endpoint_dir_out(615615+ const struct usb_endpoint_descriptor *epd)617616{618617 return ((epd->bEndpointAddress & USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);619618}···625622 *626623 * Returns true if the endpoint is of type bulk, otherwise it returns false.627624 */628628-static inline int usb_endpoint_xfer_bulk(const struct usb_endpoint_descriptor *epd)625625+static inline int usb_endpoint_xfer_bulk(626626+ const struct usb_endpoint_descriptor *epd)629627{630628 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==631629 USB_ENDPOINT_XFER_BULK);···638634 *639635 * Returns true if the endpoint is of type control, otherwise it returns false.640636 */641641-static inline int usb_endpoint_xfer_control(const struct usb_endpoint_descriptor *epd)637637+static inline int usb_endpoint_xfer_control(638638+ const struct usb_endpoint_descriptor *epd)642639{643640 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==644641 USB_ENDPOINT_XFER_CONTROL);···652647 * Returns true if the endpoint is of type interrupt, otherwise it returns653648 * false.654649 */655655-static inline int usb_endpoint_xfer_int(const struct usb_endpoint_descriptor *epd)650650+static inline int usb_endpoint_xfer_int(651651+ const struct usb_endpoint_descriptor *epd)656652{657653 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==658654 USB_ENDPOINT_XFER_INT);···666660 * Returns true if the endpoint is of type isochronous, otherwise it returns667661 * false.668662 */669669-static inline int usb_endpoint_xfer_isoc(const struct usb_endpoint_descriptor *epd)663663+static inline int usb_endpoint_xfer_isoc(664664+ const struct usb_endpoint_descriptor *epd)670665{671666 return ((epd->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) ==672667 USB_ENDPOINT_XFER_ISOC);···680673 * Returns true if the endpoint has bulk transfer type and IN direction,681674 * otherwise it returns false.682675 */683683-static inline int usb_endpoint_is_bulk_in(const struct usb_endpoint_descriptor *epd)676676+static inline int usb_endpoint_is_bulk_in(677677+ const struct usb_endpoint_descriptor *epd)684678{685679 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_in(epd));686680}···693685 * Returns true if the endpoint has bulk transfer type and OUT direction,694686 * otherwise it returns false.695687 */696696-static inline int usb_endpoint_is_bulk_out(const struct usb_endpoint_descriptor *epd)688688+static inline int usb_endpoint_is_bulk_out(689689+ const struct usb_endpoint_descriptor *epd)697690{698691 return (usb_endpoint_xfer_bulk(epd) && usb_endpoint_dir_out(epd));699692}···706697 * Returns true if the endpoint has interrupt transfer type and IN direction,707698 * otherwise it returns false.708699 */709709-static inline int usb_endpoint_is_int_in(const struct usb_endpoint_descriptor *epd)700700+static inline int usb_endpoint_is_int_in(701701+ const struct usb_endpoint_descriptor *epd)710702{711703 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_in(epd));712704}···719709 * Returns true if the endpoint has interrupt transfer type and OUT direction,720710 * otherwise it returns false.721711 */722722-static inline int usb_endpoint_is_int_out(const struct usb_endpoint_descriptor *epd)712712+static inline int usb_endpoint_is_int_out(713713+ const struct usb_endpoint_descriptor *epd)723714{724715 return (usb_endpoint_xfer_int(epd) && usb_endpoint_dir_out(epd));725716}···732721 * Returns true if the endpoint has isochronous transfer type and IN direction,733722 * otherwise it returns false.734723 */735735-static inline int usb_endpoint_is_isoc_in(const struct usb_endpoint_descriptor *epd)724724+static inline int usb_endpoint_is_isoc_in(725725+ const struct usb_endpoint_descriptor *epd)736726{737727 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_in(epd));738728}···745733 * Returns true if the endpoint has isochronous transfer type and OUT direction,746734 * otherwise it returns false.747735 */748748-static inline int usb_endpoint_is_isoc_out(const struct usb_endpoint_descriptor *epd)736736+static inline int usb_endpoint_is_isoc_out(737737+ const struct usb_endpoint_descriptor *epd)749738{750739 return (usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd));751740}···777764 * specific device.778765 */779766#define USB_DEVICE(vend,prod) \780780- .match_flags = USB_DEVICE_ID_MATCH_DEVICE, .idVendor = (vend), \781781- .idProduct = (prod)767767+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE, \768768+ .idVendor = (vend), \769769+ .idProduct = (prod)782770/**783771 * USB_DEVICE_VER - macro used to describe a specific usb device with a784772 * version range···791777 * This macro is used to create a struct usb_device_id that matches a792778 * specific device, with a version range.793779 */794794-#define USB_DEVICE_VER(vend,prod,lo,hi) \780780+#define USB_DEVICE_VER(vend, prod, lo, hi) \795781 .match_flags = USB_DEVICE_ID_MATCH_DEVICE_AND_VERSION, \796796- .idVendor = (vend), .idProduct = (prod), \797797- .bcdDevice_lo = (lo), .bcdDevice_hi = (hi)782782+ .idVendor = (vend), \783783+ .idProduct = (prod), \784784+ .bcdDevice_lo = (lo), \785785+ .bcdDevice_hi = (hi)798786799787/**800788 * USB_DEVICE_INTERFACE_PROTOCOL - macro used to describe a usb···808792 * This macro is used to create a struct usb_device_id that matches a809793 * specific interface protocol of devices.810794 */811811-#define USB_DEVICE_INTERFACE_PROTOCOL(vend,prod,pr) \812812- .match_flags = USB_DEVICE_ID_MATCH_DEVICE | USB_DEVICE_ID_MATCH_INT_PROTOCOL, \795795+#define USB_DEVICE_INTERFACE_PROTOCOL(vend, prod, pr) \796796+ .match_flags = USB_DEVICE_ID_MATCH_DEVICE | \797797+ USB_DEVICE_ID_MATCH_INT_PROTOCOL, \813798 .idVendor = (vend), \814799 .idProduct = (prod), \815800 .bInterfaceProtocol = (pr)···824807 * This macro is used to create a struct usb_device_id that matches a825808 * specific class of devices.826809 */827827-#define USB_DEVICE_INFO(cl,sc,pr) \828828- .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, .bDeviceClass = (cl), \829829- .bDeviceSubClass = (sc), .bDeviceProtocol = (pr)810810+#define USB_DEVICE_INFO(cl, sc, pr) \811811+ .match_flags = USB_DEVICE_ID_MATCH_DEV_INFO, \812812+ .bDeviceClass = (cl), \813813+ .bDeviceSubClass = (sc), \814814+ .bDeviceProtocol = (pr)830815831816/**832832- * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces 817817+ * USB_INTERFACE_INFO - macro used to describe a class of usb interfaces833818 * @cl: bInterfaceClass value834819 * @sc: bInterfaceSubClass value835820 * @pr: bInterfaceProtocol value···839820 * This macro is used to create a struct usb_device_id that matches a840821 * specific class of interfaces.841822 */842842-#define USB_INTERFACE_INFO(cl,sc,pr) \843843- .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, .bInterfaceClass = (cl), \844844- .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr)823823+#define USB_INTERFACE_INFO(cl, sc, pr) \824824+ .match_flags = USB_DEVICE_ID_MATCH_INT_INFO, \825825+ .bInterfaceClass = (cl), \826826+ .bInterfaceSubClass = (sc), \827827+ .bInterfaceProtocol = (pr)845828846829/**847830 * USB_DEVICE_AND_INTERFACE_INFO - macro used to describe a specific usb device···860839 * This is especially useful when explicitly matching devices that have861840 * vendor specific bDeviceClass values, but standards-compliant interfaces.862841 */863863-#define USB_DEVICE_AND_INTERFACE_INFO(vend,prod,cl,sc,pr) \842842+#define USB_DEVICE_AND_INTERFACE_INFO(vend, prod, cl, sc, pr) \864843 .match_flags = USB_DEVICE_ID_MATCH_INT_INFO \865844 | USB_DEVICE_ID_MATCH_DEVICE, \866866- .idVendor = (vend), .idProduct = (prod), \845845+ .idVendor = (vend), \846846+ .idProduct = (prod), \867847 .bInterfaceClass = (cl), \868868- .bInterfaceSubClass = (sc), .bInterfaceProtocol = (pr)848848+ .bInterfaceSubClass = (sc), \849849+ .bInterfaceProtocol = (pr)869850870851/* ----------------------------------------------------------------------- */871852···11451122 * transferred. It will normally be the same as requested, unless11461123 * either an error was reported or a short read was performed.11471124 * The URB_SHORT_NOT_OK transfer flag may be used to make such11481148- * short reads be reported as errors. 11251125+ * short reads be reported as errors.11491126 * @setup_packet: Only used for control transfers, this points to eight bytes11501127 * of setup data. Control transfers always start by sending this data11511128 * to the device. Then transfer_buffer is read or written, if needed.···11641141 * @complete: Completion handler. This URB is passed as the parameter to the11651142 * completion function. The completion function may then do what11661143 * it likes with the URB, including resubmitting or freeing it.11671167- * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to 11441144+ * @iso_frame_desc: Used to provide arrays of ISO transfer buffers and to11681145 * collect the transfer status for each buffer.11691146 *11701147 * This structure identifies USB transfer requests. URBs must be allocated by···12681245 * when the urb is owned by the hcd, that is, since the call to12691246 * usb_submit_urb() till the entry into the completion routine.12701247 */12711271-struct urb12721272-{12481248+struct urb {12731249 /* private: usb core and host controller only fields in the urb */12741250 struct kref kref; /* reference count of the URB */12751251 void *hcpriv; /* private data for host controller */···12791257 /* public: documented fields in the urb that can be used by drivers */12801258 struct list_head urb_list; /* list head for use by the urb's12811259 * current owner */12821282- struct list_head anchor_list; /* the URB may be anchored by the driver */12601260+ struct list_head anchor_list; /* the URB may be anchored */12831261 struct usb_anchor *anchor;12841262 struct usb_device *dev; /* (in) pointer to associated device */12851285- struct usb_host_endpoint *ep; /* (internal) pointer to endpoint struct */12631263+ struct usb_host_endpoint *ep; /* (internal) pointer to endpoint */12861264 unsigned int pipe; /* (in) pipe information */12871265 int status; /* (return) non-ISO status */12881266 unsigned int transfer_flags; /* (in) URB_SHORT_NOT_OK | ...*/···13191297 * Initializes a control urb with the proper information needed to submit13201298 * it to a device.13211299 */13221322-static inline void usb_fill_control_urb (struct urb *urb,13231323- struct usb_device *dev,13241324- unsigned int pipe,13251325- unsigned char *setup_packet,13261326- void *transfer_buffer,13271327- int buffer_length,13281328- usb_complete_t complete_fn,13291329- void *context)13001300+static inline void usb_fill_control_urb(struct urb *urb,13011301+ struct usb_device *dev,13021302+ unsigned int pipe,13031303+ unsigned char *setup_packet,13041304+ void *transfer_buffer,13051305+ int buffer_length,13061306+ usb_complete_t complete_fn,13071307+ void *context)13301308{13311309 urb->dev = dev;13321310 urb->pipe = pipe;···13501328 * Initializes a bulk urb with the proper information needed to submit it13511329 * to a device.13521330 */13531353-static inline void usb_fill_bulk_urb (struct urb *urb,13541354- struct usb_device *dev,13551355- unsigned int pipe,13561356- void *transfer_buffer,13571357- int buffer_length,13581358- usb_complete_t complete_fn,13591359- void *context)13311331+static inline void usb_fill_bulk_urb(struct urb *urb,13321332+ struct usb_device *dev,13331333+ unsigned int pipe,13341334+ void *transfer_buffer,13351335+ int buffer_length,13361336+ usb_complete_t complete_fn,13371337+ void *context)13601338{13611339 urb->dev = dev;13621340 urb->pipe = pipe;···13841362 * the endpoint interval, and express polling intervals in microframes13851363 * (eight per millisecond) rather than in frames (one per millisecond).13861364 */13871387-static inline void usb_fill_int_urb (struct urb *urb,13881388- struct usb_device *dev,13891389- unsigned int pipe,13901390- void *transfer_buffer,13911391- int buffer_length,13921392- usb_complete_t complete_fn,13931393- void *context,13941394- int interval)13651365+static inline void usb_fill_int_urb(struct urb *urb,13661366+ struct usb_device *dev,13671367+ unsigned int pipe,13681368+ void *transfer_buffer,13691369+ int buffer_length,13701370+ usb_complete_t complete_fn,13711371+ void *context,13721372+ int interval)13951373{13961374 urb->dev = dev;13971375 urb->pipe = pipe;···14441422 return (urb->transfer_flags & URB_DIR_MASK) == URB_DIR_OUT;14451423}1446142414471447-void *usb_buffer_alloc (struct usb_device *dev, size_t size,14251425+void *usb_buffer_alloc(struct usb_device *dev, size_t size,14481426 gfp_t mem_flags, dma_addr_t *dma);14491449-void usb_buffer_free (struct usb_device *dev, size_t size,14271427+void usb_buffer_free(struct usb_device *dev, size_t size,14501428 void *addr, dma_addr_t dma);1451142914521430#if 014531453-struct urb *usb_buffer_map (struct urb *urb);14541454-void usb_buffer_dmasync (struct urb *urb);14551455-void usb_buffer_unmap (struct urb *urb);14311431+struct urb *usb_buffer_map(struct urb *urb);14321432+void usb_buffer_dmasync(struct urb *urb);14331433+void usb_buffer_unmap(struct urb *urb);14561434#endif1457143514581436struct scatterlist;···15241502 int status;15251503 size_t bytes;1526150415271527- /* 15051505+ /*15281506 * members below are private: to usbcore,15291507 * and are not provided for driver access!15301508 */···15421520 struct completion complete;15431521};1544152215451545-int usb_sg_init (15231523+int usb_sg_init(15461524 struct usb_sg_request *io,15471525 struct usb_device *dev,15481548- unsigned pipe, 15261526+ unsigned pipe,15491527 unsigned period,15501528 struct scatterlist *sg,15511529 int nents,15521530 size_t length,15531531 gfp_t mem_flags15541532);15551555-void usb_sg_cancel (struct usb_sg_request *io);15561556-void usb_sg_wait (struct usb_sg_request *io);15331533+void usb_sg_cancel(struct usb_sg_request *io);15341534+void usb_sg_wait(struct usb_sg_request *io);155715351558153615591537/* ----------------------------------------------------------------------- */···1610158816111589/* Create various pipes... */16121590#define usb_sndctrlpipe(dev,endpoint) \16131613- ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint))15911591+ ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint))16141592#define usb_rcvctrlpipe(dev,endpoint) \16151615- ((PIPE_CONTROL << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)15931593+ ((PIPE_CONTROL << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)16161594#define usb_sndisocpipe(dev,endpoint) \16171617- ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint))15951595+ ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint))16181596#define usb_rcvisocpipe(dev,endpoint) \16191619- ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)15971597+ ((PIPE_ISOCHRONOUS << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)16201598#define usb_sndbulkpipe(dev,endpoint) \16211621- ((PIPE_BULK << 30) | __create_pipe(dev,endpoint))15991599+ ((PIPE_BULK << 30) | __create_pipe(dev, endpoint))16221600#define usb_rcvbulkpipe(dev,endpoint) \16231623- ((PIPE_BULK << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)16011601+ ((PIPE_BULK << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)16241602#define usb_sndintpipe(dev,endpoint) \16251625- ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint))16031603+ ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint))16261604#define usb_rcvintpipe(dev,endpoint) \16271627- ((PIPE_INTERRUPT << 30) | __create_pipe(dev,endpoint) | USB_DIR_IN)16051605+ ((PIPE_INTERRUPT << 30) | __create_pipe(dev, endpoint) | USB_DIR_IN)1628160616291607/*-------------------------------------------------------------------------*/16301608