Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 98914
b: refs/heads/master
c: 62858da
h: refs/heads/master
v: v3
  • Loading branch information
FUJITA Tomonori authored and Jens Axboe committed Jul 4, 2008
1 parent 0676c0d commit 0318576
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 16 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: 30c00eda73d5db5bd64dd0c370161abd8df5ba4a
refs/heads/master: 62858dacc8dea55c5bdb474ccd8acb0657e23dd0
20 changes: 5 additions & 15 deletions trunk/drivers/scsi/sr.c
Original file line number Diff line number Diff line change
Expand Up @@ -673,24 +673,20 @@ static int sr_probe(struct device *dev)
static void get_sectorsize(struct scsi_cd *cd)
{
unsigned char cmd[10];
unsigned char *buffer;
unsigned char buffer[8];
int the_result, retries = 3;
int sector_size;
struct request_queue *queue;

buffer = kmalloc(512, GFP_KERNEL | GFP_DMA);
if (!buffer)
goto Enomem;

do {
cmd[0] = READ_CAPACITY;
memset((void *) &cmd[1], 0, 9);
memset(buffer, 0, 8);
memset(buffer, 0, sizeof(buffer));

/* Do the command and wait.. */
the_result = scsi_execute_req(cd->device, cmd, DMA_FROM_DEVICE,
buffer, 8, NULL, SR_TIMEOUT,
MAX_RETRIES);
buffer, sizeof(buffer), NULL,
SR_TIMEOUT, MAX_RETRIES);

retries--;

Expand Down Expand Up @@ -745,14 +741,8 @@ static void get_sectorsize(struct scsi_cd *cd)

queue = cd->device->request_queue;
blk_queue_hardsect_size(queue, sector_size);
out:
kfree(buffer);
return;

Enomem:
cd->capacity = 0x1fffff;
cd->device->sector_size = 2048; /* A guess, just in case */
goto out;
return;
}

static void get_capabilities(struct scsi_cd *cd)
Expand Down

0 comments on commit 0318576

Please sign in to comment.