Commit 8bd51cce authored by Linus Torvalds's avatar Linus Torvalds

Merge master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6

* master.kernel.org:/pub/scm/linux/kernel/git/bart/ide-2.6:
  ide: add "optical" to sysfs "media" attribute
  ide: ugly messages trying to open CD drive with no media present
  ide: correctly prevent IDE timer expiry function to run if request was already handled
parents 9631eb0b a7a832de
...@@ -735,6 +735,15 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) ...@@ -735,6 +735,15 @@ static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
cdrom_saw_media_change (drive); cdrom_saw_media_change (drive);
/*printk("%s: media changed\n",drive->name);*/ /*printk("%s: media changed\n",drive->name);*/
return 0; return 0;
} else if ((sense_key == ILLEGAL_REQUEST) &&
(rq->cmd[0] == GPCMD_START_STOP_UNIT)) {
/*
* Don't print error message for this condition--
* SFF8090i indicates that 5/24/00 is the correct
* response to a request to close the tray if the
* drive doesn't have that capability.
* cdrom_log_sense() knows this!
*/
} else if (!(rq->cmd_flags & REQ_QUIET)) { } else if (!(rq->cmd_flags & REQ_QUIET)) {
/* Otherwise, print an error. */ /* Otherwise, print an error. */
ide_dump_status(drive, "packet command error", stat); ide_dump_status(drive, "packet command error", stat);
......
...@@ -1226,6 +1226,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq) ...@@ -1226,6 +1226,7 @@ static void ide_do_request (ide_hwgroup_t *hwgroup, int masked_irq)
#endif #endif
/* so that ide_timer_expiry knows what to do */ /* so that ide_timer_expiry knows what to do */
hwgroup->sleeping = 1; hwgroup->sleeping = 1;
hwgroup->req_gen_timer = hwgroup->req_gen;
mod_timer(&hwgroup->timer, sleep); mod_timer(&hwgroup->timer, sleep);
/* we purposely leave hwgroup->busy==1 /* we purposely leave hwgroup->busy==1
* while sleeping */ * while sleeping */
...@@ -1411,7 +1412,8 @@ void ide_timer_expiry (unsigned long data) ...@@ -1411,7 +1412,8 @@ void ide_timer_expiry (unsigned long data)
spin_lock_irqsave(&ide_lock, flags); spin_lock_irqsave(&ide_lock, flags);
if ((handler = hwgroup->handler) == NULL) { if (((handler = hwgroup->handler) == NULL) ||
(hwgroup->req_gen != hwgroup->req_gen_timer)) {
/* /*
* Either a marginal timeout occurred * Either a marginal timeout occurred
* (got the interrupt just as timer expired), * (got the interrupt just as timer expired),
...@@ -1439,6 +1441,7 @@ void ide_timer_expiry (unsigned long data) ...@@ -1439,6 +1441,7 @@ void ide_timer_expiry (unsigned long data)
if ((wait = expiry(drive)) > 0) { if ((wait = expiry(drive)) > 0) {
/* reset timer */ /* reset timer */
hwgroup->timer.expires = jiffies + wait; hwgroup->timer.expires = jiffies + wait;
hwgroup->req_gen_timer = hwgroup->req_gen;
add_timer(&hwgroup->timer); add_timer(&hwgroup->timer);
spin_unlock_irqrestore(&ide_lock, flags); spin_unlock_irqrestore(&ide_lock, flags);
return; return;
...@@ -1653,6 +1656,7 @@ irqreturn_t ide_intr (int irq, void *dev_id) ...@@ -1653,6 +1656,7 @@ irqreturn_t ide_intr (int irq, void *dev_id)
printk(KERN_ERR "%s: ide_intr: hwgroup->busy was 0 ??\n", drive->name); printk(KERN_ERR "%s: ide_intr: hwgroup->busy was 0 ??\n", drive->name);
} }
hwgroup->handler = NULL; hwgroup->handler = NULL;
hwgroup->req_gen++;
del_timer(&hwgroup->timer); del_timer(&hwgroup->timer);
spin_unlock(&ide_lock); spin_unlock(&ide_lock);
......
...@@ -889,6 +889,7 @@ static void __ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, ...@@ -889,6 +889,7 @@ static void __ide_set_handler (ide_drive_t *drive, ide_handler_t *handler,
hwgroup->handler = handler; hwgroup->handler = handler;
hwgroup->expiry = expiry; hwgroup->expiry = expiry;
hwgroup->timer.expires = jiffies + timeout; hwgroup->timer.expires = jiffies + timeout;
hwgroup->req_gen_timer = hwgroup->req_gen;
add_timer(&hwgroup->timer); add_timer(&hwgroup->timer);
} }
...@@ -929,6 +930,7 @@ void ide_execute_command(ide_drive_t *drive, task_ioreg_t cmd, ide_handler_t *ha ...@@ -929,6 +930,7 @@ void ide_execute_command(ide_drive_t *drive, task_ioreg_t cmd, ide_handler_t *ha
hwgroup->handler = handler; hwgroup->handler = handler;
hwgroup->expiry = expiry; hwgroup->expiry = expiry;
hwgroup->timer.expires = jiffies + timeout; hwgroup->timer.expires = jiffies + timeout;
hwgroup->req_gen_timer = hwgroup->req_gen;
add_timer(&hwgroup->timer); add_timer(&hwgroup->timer);
hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG); hwif->OUTBSYNC(drive, cmd, IDE_COMMAND_REG);
/* Drive takes 400nS to respond, we must avoid the IRQ being /* Drive takes 400nS to respond, we must avoid the IRQ being
......
...@@ -1962,6 +1962,8 @@ static char *media_string(ide_drive_t *drive) ...@@ -1962,6 +1962,8 @@ static char *media_string(ide_drive_t *drive)
return "tape"; return "tape";
case ide_floppy: case ide_floppy:
return "floppy"; return "floppy";
case ide_optical:
return "optical";
default: default:
return "UNKNOWN"; return "UNKNOWN";
} }
......
...@@ -861,6 +861,8 @@ typedef struct hwgroup_s { ...@@ -861,6 +861,8 @@ typedef struct hwgroup_s {
int (*expiry)(ide_drive_t *); int (*expiry)(ide_drive_t *);
/* ide_system_bus_speed */ /* ide_system_bus_speed */
int pio_clock; int pio_clock;
int req_gen;
int req_gen_timer;
unsigned char cmd_buf[4]; unsigned char cmd_buf[4];
} ide_hwgroup_t; } ide_hwgroup_t;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment