diff options
Diffstat (limited to 'drivers/usb/gadget/f_mass_storage.c')
-rw-r--r-- | drivers/usb/gadget/f_mass_storage.c | 72 |
1 files changed, 36 insertions, 36 deletions
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 44e5ffed5c08..838286b1cd14 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -741,7 +741,7 @@ static int do_read(struct fsg_common *common) /* Get the starting Logical Block Address and check that it's * not too big */ - if (common->cmnd[0] == SC_READ_6) + if (common->cmnd[0] == READ_6) lba = get_unaligned_be24(&common->cmnd[1]); else { lba = get_unaligned_be32(&common->cmnd[2]); @@ -879,7 +879,7 @@ static int do_write(struct fsg_common *common) /* Get the starting Logical Block Address and check that it's * not too big */ - if (common->cmnd[0] == SC_WRITE_6) + if (common->cmnd[0] == WRITE_6) lba = get_unaligned_be24(&common->cmnd[1]); else { lba = get_unaligned_be32(&common->cmnd[2]); @@ -1186,7 +1186,7 @@ static int do_inquiry(struct fsg_common *common, struct fsg_buffhd *bh) return 36; } - buf[0] = curlun->cdrom ? TYPE_CDROM : TYPE_DISK; + buf[0] = curlun->cdrom ? TYPE_ROM : TYPE_DISK; buf[1] = curlun->removable ? 0x80 : 0; buf[2] = 2; /* ANSI SCSI level 2 */ buf[3] = 2; /* SCSI-2 INQUIRY data format */ @@ -1353,11 +1353,11 @@ static int do_mode_sense(struct fsg_common *common, struct fsg_buffhd *bh) * The only variable value is the WriteProtect bit. We will fill in * the mode data length later. */ memset(buf, 0, 8); - if (mscmnd == SC_MODE_SENSE_6) { + if (mscmnd == MODE_SENSE) { buf[2] = (curlun->ro ? 0x80 : 0x00); /* WP, DPOFUA */ buf += 4; limit = 255; - } else { /* SC_MODE_SENSE_10 */ + } else { /* MODE_SENSE_10 */ buf[3] = (curlun->ro ? 0x80 : 0x00); /* WP, DPOFUA */ buf += 8; limit = 65535; /* Should really be FSG_BUFLEN */ @@ -1397,7 +1397,7 @@ static int do_mode_sense(struct fsg_common *common, struct fsg_buffhd *bh) } /* Store the mode data length */ - if (mscmnd == SC_MODE_SENSE_6) + if (mscmnd == MODE_SENSE) buf0[0] = len - 1; else put_unaligned_be16(len - 2, buf0); @@ -1886,7 +1886,7 @@ static int check_command(struct fsg_common *common, int cmnd_size, if (common->lun >= 0 && common->lun < common->nluns) { curlun = &common->luns[common->lun]; common->curlun = curlun; - if (common->cmnd[0] != SC_REQUEST_SENSE) { + if (common->cmnd[0] != REQUEST_SENSE) { curlun->sense_data = SS_NO_SENSE; curlun->sense_data_info = 0; curlun->info_valid = 0; @@ -1898,8 +1898,8 @@ static int check_command(struct fsg_common *common, int cmnd_size, /* INQUIRY and REQUEST SENSE commands are explicitly allowed * to use unsupported LUNs; all others may not. */ - if (common->cmnd[0] != SC_INQUIRY && - common->cmnd[0] != SC_REQUEST_SENSE) { + if (common->cmnd[0] != INQUIRY && + common->cmnd[0] != REQUEST_SENSE) { DBG(common, "unsupported LUN %d\n", common->lun); return -EINVAL; } @@ -1908,8 +1908,8 @@ static int check_command(struct fsg_common *common, int cmnd_size, /* If a unit attention condition exists, only INQUIRY and * REQUEST SENSE commands are allowed; anything else must fail. */ if (curlun && curlun->unit_attention_data != SS_NO_SENSE && - common->cmnd[0] != SC_INQUIRY && - common->cmnd[0] != SC_REQUEST_SENSE) { + common->cmnd[0] != INQUIRY && + common->cmnd[0] != REQUEST_SENSE) { curlun->sense_data = curlun->unit_attention_data; curlun->unit_attention_data = SS_NO_SENSE; return -EINVAL; @@ -1960,7 +1960,7 @@ static int do_scsi_command(struct fsg_common *common) down_read(&common->filesem); /* We're using the backing file */ switch (common->cmnd[0]) { - case SC_INQUIRY: + case INQUIRY: common->data_size_from_cmnd = common->cmnd[4]; reply = check_command(common, 6, DATA_DIR_TO_HOST, (1<<4), 0, @@ -1969,7 +1969,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_inquiry(common, bh); break; - case SC_MODE_SELECT_6: + case MODE_SELECT: common->data_size_from_cmnd = common->cmnd[4]; reply = check_command(common, 6, DATA_DIR_FROM_HOST, (1<<1) | (1<<4), 0, @@ -1978,7 +1978,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_mode_select(common, bh); break; - case SC_MODE_SELECT_10: + case MODE_SELECT_10: common->data_size_from_cmnd = get_unaligned_be16(&common->cmnd[7]); reply = check_command(common, 10, DATA_DIR_FROM_HOST, @@ -1988,7 +1988,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_mode_select(common, bh); break; - case SC_MODE_SENSE_6: + case MODE_SENSE: common->data_size_from_cmnd = common->cmnd[4]; reply = check_command(common, 6, DATA_DIR_TO_HOST, (1<<1) | (1<<2) | (1<<4), 0, @@ -1997,7 +1997,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_mode_sense(common, bh); break; - case SC_MODE_SENSE_10: + case MODE_SENSE_10: common->data_size_from_cmnd = get_unaligned_be16(&common->cmnd[7]); reply = check_command(common, 10, DATA_DIR_TO_HOST, @@ -2007,7 +2007,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_mode_sense(common, bh); break; - case SC_PREVENT_ALLOW_MEDIUM_REMOVAL: + case ALLOW_MEDIUM_REMOVAL: common->data_size_from_cmnd = 0; reply = check_command(common, 6, DATA_DIR_NONE, (1<<4), 0, @@ -2016,7 +2016,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_prevent_allow(common); break; - case SC_READ_6: + case READ_6: i = common->cmnd[4]; common->data_size_from_cmnd = (i == 0 ? 256 : i) << 9; reply = check_command(common, 6, DATA_DIR_TO_HOST, @@ -2026,7 +2026,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_read(common); break; - case SC_READ_10: + case READ_10: common->data_size_from_cmnd = get_unaligned_be16(&common->cmnd[7]) << 9; reply = check_command(common, 10, DATA_DIR_TO_HOST, @@ -2036,7 +2036,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_read(common); break; - case SC_READ_12: + case READ_12: common->data_size_from_cmnd = get_unaligned_be32(&common->cmnd[6]) << 9; reply = check_command(common, 12, DATA_DIR_TO_HOST, @@ -2046,7 +2046,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_read(common); break; - case SC_READ_CAPACITY: + case READ_CAPACITY: common->data_size_from_cmnd = 8; reply = check_command(common, 10, DATA_DIR_TO_HOST, (0xf<<2) | (1<<8), 1, @@ -2055,7 +2055,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_read_capacity(common, bh); break; - case SC_READ_HEADER: + case READ_HEADER: if (!common->curlun || !common->curlun->cdrom) goto unknown_cmnd; common->data_size_from_cmnd = @@ -2067,7 +2067,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_read_header(common, bh); break; - case SC_READ_TOC: + case READ_TOC: if (!common->curlun || !common->curlun->cdrom) goto unknown_cmnd; common->data_size_from_cmnd = @@ -2079,7 +2079,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_read_toc(common, bh); break; - case SC_READ_FORMAT_CAPACITIES: + case READ_FORMAT_CAPACITIES: common->data_size_from_cmnd = get_unaligned_be16(&common->cmnd[7]); reply = check_command(common, 10, DATA_DIR_TO_HOST, @@ -2089,7 +2089,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_read_format_capacities(common, bh); break; - case SC_REQUEST_SENSE: + case REQUEST_SENSE: common->data_size_from_cmnd = common->cmnd[4]; reply = check_command(common, 6, DATA_DIR_TO_HOST, (1<<4), 0, @@ -2098,7 +2098,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_request_sense(common, bh); break; - case SC_START_STOP_UNIT: + case START_STOP: common->data_size_from_cmnd = 0; reply = check_command(common, 6, DATA_DIR_NONE, (1<<1) | (1<<4), 0, @@ -2107,7 +2107,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_start_stop(common); break; - case SC_SYNCHRONIZE_CACHE: + case SYNCHRONIZE_CACHE: common->data_size_from_cmnd = 0; reply = check_command(common, 10, DATA_DIR_NONE, (0xf<<2) | (3<<7), 1, @@ -2116,7 +2116,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_synchronize_cache(common); break; - case SC_TEST_UNIT_READY: + case TEST_UNIT_READY: common->data_size_from_cmnd = 0; reply = check_command(common, 6, DATA_DIR_NONE, 0, 1, @@ -2125,7 +2125,7 @@ static int do_scsi_command(struct fsg_common *common) /* Although optional, this command is used by MS-Windows. We * support a minimal version: BytChk must be 0. */ - case SC_VERIFY: + case VERIFY: common->data_size_from_cmnd = 0; reply = check_command(common, 10, DATA_DIR_NONE, (1<<1) | (0xf<<2) | (3<<7), 1, @@ -2134,7 +2134,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_verify(common); break; - case SC_WRITE_6: + case WRITE_6: i = common->cmnd[4]; common->data_size_from_cmnd = (i == 0 ? 256 : i) << 9; reply = check_command(common, 6, DATA_DIR_FROM_HOST, @@ -2144,7 +2144,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_write(common); break; - case SC_WRITE_10: + case WRITE_10: common->data_size_from_cmnd = get_unaligned_be16(&common->cmnd[7]) << 9; reply = check_command(common, 10, DATA_DIR_FROM_HOST, @@ -2154,7 +2154,7 @@ static int do_scsi_command(struct fsg_common *common) reply = do_write(common); break; - case SC_WRITE_12: + case WRITE_12: common->data_size_from_cmnd = get_unaligned_be32(&common->cmnd[6]) << 9; reply = check_command(common, 12, DATA_DIR_FROM_HOST, @@ -2168,10 +2168,10 @@ static int do_scsi_command(struct fsg_common *common) * They don't mean much in this setting. It's left as an exercise * for anyone interested to implement RESERVE and RELEASE in terms * of Posix locks. */ - case SC_FORMAT_UNIT: - case SC_RELEASE: - case SC_RESERVE: - case SC_SEND_DIAGNOSTIC: + case FORMAT_UNIT: + case RELEASE: + case RESERVE: + case SEND_DIAGNOSTIC: /* Fall through */ default: |