Commit 1fc142589e58b20a67582974b8848595a2c7432e
1 parent
3910dde641
Exists in
master
and in
20 other branches
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>
Showing 6 changed files with 17 additions and 18 deletions Side-by-side Diff
drivers/ide/ide-cd.c
... | ... | @@ -555,14 +555,7 @@ |
555 | 555 | ATAPI_WAIT_PC, cdrom_timer_expiry); |
556 | 556 | return ide_started; |
557 | 557 | } else { |
558 | - unsigned long flags; | |
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); | |
558 | + ide_execute_pkt_cmd(drive); | |
566 | 559 | |
567 | 560 | return (*handler) (drive); |
568 | 561 | } |
drivers/ide/ide-floppy.c
... | ... | @@ -696,9 +696,7 @@ |
696 | 696 | return ide_started; |
697 | 697 | } else { |
698 | 698 | /* Issue the packet command */ |
699 | - hwif->OUTBSYNC(drive, WIN_PACKETCMD, | |
700 | - hwif->io_ports.command_addr); | |
701 | - ndelay(400); | |
699 | + ide_execute_pkt_cmd(drive); | |
702 | 700 | return (*pkt_xfer_routine) (drive); |
703 | 701 | } |
704 | 702 | } |
drivers/ide/ide-iops.c
... | ... | @@ -801,9 +801,19 @@ |
801 | 801 | ndelay(400); |
802 | 802 | spin_unlock_irqrestore(&ide_lock, flags); |
803 | 803 | } |
804 | - | |
805 | 804 | EXPORT_SYMBOL(ide_execute_command); |
806 | 805 | |
806 | +void 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 | +} | |
816 | +EXPORT_SYMBOL_GPL(ide_execute_pkt_cmd); | |
807 | 817 | |
808 | 818 | /* needed below */ |
809 | 819 | static ide_startstop_t do_reset1 (ide_drive_t *, int); |
drivers/ide/ide-tape.c
... | ... | @@ -1056,9 +1056,7 @@ |
1056 | 1056 | IDETAPE_WAIT_CMD, NULL); |
1057 | 1057 | return ide_started; |
1058 | 1058 | } else { |
1059 | - hwif->OUTBSYNC(drive, WIN_PACKETCMD, | |
1060 | - hwif->io_ports.command_addr); | |
1061 | - ndelay(400); | |
1059 | + ide_execute_pkt_cmd(drive); | |
1062 | 1060 | return idetape_transfer_pc(drive); |
1063 | 1061 | } |
1064 | 1062 | } |
drivers/scsi/ide-scsi.c
... | ... | @@ -574,9 +574,7 @@ |
574 | 574 | return ide_started; |
575 | 575 | } else { |
576 | 576 | /* Issue the packet command */ |
577 | - hwif->OUTBSYNC(drive, WIN_PACKETCMD, | |
578 | - hwif->io_ports.command_addr); | |
579 | - ndelay(400); | |
577 | + ide_execute_pkt_cmd(drive); | |
580 | 578 | return idescsi_transfer_pc(drive); |
581 | 579 | } |
582 | 580 | } |
include/linux/ide.h
... | ... | @@ -822,6 +822,8 @@ |
822 | 822 | void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int, |
823 | 823 | ide_expiry_t *); |
824 | 824 | |
825 | +void ide_execute_pkt_cmd(ide_drive_t *); | |
826 | + | |
825 | 827 | ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8); |
826 | 828 | |
827 | 829 | ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat); |