ide: remove ->INS{W,L} and ->OUTS{W,L} methods

* Use ins{w,l}()/outs{w,l}() and __ide_mm_ins{w,l}()/__ide_mm_outs{w,l}()
  directly in ata_{in,out}put_data() (by using IDE_HFLAG_MMIO host flag to
  decide which I/O ops are required).

* Remove no longer needed ->INS{W,L} and ->OUTS{W,L} methods (ide-h8300,
  au1xxx-ide and scc_pata implement their own ->{in,out}put_data methods).

There should be no functional changes caused by this patch.

Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>
This commit is contained in:
Bartlomiej Zolnierkiewicz 2008-04-28 23:44:37 +02:00
parent c5dd43ec65
commit 16bb69c14a
5 changed files with 50 additions and 83 deletions

View File

@ -90,11 +90,7 @@ static inline void hwif_setup(ide_hwif_t *hwif)
hwif->output_data = h8300_output_data;
hwif->OUTW = mm_outw;
hwif->OUTSW = mm_outsw;
hwif->INW = mm_inw;
hwif->INSW = mm_insw;
hwif->OUTSL = NULL;
hwif->INSL = NULL;
}
static int __init h8300_ide_init(void)

View File

@ -42,16 +42,6 @@ static u16 ide_inw (unsigned long port)
return (u16) inw(port);
}
static void ide_insw (unsigned long port, void *addr, u32 count)
{
insw(port, addr, count);
}
static void ide_insl (unsigned long port, void *addr, u32 count)
{
insl(port, addr, count);
}
static void ide_outb (u8 val, unsigned long port)
{
outb(val, port);
@ -67,27 +57,13 @@ static void ide_outw (u16 val, unsigned long port)
outw(val, port);
}
static void ide_outsw (unsigned long port, void *addr, u32 count)
{
outsw(port, addr, count);
}
static void ide_outsl (unsigned long port, void *addr, u32 count)
{
outsl(port, addr, count);
}
void default_hwif_iops (ide_hwif_t *hwif)
{
hwif->OUTB = ide_outb;
hwif->OUTBSYNC = ide_outbsync;
hwif->OUTW = ide_outw;
hwif->OUTSW = ide_outsw;
hwif->OUTSL = ide_outsl;
hwif->INB = ide_inb;
hwif->INW = ide_inw;
hwif->INSW = ide_insw;
hwif->INSL = ide_insl;
}
/*
@ -104,16 +80,6 @@ static u16 ide_mm_inw (unsigned long port)
return (u16) readw((void __iomem *) port);
}
static void ide_mm_insw (unsigned long port, void *addr, u32 count)
{
__ide_mm_insw((void __iomem *) port, addr, count);
}
static void ide_mm_insl (unsigned long port, void *addr, u32 count)
{
__ide_mm_insl((void __iomem *) port, addr, count);
}
static void ide_mm_outb (u8 value, unsigned long port)
{
writeb(value, (void __iomem *) port);
@ -129,16 +95,6 @@ static void ide_mm_outw (u16 value, unsigned long port)
writew(value, (void __iomem *) port);
}
static void ide_mm_outsw (unsigned long port, void *addr, u32 count)
{
__ide_mm_outsw((void __iomem *) port, addr, count);
}
static void ide_mm_outsl (unsigned long port, void *addr, u32 count)
{
__ide_mm_outsl((void __iomem *) port, addr, count);
}
void default_hwif_mmiops (ide_hwif_t *hwif)
{
hwif->OUTB = ide_mm_outb;
@ -146,12 +102,8 @@ void default_hwif_mmiops (ide_hwif_t *hwif)
this one is controller specific! */
hwif->OUTBSYNC = ide_mm_outbsync;
hwif->OUTW = ide_mm_outw;
hwif->OUTSW = ide_mm_outsw;
hwif->OUTSL = ide_mm_outsl;
hwif->INB = ide_mm_inb;
hwif->INW = ide_mm_inw;
hwif->INSW = ide_mm_insw;
hwif->INSL = ide_mm_insl;
}
EXPORT_SYMBOL(default_hwif_mmiops);
@ -203,24 +155,39 @@ static void ata_input_data(ide_drive_t *drive, struct request *rq,
struct ide_io_ports *io_ports = &hwif->io_ports;
unsigned long data_addr = io_ports->data_addr;
u8 io_32bit = drive->io_32bit;
u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
len++;
if (io_32bit) {
if (io_32bit & 2) {
unsigned long flags;
unsigned long uninitialized_var(flags);
if (io_32bit & 2) {
local_irq_save(flags);
ata_vlb_sync(drive, io_ports->nsect_addr);
hwif->INSL(data_addr, buf, len / 4);
local_irq_restore(flags);
} else
hwif->INSL(data_addr, buf, len / 4);
}
if ((len & 3) >= 2)
hwif->INSW(data_addr, (u8 *)buf + (len & ~3), 1);
} else
hwif->INSW(data_addr, buf, len / 2);
if (mmio)
__ide_mm_insl((void __iomem *)data_addr, buf, len / 4);
else
insl(data_addr, buf, len / 4);
if (io_32bit & 2)
local_irq_restore(flags);
if ((len & 3) >= 2) {
if (mmio)
__ide_mm_insw((void __iomem *)data_addr,
(u8 *)buf + (len & ~3), 1);
else
insw(data_addr, (u8 *)buf + (len & ~3), 1);
}
} else {
if (mmio)
__ide_mm_insw((void __iomem *)data_addr, buf, len / 2);
else
insw(data_addr, buf, len / 2);
}
}
/*
@ -233,22 +200,37 @@ static void ata_output_data(ide_drive_t *drive, struct request *rq,
struct ide_io_ports *io_ports = &hwif->io_ports;
unsigned long data_addr = io_ports->data_addr;
u8 io_32bit = drive->io_32bit;
u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
if (io_32bit) {
if (io_32bit & 2) {
unsigned long flags;
unsigned long uninitialized_var(flags);
if (io_32bit & 2) {
local_irq_save(flags);
ata_vlb_sync(drive, io_ports->nsect_addr);
hwif->OUTSL(data_addr, buf, len / 4);
local_irq_restore(flags);
} else
hwif->OUTSL(data_addr, buf, len / 4);
}
if ((len & 3) >= 2)
hwif->OUTSW(data_addr, (u8 *)buf + (len & ~3), 1);
} else
hwif->OUTSW(data_addr, buf, len / 2);
if (mmio)
__ide_mm_outsl((void __iomem *)data_addr, buf, len / 4);
else
outsl(data_addr, buf, len / 4);
if (io_32bit & 2)
local_irq_restore(flags);
if ((len & 3) >= 2) {
if (mmio)
__ide_mm_outsw((void __iomem *)data_addr,
(u8 *)buf + (len & ~3), 1);
else
outsw(data_addr, (u8 *)buf + (len & ~3), 1);
}
} else {
if (mmio)
__ide_mm_outsw((void __iomem *)data_addr, buf, len / 2);
else
outsw(data_addr, buf, len / 2);
}
}
void default_hwif_transport(ide_hwif_t *hwif)

View File

@ -609,9 +609,6 @@ static int au_ide_probe(struct device *dev)
#ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA
hwif->input_data = au1xxx_input_data;
hwif->output_data = au1xxx_output_data;
hwif->INSW = auide_insw;
hwif->OUTSW = auide_outsw;
#endif
hwif->select_data = 0; /* no chipset-specific code */
hwif->config_data = 0; /* no chipset-specific code */

