Commit f4d3ffa5 authored by Sergei Shtylyov's avatar Sergei Shtylyov Committed by Bartlomiej Zolnierkiewicz

ide: move ack_intr() method into 'struct ide_port_ops' (take 2)

Move the ack_intr() method into 'struct ide_port_ops', also renaming it to
test_irq() while at it...
Signed-off-by: default avatarSergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: default avatarBartlomiej Zolnierkiewicz <bzolnier@gmail.com>
parent eba8999c
...@@ -99,7 +99,7 @@ static const char *buddha_board_name[] = { "Buddha", "Catweasel", "X-Surf" }; ...@@ -99,7 +99,7 @@ static const char *buddha_board_name[] = { "Buddha", "Catweasel", "X-Surf" };
* Check and acknowledge the interrupt status * Check and acknowledge the interrupt status
*/ */
static int buddha_ack_intr(ide_hwif_t *hwif) static int buddha_test_irq(ide_hwif_t *hwif)
{ {
unsigned char ch; unsigned char ch;
...@@ -118,8 +118,7 @@ static void xsurf_clear_irq(ide_drive_t *drive) ...@@ -118,8 +118,7 @@ static void xsurf_clear_irq(ide_drive_t *drive)
} }
static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base, static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base,
unsigned long ctl, unsigned long irq_port, unsigned long ctl, unsigned long irq_port)
ide_ack_intr_t *ack_intr)
{ {
int i; int i;
...@@ -134,14 +133,19 @@ static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base, ...@@ -134,14 +133,19 @@ static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base,
hw->io_ports.irq_addr = irq_port; hw->io_ports.irq_addr = irq_port;
hw->irq = IRQ_AMIGA_PORTS; hw->irq = IRQ_AMIGA_PORTS;
hw->ack_intr = ack_intr;
} }
static const struct ide_port_ops buddha_port_ops = {
.test_irq = buddha_test_irq,
};
static const struct ide_port_ops xsurf_port_ops = { static const struct ide_port_ops xsurf_port_ops = {
.clear_irq = xsurf_clear_irq, .clear_irq = xsurf_clear_irq,
.test_irq = buddha_test_irq,
}; };
static const struct ide_port_info buddha_port_info = { static const struct ide_port_info buddha_port_info = {
.port_ops = &buddha_port_ops,
.host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA,
.irq_flags = IRQF_SHARED, .irq_flags = IRQF_SHARED,
.chipset = ide_generic, .chipset = ide_generic,
...@@ -217,8 +221,7 @@ static int __init buddha_init(void) ...@@ -217,8 +221,7 @@ static int __init buddha_init(void)
irq_port = buddha_board + xsurf_irqports[i]; irq_port = buddha_board + xsurf_irqports[i];
} }
buddha_setup_ports(&hw[i], base, ctl, irq_port, buddha_setup_ports(&hw[i], base, ctl, irq_port);
buddha_ack_intr);
hws[i] = &hw[i]; hws[i] = &hw[i];
} }
......
...@@ -128,7 +128,6 @@ static void __init falconide_setup_ports(struct ide_hw *hw) ...@@ -128,7 +128,6 @@ static void __init falconide_setup_ports(struct ide_hw *hw)
hw->io_ports.ctl_addr = ATA_HD_BASE + ATA_HD_CONTROL; hw->io_ports.ctl_addr = ATA_HD_BASE + ATA_HD_CONTROL;
hw->irq = IRQ_MFP_IDE; hw->irq = IRQ_MFP_IDE;
hw->ack_intr = NULL;
} }
/* /*
......
...@@ -66,7 +66,7 @@ MODULE_PARM_DESC(doubler, "enable support for IDE doublers"); ...@@ -66,7 +66,7 @@ MODULE_PARM_DESC(doubler, "enable support for IDE doublers");
* Check and acknowledge the interrupt status * Check and acknowledge the interrupt status
*/ */
static int gayle_ack_intr(ide_hwif_t *hwif) static int gayle_test_irq(ide_hwif_t *hwif)
{ {
unsigned char ch; unsigned char ch;
...@@ -85,8 +85,7 @@ static void gayle_a1200_clear_irq(ide_drive_t *drive) ...@@ -85,8 +85,7 @@ static void gayle_a1200_clear_irq(ide_drive_t *drive)
} }
static void __init gayle_setup_ports(struct ide_hw *hw, unsigned long base, static void __init gayle_setup_ports(struct ide_hw *hw, unsigned long base,
unsigned long ctl, unsigned long irq_port, unsigned long ctl, unsigned long irq_port)
ide_ack_intr_t *ack_intr)
{ {
int i; int i;
...@@ -101,11 +100,15 @@ static void __init gayle_setup_ports(struct ide_hw *hw, unsigned long base, ...@@ -101,11 +100,15 @@ static void __init gayle_setup_ports(struct ide_hw *hw, unsigned long base,
hw->io_ports.irq_addr = irq_port; hw->io_ports.irq_addr = irq_port;
hw->irq = IRQ_AMIGA_PORTS; hw->irq = IRQ_AMIGA_PORTS;
hw->ack_intr = ack_intr;
} }
static const struct ide_port_ops gayle_a4000_port_ops = {
.test_irq = gayle_test_irq,
};
static const struct ide_port_ops gayle_a1200_port_ops = { static const struct ide_port_ops gayle_a1200_port_ops = {
.clear_irq = gayle_a1200_clear_irq, .clear_irq = gayle_a1200_clear_irq,
.test_irq = gayle_test_irq,
}; };
static const struct ide_port_info gayle_port_info = { static const struct ide_port_info gayle_port_info = {
...@@ -148,6 +151,7 @@ static int __init gayle_init(void) ...@@ -148,6 +151,7 @@ static int __init gayle_init(void)
if (a4000) { if (a4000) {
phys_base = GAYLE_BASE_4000; phys_base = GAYLE_BASE_4000;
irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_4000); irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_4000);
d.port_ops = &gayle_a4000_port_ops;
} else { } else {
phys_base = GAYLE_BASE_1200; phys_base = GAYLE_BASE_1200;
irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200); irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200);
...@@ -164,7 +168,7 @@ static int __init gayle_init(void) ...@@ -164,7 +168,7 @@ static int __init gayle_init(void)
base = (unsigned long)ZTWO_VADDR(phys_base + i * GAYLE_NEXT_PORT); base = (unsigned long)ZTWO_VADDR(phys_base + i * GAYLE_NEXT_PORT);
ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0; ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0;
gayle_setup_ports(&hw[i], base, ctrlport, irqport, gayle_ack_intr); gayle_setup_ports(&hw[i], base, ctrlport, irqport);
hws[i] = &hw[i]; hws[i] = &hw[i];
} }
......
...@@ -804,7 +804,8 @@ irqreturn_t ide_intr (int irq, void *dev_id) ...@@ -804,7 +804,8 @@ irqreturn_t ide_intr (int irq, void *dev_id)
spin_lock_irqsave(&hwif->lock, flags); spin_lock_irqsave(&hwif->lock, flags);
if (hwif->ack_intr && hwif->ack_intr(hwif) == 0) if (hwif->port_ops && hwif->port_ops->test_irq &&
hwif->port_ops->test_irq(hwif) == 0)
goto out; goto out;
handler = hwif->handler; handler = hwif->handler;
......
...@@ -1170,7 +1170,6 @@ static void ide_init_port_hw(ide_hwif_t *hwif, struct ide_hw *hw) ...@@ -1170,7 +1170,6 @@ static void ide_init_port_hw(ide_hwif_t *hwif, struct ide_hw *hw)
hwif->irq = hw->irq; hwif->irq = hw->irq;
hwif->dev = hw->dev; hwif->dev = hw->dev;
hwif->gendev.parent = hw->parent ? hw->parent : hw->dev; hwif->gendev.parent = hw->parent ? hw->parent : hw->dev;
hwif->ack_intr = hw->ack_intr;
hwif->config_data = hw->config; hwif->config_data = hw->config;
} }
......
...@@ -53,7 +53,7 @@ ...@@ -53,7 +53,7 @@
volatile unsigned char *ide_ifr = (unsigned char *) (IDE_BASE + IDE_IFR); volatile unsigned char *ide_ifr = (unsigned char *) (IDE_BASE + IDE_IFR);
int macide_ack_intr(ide_hwif_t* hwif) int macide_test_irq(ide_hwif_t *hwif)
{ {
if (*ide_ifr & 0x20) if (*ide_ifr & 0x20)
return 1; return 1;
...@@ -66,7 +66,7 @@ static void macide_clear_irq(ide_drive_t *drive) ...@@ -66,7 +66,7 @@ static void macide_clear_irq(ide_drive_t *drive)
} }
static void __init macide_setup_ports(struct ide_hw *hw, unsigned long base, static void __init macide_setup_ports(struct ide_hw *hw, unsigned long base,
int irq, ide_ack_intr_t *ack_intr) int irq)
{ {
int i; int i;
...@@ -78,11 +78,11 @@ static void __init macide_setup_ports(struct ide_hw *hw, unsigned long base, ...@@ -78,11 +78,11 @@ static void __init macide_setup_ports(struct ide_hw *hw, unsigned long base,
hw->io_ports.ctl_addr = base + IDE_CONTROL; hw->io_ports.ctl_addr = base + IDE_CONTROL;
hw->irq = irq; hw->irq = irq;
hw->ack_intr = ack_intr;
} }
static const struct ide_port_ops macide_port_ops = { static const struct ide_port_ops macide_port_ops = {
.clear_irq = macide_clear_irq, .clear_irq = macide_clear_irq,
.test_irq = macide_test_irq,
}; };
static const struct ide_port_info macide_port_info = { static const struct ide_port_info macide_port_info = {
...@@ -101,7 +101,6 @@ static const char *mac_ide_name[] = ...@@ -101,7 +101,6 @@ static const char *mac_ide_name[] =
static int __init macide_init(void) static int __init macide_init(void)
{ {
ide_ack_intr_t *ack_intr;
unsigned long base; unsigned long base;
int irq; int irq;
struct ide_hw hw, *hws[] = { &hw }; struct ide_hw hw, *hws[] = { &hw };
...@@ -113,17 +112,14 @@ static int __init macide_init(void) ...@@ -113,17 +112,14 @@ static int __init macide_init(void)
switch (macintosh_config->ide_type) { switch (macintosh_config->ide_type) {
case MAC_IDE_QUADRA: case MAC_IDE_QUADRA:
base = IDE_BASE; base = IDE_BASE;
ack_intr = macide_ack_intr;
irq = IRQ_NUBUS_F; irq = IRQ_NUBUS_F;
break; break;
case MAC_IDE_PB: case MAC_IDE_PB:
base = IDE_BASE; base = IDE_BASE;
ack_intr = macide_ack_intr;
irq = IRQ_NUBUS_C; irq = IRQ_NUBUS_C;
break; break;
case MAC_IDE_BABOON: case MAC_IDE_BABOON:
base = BABOON_BASE; base = BABOON_BASE;
ack_intr = NULL;
d.port_ops = NULL; d.port_ops = NULL;
irq = IRQ_BABOON_1; irq = IRQ_BABOON_1;
break; break;
...@@ -134,7 +130,7 @@ static int __init macide_init(void) ...@@ -134,7 +130,7 @@ static int __init macide_init(void)
printk(KERN_INFO "ide: Macintosh %s IDE controller\n", printk(KERN_INFO "ide: Macintosh %s IDE controller\n",
mac_ide_name[macintosh_config->ide_type - 1]); mac_ide_name[macintosh_config->ide_type - 1]);
macide_setup_ports(&hw, base, irq, ack_intr); macide_setup_ports(&hw, base, irq);
return ide_host_add(&d, hws, 1, NULL); return ide_host_add(&d, hws, 1, NULL);
} }
......
...@@ -51,9 +51,7 @@ static int q40ide_default_irq(unsigned long base) ...@@ -51,9 +51,7 @@ static int q40ide_default_irq(unsigned long base)
/* /*
* Addresses are pretranslated for Q40 ISA access. * Addresses are pretranslated for Q40 ISA access.
*/ */
static void q40_ide_setup_ports(struct ide_hw *hw, unsigned long base, static void q40_ide_setup_ports(struct ide_hw *hw, unsigned long base, int irq)
ide_ack_intr_t *ack_intr,
int irq)
{ {
memset(hw, 0, sizeof(*hw)); memset(hw, 0, sizeof(*hw));
/* BIG FAT WARNING: /* BIG FAT WARNING:
...@@ -69,7 +67,6 @@ static void q40_ide_setup_ports(struct ide_hw *hw, unsigned long base, ...@@ -69,7 +67,6 @@ static void q40_ide_setup_ports(struct ide_hw *hw, unsigned long base,
hw->io_ports.ctl_addr = Q40_ISA_IO_B(base + 0x206); hw->io_ports.ctl_addr = Q40_ISA_IO_B(base + 0x206);
hw->irq = irq; hw->irq = irq;
hw->ack_intr = ack_intr;
} }
static void q40ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, static void q40ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd,
...@@ -156,7 +153,7 @@ static int __init q40ide_init(void) ...@@ -156,7 +153,7 @@ static int __init q40ide_init(void)
release_region(pcide_bases[i], 8); release_region(pcide_bases[i], 8);
continue; continue;
} }
q40_ide_setup_ports(&hw[i], pcide_bases[i], NULL, q40_ide_setup_ports(&hw[i], pcide_bases[i],
q40ide_default_irq(pcide_bases[i])); q40ide_default_irq(pcide_bases[i]));
hws[i] = &hw[i]; hws[i] = &hw[i];
......
...@@ -156,12 +156,6 @@ enum { ...@@ -156,12 +156,6 @@ enum {
#define REQ_PARK_HEADS 0x22 #define REQ_PARK_HEADS 0x22
#define REQ_UNPARK_HEADS 0x23 #define REQ_UNPARK_HEADS 0x23
/*
* Check for an interrupt and acknowledge the interrupt status
*/
struct hwif_s;
typedef int (ide_ack_intr_t)(struct hwif_s *);
/* /*
* hwif_chipset_t is used to keep track of the specific hardware * hwif_chipset_t is used to keep track of the specific hardware
* chipset used by each IDE interface, if known. * chipset used by each IDE interface, if known.
...@@ -185,7 +179,6 @@ struct ide_hw { ...@@ -185,7 +179,6 @@ struct ide_hw {
}; };
int irq; /* our irq number */ int irq; /* our irq number */
ide_ack_intr_t *ack_intr; /* acknowledge interrupt */
struct device *dev, *parent; struct device *dev, *parent;
unsigned long config; unsigned long config;
}; };
...@@ -636,6 +629,7 @@ struct ide_port_ops { ...@@ -636,6 +629,7 @@ struct ide_port_ops {
void (*maskproc)(ide_drive_t *, int); void (*maskproc)(ide_drive_t *, int);
void (*quirkproc)(ide_drive_t *); void (*quirkproc)(ide_drive_t *);
void (*clear_irq)(ide_drive_t *); void (*clear_irq)(ide_drive_t *);
int (*test_irq)(struct hwif_s *);
u8 (*mdma_filter)(ide_drive_t *); u8 (*mdma_filter)(ide_drive_t *);
u8 (*udma_filter)(ide_drive_t *); u8 (*udma_filter)(ide_drive_t *);
...@@ -701,8 +695,6 @@ typedef struct hwif_s { ...@@ -701,8 +695,6 @@ typedef struct hwif_s {
struct device *dev; struct device *dev;
ide_ack_intr_t *ack_intr;
void (*rw_disk)(ide_drive_t *, struct request *); void (*rw_disk)(ide_drive_t *, struct request *);
const struct ide_tp_ops *tp_ops; const struct ide_tp_ops *tp_ops;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment