aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-28 17:44:39 -0400
committerBartlomiej Zolnierkiewicz <bzolnier@gmail.com>2008-04-28 17:44:39 -0400
commit1fc142589e58b20a67582974b8848595a2c7432e (patch)
tree79b2006e761c70876d66a735fb30036cefb3f3e9
parent3910dde6410e742f8bd3f516ee9b1a7114abbad0 (diff)
ide: add ide_execute_pkt_cmd() helper
Add ide_execute_pkt_cmd() helper for executing PACKET command, then convert ATAPI device drivers to use it. As a nice side-effect this fixes ide-{floppy,tape,scsi} w.r.t. ide_lock taking (ide-cd was OK). Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
-rw-r--r--drivers/ide/ide-cd.c9
-rw-r--r--drivers/ide/ide-floppy.c4
-rw-r--r--drivers/ide/ide-iops.c12
-rw-r--r--drivers/ide/ide-tape.c4
-rw-r--r--drivers/scsi/ide-scsi.c4
-rw-r--r--include/linux/ide.h2
6 files changed, 17 insertions, 18 deletions
diff --git a/drivers/ide/ide-cd.c b/drivers/ide/ide-cd.c
index 095e50a93869..0881ddc5831e 100644
--- a/drivers/ide/ide-cd.c
+++ b/drivers/ide/ide-cd.c
@@ -555,14 +555,7 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
555 ATAPI_WAIT_PC, cdrom_timer_expiry); 555 ATAPI_WAIT_PC, cdrom_timer_expiry);
556 return ide_started; 556 return ide_started;
557 } else { 557 } else {
558 unsigned long flags; 558 ide_execute_pkt_cmd(drive);
559
560 /* packet command */
561 spin_lock_irqsave(&ide_lock, flags);
562 hwif->OUTBSYNC(drive, WIN_PACKETCMD,
563 hwif->io_ports.command_addr);
564 ndelay(400);
565 spin_unlock_irqrestore(&ide_lock, flags);
566 559
567 return (*handler) (drive); 560 return (*handler) (drive);
568 } 561 }
diff --git a/drivers/ide/ide-floppy.c b/drivers/ide/ide-floppy.c
index da79248633a4..0039789b0eb9 100644
--- a/drivers/ide/ide-floppy.c
+++ b/drivers/ide/ide-floppy.c
@@ -696,9 +696,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
696 return ide_started; 696 return ide_started;
697 } else { 697 } else {
698 /* Issue the packet command */ 698 /* Issue the packet command */
699 hwif->OUTBSYNC(drive, WIN_PACKETCMD, 699 ide_execute_pkt_cmd(drive);
700 hwif->io_ports.command_addr);
701 ndelay(400);
702 return (*pkt_xfer_routine) (drive); 700 return (*pkt_xfer_routine) (drive);
703 } 701 }
704} 702}
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c
index 7f2b4edc6369..dfe47d5eb157 100644
--- a/drivers/ide/ide-iops.c
+++ b/drivers/ide/ide-iops.c
@@ -801,9 +801,19 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler,
801 ndelay(400); 801 ndelay(400);
802 spin_unlock_irqrestore(&ide_lock, flags); 802 spin_unlock_irqrestore(&ide_lock, flags);
803} 803}
804
805EXPORT_SYMBOL(ide_execute_command); 804EXPORT_SYMBOL(ide_execute_command);
806 805
806void ide_execute_pkt_cmd(ide_drive_t *drive)
807{
808 ide_hwif_t *hwif = drive->hwif;
809 unsigned long flags;
810
811 spin_lock_irqsave(&ide_lock, flags);
812 hwif->OUTBSYNC(drive, WIN_PACKETCMD, hwif->io_ports.command_addr);
813 ndelay(400);
814 spin_unlock_irqrestore(&ide_lock, flags);
815}
816EXPORT_SYMBOL_GPL(ide_execute_pkt_cmd);
807 817
808/* needed below */ 818/* needed below */
809static ide_startstop_t do_reset1 (ide_drive_t *, int); 819static ide_startstop_t do_reset1 (ide_drive_t *, int);
diff --git a/drivers/ide/ide-tape.c b/drivers/ide/ide-tape.c
index dc88431a2359..71d07d740add 100644
--- a/drivers/ide/ide-tape.c
+++ b/drivers/ide/ide-tape.c
@@ -1056,9 +1056,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
1056 IDETAPE_WAIT_CMD, NULL); 1056 IDETAPE_WAIT_CMD, NULL);
1057 return ide_started; 1057 return ide_started;
1058 } else { 1058 } else {
1059 hwif->OUTBSYNC(drive, WIN_PACKETCMD, 1059 ide_execute_pkt_cmd(drive);
1060 hwif->io_ports.command_addr);
1061 ndelay(400);
1062 return idetape_transfer_pc(drive); 1060 return idetape_transfer_pc(drive);
1063 } 1061 }
1064} 1062}
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c
index 8b1c783e259b..7964cc146152 100644
--- a/drivers/scsi/ide-scsi.c
+++ b/drivers/scsi/ide-scsi.c
@@ -574,9 +574,7 @@ static ide_startstop_t idescsi_issue_pc(ide_drive_t *drive,
574 return ide_started; 574 return ide_started;
575 } else { 575 } else {
576 /* Issue the packet command */ 576 /* Issue the packet command */
577 hwif->OUTBSYNC(drive, WIN_PACKETCMD, 577 ide_execute_pkt_cmd(drive);
578 hwif->io_ports.command_addr);
579 ndelay(400);
580 return idescsi_transfer_pc(drive); 578 return idescsi_transfer_pc(drive);
581 } 579 }
582} 580}
diff --git a/include/linux/ide.h b/include/linux/ide.h
index 5ab9773b75fb..3927996d2f82 100644
--- a/include/linux/ide.h
+++ b/include/linux/ide.h
@@ -822,6 +822,8 @@ extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigne
822void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, 822void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int,
823 ide_expiry_t *); 823 ide_expiry_t *);
824 824
825void ide_execute_pkt_cmd(ide_drive_t *);
826
825ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); 827ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);
826 828
827ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); 829ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);