diff options
author | Daniel Hillenbrand <codeworkx@cyanogenmod.org> | 2013-06-24 07:28:50 -0700 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2013-06-24 07:28:50 -0700 |
commit | 5b3cb3ccc3df3b6106b5ae91f1ca77fcb1d99064 (patch) | |
tree | 9813c4c1831c63e580685a10cb63f1f3ab7c85cd /drivers | |
parent | dedc6146fcc87366872b4b1b92865e15d4554e1d (diff) | |
parent | eaa90408a32181bc47bc35bfbd7017dff3a58dc6 (diff) | |
download | kernel_samsung_smdk4412-5b3cb3ccc3df3b6106b5ae91f1ca77fcb1d99064.tar.gz kernel_samsung_smdk4412-5b3cb3ccc3df3b6106b5ae91f1ca77fcb1d99064.tar.bz2 kernel_samsung_smdk4412-5b3cb3ccc3df3b6106b5ae91f1ca77fcb1d99064.zip |
Merge "USB: f_mass_storage: 2048 block size for cdrom devices" into cm-10.1
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/usb/gadget/f_mass_storage.c | 21 | ||||
-rw-r--r-- | drivers/usb/gadget/storage_common.c | 9 |
2 files changed, 13 insertions, 17 deletions
diff --git a/drivers/usb/gadget/f_mass_storage.c b/drivers/usb/gadget/f_mass_storage.c index 884caa86c76..7f37fe2e425 100644 --- a/drivers/usb/gadget/f_mass_storage.c +++ b/drivers/usb/gadget/f_mass_storage.c @@ -1074,7 +1074,11 @@ static int do_read(struct fsg_common *common) curlun->sense_data = SS_LOGICAL_BLOCK_ADDRESS_OUT_OF_RANGE; return -EINVAL; } - file_offset = ((loff_t) lba) << 9; + if (curlun->cdrom) + file_offset = ((loff_t) lba) << 11; + else + file_offset = ((loff_t) lba) << 9; + /* Carry out the file reads */ amount_left = common->data_size_from_cmnd; @@ -1089,6 +1093,8 @@ static int do_read(struct fsg_common *common) bh->inreq->length = 0; return -EIO; /* No default reply */ } + if (curlun->cdrom) + amount_left <<= 2; for (;;) { /* @@ -1663,7 +1669,7 @@ static int do_read_capacity(struct fsg_common *common, struct fsg_buffhd *bh) put_unaligned_be32(curlun->num_sectors - 1, &buf[0]); /* Max logical block */ - put_unaligned_be32(512, &buf[4]); /* Block length */ + put_unaligned_be32(curlun->cdrom ? 2048 : 512, &buf[4]); /* Block length */ return 8; } @@ -1922,7 +1928,7 @@ static int do_read_format_capacities(struct fsg_common *common, put_unaligned_be32(curlun->num_sectors, &buf[0]); /* Number of blocks */ - put_unaligned_be32(512, &buf[4]); /* Block length */ + put_unaligned_be32(curlun->cdrom ? 2048 : 512, &buf[4]); /* Block length */ buf[4] = 0x02; /* Current capacity */ return 12; } @@ -2472,16 +2478,7 @@ static int do_scsi_command(struct fsg_common *common) common->data_size_from_cmnd = get_unaligned_be16(&common->cmnd[7]); reply = check_command(common, 10, DATA_DIR_TO_HOST, -#if defined(CONFIG_USB_CDFS_SUPPORT) -#ifdef _SUPPORT_MAC_ (0xf<<6) | (1<<1), 1, -#else - (7<<6) | (1<<1), 1, -#endif -#else - (7<<6) | (1<<1), 1, -#endif - "READ TOC"); if (reply == 0) reply = do_read_toc(common, bh); diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c index 0c7f16b46e4..79a2b6b89dc 100644 --- a/drivers/usb/gadget/storage_common.c +++ b/drivers/usb/gadget/storage_common.c @@ -701,10 +701,10 @@ static int fsg_lun_open(struct fsg_lun *curlun, const char *filename) num_sectors = size >> 9; /* File size in 512-byte blocks */ min_sectors = 1; if (curlun->cdrom) { - num_sectors &= ~3; /* Reduce to a multiple of 2048 */ - min_sectors = 300*4; /* Smallest track is 300 frames */ - if (num_sectors >= 256*60*75*4) { - num_sectors = (256*60*75 - 1) * 4; + num_sectors >>= 2; /* Reduce to a multiple of 2048 */ + min_sectors = 300; /* Smallest track is 300 frames */ + if (num_sectors >= 256*60*75) { + num_sectors = (256*60*75 - 1); LINFO(curlun, "file too big: %s\n", filename); LINFO(curlun, "using only first %d blocks\n", (int) num_sectors); @@ -759,7 +759,6 @@ static void store_cdrom_address(u8 *dest, int msf, u32 addr) { if (msf) { /* Convert to Minutes-Seconds-Frames */ - addr >>= 2; /* Convert to 2048-byte frames */ addr += 2*75; /* Lead-in occupies 2 seconds */ dest[3] = addr % 75; /* Frames */ addr /= 75; |