diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-29 23:07:43 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2009-06-29 23:07:43 -0400 |
commit | 5a4f13fad1ab5bd08dea78fc55321e429d83cddf (patch) | |
tree | 4474bf39b945b5a672e940080b17bdcbc04e1d15 /drivers | |
parent | ec9c45d456fd7f1e400c75e6c8040d1deb9d4fff (diff) | |
parent | e18ed145c7f556f1de8350c32739bf35b26df705 (diff) |
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6
* git://git.kernel.org/pub/scm/linux/kernel/git/davem/ide-2.6:
ide: memory overrun in ide_get_identity_ioctl() on big endian machines using ioctl HDIO_OBSOLETE_IDENTITY
ide: fix resume for CONFIG_BLK_DEV_IDEACPI=y
ide-cd: handle fragmented packet commands gracefully
ide: always kill the whole request on error
ide: fix ide_kill_rq() for special ide-{floppy,tape} driver requests
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/ide/ide-acpi.c | 37 | ||||
-rw-r--r-- | drivers/ide/ide-cd.c | 14 | ||||
-rw-r--r-- | drivers/ide/ide-devsets.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-eh.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-floppy.c | 2 | ||||
-rw-r--r-- | drivers/ide/ide-io.c | 14 | ||||
-rw-r--r-- | drivers/ide/ide-ioctls.c | 3 | ||||
-rw-r--r-- | drivers/ide/ide-pm.c | 30 |
8 files changed, 44 insertions, 60 deletions
diff --git a/drivers/ide/ide-acpi.c b/drivers/ide/ide-acpi.c index 77f79d26b264..c509c9916464 100644 --- a/drivers/ide/ide-acpi.c +++ b/drivers/ide/ide-acpi.c | |||
@@ -92,6 +92,11 @@ int ide_acpi_init(void) | |||
92 | return 0; | 92 | return 0; |
93 | } | 93 | } |
94 | 94 | ||
95 | bool ide_port_acpi(ide_hwif_t *hwif) | ||
96 | { | ||
97 | return ide_noacpi == 0 && hwif->acpidata; | ||
98 | } | ||
99 | |||
95 | /** | 100 | /** |
96 | * ide_get_dev_handle - finds acpi_handle and PCI device.function | 101 | * ide_get_dev_handle - finds acpi_handle and PCI device.function |
97 | * @dev: device to locate | 102 | * @dev: device to locate |
@@ -352,9 +357,6 @@ int ide_acpi_exec_tfs(ide_drive_t *drive) | |||
352 | unsigned long gtf_address; | 357 | unsigned long gtf_address; |
353 | unsigned long obj_loc; | 358 | unsigned long obj_loc; |
354 | 359 | ||
355 | if (ide_noacpi) | ||
356 | return 0; | ||
357 | |||
358 | DEBPRINT("call get_GTF, drive=%s port=%d\n", drive->name, drive->dn); | 360 | DEBPRINT("call get_GTF, drive=%s port=%d\n", drive->name, drive->dn); |
359 | 361 | ||
360 | ret = do_drive_get_GTF(drive, >f_length, >f_address, &obj_loc); | 362 | ret = do_drive_get_GTF(drive, >f_length, >f_address, &obj_loc); |
@@ -389,16 +391,6 @@ void ide_acpi_get_timing(ide_hwif_t *hwif) | |||
389 | struct acpi_buffer output; | 391 | struct acpi_buffer output; |
390 | union acpi_object *out_obj; | 392 | union acpi_object *out_obj; |
391 | 393 | ||
392 | if (ide_noacpi) | ||
393 | return; | ||
394 | |||
395 | DEBPRINT("ENTER:\n"); | ||
396 | |||
397 | if (!hwif->acpidata) { | ||
398 | DEBPRINT("no ACPI data for %s\n", hwif->name); | ||
399 | return; | ||
400 | } | ||
401 | |||
402 | /* Setting up output buffer for _GTM */ | 394 | /* Setting up output buffer for _GTM */ |
403 | output.length = ACPI_ALLOCATE_BUFFER; | 395 | output.length = ACPI_ALLOCATE_BUFFER; |
404 | output.pointer = NULL; /* ACPI-CA sets this; save/free it later */ | 396 | output.pointer = NULL; /* ACPI-CA sets this; save/free it later */ |
@@ -479,16 +471,6 @@ void ide_acpi_push_timing(ide_hwif_t *hwif) | |||
479 | struct ide_acpi_drive_link *master = &hwif->acpidata->master; | 471 | struct ide_acpi_drive_link *master = &hwif->acpidata->master; |
480 | struct ide_acpi_drive_link *slave = &hwif->acpidata->slave; | 472 | struct ide_acpi_drive_link *slave = &hwif->acpidata->slave; |
481 | 473 | ||
482 | if (ide_noacpi) | ||
483 | return; | ||
484 | |||
485 | DEBPRINT("ENTER:\n"); | ||
486 | |||
487 | if (!hwif->acpidata) { | ||
488 | DEBPRINT("no ACPI data for %s\n", hwif->name); | ||
489 | return; | ||
490 | } | ||
491 | |||
492 | /* Give the GTM buffer + drive Identify data to the channel via the | 474 | /* Give the GTM buffer + drive Identify data to the channel via the |
493 | * _STM method: */ | 475 | * _STM method: */ |
494 | /* setup input parameters buffer for _STM */ | 476 | /* setup input parameters buffer for _STM */ |
@@ -527,16 +509,11 @@ void ide_acpi_set_state(ide_hwif_t *hwif, int on) | |||
527 | ide_drive_t *drive; | 509 | ide_drive_t *drive; |
528 | int i; | 510 | int i; |
529 | 511 | ||
530 | if (ide_noacpi || ide_noacpi_psx) | 512 | if (ide_noacpi_psx) |
531 | return; | 513 | return; |
532 | 514 | ||
533 | DEBPRINT("ENTER:\n"); | 515 | DEBPRINT("ENTER:\n"); |
534 | 516 | ||
535 | if (!hwif->acpidata) { | ||
536 | DEBPRINT("no ACPI data for %s\n", hwif->name); | ||
537 | return; | ||
538 | } | ||
539 | |||
540 | /* channel first and then drives for power on and verse versa for power off */ | 517 | /* channel first and then drives for power on and verse versa for power off */ |
541 | if (on) | 518 | if (on) |
542 | acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D0); | 519 | acpi_bus_set_power(hwif->acpidata->obj_handle, ACPI_STATE_D0); |
@@ -616,7 +593,7 @@ void ide_acpi_port_init_devices(ide_hwif_t *hwif) | |||
616 | drive->name, err); | 593 | drive->name, err); |
617 | } | 594 | } |
618 | 595 | ||
619 | if (!ide_acpionboot) { | 596 | if (ide_noacpi || ide_acpionboot == 0) { |
620 | DEBPRINT("ACPI methods disabled on boot\n"); | 597 | DEBPRINT("ACPI methods disabled on boot\n"); |
621 | return; | 598 | return; |
622 | } | 599 | } |
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c index f0ede5953af8..6a9a769bffc1 100644 --- a/drivers/ide/ide-cd.c +++ b/drivers/ide/ide-cd.c | |||
@@ -592,9 +592,19 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) | |||
592 | } | 592 | } |
593 | } else if (!blk_pc_request(rq)) { | 593 | } else if (!blk_pc_request(rq)) { |
594 | ide_cd_request_sense_fixup(drive, cmd); | 594 | ide_cd_request_sense_fixup(drive, cmd); |
595 | /* complain if we still have data left to transfer */ | 595 | |
596 | uptodate = cmd->nleft ? 0 : 1; | 596 | uptodate = cmd->nleft ? 0 : 1; |
597 | if (uptodate == 0) | 597 | |
598 | /* | ||
599 | * suck out the remaining bytes from the drive in an | ||
600 | * attempt to complete the data xfer. (see BZ#13399) | ||
601 | */ | ||
602 | if (!(stat & ATA_ERR) && !uptodate && thislen) { | ||
603 | ide_pio_bytes(drive, cmd, write, thislen); | ||
604 | uptodate = cmd->nleft ? 0 : 1; | ||
605 | } | ||
606 | |||
607 | if (!uptodate) | ||
598 | rq->cmd_flags |= REQ_FAILED; | 608 | rq->cmd_flags |= REQ_FAILED; |
599 | } | 609 | } |
600 | goto out_end; | 610 | goto out_end; |
diff --git a/drivers/ide/ide-devsets.c b/drivers/ide/ide-devsets.c index 5bf958e5b1d5..1099bf7cf968 100644 --- a/drivers/ide/ide-devsets.c +++ b/drivers/ide/ide-devsets.c | |||
@@ -183,6 +183,6 @@ ide_startstop_t ide_do_devset(ide_drive_t *drive, struct request *rq) | |||
183 | err = setfunc(drive, *(int *)&rq->cmd[1]); | 183 | err = setfunc(drive, *(int *)&rq->cmd[1]); |
184 | if (err) | 184 | if (err) |
185 | rq->errors = err; | 185 | rq->errors = err; |
186 | ide_complete_rq(drive, err, ide_rq_bytes(rq)); | 186 | ide_complete_rq(drive, err, blk_rq_bytes(rq)); |
187 | return ide_stopped; | 187 | return ide_stopped; |
188 | } | 188 | } |
diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c index 2b9141979613..e9abf2c3c335 100644 --- a/drivers/ide/ide-eh.c +++ b/drivers/ide/ide-eh.c | |||
@@ -149,7 +149,7 @@ static inline void ide_complete_drive_reset(ide_drive_t *drive, int err) | |||
149 | if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET) { | 149 | if (rq && blk_special_request(rq) && rq->cmd[0] == REQ_DRIVE_RESET) { |
150 | if (err <= 0 && rq->errors == 0) | 150 | if (err <= 0 && rq->errors == 0) |
151 | rq->errors = -EIO; | 151 | rq->errors = -EIO; |
152 | ide_complete_rq(drive, err ? err : 0, ide_rq_bytes(rq)); | 152 | ide_complete_rq(drive, err ? err : 0, blk_rq_bytes(rq)); |
153 | } | 153 | } |
154 | } | 154 | } |
155 | 155 | ||
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c index 8b3f204f7d73..fefbdfc8db06 100644 --- a/drivers/ide/ide-floppy.c +++ b/drivers/ide/ide-floppy.c | |||
@@ -293,7 +293,7 @@ out_end: | |||
293 | drive->failed_pc = NULL; | 293 | drive->failed_pc = NULL; |
294 | if (blk_fs_request(rq) == 0 && rq->errors == 0) | 294 | if (blk_fs_request(rq) == 0 && rq->errors == 0) |
295 | rq->errors = -EIO; | 295 | rq->errors = -EIO; |
296 | ide_complete_rq(drive, -EIO, ide_rq_bytes(rq)); | 296 | ide_complete_rq(drive, -EIO, blk_rq_bytes(rq)); |
297 | return ide_stopped; | 297 | return ide_stopped; |
298 | } | 298 | } |
299 | 299 | ||
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c index 93b7886a2d6e..d5f3c77beadd 100644 --- a/drivers/ide/ide-io.c +++ b/drivers/ide/ide-io.c | |||
@@ -112,16 +112,6 @@ void ide_complete_cmd(ide_drive_t *drive, struct ide_cmd *cmd, u8 stat, u8 err) | |||
112 | } | 112 | } |
113 | } | 113 | } |
114 | 114 | ||
115 | /* obsolete, blk_rq_bytes() should be used instead */ | ||
116 | unsigned int ide_rq_bytes(struct request *rq) | ||
117 | { | ||
118 | if (blk_pc_request(rq)) | ||
119 | return blk_rq_bytes(rq); | ||
120 | else | ||
121 | return blk_rq_cur_sectors(rq) << 9; | ||
122 | } | ||
123 | EXPORT_SYMBOL_GPL(ide_rq_bytes); | ||
124 | |||
125 | int ide_complete_rq(ide_drive_t *drive, int error, unsigned int nr_bytes) | 115 | int ide_complete_rq(ide_drive_t *drive, int error, unsigned int nr_bytes) |
126 | { | 116 | { |
127 | ide_hwif_t *hwif = drive->hwif; | 117 | ide_hwif_t *hwif = drive->hwif; |
@@ -152,14 +142,14 @@ void ide_kill_rq(ide_drive_t *drive, struct request *rq) | |||
152 | 142 | ||
153 | if ((media == ide_floppy || media == ide_tape) && drv_req) { | 143 | if ((media == ide_floppy || media == ide_tape) && drv_req) { |
154 | rq->errors = 0; | 144 | rq->errors = 0; |
155 | ide_complete_rq(drive, 0, blk_rq_bytes(rq)); | ||
156 | } else { | 145 | } else { |
157 | if (media == ide_tape) | 146 | if (media == ide_tape) |
158 | rq->errors = IDE_DRV_ERROR_GENERAL; | 147 | rq->errors = IDE_DRV_ERROR_GENERAL; |
159 | else if (blk_fs_request(rq) == 0 && rq->errors == 0) | 148 | else if (blk_fs_request(rq) == 0 && rq->errors == 0) |
160 | rq->errors = -EIO; | 149 | rq->errors = -EIO; |
161 | ide_complete_rq(drive, -EIO, ide_rq_bytes(rq)); | ||
162 | } | 150 | } |
151 | |||
152 | ide_complete_rq(drive, -EIO, blk_rq_bytes(rq)); | ||
163 | } | 153 | } |
164 | 154 | ||
165 | static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf) | 155 | static void ide_tf_set_specify_cmd(ide_drive_t *drive, struct ide_taskfile *tf) |
diff --git a/drivers/ide/ide-ioctls.c b/drivers/ide/ide-ioctls.c index 82f252c3ee6e..e246d3d3fbcc 100644 --- a/drivers/ide/ide-ioctls.c +++ b/drivers/ide/ide-ioctls.c | |||
@@ -64,7 +64,8 @@ static int ide_get_identity_ioctl(ide_drive_t *drive, unsigned int cmd, | |||
64 | goto out; | 64 | goto out; |
65 | } | 65 | } |
66 | 66 | ||
67 | id = kmalloc(size, GFP_KERNEL); | 67 | /* ata_id_to_hd_driveid() relies on 'id' to be fully allocated. */ |
68 | id = kmalloc(ATA_ID_WORDS * 2, GFP_KERNEL); | ||
68 | if (id == NULL) { | 69 | if (id == NULL) { |
69 | rc = -ENOMEM; | 70 | rc = -ENOMEM; |
70 | goto out; | 71 | goto out; |
diff --git a/drivers/ide/ide-pm.c b/drivers/ide/ide-pm.c index c14ca144cffe..ad7be2669dcb 100644 --- a/drivers/ide/ide-pm.c +++ b/drivers/ide/ide-pm.c | |||
@@ -10,9 +10,11 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) | |||
10 | struct request_pm_state rqpm; | 10 | struct request_pm_state rqpm; |
11 | int ret; | 11 | int ret; |
12 | 12 | ||
13 | /* call ACPI _GTM only once */ | 13 | if (ide_port_acpi(hwif)) { |
14 | if ((drive->dn & 1) == 0 || pair == NULL) | 14 | /* call ACPI _GTM only once */ |
15 | ide_acpi_get_timing(hwif); | 15 | if ((drive->dn & 1) == 0 || pair == NULL) |
16 | ide_acpi_get_timing(hwif); | ||
17 | } | ||
16 | 18 | ||
17 | memset(&rqpm, 0, sizeof(rqpm)); | 19 | memset(&rqpm, 0, sizeof(rqpm)); |
18 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); | 20 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); |
@@ -26,9 +28,11 @@ int generic_ide_suspend(struct device *dev, pm_message_t mesg) | |||
26 | ret = blk_execute_rq(drive->queue, NULL, rq, 0); | 28 | ret = blk_execute_rq(drive->queue, NULL, rq, 0); |
27 | blk_put_request(rq); | 29 | blk_put_request(rq); |
28 | 30 | ||
29 | /* call ACPI _PS3 only after both devices are suspended */ | 31 | if (ret == 0 && ide_port_acpi(hwif)) { |
30 | if (ret == 0 && ((drive->dn & 1) || pair == NULL)) | 32 | /* call ACPI _PS3 only after both devices are suspended */ |
31 | ide_acpi_set_state(hwif, 0); | 33 | if ((drive->dn & 1) || pair == NULL) |
34 | ide_acpi_set_state(hwif, 0); | ||
35 | } | ||
32 | 36 | ||
33 | return ret; | 37 | return ret; |
34 | } | 38 | } |
@@ -42,13 +46,15 @@ int generic_ide_resume(struct device *dev) | |||
42 | struct request_pm_state rqpm; | 46 | struct request_pm_state rqpm; |
43 | int err; | 47 | int err; |
44 | 48 | ||
45 | /* call ACPI _PS0 / _STM only once */ | 49 | if (ide_port_acpi(hwif)) { |
46 | if ((drive->dn & 1) == 0 || pair == NULL) { | 50 | /* call ACPI _PS0 / _STM only once */ |
47 | ide_acpi_set_state(hwif, 1); | 51 | if ((drive->dn & 1) == 0 || pair == NULL) { |
48 | ide_acpi_push_timing(hwif); | 52 | ide_acpi_set_state(hwif, 1); |
49 | } | 53 | ide_acpi_push_timing(hwif); |
54 | } | ||
50 | 55 | ||
51 | ide_acpi_exec_tfs(drive); | 56 | ide_acpi_exec_tfs(drive); |
57 | } | ||
52 | 58 | ||
53 | memset(&rqpm, 0, sizeof(rqpm)); | 59 | memset(&rqpm, 0, sizeof(rqpm)); |
54 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); | 60 | rq = blk_get_request(drive->queue, READ, __GFP_WAIT); |