Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 107649
b: refs/heads/master
c: 938bb03
h: refs/heads/master
i:
  107647: f317d16
v: v3
  • Loading branch information
Petr Tesarik authored and Bartlomiej Zolnierkiewicz committed Aug 5, 2008
1 parent 06572a6 commit b61bb4b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 9 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: c5bfc3757f1d843a8e1261840c1f53c5062f8e92
refs/heads/master: 938bb03d188a1e688fb0bcae49788f540193e80a
18 changes: 10 additions & 8 deletions trunk/drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -1307,6 +1307,7 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
int stat;
unsigned char cmd[BLK_MAX_CDB];
unsigned len = sizeof(capbuf);
u32 blocklen;

memset(cmd, 0, BLK_MAX_CDB);
cmd[0] = GPCMD_READ_CDVD_CAPACITY;
Expand All @@ -1319,23 +1320,24 @@ static int cdrom_read_capacity(ide_drive_t *drive, unsigned long *capacity,
/*
* Sanity check the given block size
*/
switch (capbuf.blocklen) {
case __constant_cpu_to_be32(512):
case __constant_cpu_to_be32(1024):
case __constant_cpu_to_be32(2048):
case __constant_cpu_to_be32(4096):
blocklen = be32_to_cpu(capbuf.blocklen);
switch (blocklen) {
case 512:
case 1024:
case 2048:
case 4096:
break;
default:
printk(KERN_ERR "%s: weird block size %u\n",
drive->name, capbuf.blocklen);
drive->name, blocklen);
printk(KERN_ERR "%s: default to 2kb block size\n",
drive->name);
capbuf.blocklen = __constant_cpu_to_be32(2048);
blocklen = 2048;
break;
}

*capacity = 1 + be32_to_cpu(capbuf.lba);
*sectors_per_frame = be32_to_cpu(capbuf.blocklen) >> SECTOR_BITS;
*sectors_per_frame = blocklen >> SECTOR_BITS;
return 0;
}

Expand Down

0 comments on commit b61bb4b

Please sign in to comment.