Skip to content

Commit ecf3a31

Browse files
Sergei Shtylyovbzolnier
authored andcommitted
ide: turn set_irq() method into write_devctl() method
Turn set_irq() method with its software reset hack into write_devctl() method (for just writing a value into the device control register) at last... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
1 parent 4d74c3f commit ecf3a31

19 files changed

Lines changed: 32 additions & 72 deletions

‎drivers/ide/at91_ide.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -295,7 +295,7 @@ static const struct ide_tp_ops at91_ide_tp_ops = {
295295
.exec_command = ide_exec_command,
296296
.read_status = ide_read_status,
297297
.read_altstatus = ide_read_altstatus,
298-
.set_irq = ide_set_irq,
298+
.write_devctl = ide_write_devctl,
299299

300300
.tf_load = at91_ide_tf_load,
301301
.tf_read = at91_ide_tf_read,

‎drivers/ide/au1xxx-ide.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -467,8 +467,7 @@ static const struct ide_tp_ops au1xxx_tp_ops = {
467467
.exec_command = ide_exec_command,
468468
.read_status = ide_read_status,
469469
.read_altstatus = ide_read_altstatus,
470-
471-
.set_irq = ide_set_irq,
470+
.write_devctl = ide_write_devctl,
472471

473472
.tf_load = ide_tf_load,
474473
.tf_read = ide_tf_read,

‎drivers/ide/falconide.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -89,8 +89,7 @@ static const struct ide_tp_ops falconide_tp_ops = {
8989
.exec_command = ide_exec_command,
9090
.read_status = ide_read_status,
9191
.read_altstatus = ide_read_altstatus,
92-
93-
.set_irq = ide_set_irq,
92+
.write_devctl = ide_write_devctl,
9493

9594
.tf_load = ide_tf_load,
9695
.tf_read = ide_tf_read,

‎drivers/ide/ide-eh.c‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -401,15 +401,14 @@ static ide_startstop_t do_reset1(ide_drive_t *drive, int do_not_try_atapi)
401401
* immediate interrupt due to the edge transition it produces.
402402
* This single interrupt gives us a "fast poll" for drives that
403403
* recover from reset very quickly, saving us the first 50ms wait time.
404-
*
405-
* TODO: add ->softreset method and stop abusing ->set_irq
406404
*/
407405
/* set SRST and nIEN */
408-
tp_ops->set_irq(hwif, 4);
406+
tp_ops->write_devctl(hwif, ATA_SRST | ATA_NIEN | ATA_DEVCTL_OBS);
409407
/* more than enough time */
410408
udelay(10);
411409
/* clear SRST, leave nIEN (unless device is on the quirk list) */
412-
tp_ops->set_irq(hwif, drive->quirk_list == 2);
410+
tp_ops->write_devctl(hwif, (drive->quirk_list == 2 ? 0 : ATA_NIEN) |
411+
ATA_DEVCTL_OBS);
413412
/* more than enough time */
414413
udelay(10);
415414
hwif->poll_timeout = jiffies + WAIT_WORSTCASE;

‎drivers/ide/ide-h8300.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,8 +159,7 @@ static const struct ide_tp_ops h8300_tp_ops = {
159159
.exec_command = ide_exec_command,
160160
.read_status = ide_read_status,
161161
.read_altstatus = ide_read_altstatus,
162-
163-
.set_irq = ide_set_irq,
162+
.write_devctl = ide_write_devctl,
164163

165164
.tf_load = h8300_tf_load,
166165
.tf_read = h8300_tf_read,

‎drivers/ide/ide-io-std.c‎

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -64,23 +64,14 @@ u8 ide_read_altstatus(ide_hwif_t *hwif)
6464
}
6565
EXPORT_SYMBOL_GPL(ide_read_altstatus);
6666

67-
void ide_set_irq(ide_hwif_t *hwif, int on)
67+
void ide_write_devctl(ide_hwif_t *hwif, u8 ctl)
6868
{
69-
u8 ctl = ATA_DEVCTL_OBS;
70-
71-
if (on == 4) { /* hack for SRST */
72-
ctl |= 4;
73-
on &= ~4;
74-
}
75-
76-
ctl |= on ? 0 : 2;
77-
7869
if (hwif->host_flags & IDE_HFLAG_MMIO)
7970
writeb(ctl, (void __iomem *)hwif->io_ports.ctl_addr);
8071
else
8172
outb(ctl, hwif->io_ports.ctl_addr);
8273
}
83-
EXPORT_SYMBOL_GPL(ide_set_irq);
74+
EXPORT_SYMBOL_GPL(ide_write_devctl);
8475

8576
void ide_tf_load(ide_drive_t *drive, struct ide_cmd *cmd)
8677
{
@@ -312,8 +303,7 @@ const struct ide_tp_ops default_tp_ops = {
312303
.exec_command = ide_exec_command,
313304
.read_status = ide_read_status,
314305
.read_altstatus = ide_read_altstatus,
315-
316-
.set_irq = ide_set_irq,
306+
.write_devctl = ide_write_devctl,
317307

318308
.tf_load = ide_tf_load,
319309
.tf_read = ide_tf_read,

‎drivers/ide/ide-io.c‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,9 @@ void do_ide_request(struct request_queue *q)
494494
* quirk_list may not like intr setups/cleanups
495495
*/
496496
if (prev_port && prev_port->cur_dev->quirk_list == 0)
497-
prev_port->tp_ops->set_irq(prev_port, 0);
497+
prev_port->tp_ops->write_devctl(prev_port,
498+
ATA_NIEN |
499+
ATA_DEVCTL_OBS);
498500

499501
hwif->host->cur_port = hwif;
500502
}

‎drivers/ide/ide-iops.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
360360
SELECT_DRIVE(drive);
361361
SELECT_MASK(drive, 1);
362362
udelay(1);
363-
tp_ops->set_irq(hwif, 0);
363+
tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS);
364364

365365
memset(&cmd, 0, sizeof(cmd));
366366
cmd.tf_flags = IDE_TFLAG_OUT_FEATURE | IDE_TFLAG_OUT_NSECT;
@@ -372,7 +372,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
372372
tp_ops->exec_command(hwif, ATA_CMD_SET_FEATURES);
373373

374374
if (drive->quirk_list == 2)
375-
tp_ops->set_irq(hwif, 1);
375+
tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
376376

377377
error = __ide_wait_stat(drive, drive->ready_stat,
378378
ATA_BUSY | ATA_DRQ | ATA_ERR,

‎drivers/ide/ide-pm.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,7 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
233233
if (rc)
234234
printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name);
235235
SELECT_DRIVE(drive);
236-
hwif->tp_ops->set_irq(hwif, 1);
236+
hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
237237
rc = ide_wait_not_busy(hwif, 100000);
238238
if (rc)
239239
printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);

‎drivers/ide/ide-probe.c‎

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -260,7 +260,7 @@ int ide_dev_read_id(ide_drive_t *drive, u8 cmd, u16 *id)
260260
* during the identify phase that the IRQ handler isn't expecting.
261261
*/
262262
if (io_ports->ctl_addr)
263-
tp_ops->set_irq(hwif, 0);
263+
tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS);
264264

265265
/* take a deep breath */
266266
msleep(50);
@@ -628,7 +628,7 @@ static int ide_port_wait_ready(ide_hwif_t *hwif)
628628
if ((drive->dev_flags & IDE_DFLAG_NOPROBE) == 0 ||
629629
(drive->dev_flags & IDE_DFLAG_PRESENT)) {
630630
SELECT_DRIVE(drive);
631-
hwif->tp_ops->set_irq(hwif, 1);
631+
hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
632632
mdelay(2);
633633
rc = ide_wait_not_busy(hwif, 35000);
634634
if (rc)
@@ -845,7 +845,7 @@ static int init_irq (ide_hwif_t *hwif)
845845
irq_handler = ide_intr;
846846

847847
if (io_ports->ctl_addr)
848-
hwif->tp_ops->set_irq(hwif, 1);
848+
hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
849849

850850
if (request_irq(hwif->irq, irq_handler, sa, hwif->name, hwif))
851851
goto out_up;

0 commit comments

Comments
 (0)