mirror of
https://github.com/Fishwaldo/linux-bl808.git
synced 2025-06-17 20:25:19 +00:00
ide: inline SELECT_DRIVE()
Since SELECT_DRIVE() has boiled down to a mere dev_select() method call, it now makes sense to just inline it... Signed-off-by: Sergei Shtylyov <sshtylyov@ru.mvista.com> Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
parent
abb596b25e
commit
fdd88f0af6
7 changed files with 18 additions and 21 deletions
|
@ -165,11 +165,12 @@ static ide_startstop_t do_reset1(ide_drive_t *, int);
|
||||||
static ide_startstop_t atapi_reset_pollfunc(ide_drive_t *drive)
|
static ide_startstop_t atapi_reset_pollfunc(ide_drive_t *drive)
|
||||||
{
|
{
|
||||||
ide_hwif_t *hwif = drive->hwif;
|
ide_hwif_t *hwif = drive->hwif;
|
||||||
|
const struct ide_tp_ops *tp_ops = hwif->tp_ops;
|
||||||
u8 stat;
|
u8 stat;
|
||||||
|
|
||||||
SELECT_DRIVE(drive);
|
tp_ops->dev_select(drive);
|
||||||
udelay(10);
|
udelay(10);
|
||||||
stat = hwif->tp_ops->read_status(hwif);
|
stat = tp_ops->read_status(hwif);
|
||||||
|
|
||||||
if (OK_STAT(stat, 0, ATA_BUSY))
|
if (OK_STAT(stat, 0, ATA_BUSY))
|
||||||
printk(KERN_INFO "%s: ATAPI reset complete\n", drive->name);
|
printk(KERN_INFO "%s: ATAPI reset complete\n", drive->name);
|
||||||
|
@ -348,7 +349,7 @@ static ide_startstop_t do_reset1(ide_drive_t *drive, int do_not_try_atapi)
|
||||||
/* For an ATAPI device, first try an ATAPI SRST. */
|
/* For an ATAPI device, first try an ATAPI SRST. */
|
||||||
if (drive->media != ide_disk && !do_not_try_atapi) {
|
if (drive->media != ide_disk && !do_not_try_atapi) {
|
||||||
pre_reset(drive);
|
pre_reset(drive);
|
||||||
SELECT_DRIVE(drive);
|
tp_ops->dev_select(drive);
|
||||||
udelay(20);
|
udelay(20);
|
||||||
tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET);
|
tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET);
|
||||||
ndelay(400);
|
ndelay(400);
|
||||||
|
|
|
@ -348,7 +348,7 @@ static ide_startstop_t start_request (ide_drive_t *drive, struct request *rq)
|
||||||
if (blk_pm_request(rq))
|
if (blk_pm_request(rq))
|
||||||
ide_check_pm_state(drive, rq);
|
ide_check_pm_state(drive, rq);
|
||||||
|
|
||||||
SELECT_DRIVE(drive);
|
drive->hwif->tp_ops->dev_select(drive);
|
||||||
if (ide_wait_stat(&startstop, drive, drive->ready_stat,
|
if (ide_wait_stat(&startstop, drive, drive->ready_stat,
|
||||||
ATA_BUSY | ATA_DRQ, WAIT_READY)) {
|
ATA_BUSY | ATA_DRQ, WAIT_READY)) {
|
||||||
printk(KERN_ERR "%s: drive not ready for command\n", drive->name);
|
printk(KERN_ERR "%s: drive not ready for command\n", drive->name);
|
||||||
|
|
|
@ -27,11 +27,6 @@
|
||||||
#include <asm/uaccess.h>
|
#include <asm/uaccess.h>
|
||||||
#include <asm/io.h>
|
#include <asm/io.h>
|
||||||
|
|
||||||
void SELECT_DRIVE(ide_drive_t *drive)
|
|
||||||
{
|
|
||||||
drive->hwif->tp_ops->dev_select(drive);
|
|
||||||
}
|
|
||||||
|
|
||||||
void SELECT_MASK(ide_drive_t *drive, int mask)
|
void SELECT_MASK(ide_drive_t *drive, int mask)
|
||||||
{
|
{
|
||||||
const struct ide_port_ops *port_ops = drive->hwif->port_ops;
|
const struct ide_port_ops *port_ops = drive->hwif->port_ops;
|
||||||
|
@ -347,7 +342,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed)
|
||||||
disable_irq_nosync(hwif->irq);
|
disable_irq_nosync(hwif->irq);
|
||||||
|
|
||||||
udelay(1);
|
udelay(1);
|
||||||
SELECT_DRIVE(drive);
|
tp_ops->dev_select(drive);
|
||||||
SELECT_MASK(drive, 1);
|
SELECT_MASK(drive, 1);
|
||||||
udelay(1);
|
udelay(1);
|
||||||
tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS);
|
tp_ops->write_devctl(hwif, ATA_NIEN | ATA_DEVCTL_OBS);
|
||||||
|
|
|
@ -223,6 +223,7 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
|
||||||
* point.
|
* point.
|
||||||
*/
|
*/
|
||||||
ide_hwif_t *hwif = drive->hwif;
|
ide_hwif_t *hwif = drive->hwif;
|
||||||
|
const struct ide_tp_ops *tp_ops = hwif->tp_ops;
|
||||||
struct request_queue *q = drive->queue;
|
struct request_queue *q = drive->queue;
|
||||||
unsigned long flags;
|
unsigned long flags;
|
||||||
int rc;
|
int rc;
|
||||||
|
@ -232,8 +233,8 @@ void ide_check_pm_state(ide_drive_t *drive, struct request *rq)
|
||||||
rc = ide_wait_not_busy(hwif, 35000);
|
rc = ide_wait_not_busy(hwif, 35000);
|
||||||
if (rc)
|
if (rc)
|
||||||
printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name);
|
printk(KERN_WARNING "%s: bus not ready on wakeup\n", drive->name);
|
||||||
SELECT_DRIVE(drive);
|
tp_ops->dev_select(drive);
|
||||||
hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
|
tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
|
||||||
rc = ide_wait_not_busy(hwif, 100000);
|
rc = ide_wait_not_busy(hwif, 100000);
|
||||||
if (rc)
|
if (rc)
|
||||||
printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);
|
printk(KERN_WARNING "%s: drive not ready on wakeup\n", drive->name);
|
||||||
|
|
|
@ -390,13 +390,13 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
|
||||||
* (e.g. crw9624 as drive0 with disk as slave)
|
* (e.g. crw9624 as drive0 with disk as slave)
|
||||||
*/
|
*/
|
||||||
msleep(50);
|
msleep(50);
|
||||||
SELECT_DRIVE(drive);
|
tp_ops->dev_select(drive);
|
||||||
msleep(50);
|
msleep(50);
|
||||||
|
|
||||||
if (ide_read_device(drive) != drive->select && present == 0) {
|
if (ide_read_device(drive) != drive->select && present == 0) {
|
||||||
if (drive->dn & 1) {
|
if (drive->dn & 1) {
|
||||||
/* exit with drive0 selected */
|
/* exit with drive0 selected */
|
||||||
SELECT_DRIVE(hwif->devices[0]);
|
tp_ops->dev_select(hwif->devices[0]);
|
||||||
/* allow ATA_BUSY to assert & clear */
|
/* allow ATA_BUSY to assert & clear */
|
||||||
msleep(50);
|
msleep(50);
|
||||||
}
|
}
|
||||||
|
@ -422,7 +422,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
|
||||||
printk(KERN_ERR "%s: no response (status = 0x%02x), "
|
printk(KERN_ERR "%s: no response (status = 0x%02x), "
|
||||||
"resetting drive\n", drive->name, stat);
|
"resetting drive\n", drive->name, stat);
|
||||||
msleep(50);
|
msleep(50);
|
||||||
SELECT_DRIVE(drive);
|
tp_ops->dev_select(drive);
|
||||||
msleep(50);
|
msleep(50);
|
||||||
tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET);
|
tp_ops->exec_command(hwif, ATA_CMD_DEV_RESET);
|
||||||
(void)ide_busy_sleep(hwif, WAIT_WORSTCASE, 0);
|
(void)ide_busy_sleep(hwif, WAIT_WORSTCASE, 0);
|
||||||
|
@ -441,7 +441,7 @@ static int do_probe (ide_drive_t *drive, u8 cmd)
|
||||||
}
|
}
|
||||||
if (drive->dn & 1) {
|
if (drive->dn & 1) {
|
||||||
/* exit with drive0 selected */
|
/* exit with drive0 selected */
|
||||||
SELECT_DRIVE(hwif->devices[0]);
|
tp_ops->dev_select(hwif->devices[0]);
|
||||||
msleep(50);
|
msleep(50);
|
||||||
/* ensure drive irq is clear */
|
/* ensure drive irq is clear */
|
||||||
(void)tp_ops->read_status(hwif);
|
(void)tp_ops->read_status(hwif);
|
||||||
|
@ -605,6 +605,7 @@ out:
|
||||||
|
|
||||||
static int ide_port_wait_ready(ide_hwif_t *hwif)
|
static int ide_port_wait_ready(ide_hwif_t *hwif)
|
||||||
{
|
{
|
||||||
|
const struct ide_tp_ops *tp_ops = hwif->tp_ops;
|
||||||
ide_drive_t *drive;
|
ide_drive_t *drive;
|
||||||
int i, rc;
|
int i, rc;
|
||||||
|
|
||||||
|
@ -627,8 +628,8 @@ static int ide_port_wait_ready(ide_hwif_t *hwif)
|
||||||
/* Ignore disks that we will not probe for later. */
|
/* Ignore disks that we will not probe for later. */
|
||||||
if ((drive->dev_flags & IDE_DFLAG_NOPROBE) == 0 ||
|
if ((drive->dev_flags & IDE_DFLAG_NOPROBE) == 0 ||
|
||||||
(drive->dev_flags & IDE_DFLAG_PRESENT)) {
|
(drive->dev_flags & IDE_DFLAG_PRESENT)) {
|
||||||
SELECT_DRIVE(drive);
|
tp_ops->dev_select(drive);
|
||||||
hwif->tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
|
tp_ops->write_devctl(hwif, ATA_DEVCTL_OBS);
|
||||||
mdelay(2);
|
mdelay(2);
|
||||||
rc = ide_wait_not_busy(hwif, 35000);
|
rc = ide_wait_not_busy(hwif, 35000);
|
||||||
if (rc)
|
if (rc)
|
||||||
|
@ -640,7 +641,7 @@ static int ide_port_wait_ready(ide_hwif_t *hwif)
|
||||||
out:
|
out:
|
||||||
/* Exit function with master reselected (let's be sane) */
|
/* Exit function with master reselected (let's be sane) */
|
||||||
if (i)
|
if (i)
|
||||||
SELECT_DRIVE(hwif->devices[0]);
|
tp_ops->dev_select(hwif->devices[0]);
|
||||||
|
|
||||||
return rc;
|
return rc;
|
||||||
}
|
}
|
||||||
|
|
|
@ -262,7 +262,7 @@ static void __devinit init_hwif_ns87415 (ide_hwif_t *hwif)
|
||||||
#ifdef __sparc_v9__
|
#ifdef __sparc_v9__
|
||||||
/*
|
/*
|
||||||
* XXX: Reset the device, if we don't it will not respond to
|
* XXX: Reset the device, if we don't it will not respond to
|
||||||
* SELECT_DRIVE() properly during first ide_probe_port().
|
* dev_select() properly during first ide_probe_port().
|
||||||
*/
|
*/
|
||||||
timeout = 10000;
|
timeout = 10000;
|
||||||
outb(12, hwif->io_ports.ctl_addr);
|
outb(12, hwif->io_ports.ctl_addr);
|
||||||
|
|
|
@ -1176,7 +1176,6 @@ void ide_tf_read(ide_drive_t *, struct ide_cmd *);
|
||||||
void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
|
void ide_input_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
|
||||||
void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
|
void ide_output_data(ide_drive_t *, struct ide_cmd *, void *, unsigned int);
|
||||||
|
|
||||||
extern void SELECT_DRIVE(ide_drive_t *);
|
|
||||||
void SELECT_MASK(ide_drive_t *, int);
|
void SELECT_MASK(ide_drive_t *, int);
|
||||||
|
|
||||||
u8 ide_read_error(ide_drive_t *);
|
u8 ide_read_error(ide_drive_t *);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue