From ac95beedf8bc97b24f9540d4da9952f07221c023 Mon Sep 17 00:00:00 2001 From: Bartlomiej Zolnierkiewicz Date: Sat, 26 Apr 2008 22:25:14 +0200 Subject: ide: add struct ide_port_ops (take 2) * Move hooks for port/host specific methods from ide_hwif_t to 'struct ide_port_ops'. * Add 'const struct ide_port_ops *port_ops' to 'struct ide_port_info' and ide_hwif_t. * Update host drivers and core code accordingly. While at it: * Rename ata66_*() cable detect functions to *_cable_detect() to match the standard naming. (Suggested by Sergei Shtylyov) v2: * Fix build for bast-ide. (Noticed by Andrew Morton) Acked-by: Sergei Shtylyov Signed-off-by: Bartlomiej Zolnierkiewicz --- drivers/ide/arm/bast-ide.c | 2 +- drivers/ide/arm/icside.c | 13 +++++++++++-- drivers/ide/arm/palm_bk3710.c | 14 ++++++-------- 3 files changed, 18 insertions(+), 11 deletions(-) (limited to 'drivers/ide/arm') diff --git a/drivers/ide/arm/bast-ide.c b/drivers/ide/arm/bast-ide.c index a80b9574865e..5a2b0f163e84 100644 --- a/drivers/ide/arm/bast-ide.c +++ b/drivers/ide/arm/bast-ide.c @@ -56,7 +56,7 @@ static int __init bastide_register(unsigned int base, unsigned int aux, int irq) ide_init_port_hw(hwif, &hw); hwif->mmio = 1; - hwif->quirkproc = NULL; + hwif->port_ops = NULL; idx[0] = i; diff --git a/drivers/ide/arm/icside.c b/drivers/ide/arm/icside.c index fd12bbe93f11..b219818a400a 100644 --- a/drivers/ide/arm/icside.c +++ b/drivers/ide/arm/icside.c @@ -191,6 +191,10 @@ static void icside_maskproc(ide_drive_t *drive, int mask) local_irq_restore(flags); } +static const struct ide_port_ops icside_v6_no_dma_port_ops = { + .maskproc = icside_maskproc, +}; + #ifdef CONFIG_BLK_DEV_IDEDMA_ICS /* * SG-DMA support. @@ -266,6 +270,11 @@ static void icside_set_dma_mode(ide_drive_t *drive, const u8 xfer_mode) ide_xfer_verbose(xfer_mode), 2000 / drive->drive_data); } +static const struct ide_port_ops icside_v6_port_ops = { + .set_dma_mode = icside_set_dma_mode, + .maskproc = icside_maskproc, +}; + static void icside_dma_host_set(ide_drive_t *drive, int on) { } @@ -379,7 +388,6 @@ static void icside_dma_init(ide_hwif_t *hwif) { hwif->dmatable_cpu = NULL; hwif->dmatable_dma = 0; - hwif->set_dma_mode = icside_set_dma_mode; hwif->dma_host_set = icside_dma_host_set; hwif->dma_setup = icside_dma_setup; @@ -462,6 +470,7 @@ icside_register_v5(struct icside_state *state, struct expansion_card *ec) } static const struct ide_port_info icside_v6_port_info __initdata = { + .port_ops = &icside_v6_no_dma_port_ops, .host_flags = IDE_HFLAG_SERIALIZE | IDE_HFLAG_NO_DMA | /* no SFF-style DMA */ IDE_HFLAG_NO_AUTOTUNE, @@ -526,7 +535,6 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) state->hwif[0] = hwif; state->hwif[1] = mate; - hwif->maskproc = icside_maskproc; hwif->hwif_data = state; hwif->config_data = (unsigned long)ioc_base; hwif->select_data = sel; @@ -539,6 +547,7 @@ icside_register_v6(struct icside_state *state, struct expansion_card *ec) if (ec->dma != NO_DMA && !request_dma(ec->dma, hwif->name)) { icside_dma_init(hwif); icside_dma_init(mate); + d.port_ops = &icside_v6_dma_port_ops; } else d.mwdma_mask = d.swdma_mask = 0; diff --git a/drivers/ide/arm/palm_bk3710.c b/drivers/ide/arm/palm_bk3710.c index 666df779a5f4..9e21b8e6099c 100644 --- a/drivers/ide/arm/palm_bk3710.c +++ b/drivers/ide/arm/palm_bk3710.c @@ -317,16 +317,14 @@ static u8 __devinit palm_bk3710_cable_detect(ide_hwif_t *hwif) return ATA_CBL_PATA80; } -static void __devinit palm_bk3710_init_hwif(ide_hwif_t *hwif) -{ - hwif->set_pio_mode = palm_bk3710_set_pio_mode; - hwif->set_dma_mode = palm_bk3710_set_dma_mode; - - hwif->cable_detect = palm_bk3710_cable_detect; -} +static const struct ide_port_ops palm_bk3710_ports_ops = { + .set_pio_mode = palm_bk3710_set_pio_mode, + .set_dma_mode = palm_bk3710_set_dma_mode, + .cable_detect = palm_bk3710_cable_detect, +}; static const struct ide_port_info __devinitdata palm_bk3710_port_info = { - .init_hwif = palm_bk3710_init_hwif, + .port_ops = &palm_bk3710_ports_ops, .host_flags = IDE_HFLAG_NO_DMA, /* hack (no PCI) */ .pio_mask = ATA_PIO4, .udma_mask = ATA_UDMA4, /* (input clk 99MHz) */ -- cgit v1.2.1