Commit 07868ac7 authored by Alan Stern's avatar Alan Stern Committed by Greg Kroah-Hartman

[PATCH] USB file-storage gadget: clean up endian issues

This patch adds the __le16 data types to the file-storage gadget and
removes some erroneous conversions to little-endian order.
Signed-off-by: default avatarAlan Stern <stern@rowland.harvard.edu>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 5831b7b4
...@@ -250,7 +250,7 @@ ...@@ -250,7 +250,7 @@
#define DRIVER_DESC "File-backed Storage Gadget" #define DRIVER_DESC "File-backed Storage Gadget"
#define DRIVER_NAME "g_file_storage" #define DRIVER_NAME "g_file_storage"
#define DRIVER_VERSION "31 August 2004" #define DRIVER_VERSION "20 October 2004"
static const char longname[] = DRIVER_DESC; static const char longname[] = DRIVER_DESC;
static const char shortname[] = DRIVER_NAME; static const char shortname[] = DRIVER_NAME;
...@@ -430,9 +430,9 @@ MODULE_PARM_DESC(stall, "false to prevent bulk stalls"); ...@@ -430,9 +430,9 @@ MODULE_PARM_DESC(stall, "false to prevent bulk stalls");
/* Command Block Wrapper */ /* Command Block Wrapper */
struct bulk_cb_wrap { struct bulk_cb_wrap {
u32 Signature; // Contains 'USBC' __le32 Signature; // Contains 'USBC'
u32 Tag; // Unique per command id u32 Tag; // Unique per command id
u32 DataTransferLength; // Size of the data __le32 DataTransferLength; // Size of the data
u8 Flags; // Direction in bit 7 u8 Flags; // Direction in bit 7
u8 Lun; // LUN (normally 0) u8 Lun; // LUN (normally 0)
u8 Length; // Of the CDB, <= MAX_COMMAND_SIZE u8 Length; // Of the CDB, <= MAX_COMMAND_SIZE
...@@ -445,9 +445,9 @@ struct bulk_cb_wrap { ...@@ -445,9 +445,9 @@ struct bulk_cb_wrap {
/* Command Status Wrapper */ /* Command Status Wrapper */
struct bulk_cs_wrap { struct bulk_cs_wrap {
u32 Signature; // Should = 'USBS' __le32 Signature; // Should = 'USBS'
u32 Tag; // Same as original command u32 Tag; // Same as original command
u32 Residue; // Amount not transferred __le32 Residue; // Amount not transferred
u8 Status; // See below u8 Status; // See below
}; };
...@@ -3717,30 +3717,30 @@ static int __init check_parameters(struct fsg_dev *fsg) ...@@ -3717,30 +3717,30 @@ static int __init check_parameters(struct fsg_dev *fsg)
if (mod_data.release == 0xffff) { // Parameter wasn't set if (mod_data.release == 0xffff) { // Parameter wasn't set
if (gadget_is_net2280(fsg->gadget)) if (gadget_is_net2280(fsg->gadget))
mod_data.release = __constant_cpu_to_le16(0x0301); mod_data.release = 0x0301;
else if (gadget_is_dummy(fsg->gadget)) else if (gadget_is_dummy(fsg->gadget))
mod_data.release = __constant_cpu_to_le16(0x0302); mod_data.release = 0x0302;
else if (gadget_is_pxa(fsg->gadget)) else if (gadget_is_pxa(fsg->gadget))
mod_data.release = __constant_cpu_to_le16(0x0303); mod_data.release = 0x0303;
else if (gadget_is_sh(fsg->gadget)) else if (gadget_is_sh(fsg->gadget))
mod_data.release = __constant_cpu_to_le16(0x0304); mod_data.release = 0x0304;
/* The sa1100 controller is not supported */ /* The sa1100 controller is not supported */
else if (gadget_is_goku(fsg->gadget)) else if (gadget_is_goku(fsg->gadget))
mod_data.release = __constant_cpu_to_le16(0x0306); mod_data.release = 0x0306;
else if (gadget_is_mq11xx(fsg->gadget)) else if (gadget_is_mq11xx(fsg->gadget))
mod_data.release = __constant_cpu_to_le16(0x0307); mod_data.release = 0x0307;
else if (gadget_is_omap(fsg->gadget)) else if (gadget_is_omap(fsg->gadget))
mod_data.release = __constant_cpu_to_le16(0x0308); mod_data.release = 0x0308;
else if (gadget_is_lh7a40x(fsg->gadget)) else if (gadget_is_lh7a40x(fsg->gadget))
mod_data.release = __constant_cpu_to_le16 (0x0309); mod_data.release = 0x0309;
else if (gadget_is_n9604(fsg->gadget)) else if (gadget_is_n9604(fsg->gadget))
mod_data.release = __constant_cpu_to_le16 (0x0310); mod_data.release = 0x0310;
else { else {
WARN(fsg, "controller '%s' not recognized\n", WARN(fsg, "controller '%s' not recognized\n",
fsg->gadget->name); fsg->gadget->name);
mod_data.release = __constant_cpu_to_le16(0x0399); mod_data.release = 0x0399;
} }
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment