diff options
-rw-r--r-- | drivers/ide/ide-cd.c | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index e19caa1453a3..89a112d513ad 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -1307,6 +1307,7 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity, | |||
1307 | int stat; | 1307 | int stat; |
1308 | unsigned char cmd[BLK_MAX_CDB]; | 1308 | unsigned char cmd[BLK_MAX_CDB]; |
1309 | unsigned len = sizeof(capbuf); | 1309 | unsigned len = sizeof(capbuf); |
1310 | u32 blocklen; | ||
1310 | 1311 | ||
1311 | memset(cmd, 0, BLK_MAX_CDB); | 1312 | memset(cmd, 0, BLK_MAX_CDB); |
1312 | cmd[0] = GPCMD_READ_CDVD_CAPACITY; | 1313 | cmd[0] = GPCMD_READ_CDVD_CAPACITY; |
@@ -1319,23 +1320,24 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity, | |||
1319 | /* | 1320 | /* |
1320 | * Sanity check the given block size | 1321 | * Sanity check the given block size |
1321 | */ | 1322 | */ |
1322 | switch (capbuf.blocklen) { | 1323 | blocklen = be32_to_cpu(capbuf.blocklen); |
1323 | case __constant_cpu_to_be32(512): | 1324 | switch (blocklen) { |
1324 | case __constant_cpu_to_be32(1024): | 1325 | case 512: |
1325 | case __constant_cpu_to_be32(2048): | 1326 | case 1024: |
1326 | case __constant_cpu_to_be32(4096): | 1327 | case 2048: |
1328 | case 4096: | ||
1327 | break; | 1329 | break; |
1328 | default: | 1330 | default: |
1329 | printk(KERN_ERR "%s: weird block size %u\n", | 1331 | printk(KERN_ERR "%s: weird block size %u\n", |
1330 | drive->name, capbuf.blocklen); | 1332 | drive->name, blocklen); |
1331 | printk(KERN_ERR "%s: default to 2kb block size\n", | 1333 | printk(KERN_ERR "%s: default to 2kb block size\n", |
1332 | drive->name); | 1334 | drive->name); |
1333 | capbuf.blocklen = __constant_cpu_to_be32(2048); | 1335 | blocklen = 2048; |
1334 | break; | 1336 | break; |
1335 | } | 1337 | } |
1336 | 1338 | ||
1337 | *capacity = 1 + be32_to_cpu(capbuf.lba); | 1339 | *capacity = 1 + be32_to_cpu(capbuf.lba); |
1338 | *sectors_per_frame = be32_to_cpu(capbuf.blocklen) >> SECTOR_BITS; | 1340 | *sectors_per_frame = blocklen >> SECTOR_BITS; |
1339 | return 0; | 1341 | return 0; |
1340 | } | 1342 | } |
1341 | 1343 | ||