View File

@ -669,13 +669,9 @@ static void __devinit init_mmio_iops_scc(ide_hwif_t *hwif)
hwif->INB = scc_ide_inb;
hwif->INW = scc_ide_inw;
hwif->INSW = scc_ide_insw;
hwif->INSL = scc_ide_insl;
hwif->OUTB = scc_ide_outb;
hwif->OUTBSYNC = scc_ide_outbsync;
hwif->OUTW = scc_ide_outw;
hwif->OUTSW = scc_ide_outsw;
hwif->OUTSL = scc_ide_outsl;
hwif->dma_base = dma_base;
hwif->config_data = ports->ctl;

View File

@ -475,13 +475,9 @@ typedef struct hwif_s {
void (*OUTB)(u8 addr, unsigned long port);
void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port);
void (*OUTW)(u16 addr, unsigned long port);
void (*OUTSW)(unsigned long port, void *addr, u32 count);
void (*OUTSL)(unsigned long port, void *addr, u32 count);
u8 (*INB)(unsigned long port);
u16 (*INW)(unsigned long port);
void (*INSW)(unsigned long port, void *addr, u32 count);
void (*INSL)(unsigned long port, void *addr, u32 count);
/* dma physical region descriptor table (cpu view) */
unsigned int *dmatable_cpu;