diff options
author | David Brownell <david-b@pacbell.net> | 2005-05-07 16:05:13 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2005-06-27 17:43:53 -0400 |
commit | 1bbc169621cbe502b9143a27eb12802a0f1d43a0 (patch) | |
tree | a8fc4a429d890ea02ef1084ec3ffb2a9b9ef9c61 /drivers/usb/gadget/serial.c | |
parent | 028b271b687714f9fc7a1e89bb79f1fbeef154ee (diff) |
[PATCH] USB: gadget driver updates (SETUP api change)
This updates most of the gadget framework to expect SETUP packets use
USB byteorder (matching the annotation in <linux/usb_ch9.h> and usage
in the host side stack):
- definition in <linux/usb_gadget.h>
- gadget drivers: Ethernet/RNDIS, serial/ACM, file_storage, gadgetfs.
- dummy_hcd
It also includes some other similar changes as suggested by "sparse",
which was used to detect byteorder bugs.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/usb/gadget/serial.c')
-rw-r--r-- | drivers/usb/gadget/serial.c | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/drivers/usb/gadget/serial.c b/drivers/usb/gadget/serial.c index 4d591c764e3..9e4f1c6935a 100644 --- a/drivers/usb/gadget/serial.c +++ b/drivers/usb/gadget/serial.c | |||
@@ -300,18 +300,18 @@ static int gs_build_config_buf(u8 *buf, enum usb_device_speed speed, | |||
300 | u8 type, unsigned int index, int is_otg); | 300 | u8 type, unsigned int index, int is_otg); |
301 | 301 | ||
302 | static struct usb_request *gs_alloc_req(struct usb_ep *ep, unsigned int len, | 302 | static struct usb_request *gs_alloc_req(struct usb_ep *ep, unsigned int len, |
303 | int kmalloc_flags); | 303 | unsigned kmalloc_flags); |
304 | static void gs_free_req(struct usb_ep *ep, struct usb_request *req); | 304 | static void gs_free_req(struct usb_ep *ep, struct usb_request *req); |
305 | 305 | ||
306 | static struct gs_req_entry *gs_alloc_req_entry(struct usb_ep *ep, unsigned len, | 306 | static struct gs_req_entry *gs_alloc_req_entry(struct usb_ep *ep, unsigned len, |
307 | int kmalloc_flags); | 307 | unsigned kmalloc_flags); |
308 | static void gs_free_req_entry(struct usb_ep *ep, struct gs_req_entry *req); | 308 | static void gs_free_req_entry(struct usb_ep *ep, struct gs_req_entry *req); |
309 | 309 | ||
310 | static int gs_alloc_ports(struct gs_dev *dev, int kmalloc_flags); | 310 | static int gs_alloc_ports(struct gs_dev *dev, unsigned kmalloc_flags); |
311 | static void gs_free_ports(struct gs_dev *dev); | 311 | static void gs_free_ports(struct gs_dev *dev); |
312 | 312 | ||
313 | /* circular buffer */ | 313 | /* circular buffer */ |
314 | static struct gs_buf *gs_buf_alloc(unsigned int size, int kmalloc_flags); | 314 | static struct gs_buf *gs_buf_alloc(unsigned int size, unsigned kmalloc_flags); |
315 | static void gs_buf_free(struct gs_buf *gb); | 315 | static void gs_buf_free(struct gs_buf *gb); |
316 | static void gs_buf_clear(struct gs_buf *gb); | 316 | static void gs_buf_clear(struct gs_buf *gb); |
317 | static unsigned int gs_buf_data_avail(struct gs_buf *gb); | 317 | static unsigned int gs_buf_data_avail(struct gs_buf *gb); |
@@ -1607,9 +1607,9 @@ static int gs_setup(struct usb_gadget *gadget, | |||
1607 | int ret = -EOPNOTSUPP; | 1607 | int ret = -EOPNOTSUPP; |
1608 | struct gs_dev *dev = get_gadget_data(gadget); | 1608 | struct gs_dev *dev = get_gadget_data(gadget); |
1609 | struct usb_request *req = dev->dev_ctrl_req; | 1609 | struct usb_request *req = dev->dev_ctrl_req; |
1610 | u16 wIndex = ctrl->wIndex; | 1610 | u16 wIndex = le16_to_cpu(ctrl->wIndex); |
1611 | u16 wValue = ctrl->wValue; | 1611 | u16 wValue = le16_to_cpu(ctrl->wValue); |
1612 | u16 wLength = ctrl->wLength; | 1612 | u16 wLength = le16_to_cpu(ctrl->wLength); |
1613 | 1613 | ||
1614 | switch (ctrl->bRequestType & USB_TYPE_MASK) { | 1614 | switch (ctrl->bRequestType & USB_TYPE_MASK) { |
1615 | case USB_TYPE_STANDARD: | 1615 | case USB_TYPE_STANDARD: |
@@ -1651,9 +1651,9 @@ static int gs_setup_standard(struct usb_gadget *gadget, | |||
1651 | int ret = -EOPNOTSUPP; | 1651 | int ret = -EOPNOTSUPP; |
1652 | struct gs_dev *dev = get_gadget_data(gadget); | 1652 | struct gs_dev *dev = get_gadget_data(gadget); |
1653 | struct usb_request *req = dev->dev_ctrl_req; | 1653 | struct usb_request *req = dev->dev_ctrl_req; |
1654 | u16 wIndex = ctrl->wIndex; | 1654 | u16 wIndex = le16_to_cpu(ctrl->wIndex); |
1655 | u16 wValue = ctrl->wValue; | 1655 | u16 wValue = le16_to_cpu(ctrl->wValue); |
1656 | u16 wLength = ctrl->wLength; | 1656 | u16 wLength = le16_to_cpu(ctrl->wLength); |
1657 | 1657 | ||
1658 | switch (ctrl->bRequest) { | 1658 | switch (ctrl->bRequest) { |
1659 | case USB_REQ_GET_DESCRIPTOR: | 1659 | case USB_REQ_GET_DESCRIPTOR: |
@@ -1782,9 +1782,9 @@ static int gs_setup_class(struct usb_gadget *gadget, | |||
1782 | struct gs_dev *dev = get_gadget_data(gadget); | 1782 | struct gs_dev *dev = get_gadget_data(gadget); |
1783 | struct gs_port *port = dev->dev_port[0]; /* ACM only has one port */ | 1783 | struct gs_port *port = dev->dev_port[0]; /* ACM only has one port */ |
1784 | struct usb_request *req = dev->dev_ctrl_req; | 1784 | struct usb_request *req = dev->dev_ctrl_req; |
1785 | u16 wIndex = ctrl->wIndex; | 1785 | u16 wIndex = le16_to_cpu(ctrl->wIndex); |
1786 | u16 wValue = ctrl->wValue; | 1786 | u16 wValue = le16_to_cpu(ctrl->wValue); |
1787 | u16 wLength = ctrl->wLength; | 1787 | u16 wLength = le16_to_cpu(ctrl->wLength); |
1788 | 1788 | ||
1789 | switch (ctrl->bRequest) { | 1789 | switch (ctrl->bRequest) { |
1790 | case USB_CDC_REQ_SET_LINE_CODING: | 1790 | case USB_CDC_REQ_SET_LINE_CODING: |
@@ -2119,7 +2119,8 @@ static int gs_build_config_buf(u8 *buf, enum usb_device_speed speed, | |||
2119 | * Allocate a usb_request and its buffer. Returns a pointer to the | 2119 | * Allocate a usb_request and its buffer. Returns a pointer to the |
2120 | * usb_request or NULL if there is an error. | 2120 | * usb_request or NULL if there is an error. |
2121 | */ | 2121 | */ |
2122 | static struct usb_request *gs_alloc_req(struct usb_ep *ep, unsigned int len, int kmalloc_flags) | 2122 | static struct usb_request * |
2123 | gs_alloc_req(struct usb_ep *ep, unsigned int len, unsigned kmalloc_flags) | ||
2123 | { | 2124 | { |
2124 | struct usb_request *req; | 2125 | struct usb_request *req; |
2125 | 2126 | ||
@@ -2159,7 +2160,8 @@ static void gs_free_req(struct usb_ep *ep, struct usb_request *req) | |||
2159 | * Allocates a request and its buffer, using the given | 2160 | * Allocates a request and its buffer, using the given |
2160 | * endpoint, buffer len, and kmalloc flags. | 2161 | * endpoint, buffer len, and kmalloc flags. |
2161 | */ | 2162 | */ |
2162 | static struct gs_req_entry *gs_alloc_req_entry(struct usb_ep *ep, unsigned len, int kmalloc_flags) | 2163 | static struct gs_req_entry * |
2164 | gs_alloc_req_entry(struct usb_ep *ep, unsigned len, unsigned kmalloc_flags) | ||
2163 | { | 2165 | { |
2164 | struct gs_req_entry *req; | 2166 | struct gs_req_entry *req; |
2165 | 2167 | ||
@@ -2200,7 +2202,7 @@ static void gs_free_req_entry(struct usb_ep *ep, struct gs_req_entry *req) | |||
2200 | * | 2202 | * |
2201 | * The device lock is normally held when calling this function. | 2203 | * The device lock is normally held when calling this function. |
2202 | */ | 2204 | */ |
2203 | static int gs_alloc_ports(struct gs_dev *dev, int kmalloc_flags) | 2205 | static int gs_alloc_ports(struct gs_dev *dev, unsigned kmalloc_flags) |
2204 | { | 2206 | { |
2205 | int i; | 2207 | int i; |
2206 | struct gs_port *port; | 2208 | struct gs_port *port; |
@@ -2282,7 +2284,7 @@ static void gs_free_ports(struct gs_dev *dev) | |||
2282 | * | 2284 | * |
2283 | * Allocate a circular buffer and all associated memory. | 2285 | * Allocate a circular buffer and all associated memory. |
2284 | */ | 2286 | */ |
2285 | static struct gs_buf *gs_buf_alloc(unsigned int size, int kmalloc_flags) | 2287 | static struct gs_buf *gs_buf_alloc(unsigned int size, unsigned kmalloc_flags) |
2286 | { | 2288 | { |
2287 | struct gs_buf *gb; | 2289 | struct gs_buf *gb; |
2288 | 2290 | ||