aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/usb/gadget/storage_common.c
diff options
context:
space:
mode:
authorFrozenCow <frozencow@gmail.com>2013-02-13 21:41:07 +0100
committerPawit Pornkitprasan <p.pawit@gmail.com>2013-03-03 13:01:44 +0700
commit1736943179733a4629e0eaa773848bdeeaeefec1 (patch)
treecc306f5ddfd684bc943c545bbb63c940b07c203c /drivers/usb/gadget/storage_common.c
parent979aa0d835ddca5fdbaab47bcd9aa7f7d359feb0 (diff)
downloadkernel_samsung_aries-1736943179733a4629e0eaa773848bdeeaeefec1.zip
kernel_samsung_aries-1736943179733a4629e0eaa773848bdeeaeefec1.tar.gz
kernel_samsung_aries-1736943179733a4629e0eaa773848bdeeaeefec1.tar.bz2
USB: f_mass_storage: 2048 block size for cdrom devices
Bios will recognize the cdrom device like most other cdrom devices. This allows people to boot ISOs from their phone. Original by Andreas Kemnade: http://www.spinics.net/lists/linux-usb/msg25178.html Change-Id: Id8fba96e1683f6daa6330b1e59f4a4ca4fe5c271
Diffstat (limited to 'drivers/usb/gadget/storage_common.c')
-rw-r--r--drivers/usb/gadget/storage_common.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/drivers/usb/gadget/storage_common.c b/drivers/usb/gadget/storage_common.c
index 4e64b08..4dfede4 100644
--- a/drivers/usb/gadget/storage_common.c
+++ b/drivers/usb/gadget/storage_common.c
@@ -583,10 +583,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);
@@ -641,7 +641,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;