aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/storage
diff options
context:
space:
mode:
authorSebastian Andrzej Siewior <bigeasy@linutronix.de>2012-02-25 12:28:10 -0500
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-02-28 14:07:42 -0500
commitb8db6d6402ddca1c78a27407fbd10a6ccb23ab14 (patch)
tree4e9dfe7724cb2332f083f4dd0a3a4b5576c0e28a /drivers/usb/storage
parent7ac4704c099125214a4f0a4bd54ce94d15be2ffb (diff)
usb/storage: redefine US_BULK_FLAG_IN and use it
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>
Diffstat (limited to 'drivers/usb/storage')
-rw-r--r--drivers/usb/storage/ene_ub6250.c26
-rw-r--r--drivers/usb/storage/realtek_cr.c4
-rw-r--r--drivers/usb/storage/transport.c3
3 files changed, 17 insertions, 16 deletions
diff --git a/drivers/usb/storage/ene_ub6250.c b/drivers/usb/storage/ene_ub6250.c
index 30532d93eecc..e7e678109500 100644
--- a/drivers/usb/storage/ene_ub6250.c
+++ b/drivers/usb/storage/ene_ub6250.c
@@ -674,7 +674,7 @@ static int sd_scsi_read(struct us_data *us, struct scsi_cmnd *srb)
674 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 674 memset(bcb, 0, sizeof(struct bulk_cb_wrap));
675 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 675 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
676 bcb->DataTransferLength = blenByte; 676 bcb->DataTransferLength = blenByte;
677 bcb->Flags = 0x80; 677 bcb->Flags = US_BULK_FLAG_IN;
678 bcb->CDB[0] = 0xF1; 678 bcb->CDB[0] = 0xF1;
679 bcb->CDB[5] = (unsigned char)(bnByte); 679 bcb->CDB[5] = (unsigned char)(bnByte);
680 bcb->CDB[4] = (unsigned char)(bnByte>>8); 680 bcb->CDB[4] = (unsigned char)(bnByte>>8);
@@ -858,7 +858,7 @@ static int ms_read_readpage(struct us_data *us, u32 PhyBlockAddr,
858 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 858 memset(bcb, 0, sizeof(struct bulk_cb_wrap));
859 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 859 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
860 bcb->DataTransferLength = 0x200; 860 bcb->DataTransferLength = 0x200;
861 bcb->Flags = 0x80; 861 bcb->Flags = US_BULK_FLAG_IN;
862 bcb->CDB[0] = 0xF1; 862 bcb->CDB[0] = 0xF1;
863 863
864 bcb->CDB[1] = 0x02; /* in init.c ENE_MSInit() is 0x01 */ 864 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,
877 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 877 memset(bcb, 0, sizeof(struct bulk_cb_wrap));
878 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 878 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
879 bcb->DataTransferLength = 0x4; 879 bcb->DataTransferLength = 0x4;
880 bcb->Flags = 0x80; 880 bcb->Flags = US_BULK_FLAG_IN;
881 bcb->CDB[0] = 0xF1; 881 bcb->CDB[0] = 0xF1;
882 bcb->CDB[1] = 0x03; 882 bcb->CDB[1] = 0x03;
883 883
@@ -1170,7 +1170,7 @@ static int ms_read_eraseblock(struct us_data *us, u32 PhyBlockAddr)
1170 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 1170 memset(bcb, 0, sizeof(struct bulk_cb_wrap));
1171 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 1171 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
1172 bcb->DataTransferLength = 0x200; 1172 bcb->DataTransferLength = 0x200;
1173 bcb->Flags = 0x80; 1173 bcb->Flags = US_BULK_FLAG_IN;
1174 bcb->CDB[0] = 0xF2; 1174 bcb->CDB[0] = 0xF2;
1175 bcb->CDB[1] = 0x06; 1175 bcb->CDB[1] = 0x06;
1176 bcb->CDB[4] = (unsigned char)(bn); 1176 bcb->CDB[4] = (unsigned char)(bn);
@@ -1249,7 +1249,7 @@ static int ms_lib_overwrite_extra(struct us_data *us, u32 PhyBlockAddr,
1249 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 1249 memset(bcb, 0, sizeof(struct bulk_cb_wrap));
1250 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 1250 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
1251 bcb->DataTransferLength = 0x4; 1251 bcb->DataTransferLength = 0x4;
1252 bcb->Flags = 0x80; 1252 bcb->Flags = US_BULK_FLAG_IN;
1253 bcb->CDB[0] = 0xF2; 1253 bcb->CDB[0] = 0xF2;
1254 bcb->CDB[1] = 0x05; 1254 bcb->CDB[1] = 0x05;
1255 bcb->CDB[5] = (unsigned char)(PageNum); 1255 bcb->CDB[5] = (unsigned char)(PageNum);
@@ -1331,7 +1331,7 @@ static int ms_lib_read_extra(struct us_data *us, u32 PhyBlock,
1331 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 1331 memset(bcb, 0, sizeof(struct bulk_cb_wrap));
1332 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 1332 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
1333 bcb->DataTransferLength = 0x4; 1333 bcb->DataTransferLength = 0x4;
1334 bcb->Flags = 0x80; 1334 bcb->Flags = US_BULK_FLAG_IN;
1335 bcb->CDB[0] = 0xF1; 1335 bcb->CDB[0] = 0xF1;
1336 bcb->CDB[1] = 0x03; 1336 bcb->CDB[1] = 0x03;
1337 bcb->CDB[5] = (unsigned char)(PageNum); 1337 bcb->CDB[5] = (unsigned char)(PageNum);
@@ -1533,7 +1533,7 @@ static int ms_lib_read_extrablock(struct us_data *us, u32 PhyBlock,
1533 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 1533 memset(bcb, 0, sizeof(struct bulk_cb_wrap));
1534 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 1534 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
1535 bcb->DataTransferLength = 0x4 * blen; 1535 bcb->DataTransferLength = 0x4 * blen;
1536 bcb->Flags = 0x80; 1536 bcb->Flags = US_BULK_FLAG_IN;
1537 bcb->CDB[0] = 0xF1; 1537 bcb->CDB[0] = 0xF1;
1538 bcb->CDB[1] = 0x03; 1538 bcb->CDB[1] = 0x03;
1539 bcb->CDB[5] = (unsigned char)(PageNum); 1539 bcb->CDB[5] = (unsigned char)(PageNum);
@@ -1650,7 +1650,7 @@ static int ms_scsi_read(struct us_data *us, struct scsi_cmnd *srb)
1650 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 1650 memset(bcb, 0, sizeof(struct bulk_cb_wrap));
1651 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 1651 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
1652 bcb->DataTransferLength = blenByte; 1652 bcb->DataTransferLength = blenByte;
1653 bcb->Flags = 0x80; 1653 bcb->Flags = US_BULK_FLAG_IN;
1654 bcb->CDB[0] = 0xF1; 1654 bcb->CDB[0] = 0xF1;
1655 bcb->CDB[1] = 0x02; 1655 bcb->CDB[1] = 0x02;
1656 bcb->CDB[5] = (unsigned char)(bn); 1656 bcb->CDB[5] = (unsigned char)(bn);
@@ -1694,7 +1694,7 @@ static int ms_scsi_read(struct us_data *us, struct scsi_cmnd *srb)
1694 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 1694 memset(bcb, 0, sizeof(struct bulk_cb_wrap));
1695 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 1695 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
1696 bcb->DataTransferLength = 0x200 * len; 1696 bcb->DataTransferLength = 0x200 * len;
1697 bcb->Flags = 0x80; 1697 bcb->Flags = US_BULK_FLAG_IN;
1698 bcb->CDB[0] = 0xF1; 1698 bcb->CDB[0] = 0xF1;
1699 bcb->CDB[1] = 0x02; 1699 bcb->CDB[1] = 0x02;
1700 bcb->CDB[5] = (unsigned char)(blkno); 1700 bcb->CDB[5] = (unsigned char)(blkno);
@@ -1827,7 +1827,7 @@ static int ene_get_card_type(struct us_data *us, u16 index, void *buf)
1827 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 1827 memset(bcb, 0, sizeof(struct bulk_cb_wrap));
1828 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 1828 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
1829 bcb->DataTransferLength = 0x01; 1829 bcb->DataTransferLength = 0x01;
1830 bcb->Flags = 0x80; 1830 bcb->Flags = US_BULK_FLAG_IN;
1831 bcb->CDB[0] = 0xED; 1831 bcb->CDB[0] = 0xED;
1832 bcb->CDB[2] = (unsigned char)(index>>8); 1832 bcb->CDB[2] = (unsigned char)(index>>8);
1833 bcb->CDB[3] = (unsigned char)index; 1833 bcb->CDB[3] = (unsigned char)index;
@@ -2083,7 +2083,7 @@ static int ene_ms_init(struct us_data *us)
2083 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 2083 memset(bcb, 0, sizeof(struct bulk_cb_wrap));
2084 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 2084 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
2085 bcb->DataTransferLength = 0x200; 2085 bcb->DataTransferLength = 0x200;
2086 bcb->Flags = 0x80; 2086 bcb->Flags = US_BULK_FLAG_IN;
2087 bcb->CDB[0] = 0xF1; 2087 bcb->CDB[0] = 0xF1;
2088 bcb->CDB[1] = 0x01; 2088 bcb->CDB[1] = 0x01;
2089 2089
@@ -2134,7 +2134,7 @@ static int ene_sd_init(struct us_data *us)
2134 2134
2135 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 2135 memset(bcb, 0, sizeof(struct bulk_cb_wrap));
2136 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 2136 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
2137 bcb->Flags = 0x80; 2137 bcb->Flags = US_BULK_FLAG_IN;
2138 bcb->CDB[0] = 0xF2; 2138 bcb->CDB[0] = 0xF2;
2139 2139
2140 result = ene_send_scsi_cmd(us, FDIR_READ, NULL, 0); 2140 result = ene_send_scsi_cmd(us, FDIR_READ, NULL, 0);
@@ -2153,7 +2153,7 @@ static int ene_sd_init(struct us_data *us)
2153 memset(bcb, 0, sizeof(struct bulk_cb_wrap)); 2153 memset(bcb, 0, sizeof(struct bulk_cb_wrap));
2154 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 2154 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
2155 bcb->DataTransferLength = 0x200; 2155 bcb->DataTransferLength = 0x200;
2156 bcb->Flags = 0x80; 2156 bcb->Flags = US_BULK_FLAG_IN;
2157 bcb->CDB[0] = 0xF1; 2157 bcb->CDB[0] = 0xF1;
2158 2158
2159 result = ene_send_scsi_cmd(us, FDIR_READ, &buf, 0); 2159 result = ene_send_scsi_cmd(us, FDIR_READ, &buf, 0);
diff --git a/drivers/usb/storage/realtek_cr.c b/drivers/usb/storage/realtek_cr.c
index 84a4bc0cbee4..63cf2822e299 100644
--- a/drivers/usb/storage/realtek_cr.c
+++ b/drivers/usb/storage/realtek_cr.c
@@ -219,7 +219,7 @@ static int rts51x_bulk_transport(struct us_data *us, u8 lun,
219 /* set up the command wrapper */ 219 /* set up the command wrapper */
220 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 220 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
221 bcb->DataTransferLength = cpu_to_le32(buf_len); 221 bcb->DataTransferLength = cpu_to_le32(buf_len);
222 bcb->Flags = (dir == DMA_FROM_DEVICE) ? 1 << 7 : 0; 222 bcb->Flags = (dir == DMA_FROM_DEVICE) ? US_BULK_FLAG_IN : 0;
223 bcb->Tag = ++us->tag; 223 bcb->Tag = ++us->tag;
224 bcb->Lun = lun; 224 bcb->Lun = lun;
225 bcb->Length = cmd_len; 225 bcb->Length = cmd_len;
@@ -305,7 +305,7 @@ static int rts51x_bulk_transport_special(struct us_data *us, u8 lun,
305 /* set up the command wrapper */ 305 /* set up the command wrapper */
306 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 306 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
307 bcb->DataTransferLength = cpu_to_le32(buf_len); 307 bcb->DataTransferLength = cpu_to_le32(buf_len);
308 bcb->Flags = (dir == DMA_FROM_DEVICE) ? 1 << 7 : 0; 308 bcb->Flags = (dir == DMA_FROM_DEVICE) ? US_BULK_FLAG_IN : 0;
309 bcb->Tag = ++us->tag; 309 bcb->Tag = ++us->tag;
310 bcb->Lun = lun; 310 bcb->Lun = lun;
311 bcb->Length = cmd_len; 311 bcb->Length = cmd_len;
diff --git a/drivers/usb/storage/transport.c b/drivers/usb/storage/transport.c
index 0e5c91c6187f..c70109e5d60b 100644
--- a/drivers/usb/storage/transport.c
+++ b/drivers/usb/storage/transport.c
@@ -1071,7 +1071,8 @@ int usb_stor_Bulk_transport(struct scsi_cmnd *srb, struct us_data *us)
1071 /* set up the command wrapper */ 1071 /* set up the command wrapper */
1072 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN); 1072 bcb->Signature = cpu_to_le32(US_BULK_CB_SIGN);
1073 bcb->DataTransferLength = cpu_to_le32(transfer_length); 1073 bcb->DataTransferLength = cpu_to_le32(transfer_length);
1074 bcb->Flags = srb->sc_data_direction == DMA_FROM_DEVICE ? 1 << 7 : 0; 1074 bcb->Flags = srb->sc_data_direction == DMA_FROM_DEVICE ?
1075 US_BULK_FLAG_IN : 0;
1075 bcb->Tag = ++us->tag; 1076 bcb->Tag = ++us->tag;
1076 bcb->Lun = srb->device->lun; 1077 bcb->Lun = srb->device->lun;
1077 if (us->fflags & US_FL_SCM_MULT_TARG) 1078 if (us->fflags & US_FL_SCM_MULT_TARG)