aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:46 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2009-03-27 07:46:46 -0400
commit60c0cd02b254805691cdc61101ada6af7bd56fde (patch)
tree1b600eb9f22034824bf21377041f470c09af09c7
parentb788ee9c6561fd9219a503216284d61036a0dc0b (diff)
ide: set hwif->expiry prior to calling [__]ide_set_handler()
* Set hwif->expiry prior to calling [__]ide_set_handler() and drop 'expiry' argument. * Set hwif->expiry to NULL in ide_{timer_expiry,intr}() and remove 'hwif->expiry = NULL' assignments. There should be no functional changes caused by this patch. Acked-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-atapi.c6
-rw-r--r--drivers/ide/ide-cd.c3
-rw-r--r--drivers/ide/ide-eh.c9
-rw-r--r--drivers/ide/ide-io.c2
-rw-r--r--drivers/ide/ide-iops.c13
-rw-r--r--drivers/ide/ide-taskfile.c6
-rw-r--r--include/linux/ide.h6
7 files changed, 24 insertions, 21 deletions
diff --git a/drivers/ide/ide-atapi.c b/drivers/ide/ide-atapi.c
index 75df05add1b9..f1b1b71cb74c 100644
--- a/drivers/ide/ide-atapi.c
+++ b/drivers/ide/ide-atapi.c
@@ -483,7 +483,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
483 rq->cmd[0], bcount); 483 rq->cmd[0], bcount);
484next_irq: 484next_irq:
485 /* And set the interrupt handler again */ 485 /* And set the interrupt handler again */
486 ide_set_handler(drive, ide_pc_intr, timeout, NULL); 486 ide_set_handler(drive, ide_pc_intr, timeout);
487 return ide_started; 487 return ide_started;
488} 488}
489 489
@@ -602,11 +602,13 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive)
602 } 602 }
603 } 603 }
604 604
605 hwif->expiry = expiry;
606
605 /* Set the interrupt routine */ 607 /* Set the interrupt routine */
606 ide_set_handler(drive, 608 ide_set_handler(drive,
607 (dev_is_idecd(drive) ? drive->irq_handler 609 (dev_is_idecd(drive) ? drive->irq_handler
608 : ide_pc_intr), 610 : ide_pc_intr),
609 timeout, expiry); 611 timeout);
610 612
611 /* Begin DMA, if necessary */ 613 /* Begin DMA, if necessary */
612 if (dev_is_idecd(drive)) { 614 if (dev_is_idecd(drive)) {
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index a6c847d31b9d..3f630e4080d4 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -959,7 +959,8 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
959 expiry = ide_cd_expiry; 959 expiry = ide_cd_expiry;
960 } 960 }
961 961
962 ide_set_handler(drive, cdrom_newpc_intr, timeout, expiry); 962 hwif->expiry = expiry;
963 ide_set_handler(drive, cdrom_newpc_intr, timeout);
963 return ide_started; 964 return ide_started;
964 965
965end_request: 966end_request:
diff --git a/drivers/ide/ide-eh.c b/drivers/ide/ide-eh.c
index aff1a9b04559..11664976eea3 100644
--- a/drivers/ide/ide-eh.c
+++ b/drivers/ide/ide-eh.c
@@ -175,8 +175,7 @@ static ide_startstop_t atapi_reset_pollfunc(ide_drive_t *drive)
175 printk(KERN_INFO "%s: ATAPI reset complete\n", drive->name); 175 printk(KERN_INFO "%s: ATAPI reset complete\n", drive->name);
176 else { 176 else {
177 if (time_before(jiffies, hwif->poll_timeout)) { 177 if (time_before(jiffies, hwif->poll_timeout)) {
178 ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, 178 ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20);
179 NULL);
180 /* continue polling */ 179 /* continue polling */
181 return ide_started; 180 return ide_started;
182 } 181 }
@@ -238,7 +237,7 @@ static ide_startstop_t reset_pollfunc(ide_drive_t *drive)
238 237
239 if (!OK_STAT(tmp, 0, ATA_BUSY)) { 238 if (!OK_STAT(tmp, 0, ATA_BUSY)) {
240 if (time_before(jiffies, hwif->poll_timeout)) { 239 if (time_before(jiffies, hwif->poll_timeout)) {
241 ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL); 240 ide_set_handler(drive, &reset_pollfunc, HZ/20);
242 /* continue polling */ 241 /* continue polling */
243 return ide_started; 242 return ide_started;
244 } 243 }
@@ -355,7 +354,7 @@ static ide_startstop_t do_reset1(ide_drive_t *drive, int do_not_try_atapi)
355 ndelay(400); 354 ndelay(400);
356 hwif->poll_timeout = jiffies + WAIT_WORSTCASE; 355 hwif->poll_timeout = jiffies + WAIT_WORSTCASE;
357 hwif->polling = 1; 356 hwif->polling = 1;
358 __ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, NULL); 357 __ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20);
359 spin_unlock_irqrestore(&hwif->lock, flags); 358 spin_unlock_irqrestore(&hwif->lock, flags);
360 return ide_started; 359 return ide_started;
361 } 360 }
@@ -415,7 +414,7 @@ static ide_startstop_t do_reset1(ide_drive_t *drive, int do_not_try_atapi)
415 udelay(10); 414 udelay(10);
416 hwif->poll_timeout = jiffies + WAIT_WORSTCASE; 415 hwif->poll_timeout = jiffies + WAIT_WORSTCASE;
417 hwif->polling = 1; 416 hwif->polling = 1;
418 __ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL); 417 __ide_set_handler(drive, &reset_pollfunc, HZ/20);
419 418
420 /* 419 /*
421 * Some weird controller like resetting themselves to a strange 420 * Some weird controller like resetting themselves to a strange
diff --git a/drivers/ide/ide-io.c b/drivers/ide/ide-io.c
index 47404f5526f1..b4901b690c9a 100644
--- a/drivers/ide/ide-io.c
+++ b/drivers/ide/ide-io.c
@@ -651,6 +651,7 @@ void ide_timer_expiry (unsigned long data)
651 } 651 }
652 } 652 }
653 hwif->handler = NULL; 653 hwif->handler = NULL;
654 hwif->expiry = NULL;
654 /* 655 /*
655 * We need to simulate a real interrupt when invoking 656 * We need to simulate a real interrupt when invoking
656 * the handler() function, which means we need to 657 * the handler() function, which means we need to
@@ -830,6 +831,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
830 goto out; 831 goto out;
831 832
832 hwif->handler = NULL; 833 hwif->handler = NULL;
834 hwif->expiry = NULL;
833 hwif->req_gen++; 835 hwif->req_gen++;
834 del_timer(&hwif->timer); 836 del_timer(&hwif->timer);
835 spin_unlock(&hwif->lock); 837 spin_unlock(&hwif->lock);
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index c3023de7270c..916495ba45df 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -425,26 +425,25 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
425 * See also ide_execute_command 425 * See also ide_execute_command
426 */ 426 */
427void __ide_set_handler(ide_drive_t *drive, ide_handler_t *handler, 427void __ide_set_handler(ide_drive_t *drive, ide_handler_t *handler,
428 unsigned int timeout, ide_expiry_t *expiry) 428 unsigned int timeout)
429{ 429{
430 ide_hwif_t *hwif = drive->hwif; 430 ide_hwif_t *hwif = drive->hwif;
431 431
432 BUG_ON(hwif->handler); 432 BUG_ON(hwif->handler);
433 hwif->handler = handler; 433 hwif->handler = handler;
434 hwif->expiry = expiry;
435 hwif->timer.expires = jiffies + timeout; 434 hwif->timer.expires = jiffies + timeout;
436 hwif->req_gen_timer = hwif->req_gen; 435 hwif->req_gen_timer = hwif->req_gen;
437 add_timer(&hwif->timer); 436 add_timer(&hwif->timer);
438} 437}
439 438
440void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, 439void ide_set_handler(ide_drive_t *drive, ide_handler_t *handler,
441 unsigned int timeout, ide_expiry_t *expiry) 440 unsigned int timeout)
442{ 441{
443 ide_hwif_t *hwif = drive->hwif; 442 ide_hwif_t *hwif = drive->hwif;
444 unsigned long flags; 443 unsigned long flags;
445 444
446 spin_lock_irqsave(&hwif->lock, flags); 445 spin_lock_irqsave(&hwif->lock, flags);
447 __ide_set_handler(drive, handler, timeout, expiry); 446 __ide_set_handler(drive, handler, timeout);
448 spin_unlock_irqrestore(&hwif->lock, flags); 447 spin_unlock_irqrestore(&hwif->lock, flags);
449} 448}
450EXPORT_SYMBOL(ide_set_handler); 449EXPORT_SYMBOL(ide_set_handler);
@@ -469,8 +468,10 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler,
469 ide_hwif_t *hwif = drive->hwif; 468 ide_hwif_t *hwif = drive->hwif;
470 unsigned long flags; 469 unsigned long flags;
471 470
471 hwif->expiry = expiry;
472
472 spin_lock_irqsave(&hwif->lock, flags); 473 spin_lock_irqsave(&hwif->lock, flags);
473 __ide_set_handler(drive, handler, timeout, expiry); 474 __ide_set_handler(drive, handler, timeout);
474 hwif->tp_ops->exec_command(hwif, cmd); 475 hwif->tp_ops->exec_command(hwif, cmd);
475 /* 476 /*
476 * Drive takes 400nS to respond, we must avoid the IRQ being 477 * Drive takes 400nS to respond, we must avoid the IRQ being
diff --git a/drivers/ide/ide-taskfile.c b/drivers/ide/ide-taskfile.c
index 63ab233ba942..286804142e4d 100644
--- a/drivers/ide/ide-taskfile.c
+++ b/drivers/ide/ide-taskfile.c
@@ -140,7 +140,7 @@ static ide_startstop_t task_no_data_intr(ide_drive_t *drive)
140 } else if (custom && tf->command == ATA_CMD_INIT_DEV_PARAMS) { 140 } else if (custom && tf->command == ATA_CMD_INIT_DEV_PARAMS) {
141 if ((stat & (ATA_ERR | ATA_DRQ)) == 0) { 141 if ((stat & (ATA_ERR | ATA_DRQ)) == 0) {
142 ide_set_handler(drive, &task_no_data_intr, 142 ide_set_handler(drive, &task_no_data_intr,
143 WAIT_WORSTCASE, NULL); 143 WAIT_WORSTCASE);
144 return ide_started; 144 return ide_started;
145 } 145 }
146 } 146 }
@@ -347,7 +347,7 @@ static ide_startstop_t task_pio_intr(ide_drive_t *drive)
347 } 347 }
348out_wait: 348out_wait:
349 /* Still data left to transfer. */ 349 /* Still data left to transfer. */
350 ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL); 350 ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE);
351 return ide_started; 351 return ide_started;
352out_end: 352out_end:
353 if ((cmd->tf_flags & IDE_TFLAG_FS) == 0) 353 if ((cmd->tf_flags & IDE_TFLAG_FS) == 0)
@@ -377,7 +377,7 @@ static ide_startstop_t pre_task_out_intr(ide_drive_t *drive,
377 if ((drive->dev_flags & IDE_DFLAG_UNMASK) == 0) 377 if ((drive->dev_flags & IDE_DFLAG_UNMASK) == 0)
378 local_irq_disable(); 378 local_irq_disable();
379 379
380 ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE, NULL); 380 ide_set_handler(drive, &task_pio_intr, WAIT_WORSTCASE);
381 381
382 ide_pio_datablock(drive, cmd, 1); 382 ide_pio_datablock(drive, cmd, 1);
383 383
diff --git a/include/linux/ide.h b/include/linux/ide.h
index e339d6646552..476f59885fda 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -1135,10 +1135,8 @@ unsigned int ide_rq_bytes(struct request *);
1135int ide_end_rq(ide_drive_t *, struct request *, int, unsigned int); 1135int ide_end_rq(ide_drive_t *, struct request *, int, unsigned int);
1136void ide_kill_rq(ide_drive_t *, struct request *); 1136void ide_kill_rq(ide_drive_t *, struct request *);
1137 1137
1138void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int, 1138void __ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
1139 ide_expiry_t *); 1139void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int);
1140void ide_set_handler(ide_drive_t *, ide_handler_t *, unsigned int,
1141 ide_expiry_t *);
1142 1140
1143void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, 1141void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int,
1144 ide_expiry_t *); 1142 ide_expiry_t *);