aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget
diff options
context:
space:
mode:
authorJeff Garzik <jgarzik@pobox.com>2006-02-02 01:12:54 -0500
committerJeff Garzik <jgarzik@pobox.com>2006-02-02 01:12:54 -0500
commit18ee3610040a4c008ce08a40a5dd025241cc7e97 (patch)
tree32a996a5123726b63c31a1522f230933fb967a32 /drivers/usb/gadget
parente4e7b89280d1d666e2c09e5ad36cf071796c4c7e (diff)
parentb4103333d7904310d34de18d85e51e3d74f00a3b (diff)
Merge branch 'master'
Diffstat (limited to 'drivers/usb/gadget')
-rw-r--r--drivers/usb/gadget/inode.c8
-rw-r--r--drivers/usb/gadget/net2280.c1
-rw-r--r--drivers/usb/gadget/zero.c8
3 files changed, 13 insertions, 4 deletions
diff --git a/drivers/usb/gadget/inode.c b/drivers/usb/gadget/inode.c
index 9a4edc5657aa..0aab7d24c768 100644
--- a/drivers/usb/gadget/inode.c
+++ b/drivers/usb/gadget/inode.c
@@ -135,6 +135,7 @@ struct dev_data {
135 setup_out_ready : 1, 135 setup_out_ready : 1,
136 setup_out_error : 1, 136 setup_out_error : 1,
137 setup_abort : 1; 137 setup_abort : 1;
138 unsigned setup_wLength;
138 139
139 /* the rest is basically write-once */ 140 /* the rest is basically write-once */
140 struct usb_config_descriptor *config, *hs_config; 141 struct usb_config_descriptor *config, *hs_config;
@@ -942,6 +943,7 @@ static int setup_req (struct usb_ep *ep, struct usb_request *req, u16 len)
942 } 943 }
943 req->complete = ep0_complete; 944 req->complete = ep0_complete;
944 req->length = len; 945 req->length = len;
946 req->zero = 0;
945 return 0; 947 return 0;
946} 948}
947 949
@@ -1161,10 +1163,13 @@ ep0_write (struct file *fd, const char __user *buf, size_t len, loff_t *ptr)
1161 spin_unlock_irq (&dev->lock); 1163 spin_unlock_irq (&dev->lock);
1162 if (copy_from_user (dev->req->buf, buf, len)) 1164 if (copy_from_user (dev->req->buf, buf, len))
1163 retval = -EFAULT; 1165 retval = -EFAULT;
1164 else 1166 else {
1167 if (len < dev->setup_wLength)
1168 dev->req->zero = 1;
1165 retval = usb_ep_queue ( 1169 retval = usb_ep_queue (
1166 dev->gadget->ep0, dev->req, 1170 dev->gadget->ep0, dev->req,
1167 GFP_KERNEL); 1171 GFP_KERNEL);
1172 }
1168 if (retval < 0) { 1173 if (retval < 0) {
1169 spin_lock_irq (&dev->lock); 1174 spin_lock_irq (&dev->lock);
1170 clean_req (dev->gadget->ep0, dev->req); 1175 clean_req (dev->gadget->ep0, dev->req);
@@ -1483,6 +1488,7 @@ unrecognized:
1483delegate: 1488delegate:
1484 dev->setup_in = (ctrl->bRequestType & USB_DIR_IN) 1489 dev->setup_in = (ctrl->bRequestType & USB_DIR_IN)
1485 ? 1 : 0; 1490 ? 1 : 0;
1491 dev->setup_wLength = w_length;
1486 dev->setup_out_ready = 0; 1492 dev->setup_out_ready = 0;
1487 dev->setup_out_error = 0; 1493 dev->setup_out_error = 0;
1488 value = 0; 1494 value = 0;
diff --git a/drivers/usb/gadget/net2280.c b/drivers/usb/gadget/net2280.c
index c32e1f7476da..67b13ab2f3f5 100644
--- a/drivers/usb/gadget/net2280.c
+++ b/drivers/usb/gadget/net2280.c
@@ -47,6 +47,7 @@
47#include <linux/config.h> 47#include <linux/config.h>
48#include <linux/module.h> 48#include <linux/module.h>
49#include <linux/pci.h> 49#include <linux/pci.h>
50#include <linux/dma-mapping.h>
50#include <linux/kernel.h> 51#include <linux/kernel.h>
51#include <linux/delay.h> 52#include <linux/delay.h>
52#include <linux/ioport.h> 53#include <linux/ioport.h>
diff --git a/drivers/usb/gadget/zero.c b/drivers/usb/gadget/zero.c
index 2fc110d3ad5a..ae7a1c0f5748 100644
--- a/drivers/usb/gadget/zero.c
+++ b/drivers/usb/gadget/zero.c
@@ -165,8 +165,8 @@ static unsigned buflen = 4096;
165static unsigned qlen = 32; 165static unsigned qlen = 32;
166static unsigned pattern = 0; 166static unsigned pattern = 0;
167 167
168module_param (buflen, uint, S_IRUGO|S_IWUSR); 168module_param (buflen, uint, S_IRUGO);
169module_param (qlen, uint, S_IRUGO|S_IWUSR); 169module_param (qlen, uint, S_IRUGO);
170module_param (pattern, uint, S_IRUGO|S_IWUSR); 170module_param (pattern, uint, S_IRUGO|S_IWUSR);
171 171
172/* 172/*
@@ -1127,8 +1127,10 @@ zero_unbind (struct usb_gadget *gadget)
1127 DBG (dev, "unbind\n"); 1127 DBG (dev, "unbind\n");
1128 1128
1129 /* we've already been disconnected ... no i/o is active */ 1129 /* we've already been disconnected ... no i/o is active */
1130 if (dev->req) 1130 if (dev->req) {
1131 dev->req->length = USB_BUFSIZ;
1131 free_ep_req (gadget->ep0, dev->req); 1132 free_ep_req (gadget->ep0, dev->req);
1133 }
1132 del_timer_sync (&dev->resume); 1134 del_timer_sync (&dev->resume);
1133 kfree (dev); 1135 kfree (dev);
1134 set_gadget_data (gadget, NULL); 1136 set_gadget_data (gadget, NULL);