ide: merge ide_hwgroup_t with ide_hwif_t (v2)

* Merge ide_hwgroup_t with ide_hwif_t.

* Cleanup init_irq() accordingly, then remove no longer needed
  ide_remove_port_from_hwgroup() and ide_ports[].

* Remove now unused HWGROUP() macro.

While at it:

* ide_dump_ata_error() fixups

v2:
* Fix ->quirk_list check in do_ide_request()
  (s/hwif->cur_dev/prev_port->cur_dev).
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent 5b31f855
...@@ -198,7 +198,7 @@ static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed) ...@@ -198,7 +198,7 @@ static void ali_set_dma_mode(ide_drive_t *drive, const u8 speed)
static int ali15x3_dma_setup(ide_drive_t *drive) static int ali15x3_dma_setup(ide_drive_t *drive)
{ {
if (m5229_revision < 0xC2 && drive->media != ide_disk) { if (m5229_revision < 0xC2 && drive->media != ide_disk) {
if (rq_data_dir(drive->hwif->hwgroup->rq)) if (rq_data_dir(drive->hwif->rq))
return 1; /* try PIO instead of DMA */ return 1; /* try PIO instead of DMA */
} }
return ide_dma_setup(drive); return ide_dma_setup(drive);
......
...@@ -213,7 +213,7 @@ static int auide_build_dmatable(ide_drive_t *drive) ...@@ -213,7 +213,7 @@ static int auide_build_dmatable(ide_drive_t *drive)
{ {
int i, iswrite, count = 0; int i, iswrite, count = 0;
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
struct request *rq = HWGROUP(drive)->rq; struct request *rq = hwif->rq;
_auide_hwif *ahwif = &auide_hwif; _auide_hwif *ahwif = &auide_hwif;
struct scatterlist *sg; struct scatterlist *sg;
...@@ -309,8 +309,8 @@ static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command) ...@@ -309,8 +309,8 @@ static void auide_dma_exec_cmd(ide_drive_t *drive, u8 command)
} }
static int auide_dma_setup(ide_drive_t *drive) static int auide_dma_setup(ide_drive_t *drive)
{ {
struct request *rq = HWGROUP(drive)->rq; struct request *rq = drive->hwif->rq;
if (!auide_build_dmatable(drive)) { if (!auide_build_dmatable(drive)) {
ide_map_sg(drive, rq); ide_map_sg(drive, rq);
......
...@@ -312,7 +312,7 @@ static int icside_dma_setup(ide_drive_t *drive) ...@@ -312,7 +312,7 @@ static int icside_dma_setup(ide_drive_t *drive)
ide_hwif_t *hwif = HWIF(drive); ide_hwif_t *hwif = HWIF(drive);
struct expansion_card *ec = ECARD_DEV(hwif->dev); struct expansion_card *ec = ECARD_DEV(hwif->dev);
struct icside_state *state = ecard_get_drvdata(ec); struct icside_state *state = ecard_get_drvdata(ec);
struct request *rq = hwif->hwgroup->rq; struct request *rq = hwif->rq;
unsigned int dma_mode; unsigned int dma_mode;
if (rq_data_dir(rq)) if (rq_data_dir(rq))
......
...@@ -243,7 +243,7 @@ EXPORT_SYMBOL_GPL(ide_retry_pc); ...@@ -243,7 +243,7 @@ EXPORT_SYMBOL_GPL(ide_retry_pc);
int ide_cd_expiry(ide_drive_t *drive) int ide_cd_expiry(ide_drive_t *drive)
{ {
struct request *rq = HWGROUP(drive)->rq; struct request *rq = drive->hwif->rq;
unsigned long wait = 0; unsigned long wait = 0;
debug_log("%s: rq->cmd[0]: 0x%x\n", __func__, rq->cmd[0]); debug_log("%s: rq->cmd[0]: 0x%x\n", __func__, rq->cmd[0]);
...@@ -294,7 +294,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive) ...@@ -294,7 +294,7 @@ static ide_startstop_t ide_pc_intr(ide_drive_t *drive)
{ {
struct ide_atapi_pc *pc = drive->pc; struct ide_atapi_pc *pc = drive->pc;
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct request *rq = hwif->hwgroup->rq; struct request *rq = hwif->rq;
const struct ide_tp_ops *tp_ops = hwif->tp_ops; const struct ide_tp_ops *tp_ops = hwif->tp_ops;
xfer_func_t *xferfunc; xfer_func_t *xferfunc;
unsigned int timeout, temp; unsigned int timeout, temp;
...@@ -491,7 +491,7 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive) ...@@ -491,7 +491,7 @@ static ide_startstop_t ide_transfer_pc(ide_drive_t *drive)
{ {
struct ide_atapi_pc *uninitialized_var(pc); struct ide_atapi_pc *uninitialized_var(pc);
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct request *rq = hwif->hwgroup->rq; struct request *rq = hwif->rq;
ide_expiry_t *expiry; ide_expiry_t *expiry;
unsigned int timeout; unsigned int timeout;
int cmd_len; int cmd_len;
...@@ -580,7 +580,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive) ...@@ -580,7 +580,7 @@ ide_startstop_t ide_issue_pc(ide_drive_t *drive)
if (dev_is_idecd(drive)) { if (dev_is_idecd(drive)) {
tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL; tf_flags = IDE_TFLAG_OUT_NSECT | IDE_TFLAG_OUT_LBAL;
bcount = ide_cd_get_xferlen(hwif->hwgroup->rq); bcount = ide_cd_get_xferlen(hwif->rq);
expiry = ide_cd_expiry; expiry = ide_cd_expiry;
timeout = ATAPI_WAIT_PC; timeout = ATAPI_WAIT_PC;
......
...@@ -239,7 +239,7 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense, ...@@ -239,7 +239,7 @@ static void cdrom_queue_request_sense(ide_drive_t *drive, void *sense,
static void cdrom_end_request(ide_drive_t *drive, int uptodate) static void cdrom_end_request(ide_drive_t *drive, int uptodate)
{ {
struct request *rq = HWGROUP(drive)->rq; struct request *rq = drive->hwif->rq;
int nsectors = rq->hard_cur_sectors; int nsectors = rq->hard_cur_sectors;
ide_debug_log(IDE_DBG_FUNC, "Call %s, cmd: 0x%x, uptodate: 0x%x, " ide_debug_log(IDE_DBG_FUNC, "Call %s, cmd: 0x%x, uptodate: 0x%x, "
...@@ -306,8 +306,7 @@ static void ide_dump_status_no_sense(ide_drive_t *drive, const char *msg, u8 st) ...@@ -306,8 +306,7 @@ static void ide_dump_status_no_sense(ide_drive_t *drive, const char *msg, u8 st)
static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret) static int cdrom_decode_status(ide_drive_t *drive, int good_stat, int *stat_ret)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
ide_hwgroup_t *hwgroup = hwif->hwgroup; struct request *rq = hwif->rq;
struct request *rq = hwgroup->rq;
int stat, err, sense_key; int stat, err, sense_key;
/* check for errors */ /* check for errors */
...@@ -502,7 +501,7 @@ end_request: ...@@ -502,7 +501,7 @@ end_request:
blkdev_dequeue_request(rq); blkdev_dequeue_request(rq);
spin_unlock_irqrestore(q->queue_lock, flags); spin_unlock_irqrestore(q->queue_lock, flags);
hwgroup->rq = NULL; hwif->rq = NULL;
cdrom_queue_request_sense(drive, rq->sense, rq); cdrom_queue_request_sense(drive, rq->sense, rq);
} else } else
...@@ -525,7 +524,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *); ...@@ -525,7 +524,7 @@ static ide_startstop_t cdrom_newpc_intr(ide_drive_t *);
static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive) static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct request *rq = hwif->hwgroup->rq; struct request *rq = hwif->rq;
int xferlen; int xferlen;
xferlen = ide_cd_get_xferlen(rq); xferlen = ide_cd_get_xferlen(rq);
...@@ -567,7 +566,7 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive) ...@@ -567,7 +566,7 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive)
static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive) static ide_startstop_t cdrom_transfer_packet_command(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct request *rq = hwif->hwgroup->rq; struct request *rq = hwif->rq;
int cmd_len; int cmd_len;
ide_startstop_t startstop; ide_startstop_t startstop;
...@@ -854,8 +853,7 @@ static int cdrom_newpc_intr_dummy_cb(struct request *rq) ...@@ -854,8 +853,7 @@ static int cdrom_newpc_intr_dummy_cb(struct request *rq)
static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive) static ide_startstop_t cdrom_newpc_intr(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
ide_hwgroup_t *hwgroup = hwif->hwgroup; struct request *rq = hwif->rq;
struct request *rq = hwgroup->rq;
xfer_func_t *xferfunc; xfer_func_t *xferfunc;
ide_expiry_t *expiry = NULL; ide_expiry_t *expiry = NULL;
int dma_error = 0, dma, stat, thislen, uptodate = 0; int dma_error = 0, dma, stat, thislen, uptodate = 0;
...@@ -1061,7 +1059,7 @@ end_request: ...@@ -1061,7 +1059,7 @@ end_request:
if (blk_end_request(rq, 0, dlen)) if (blk_end_request(rq, 0, dlen))
BUG(); BUG();
hwgroup->rq = NULL; hwif->rq = NULL;
} else { } else {
if (!uptodate) if (!uptodate)
rq->cmd_flags |= REQ_FAILED; rq->cmd_flags |= REQ_FAILED;
......
...@@ -175,7 +175,7 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable); ...@@ -175,7 +175,7 @@ EXPORT_SYMBOL_GPL(ide_build_dmatable);
int ide_dma_setup(ide_drive_t *drive) int ide_dma_setup(ide_drive_t *drive)
{ {
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct request *rq = hwif->hwgroup->rq; struct request *rq = hwif->rq;
unsigned int reading = rq_data_dir(rq) ? 0 : ATA_DMA_WR; unsigned int reading = rq_data_dir(rq) ? 0 : ATA_DMA_WR;
u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0; u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
u8 dma_stat; u8 dma_stat;
...@@ -240,7 +240,7 @@ static int dma_timer_expiry(ide_drive_t *drive) ...@@ -240,7 +240,7 @@ static int dma_timer_expiry(ide_drive_t *drive)
if ((dma_stat & 0x18) == 0x18) /* BUSY Stupid Early Timer !! */ if ((dma_stat & 0x18) == 0x18) /* BUSY Stupid Early Timer !! */
return WAIT_CMD; return WAIT_CMD;
hwif->hwgroup->expiry = NULL; /* one free ride for now */ hwif->expiry = NULL; /* one free ride for now */
if (dma_stat & ATA_DMA_ERR) /* ERROR */ if (dma_stat & ATA_DMA_ERR) /* ERROR */
return -1; return -1;
......
...@@ -96,7 +96,7 @@ ide_startstop_t ide_dma_intr(ide_drive_t *drive) ...@@ -96,7 +96,7 @@ ide_startstop_t ide_dma_intr(ide_drive_t *drive)
if (OK_STAT(stat, DRIVE_READY, drive->bad_wstat | ATA_DRQ)) { if (OK_STAT(stat, DRIVE_READY, drive->bad_wstat | ATA_DRQ)) {
if (!dma_stat) { if (!dma_stat) {
struct request *rq = hwif->hwgroup->rq; struct request *rq = hwif->rq;
task_end_request(drive, rq, stat); task_end_request(drive, rq, stat);
return ide_stopped; return ide_stopped;
......
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs) static int ide_floppy_end_request(ide_drive_t *drive, int uptodate, int nsecs)
{ {
struct ide_disk_obj *floppy = drive->driver_data; struct ide_disk_obj *floppy = drive->driver_data;
struct request *rq = HWGROUP(drive)->rq; struct request *rq = drive->hwif->rq;
int error; int error;
ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__); ide_debug_log(IDE_DBG_FUNC, "Call %s\n", __func__);
......
...@@ -88,7 +88,7 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq, ...@@ -88,7 +88,7 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq,
ret = 0; ret = 0;
if (ret == 0 && dequeue) if (ret == 0 && dequeue)
drive->hwif->hwgroup->rq = NULL; drive->hwif->rq = NULL;
return ret; return ret;
} }
...@@ -107,7 +107,7 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq, ...@@ -107,7 +107,7 @@ static int __ide_end_request(ide_drive_t *drive, struct request *rq,
int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors) int ide_end_request (ide_drive_t *drive, int uptodate, int nr_sectors)
{ {
unsigned int nr_bytes = nr_sectors << 9; unsigned int nr_bytes = nr_sectors << 9;
struct request *rq = drive->hwif->hwgroup->rq; struct request *rq = drive->hwif->rq;
if (!nr_bytes) { if (!nr_bytes) {
if (blk_pc_request(rq)) if (blk_pc_request(rq))
...@@ -160,8 +160,8 @@ EXPORT_SYMBOL_GPL(ide_end_dequeued_request); ...@@ -160,8 +160,8 @@ EXPORT_SYMBOL_GPL(ide_end_dequeued_request);
void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
{ {
ide_hwgroup_t *hwgroup = drive->hwif->hwgroup; ide_hwif_t *hwif = drive->hwif;
struct request *rq = hwgroup->rq; struct request *rq = hwif->rq;
if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) { if (rq->cmd_type == REQ_TYPE_ATA_TASKFILE) {
ide_task_t *task = (ide_task_t *)rq->special; ide_task_t *task = (ide_task_t *)rq->special;
...@@ -186,7 +186,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err) ...@@ -186,7 +186,7 @@ void ide_end_drive_cmd (ide_drive_t *drive, u8 stat, u8 err)
return; return;
} }
hwgroup->rq = NULL; hwif->rq = NULL;
rq->errors = err; rq->errors = err;
...@@ -321,7 +321,8 @@ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, u8 stat) ...@@ -321,7 +321,8 @@ ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, u8 stat)
err = ide_dump_status(drive, msg, stat); err = ide_dump_status(drive, msg, stat);
if ((rq = HWGROUP(drive)->rq) == NULL) rq = drive->hwif->rq;
if (rq == NULL)
return ide_stopped; return ide_stopped;
/* retry only "normal" I/O: */ /* retry only "normal" I/O: */
...@@ -654,7 +655,7 @@ kill_rq: ...@@ -654,7 +655,7 @@ kill_rq:
* @timeout: time to stall for (jiffies) * @timeout: time to stall for (jiffies)
* *
* ide_stall_queue() can be used by a drive to give excess bandwidth back * ide_stall_queue() can be used by a drive to give excess bandwidth back
* to the hwgroup by sleeping for timeout jiffies. * to the port by sleeping for timeout jiffies.
*/ */
void ide_stall_queue (ide_drive_t *drive, unsigned long timeout) void ide_stall_queue (ide_drive_t *drive, unsigned long timeout)
...@@ -705,14 +706,13 @@ static inline void ide_unlock_host(struct ide_host *host) ...@@ -705,14 +706,13 @@ static inline void ide_unlock_host(struct ide_host *host)
} }
/* /*
* Issue a new request to a drive from hwgroup * Issue a new request to a device.
*/ */
void do_ide_request(struct request_queue *q) void do_ide_request(struct request_queue *q)
{ {
ide_drive_t *drive = q->queuedata; ide_drive_t *drive = q->queuedata;
ide_hwif_t *hwif = drive->hwif; ide_hwif_t *hwif = drive->hwif;
struct ide_host *host = hwif->host; struct ide_host *host = hwif->host;
ide_hwgroup_t *hwgroup = hwif->hwgroup;
struct request *rq = NULL; struct request *rq = NULL;
ide_startstop_t startstop; ide_startstop_t startstop;
...@@ -734,13 +734,13 @@ void do_ide_request(struct request_queue *q) ...@@ -734,13 +734,13 @@ void do_ide_request(struct request_queue *q)
if (ide_lock_host(host, hwif)) if (ide_lock_host(host, hwif))
goto plug_device_2; goto plug_device_2;
spin_lock_irq(&hwgroup->lock); spin_lock_irq(&hwif->lock);
if (!ide_lock_port(hwif)) { if (!ide_lock_port(hwif)) {
ide_hwif_t *prev_port; ide_hwif_t *prev_port;
repeat: repeat:
prev_port = hwif->host->cur_port; prev_port = hwif->host->cur_port;
hwgroup->rq = NULL; hwif->rq = NULL;
if (drive->dev_flags & IDE_DFLAG_SLEEPING) { if (drive->dev_flags & IDE_DFLAG_SLEEPING) {
if (time_before(drive->sleep, jiffies)) { if (time_before(drive->sleep, jiffies)) {
...@@ -755,15 +755,15 @@ repeat: ...@@ -755,15 +755,15 @@ repeat:
* set nIEN for previous port, drives in the * set nIEN for previous port, drives in the
* quirk_list may not like intr setups/cleanups * quirk_list may not like intr setups/cleanups
*/ */
if (prev_port && hwgroup->cur_dev->quirk_list == 0) if (prev_port && prev_port->cur_dev->quirk_list == 0)
prev_port->tp_ops->set_irq(prev_port, 0); prev_port->tp_ops->set_irq(prev_port, 0);
hwif->host->cur_port = hwif; hwif->host->cur_port = hwif;
} }
hwgroup->cur_dev = drive; hwif->cur_dev = drive;
drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED); drive->dev_flags &= ~(IDE_DFLAG_SLEEPING | IDE_DFLAG_PARKED);
spin_unlock_irq(&hwgroup->lock); spin_unlock_irq(&hwif->lock);
spin_lock_irq(q->queue_lock); spin_lock_irq(q->queue_lock);
/* /*
* we know that the queue isn't empty, but this can happen * we know that the queue isn't empty, but this can happen
...@@ -771,7 +771,7 @@ repeat: ...@@ -771,7 +771,7 @@ repeat:
*/ */
rq = elv_next_request(drive->queue); rq = elv_next_request(drive->queue);
spin_unlock_irq(q->queue_lock); spin_unlock_irq(q->queue_lock);
spin_lock_irq(&hwgroup->lock); spin_lock_irq(&hwif->lock);
if (!rq) { if (!rq) {
ide_unlock_port(hwif); ide_unlock_port(hwif);
...@@ -799,25 +799,25 @@ repeat: ...@@ -799,25 +799,25 @@ repeat:
goto plug_device; goto plug_device;
} }
hwgroup->rq = rq; hwif->rq = rq;
spin_unlock_irq(&hwgroup->lock); spin_unlock_irq(&hwif->lock);
startstop = start_request(drive, rq); startstop = start_request(drive, rq);
spin_lock_irq(&hwgroup->lock); spin_lock_irq(&hwif->lock);
if (startstop == ide_stopped) if (startstop == ide_stopped)
goto repeat; goto repeat;
} else } else
goto plug_device; goto plug_device;
out: out:
spin_unlock_irq(&hwgroup->lock); spin_unlock_irq(&hwif->lock);
if (rq == NULL) if (rq == NULL)
ide_unlock_host(host); ide_unlock_host(host);
spin_lock_irq(q->queue_lock); spin_lock_irq(q->queue_lock);
return; return;
plug_device: plug_device:
spin_unlock_irq(&hwgroup->lock); spin_unlock_irq(&hwif->lock);
ide_unlock_host(host); ide_unlock_host(host);
plug_device_2: plug_device_2:
spin_lock_irq(q->queue_lock); spin_lock_irq(q->queue_lock);
...@@ -827,7 +827,7 @@ plug_device_2: ...@@ -827,7 +827,7 @@ plug_device_2:
} }
/* /*
* un-busy the hwgroup etc, and clear any pending DMA status. we want to * un-busy the port etc, and clear any pending DMA status. we want to
* retry the current request in pio mode instead of risking tossing it * retry the current request in pio mode instead of risking tossing it
* all away * all away
*/ */
...@@ -864,12 +864,11 @@ static ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error) ...@@ -864,12 +864,11 @@ static ide_startstop_t ide_dma_timeout_retry(ide_drive_t *drive, int error)
* un-busy drive etc and make sure request is sane * un-busy drive etc and make sure request is sane
*/ */
rq = HWGROUP(drive)->rq; rq = hwif->rq;
if (!rq) if (!rq)
goto out; goto out;
HWGROUP(drive)->rq = NULL; hwif->rq = NULL;
rq->errors = 0; rq->errors = 0;
...@@ -897,7 +896,7 @@ static void ide_plug_device(ide_drive_t *drive) ...@@ -897,7 +896,7 @@ static void ide_plug_device(ide_drive_t *drive)
/** /**
* ide_timer_expiry - handle lack of an IDE interrupt * ide_timer_expiry - handle lack of an IDE interrupt
* @data: timer callback magic (hwgroup) * @data: timer callback magic (hwif)
* *
* An IDE command has timed out before the expected drive return * An IDE command has timed out before the expected drive return
* occurred. At this point we attempt to clean up the current * occurred. At this point we attempt to clean up the current
...@@ -911,19 +910,18 @@ static void ide_plug_device(ide_drive_t *drive) ...@@ -911,19 +910,18 @@ static void ide_plug_device(ide_drive_t *drive)
void ide_timer_expiry (unsigned long data) void ide_timer_expiry (unsigned long data)
{ {
ide_hwgroup_t *hwgroup = (ide_hwgroup_t *) data; ide_hwif_t *hwif = (ide_hwif_t *)data;
ide_hwif_t *uninitialized_var(hwif);
ide_drive_t *uninitialized_var(drive); ide_drive_t *uninitialized_var(drive);
ide_handler_t *handler; ide_handler_t *handler;
ide_expiry_t *expiry;
unsigned long flags; unsigned long flags;
unsigned long wait = -1; unsigned long wait = -1;
int plug_device = 0; int plug_device = 0;
spin_lock_irqsave(&hwgroup->lock, flags); spin_lock_irqsave(&hwif->lock, flags);
handler = hwif->handler;
if (((handler = hwgroup->handler) == NULL) || if (handler == NULL || hwif->req_gen != hwif->req_gen_timer) {
(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),
...@@ -931,38 +929,39 @@ void ide_timer_expiry (unsigned long data) ...@@ -931,38 +929,39 @@ void ide_timer_expiry (unsigned long data)
* Either way, we don't really want to complain about anything. * Either way, we don't really want to complain about anything.
*/ */
} else { } else {
drive = hwgroup->cur_dev; drive = hwif->cur_dev;
if (!drive) { if (!drive) {
printk(KERN_ERR "%s: ->cur_dev was NULL\n", __func__); printk(KERN_ERR "%s: ->cur_dev was NULL\n", __func__);
hwgroup->handler = NULL; hwif->handler = NULL;
} else { } else {
ide_expiry_t *expiry = hwif->expiry;
ide_startstop_t startstop = ide_stopped; ide_startstop_t startstop = ide_stopped;
if ((expiry = hwgroup->expiry) != NULL) { if (expiry) {
/* continue */ /* continue */
if ((wait = expiry(drive)) > 0) { if ((wait = expiry(drive)) > 0) {
/* reset timer */ /* reset timer */
hwgroup->timer.expires = jiffies + wait; hwif->timer.expires = jiffies + wait;
hwgroup->req_gen_timer = hwgroup->req_gen; hwif->req_gen_timer = hwif->req_gen;
add_timer(&hwgroup->timer); add_timer(&hwif->timer);
spin_unlock_irqrestore(&hwgroup->lock, flags); spin_unlock_irqrestore(&hwif->lock, flags);
return; return;
} }
} }
hwgroup->handler = NULL; hwif->handler = NULL;
/* /*
* We need to simulate a real interrupt when invoking * We need to simulate a real interrupt when invoking
* the handler() function, which means we need to * the handler() function, which means we need to