Merge branch 'v4l_for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mchehab...
[pandora-kernel.git] / drivers / usb / gadget / storage_common.c
index 3179b8b..1fa4f70 100644 (file)
@@ -286,6 +286,13 @@ struct fsg_buffhd {
        enum fsg_buffer_state           state;
        struct fsg_buffhd               *next;
 
+       /*
+        * The NetChip 2280 is faster, and handles some protocol faults
+        * better, if we don't submit any short bulk-out read requests.
+        * So we will record the intended request length here.
+        */
+       unsigned int                    bulk_out_intended_length;
+
        struct usb_request              *inreq;
        int                             inreq_busy;
        struct usb_request              *outreq;
@@ -701,13 +708,14 @@ static ssize_t fsg_show_file(struct device *dev, struct device_attribute *attr,
 static ssize_t fsg_store_ro(struct device *dev, struct device_attribute *attr,
                            const char *buf, size_t count)
 {
-       ssize_t         rc = count;
+       ssize_t         rc;
        struct fsg_lun  *curlun = fsg_lun_from_dev(dev);
        struct rw_semaphore     *filesem = dev_get_drvdata(dev);
-       unsigned long   ro;
+       unsigned        ro;
 
-       if (strict_strtoul(buf, 2, &ro))
-               return -EINVAL;
+       rc = kstrtouint(buf, 2, &ro);
+       if (rc)
+               return rc;
 
        /*
         * Allow the write-enable status to change only while the
@@ -721,6 +729,7 @@ static ssize_t fsg_store_ro(struct device *dev, struct device_attribute *attr,
                curlun->ro = ro;
                curlun->initially_ro = ro;
                LDBG(curlun, "read-only status set to %d\n", curlun->ro);
+               rc = count;
        }
        up_read(filesem);
        return rc;
@@ -731,10 +740,12 @@ static ssize_t fsg_store_nofua(struct device *dev,
                               const char *buf, size_t count)
 {
        struct fsg_lun  *curlun = fsg_lun_from_dev(dev);
-       unsigned long   nofua;
+       unsigned        nofua;
+       int             ret;
 
-       if (strict_strtoul(buf, 2, &nofua))
-               return -EINVAL;
+       ret = kstrtouint(buf, 2, &nofua);
+       if (ret)
+               return ret;
 
        /* Sync data when switching from async mode to sync */
        if (!nofua && curlun->nofua)