]> git.openfabrics.org - ~shefty/rdma-dev.git/commitdiff
usb/storage: redefine US_BULK_FLAG_IN and use it
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>
Sat, 25 Feb 2012 17:28:10 +0000 (18:28 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Tue, 28 Feb 2012 19:07:42 +0000 (11:07 -0800)
US_BULK_FLAG_IN is defined as 1 and not used. The USB storage spec says
that bit 7 of flags within CBW defines the data direction. 1 is DATA-IN
(read from device) and 0 is the DATA-OUT. Bit 6 is obselete and bits 0-5
are reserved.
This patch redefines the unsued define US_BULK_FLAG_IN from 1 to 1 << 7
aka 0x80 and replaces the obvious users. In a following patch the
storage gadget will use it as well.

Signed-off-by: Sebastian Andrzej Siewior <bigeasy@linutronix.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/storage/ene_ub6250.c
drivers/usb/storage/realtek_cr.c
drivers/usb/storage/transport.c
include/linux/usb/storage.h

index 30532d93eecc3c1fc9d113df1150c12292ab2840..e7e678109500bd776e7d87ea27d16672166a0a9a 100644 (file)
@@ -674,7 +674,7 @@ static int sd_scsi_read(struct us_data *us, struct scsi_cmnd *srb)
        memset(bcb, 0, sizeof(struct bulk_cb_wrap));
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = blenByte;
-       bcb->Flags  = 0x80;
+       bcb->Flags  = US_BULK_FLAG_IN;
        bcb->CDB[0] = 0xF1;
        bcb->CDB[5] = (unsigned char)(bnByte);
        bcb->CDB[4] = (unsigned char)(bnByte>>8);
@@ -858,7 +858,7 @@ static int ms_read_readpage(struct us_data *us, u32 PhyBlockAddr,
        memset(bcb, 0, sizeof(struct bulk_cb_wrap));
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = 0x200;
-       bcb->Flags      = 0x80;
+       bcb->Flags      = US_BULK_FLAG_IN;
        bcb->CDB[0]     = 0xF1;
 
        bcb->CDB[1]     = 0x02; /* in init.c ENE_MSInit() is 0x01 */
@@ -877,7 +877,7 @@ static int ms_read_readpage(struct us_data *us, u32 PhyBlockAddr,
        memset(bcb, 0, sizeof(struct bulk_cb_wrap));
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = 0x4;
-       bcb->Flags      = 0x80;
+       bcb->Flags      = US_BULK_FLAG_IN;
        bcb->CDB[0]     = 0xF1;
        bcb->CDB[1]     = 0x03;
 
@@ -1170,7 +1170,7 @@ static int ms_read_eraseblock(struct us_data *us, u32 PhyBlockAddr)
        memset(bcb, 0, sizeof(struct bulk_cb_wrap));
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = 0x200;
-       bcb->Flags = 0x80;
+       bcb->Flags = US_BULK_FLAG_IN;
        bcb->CDB[0] = 0xF2;
        bcb->CDB[1] = 0x06;
        bcb->CDB[4] = (unsigned char)(bn);
@@ -1249,7 +1249,7 @@ static int ms_lib_overwrite_extra(struct us_data *us, u32 PhyBlockAddr,
        memset(bcb, 0, sizeof(struct bulk_cb_wrap));
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = 0x4;
-       bcb->Flags = 0x80;
+       bcb->Flags = US_BULK_FLAG_IN;
        bcb->CDB[0] = 0xF2;
        bcb->CDB[1] = 0x05;
        bcb->CDB[5] = (unsigned char)(PageNum);
@@ -1331,7 +1331,7 @@ static int ms_lib_read_extra(struct us_data *us, u32 PhyBlock,
        memset(bcb, 0, sizeof(struct bulk_cb_wrap));
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = 0x4;
-       bcb->Flags      = 0x80;
+       bcb->Flags      = US_BULK_FLAG_IN;
        bcb->CDB[0]     = 0xF1;
        bcb->CDB[1]     = 0x03;
        bcb->CDB[5]     = (unsigned char)(PageNum);
@@ -1533,7 +1533,7 @@ static int ms_lib_read_extrablock(struct us_data *us, u32 PhyBlock,
        memset(bcb, 0, sizeof(struct bulk_cb_wrap));
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = 0x4 * blen;
-       bcb->Flags      = 0x80;
+       bcb->Flags      = US_BULK_FLAG_IN;
        bcb->CDB[0]     = 0xF1;
        bcb->CDB[1]     = 0x03;
        bcb->CDB[5]     = (unsigned char)(PageNum);
@@ -1650,7 +1650,7 @@ static int ms_scsi_read(struct us_data *us, struct scsi_cmnd *srb)
                memset(bcb, 0, sizeof(struct bulk_cb_wrap));
                bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
                bcb->DataTransferLength = blenByte;
-               bcb->Flags  = 0x80;
+               bcb->Flags  = US_BULK_FLAG_IN;
                bcb->CDB[0] = 0xF1;
                bcb->CDB[1] = 0x02;
                bcb->CDB[5] = (unsigned char)(bn);
@@ -1694,7 +1694,7 @@ static int ms_scsi_read(struct us_data *us, struct scsi_cmnd *srb)
                        memset(bcb, 0, sizeof(struct bulk_cb_wrap));
                        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
                        bcb->DataTransferLength = 0x200 * len;
-                       bcb->Flags  = 0x80;
+                       bcb->Flags  = US_BULK_FLAG_IN;
                        bcb->CDB[0] = 0xF1;
                        bcb->CDB[1] = 0x02;
                        bcb->CDB[5] = (unsigned char)(blkno);
@@ -1827,7 +1827,7 @@ static int ene_get_card_type(struct us_data *us, u16 index, void *buf)
        memset(bcb, 0, sizeof(struct bulk_cb_wrap));
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = 0x01;
-       bcb->Flags                      = 0x80;
+       bcb->Flags                      = US_BULK_FLAG_IN;
        bcb->CDB[0]                     = 0xED;
        bcb->CDB[2]                     = (unsigned char)(index>>8);
        bcb->CDB[3]                     = (unsigned char)index;
@@ -2083,7 +2083,7 @@ static int ene_ms_init(struct us_data *us)
        memset(bcb, 0, sizeof(struct bulk_cb_wrap));
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = 0x200;
-       bcb->Flags      = 0x80;
+       bcb->Flags      = US_BULK_FLAG_IN;
        bcb->CDB[0]     = 0xF1;
        bcb->CDB[1]     = 0x01;
 
@@ -2134,7 +2134,7 @@ static int ene_sd_init(struct us_data *us)
 
        memset(bcb, 0, sizeof(struct bulk_cb_wrap));
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
-       bcb->Flags = 0x80;
+       bcb->Flags = US_BULK_FLAG_IN;
        bcb->CDB[0] = 0xF2;
 
        result = ene_send_scsi_cmd(us, FDIR_READ, NULL, 0);
@@ -2153,7 +2153,7 @@ static int ene_sd_init(struct us_data *us)
        memset(bcb, 0, sizeof(struct bulk_cb_wrap));
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = 0x200;
-       bcb->Flags              = 0x80;
+       bcb->Flags              = US_BULK_FLAG_IN;
        bcb->CDB[0]             = 0xF1;
 
        result = ene_send_scsi_cmd(us, FDIR_READ, &buf, 0);
index 84a4bc0cbee417df2fdeebda3d043370dbf8629e..63cf2822e299a6213164feb3a9d426e6ff40ee4a 100644 (file)
@@ -219,7 +219,7 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun,
        /* set up the command wrapper */
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = cpu_to_le32(buf_len);
-       bcb->Flags = (dir == DMA_FROM_DEVICE) ? 1 << 7 : 0;
+       bcb->Flags = (dir == DMA_FROM_DEVICE) ? US_BULK_FLAG_IN : 0;
        bcb->Tag = ++us->tag;
        bcb->Lun = lun;
        bcb->Length = cmd_len;
@@ -305,7 +305,7 @@ static int rts51x_bulk_transport_special(struct us_data *us, u8 lun,
        /* set up the command wrapper */
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = cpu_to_le32(buf_len);
-       bcb->Flags = (dir == DMA_FROM_DEVICE) ? 1 << 7 : 0;
+       bcb->Flags = (dir == DMA_FROM_DEVICE) ? US_BULK_FLAG_IN : 0;
        bcb->Tag = ++us->tag;
        bcb->Lun = lun;
        bcb->Length = cmd_len;
index 0e5c91c6187f1a8f45d3a873f05507c09ab795da..c70109e5d60bb0f409df74187e3dabc5a53f4979 100644 (file)
@@ -1071,7 +1071,8 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
        /* set up the command wrapper */
        bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
        bcb->DataTransferLength = cpu_to_le32(transfer_length);
-       bcb->Flags = srb->sc_data_direction == DMA_FROM_DEVICE ? 1 << 7 : 0;
+       bcb->Flags = srb->sc_data_direction == DMA_FROM_DEVICE ?
+               US_BULK_FLAG_IN : 0;
        bcb->Tag = ++us->tag;
        bcb->Lun = srb->device->lun;
        if (us->fflags & US_FL_SCM_MULT_TARG)
index 87a94bf34d4764913515a2db06f720c074197212..4de58b15fad63b082d8c410493e36697c34dcf05 100644 (file)
@@ -62,7 +62,7 @@ struct bulk_cb_wrap {
 
 #define US_BULK_CB_WRAP_LEN    31
 #define US_BULK_CB_SIGN                0x43425355      /*spells out USBC */
-#define US_BULK_FLAG_IN                1
+#define US_BULK_FLAG_IN                (1 << 7)
 #define US_BULK_FLAG_OUT       0
 
 /* command status wrapper */