Skip to content

Commit

Permalink
ide: add ide_execute_pkt_cmd() helper
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Bartlomiej Zolnierkiewicz committed Apr 28, 2008
1 parent 3910dde commit 1fc1425
Show file tree
Hide file tree
Showing 6 changed files with 17 additions and 18 deletions.
9 changes: 1 addition & 8 deletions drivers/ide/ide-cd.c
Original file line number Diff line number Diff line change
Expand Up @@ -555,14 +555,7 @@ static ide_startstop_t cdrom_start_packet_command(ide_drive_t *drive,
ATAPI_WAIT_PC, cdrom_timer_expiry);
return ide_started;
} else {
unsigned long flags;

/* packet command */
spin_lock_irqsave(&ide_lock, flags);
hwif->OUTBSYNC(drive, WIN_PACKETCMD,
hwif->io_ports.command_addr);
ndelay(400);
spin_unlock_irqrestore(&ide_lock, flags);
ide_execute_pkt_cmd(drive);

return (*handler) (drive);
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/ide/ide-floppy.c
Original file line number Diff line number Diff line change
Expand Up @@ -696,9 +696,7 @@ static ide_startstop_t idefloppy_issue_pc(ide_drive_t *drive,
return ide_started;
} else {
/* Issue the packet command */
hwif->OUTBSYNC(drive, WIN_PACKETCMD,
hwif->io_ports.command_addr);
ndelay(400);
ide_execute_pkt_cmd(drive);
return (*pkt_xfer_routine) (drive);
}
}
Expand Down
12 changes: 11 additions & 1 deletion drivers/ide/ide-iops.c
Original file line number Diff line number Diff line change
Expand Up @@ -801,9 +801,19 @@ void ide_execute_command(ide_drive_t *drive, u8 cmd, ide_handler_t *handler,
ndelay(400);
spin_unlock_irqrestore(&ide_lock, flags);
}

EXPORT_SYMBOL(ide_execute_command);

void ide_execute_pkt_cmd(ide_drive_t *drive)
{
ide_hwif_t *hwif = drive->hwif;
unsigned long flags;

spin_lock_irqsave(&ide_lock, flags);
hwif->OUTBSYNC(drive, WIN_PACKETCMD, hwif->io_ports.command_addr);
ndelay(400);
spin_unlock_irqrestore(&ide_lock, flags);
}
EXPORT_SYMBOL_GPL(ide_execute_pkt_cmd);

/* needed below */
static ide_startstop_t do_reset1 (ide_drive_t *, int);
Expand Down
4 changes: 1 addition & 3 deletions drivers/ide/ide-tape.c
Original file line number Diff line number Diff line change
Expand Up @@ -1056,9 +1056,7 @@ static ide_startstop_t idetape_issue_pc(ide_drive_t *drive,
IDETAPE_WAIT_CMD, NULL);
return ide_started;
} else {
hwif->OUTBSYNC(drive, WIN_PACKETCMD,
hwif->io_ports.command_addr);
ndelay(400);
ide_execute_pkt_cmd(drive);
return idetape_transfer_pc(drive);
}
}
Expand Down
4 changes: 1 addition & 3 deletions drivers/scsi/ide-scsi.c
Original file line number Diff line number Diff line change
Expand Up @@ -574,9 +574,7 @@ static ide_startstop_t idescsi_issue_pc(ide_drive_t *drive,
return ide_started;
} else {
/* Issue the packet command */
hwif->OUTBSYNC(drive, WIN_PACKETCMD,
hwif->io_ports.command_addr);
ndelay(400);
ide_execute_pkt_cmd(drive);
return idescsi_transfer_pc(drive);
}
}
Expand Down
2 changes: 2 additions & 0 deletions include/linux/ide.h
Original file line number Diff line number Diff line change
Expand Up @@ -822,6 +822,8 @@ extern void ide_set_handler (ide_drive_t *drive, ide_handler_t *handler, unsigne
void ide_execute_command(ide_drive_t *, u8, ide_handler_t *, unsigned int,
ide_expiry_t *);

void ide_execute_pkt_cmd(ide_drive_t *);

ide_startstop_t __ide_error(ide_drive_t *, struct request *, u8, u8);

ide_startstop_t ide_error (ide_drive_t *drive, const char *msg, byte stat);
Expand Down

0 comments on commit 1fc1425

Please sign in to comment.