Merge remote-tracking branch 'usb-gadget/next'
[deliverable/linux.git] / drivers / usb / gadget / function / f_mass_storage.c
index 2505117e88e8bad0f1ce98a49498731634ceaf88..8f3659b65f5313303140c7f56100ea4c8cb30b1a 100644 (file)
@@ -311,11 +311,7 @@ struct fsg_common {
        /* Gadget's private data. */
        void                    *private_data;
 
-       /*
-        * Vendor (8 chars), product (16 chars), release (4
-        * hexadecimal digits) and NUL byte
-        */
-       char inquiry_string[8 + 16 + 4 + 1];
+       char inquiry_string[INQUIRY_STRING_LEN];
 
        struct kref             ref;
 };
@@ -1107,7 +1103,12 @@ static int do_inquiry(struct fsg_common *common, struct fsg_buffhd *bh)
        buf[5] = 0;             /* No special options */
        buf[6] = 0;
        buf[7] = 0;
-       memcpy(buf + 8, common->inquiry_string, sizeof common->inquiry_string);
+       if (curlun->inquiry_string[0])
+               memcpy(buf + 8, curlun->inquiry_string,
+                      sizeof(curlun->inquiry_string));
+       else
+               memcpy(buf + 8, common->inquiry_string,
+                      sizeof(common->inquiry_string));
        return 36;
 }
 
@@ -3209,12 +3210,27 @@ static ssize_t fsg_lun_opts_nofua_store(struct config_item *item,
 
 CONFIGFS_ATTR(fsg_lun_opts_, nofua);
 
+static ssize_t fsg_lun_opts_inquiry_string_show(struct config_item *item,
+                                               char *page)
+{
+       return fsg_show_inquiry_string(to_fsg_lun_opts(item)->lun, page);
+}
+
+static ssize_t fsg_lun_opts_inquiry_string_store(struct config_item *item,
+                                                const char *page, size_t len)
+{
+       return fsg_store_inquiry_string(to_fsg_lun_opts(item)->lun, page, len);
+}
+
+CONFIGFS_ATTR(fsg_lun_opts_, inquiry_string);
+
 static struct configfs_attribute *fsg_lun_attrs[] = {
        &fsg_lun_opts_attr_file,
        &fsg_lun_opts_attr_ro,
        &fsg_lun_opts_attr_removable,
        &fsg_lun_opts_attr_cdrom,
        &fsg_lun_opts_attr_nofua,
+       &fsg_lun_opts_attr_inquiry_string,
        NULL,
 };
 
This page took 0.025942 seconds and 5 git commands to generate.