Commit 8a5e2be9 authored by Tejun Heo's avatar Tejun Heo Committed by Bartlomiej Zolnierkiewicz

[ide] add ide_hwgroup_t.polling

ide_hwgroup_t.polling field added.  0 in poll_timeout field
used to indicate inactive polling but because 0 is a valid
jiffy value, though slim, there's a chance that something
weird can happen.
Signed-off-by: default avatarTejun Heo <tj@home-tj.org>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent dda8f422
......@@ -1314,7 +1314,7 @@ void ide_timer_expiry (unsigned long data)
/* local CPU only,
* as if we were handling an interrupt */
local_irq_disable();
if (hwgroup->poll_timeout != 0) {
if (hwgroup->polling) {
startstop = handler(drive);
} else if (drive_is_ready(drive)) {
if (drive->waiting_for_dma)
......@@ -1442,8 +1442,7 @@ irqreturn_t ide_intr (int irq, void *dev_id, struct pt_regs *regs)
return IRQ_NONE;
}
if ((handler = hwgroup->handler) == NULL ||
hwgroup->poll_timeout != 0) {
if ((handler = hwgroup->handler) == NULL || hwgroup->polling) {
/*
* Not expecting an interrupt from this drive.
* That means this could be:
......
......@@ -1023,14 +1023,14 @@ static ide_startstop_t atapi_reset_pollfunc (ide_drive_t *drive)
return ide_started;
}
/* end of polling */
hwgroup->poll_timeout = 0;
hwgroup->polling = 0;
printk("%s: ATAPI reset timed-out, status=0x%02x\n",
drive->name, stat);
/* do it the old fashioned way */
return do_reset1(drive, 1);
}
/* done polling */
hwgroup->poll_timeout = 0;
hwgroup->polling = 0;
return ide_stopped;
}
......@@ -1090,7 +1090,7 @@ static ide_startstop_t reset_pollfunc (ide_drive_t *drive)
printk("\n");
}
}
hwgroup->poll_timeout = 0; /* done polling */
hwgroup->polling = 0; /* done polling */
return ide_stopped;
}
......@@ -1165,6 +1165,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
udelay (20);
hwif->OUTB(WIN_SRST, IDE_COMMAND_REG);
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
hwgroup->polling = 1;
__ide_set_handler(drive, &atapi_reset_pollfunc, HZ/20, NULL);
spin_unlock_irqrestore(&ide_lock, flags);
return ide_started;
......@@ -1205,6 +1206,7 @@ static ide_startstop_t do_reset1 (ide_drive_t *drive, int do_not_try_atapi)
/* more than enough time */
udelay(10);
hwgroup->poll_timeout = jiffies + WAIT_WORSTCASE;
hwgroup->polling = 1;
__ide_set_handler(drive, &reset_pollfunc, HZ/20, NULL);
/*
......
......@@ -590,7 +590,7 @@ static int siimage_reset_poll (ide_drive_t *drive)
if ((hwif->INL(SATA_STATUS_REG) & 0x03) != 0x03) {
printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n",
hwif->name, hwif->INL(SATA_STATUS_REG));
HWGROUP(drive)->poll_timeout = 0;
HWGROUP(drive)->polling = 0;
return ide_started;
}
return 0;
......
......@@ -934,7 +934,9 @@ typedef struct hwgroup_s {
/* BOOL: protects all fields below */
volatile int busy;
/* BOOL: wake us up on timer expiry */
int sleeping;
int sleeping : 1;
/* BOOL: polling active & poll_timeout field valid */
int polling : 1;
/* current drive */
ide_drive_t *drive;
/* ptr to current hwif in linked-list */
......
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