diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/usb/cdc.h | 16 | ||||
-rw-r--r-- | include/linux/usb/ch9.h | 4 | ||||
-rw-r--r-- | include/linux/usb/gadget.h | 120 |
3 files changed, 63 insertions, 77 deletions
diff --git a/include/linux/usb/cdc.h b/include/linux/usb/cdc.h index 9b129c9..03541cb 100644 --- a/include/linux/usb/cdc.h +++ b/include/linux/usb/cdc.h @@ -34,16 +34,16 @@ * Class-Specific descriptors ... there are a couple dozen of them */ -#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ -#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ -#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ -#define USB_CDC_UNION_TYPE 0x06 /* union_desc */ +#define USB_CDC_HEADER_TYPE 0x00 /* header_desc */ +#define USB_CDC_CALL_MANAGEMENT_TYPE 0x01 /* call_mgmt_descriptor */ +#define USB_CDC_ACM_TYPE 0x02 /* acm_descriptor */ +#define USB_CDC_UNION_TYPE 0x06 /* union_desc */ #define USB_CDC_COUNTRY_TYPE 0x07 -#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ -#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ +#define USB_CDC_NETWORK_TERMINAL_TYPE 0x0a /* network_terminal_desc */ +#define USB_CDC_ETHERNET_TYPE 0x0f /* ether_desc */ #define USB_CDC_WHCM_TYPE 0x11 -#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ -#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ +#define USB_CDC_MDLM_TYPE 0x12 /* mdlm_desc */ +#define USB_CDC_MDLM_DETAIL_TYPE 0x13 /* mdlm_detail_desc */ #define USB_CDC_DMM_TYPE 0x14 #define USB_CDC_OBEX_TYPE 0x15 diff --git a/include/linux/usb/ch9.h b/include/linux/usb/ch9.h index 1091692..49b7483 100644 --- a/include/linux/usb/ch9.h +++ b/include/linux/usb/ch9.h @@ -69,8 +69,8 @@ #define USB_RECIP_ENDPOINT 0x02 #define USB_RECIP_OTHER 0x03 /* From Wireless USB 1.0 */ -#define USB_RECIP_PORT 0x04 -#define USB_RECIP_RPIPE 0x05 +#define USB_RECIP_PORT 0x04 +#define USB_RECIP_RPIPE 0x05 /* * Standard requests, for the bRequest field of a SETUP packet. diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index 344fc78..275cb5f 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -73,9 +73,10 @@ struct usb_ep; * * Bulk endpoints can use any size buffers, and can also be used for interrupt * transfers. interrupt-only endpoints can be much less functional. + * + * NOTE: this is analagous to 'struct urb' on the host side, except that + * it's thinner and promotes more pre-allocation. */ - // NOTE this is analagous to 'struct urb' on the host side, - // except that it's thinner and promotes more pre-allocation. struct usb_request { void *buf; @@ -170,10 +171,10 @@ struct usb_ep { * * returns zero, or a negative error code. */ -static inline int -usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc) +static inline int usb_ep_enable(struct usb_ep *ep, + const struct usb_endpoint_descriptor *desc) { - return ep->ops->enable (ep, desc); + return ep->ops->enable(ep, desc); } /** @@ -188,10 +189,9 @@ usb_ep_enable (struct usb_ep *ep, const struct usb_endpoint_descriptor *desc) * * returns zero, or a negative error code. */ -static inline int -usb_ep_disable (struct usb_ep *ep) +static inline int usb_ep_disable(struct usb_ep *ep) { - return ep->ops->disable (ep); + return ep->ops->disable(ep); } /** @@ -208,10 +208,10 @@ usb_ep_disable (struct usb_ep *ep) * * Returns the request, or null if one could not be allocated. */ -static inline struct usb_request * -usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags) +static inline struct usb_request *usb_ep_alloc_request(struct usb_ep *ep, + gfp_t gfp_flags) { - return ep->ops->alloc_request (ep, gfp_flags); + return ep->ops->alloc_request(ep, gfp_flags); } /** @@ -223,10 +223,10 @@ usb_ep_alloc_request (struct usb_ep *ep, gfp_t gfp_flags) * Caller guarantees the request is not queued, and that it will * no longer be requeued (or otherwise used). */ -static inline void -usb_ep_free_request (struct usb_ep *ep, struct usb_request *req) +static inline void usb_ep_free_request(struct usb_ep *ep, + struct usb_request *req) { - ep->ops->free_request (ep, req); + ep->ops->free_request(ep, req); } /** @@ -283,10 +283,10 @@ usb_ep_free_request (struct usb_ep *ep, struct usb_request *req) * report errors; errors will also be * reported when the usb peripheral is disconnected. */ -static inline int -usb_ep_queue (struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags) +static inline int usb_ep_queue(struct usb_ep *ep, + struct usb_request *req, gfp_t gfp_flags) { - return ep->ops->queue (ep, req, gfp_flags); + return ep->ops->queue(ep, req, gfp_flags); } /** @@ -303,9 +303,9 @@ usb_ep_queue (struct usb_ep *ep, struct usb_request *req, gfp_t gfp_flags) * restrictions prevent drivers from supporting configuration changes, * even to configuration zero (a "chapter 9" requirement). */ -static inline int usb_ep_dequeue (struct usb_ep *ep, struct usb_request *req) +static inline int usb_ep_dequeue(struct usb_ep *ep, struct usb_request *req) { - return ep->ops->dequeue (ep, req); + return ep->ops->dequeue(ep, req); } /** @@ -329,10 +329,9 @@ static inline int usb_ep_dequeue (struct usb_ep *ep, struct usb_request *req) * transfer requests are still queued, or if the controller hardware * (usually a FIFO) still holds bytes that the host hasn't collected. */ -static inline int -usb_ep_set_halt (struct usb_ep *ep) +static inline int usb_ep_set_halt(struct usb_ep *ep) { - return ep->ops->set_halt (ep, 1); + return ep->ops->set_halt(ep, 1); } /** @@ -348,10 +347,9 @@ usb_ep_set_halt (struct usb_ep *ep) * Note that some hardware can't support this request (like pxa2xx_udc), * and accordingly can't correctly implement interface altsettings. */ -static inline int -usb_ep_clear_halt (struct usb_ep *ep) +static inline int usb_ep_clear_halt(struct usb_ep *ep) { - return ep->ops->set_halt (ep, 0); + return ep->ops->set_halt(ep, 0); } /** @@ -369,11 +367,10 @@ usb_ep_clear_halt (struct usb_ep *ep) * errno if the endpoint doesn't use a FIFO or doesn't support such * precise handling. */ -static inline int -usb_ep_fifo_status (struct usb_ep *ep) +static inline int usb_ep_fifo_status(struct usb_ep *ep) { if (ep->ops->fifo_status) - return ep->ops->fifo_status (ep); + return ep->ops->fifo_status(ep); else return -EOPNOTSUPP; } @@ -387,11 +384,10 @@ usb_ep_fifo_status (struct usb_ep *ep) * must never be used except when endpoint is not being used for any * protocol translation. */ -static inline void -usb_ep_fifo_flush (struct usb_ep *ep) +static inline void usb_ep_fifo_flush(struct usb_ep *ep) { if (ep->ops->fifo_flush) - ep->ops->fifo_flush (ep); + ep->ops->fifo_flush(ep); } @@ -475,18 +471,18 @@ struct usb_gadget { struct device dev; }; -static inline void set_gadget_data (struct usb_gadget *gadget, void *data) +static inline void set_gadget_data(struct usb_gadget *gadget, void *data) { gadget->dev.driver_data = data; } -static inline void *get_gadget_data (struct usb_gadget *gadget) +static inline void *get_gadget_data(struct usb_gadget *gadget) { return gadget->dev.driver_data; } /* iterates the non-control endpoints; 'tmp' is a struct usb_ep pointer */ -#define gadget_for_each_ep(tmp,gadget) \ +#define gadget_for_each_ep(tmp, gadget) \ list_for_each_entry(tmp, &(gadget)->ep_list, ep_list) @@ -522,7 +518,6 @@ static inline int gadget_is_otg(struct usb_gadget *g) #endif } - /** * usb_gadget_frame_number - returns the current frame number * @gadget: controller that reports the frame number @@ -530,9 +525,9 @@ static inline int gadget_is_otg(struct usb_gadget *g) * Returns the usb frame number, normally eleven bits from a SOF packet, * or negative errno if this device doesn't support this capability. */ -static inline int usb_gadget_frame_number (struct usb_gadget *gadget) +static inline int usb_gadget_frame_number(struct usb_gadget *gadget) { - return gadget->ops->get_frame (gadget); + return gadget->ops->get_frame(gadget); } /** @@ -548,11 +543,11 @@ static inline int usb_gadget_frame_number (struct usb_gadget *gadget) * even if OTG isn't otherwise in use. OTG devices may also start * remote wakeup even when hosts don't explicitly enable it. */ -static inline int usb_gadget_wakeup (struct usb_gadget *gadget) +static inline int usb_gadget_wakeup(struct usb_gadget *gadget) { if (!gadget->ops->wakeup) return -EOPNOTSUPP; - return gadget->ops->wakeup (gadget); + return gadget->ops->wakeup(gadget); } /** @@ -564,12 +559,11 @@ static inline int usb_gadget_wakeup (struct usb_gadget *gadget) * * returns zero on success, else negative errno. */ -static inline int -usb_gadget_set_selfpowered (struct usb_gadget *gadget) +static inline int usb_gadget_set_selfpowered(struct usb_gadget *gadget) { if (!gadget->ops->set_selfpowered) return -EOPNOTSUPP; - return gadget->ops->set_selfpowered (gadget, 1); + return gadget->ops->set_selfpowered(gadget, 1); } /** @@ -582,12 +576,11 @@ usb_gadget_set_selfpowered (struct usb_gadget *gadget) * * returns zero on success, else negative errno. */ -static inline int -usb_gadget_clear_selfpowered (struct usb_gadget *gadget) +static inline int usb_gadget_clear_selfpowered(struct usb_gadget *gadget) { if (!gadget->ops->set_selfpowered) return -EOPNOTSUPP; - return gadget->ops->set_selfpowered (gadget, 0); + return gadget->ops->set_selfpowered(gadget, 0); } /** @@ -602,12 +595,11 @@ usb_gadget_clear_selfpowered (struct usb_gadget *gadget) * * Returns zero on success, else negative errno. */ -static inline int -usb_gadget_vbus_connect(struct usb_gadget *gadget) +static inline int usb_gadget_vbus_connect(struct usb_gadget *gadget) { if (!gadget->ops->vbus_session) return -EOPNOTSUPP; - return gadget->ops->vbus_session (gadget, 1); + return gadget->ops->vbus_session(gadget, 1); } /** @@ -622,12 +614,11 @@ usb_gadget_vbus_connect(struct usb_gadget *gadget) * * Returns zero on success, else negative errno. */ -static inline int -usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) +static inline int usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) { if (!gadget->ops->vbus_draw) return -EOPNOTSUPP; - return gadget->ops->vbus_draw (gadget, mA); + return gadget->ops->vbus_draw(gadget, mA); } /** @@ -640,12 +631,11 @@ usb_gadget_vbus_draw(struct usb_gadget *gadget, unsigned mA) * * Returns zero on success, else negative errno. */ -static inline int -usb_gadget_vbus_disconnect(struct usb_gadget *gadget) +static inline int usb_gadget_vbus_disconnect(struct usb_gadget *gadget) { if (!gadget->ops->vbus_session) return -EOPNOTSUPP; - return gadget->ops->vbus_session (gadget, 0); + return gadget->ops->vbus_session(gadget, 0); } /** @@ -659,12 +649,11 @@ usb_gadget_vbus_disconnect(struct usb_gadget *gadget) * * Returns zero on success, else negative errno. */ -static inline int -usb_gadget_connect (struct usb_gadget *gadget) +static inline int usb_gadget_connect(struct usb_gadget *gadget) { if (!gadget->ops->pullup) return -EOPNOTSUPP; - return gadget->ops->pullup (gadget, 1); + return gadget->ops->pullup(gadget, 1); } /** @@ -682,16 +671,14 @@ usb_gadget_connect (struct usb_gadget *gadget) * * Returns zero on success, else negative errno. */ -static inline int -usb_gadget_disconnect (struct usb_gadget *gadget) +static inline int usb_gadget_disconnect(struct usb_gadget *gadget) { if (!gadget->ops->pullup) return -EOPNOTSUPP; - return gadget->ops->pullup (gadget, 0); + return gadget->ops->pullup(gadget, 0); } - /*-------------------------------------------------------------------------*/ /** @@ -774,7 +761,6 @@ struct usb_gadget_driver { }; - /*-------------------------------------------------------------------------*/ /* driver modules register and unregister, as usual. @@ -795,7 +781,7 @@ struct usb_gadget_driver { * the bind() functions will be in init sections. * This function must be called in a context that can sleep. */ -int usb_gadget_register_driver (struct usb_gadget_driver *driver); +int usb_gadget_register_driver(struct usb_gadget_driver *driver); /** * usb_gadget_unregister_driver - unregister a gadget driver @@ -810,7 +796,7 @@ int usb_gadget_register_driver (struct usb_gadget_driver *driver); * will in in exit sections, so may not be linked in some kernels. * This function must be called in a context that can sleep. */ -int usb_gadget_unregister_driver (struct usb_gadget_driver *driver); +int usb_gadget_unregister_driver(struct usb_gadget_driver *driver); /*-------------------------------------------------------------------------*/ @@ -843,7 +829,7 @@ struct usb_gadget_strings { }; /* put descriptor for string with that id into buf (buflen >= 256) */ -int usb_gadget_get_string (struct usb_gadget_strings *table, int id, u8 *buf); +int usb_gadget_get_string(struct usb_gadget_strings *table, int id, u8 *buf); /*-------------------------------------------------------------------------*/ @@ -861,10 +847,10 @@ int usb_gadget_config_buf(const struct usb_config_descriptor *config, /* utility wrapping a simple endpoint selection policy */ -extern struct usb_ep *usb_ep_autoconfig (struct usb_gadget *, +extern struct usb_ep *usb_ep_autoconfig(struct usb_gadget *, struct usb_endpoint_descriptor *); -extern void usb_ep_autoconfig_reset (struct usb_gadget *); +extern void usb_ep_autoconfig_reset(struct usb_gadget *); extern int usb_gadget_handle_interrupts(void); |