Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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: Sergei Shtylyov <sshtylyov@ru.mvista.com>
Signed-off-by: Bartlomiej Zolnierkiewicz <bzolnier@gmail.com>

authored by

Sergei Shtylyov and committed by
Bartlomiej Zolnierkiewicz
f4d3ffa5 eba8999c

+27 -36
+9 -6
drivers/ide/buddha.c
··· 99 99 * Check and acknowledge the interrupt status 100 100 */ 101 101 102 - static int buddha_ack_intr(ide_hwif_t *hwif) 102 + static int buddha_test_irq(ide_hwif_t *hwif) 103 103 { 104 104 unsigned char ch; 105 105 ··· 118 118 } 119 119 120 120 static void __init buddha_setup_ports(struct ide_hw *hw, unsigned long base, 121 - unsigned long ctl, unsigned long irq_port, 122 - ide_ack_intr_t *ack_intr) 121 + unsigned long ctl, unsigned long irq_port) 123 122 { 124 123 int i; 125 124 ··· 133 134 hw->io_ports.irq_addr = irq_port; 134 135 135 136 hw->irq = IRQ_AMIGA_PORTS; 136 - hw->ack_intr = ack_intr; 137 137 } 138 + 139 + static const struct ide_port_ops buddha_port_ops = { 140 + .test_irq = buddha_test_irq, 141 + }; 138 142 139 143 static const struct ide_port_ops xsurf_port_ops = { 140 144 .clear_irq = xsurf_clear_irq, 145 + .test_irq = buddha_test_irq, 141 146 }; 142 147 143 148 static const struct ide_port_info buddha_port_info = { 149 + .port_ops = &buddha_port_ops, 144 150 .host_flags = IDE_HFLAG_MMIO | IDE_HFLAG_NO_DMA, 145 151 .irq_flags = IRQF_SHARED, 146 152 .chipset = ide_generic, ··· 221 217 irq_port = buddha_board + xsurf_irqports[i]; 222 218 } 223 219 224 - buddha_setup_ports(&hw[i], base, ctl, irq_port, 225 - buddha_ack_intr); 220 + buddha_setup_ports(&hw[i], base, ctl, irq_port); 226 221 227 222 hws[i] = &hw[i]; 228 223 }
-1
drivers/ide/falconide.c
··· 128 128 hw->io_ports.ctl_addr = ATA_HD_BASE + ATA_HD_CONTROL; 129 129 130 130 hw->irq = IRQ_MFP_IDE; 131 - hw->ack_intr = NULL; 132 131 } 133 132 134 133 /*
+9 -5
drivers/ide/gayle.c
··· 66 66 * Check and acknowledge the interrupt status 67 67 */ 68 68 69 - static int gayle_ack_intr(ide_hwif_t *hwif) 69 + static int gayle_test_irq(ide_hwif_t *hwif) 70 70 { 71 71 unsigned char ch; 72 72 ··· 85 85 } 86 86 87 87 static void __init gayle_setup_ports(struct ide_hw *hw, unsigned long base, 88 - unsigned long ctl, unsigned long irq_port, 89 - ide_ack_intr_t *ack_intr) 88 + unsigned long ctl, unsigned long irq_port) 90 89 { 91 90 int i; 92 91 ··· 100 101 hw->io_ports.irq_addr = irq_port; 101 102 102 103 hw->irq = IRQ_AMIGA_PORTS; 103 - hw->ack_intr = ack_intr; 104 104 } 105 + 106 + static const struct ide_port_ops gayle_a4000_port_ops = { 107 + .test_irq = gayle_test_irq, 108 + }; 105 109 106 110 static const struct ide_port_ops gayle_a1200_port_ops = { 107 111 .clear_irq = gayle_a1200_clear_irq, 112 + .test_irq = gayle_test_irq, 108 113 }; 109 114 110 115 static const struct ide_port_info gayle_port_info = { ··· 151 148 if (a4000) { 152 149 phys_base = GAYLE_BASE_4000; 153 150 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_4000); 151 + d.port_ops = &gayle_a4000_port_ops; 154 152 } else { 155 153 phys_base = GAYLE_BASE_1200; 156 154 irqport = (unsigned long)ZTWO_VADDR(GAYLE_IRQ_1200); ··· 168 164 base = (unsigned long)ZTWO_VADDR(phys_base + i * GAYLE_NEXT_PORT); 169 165 ctrlport = GAYLE_HAS_CONTROL_REG ? (base + GAYLE_CONTROL) : 0; 170 166 171 - gayle_setup_ports(&hw[i], base, ctrlport, irqport, gayle_ack_intr); 167 + gayle_setup_ports(&hw[i], base, ctrlport, irqport); 172 168 173 169 hws[i] = &hw[i]; 174 170 }
+2 -1
drivers/ide/ide-io.c
··· 804 804 805 805 spin_lock_irqsave(&hwif->lock, flags); 806 806 807 - if (hwif->ack_intr && hwif->ack_intr(hwif) == 0) 807 + if (hwif->port_ops && hwif->port_ops->test_irq && 808 + hwif->port_ops->test_irq(hwif) == 0) 808 809 goto out; 809 810 810 811 handler = hwif->handler;
-1
drivers/ide/ide-probe.c
··· 1170 1170 hwif->irq = hw->irq; 1171 1171 hwif->dev = hw->dev; 1172 1172 hwif->gendev.parent = hw->parent ? hw->parent : hw->dev; 1173 - hwif->ack_intr = hw->ack_intr; 1174 1173 hwif->config_data = hw->config; 1175 1174 } 1176 1175
+4 -8
drivers/ide/macide.c
··· 53 53 54 54 volatile unsigned char *ide_ifr = (unsigned char *) (IDE_BASE + IDE_IFR); 55 55 56 - int macide_ack_intr(ide_hwif_t* hwif) 56 + int macide_test_irq(ide_hwif_t *hwif) 57 57 { 58 58 if (*ide_ifr & 0x20) 59 59 return 1; ··· 66 66 } 67 67 68 68 static void __init macide_setup_ports(struct ide_hw *hw, unsigned long base, 69 - int irq, ide_ack_intr_t *ack_intr) 69 + int irq) 70 70 { 71 71 int i; 72 72 ··· 78 78 hw->io_ports.ctl_addr = base + IDE_CONTROL; 79 79 80 80 hw->irq = irq; 81 - hw->ack_intr = ack_intr; 82 81 } 83 82 84 83 static const struct ide_port_ops macide_port_ops = { 85 84 .clear_irq = macide_clear_irq, 85 + .test_irq = macide_test_irq, 86 86 }; 87 87 88 88 static const struct ide_port_info macide_port_info = { ··· 101 101 102 102 static int __init macide_init(void) 103 103 { 104 - ide_ack_intr_t *ack_intr; 105 104 unsigned long base; 106 105 int irq; 107 106 struct ide_hw hw, *hws[] = { &hw }; ··· 112 113 switch (macintosh_config->ide_type) { 113 114 case MAC_IDE_QUADRA: 114 115 base = IDE_BASE; 115 - ack_intr = macide_ack_intr; 116 116 irq = IRQ_NUBUS_F; 117 117 break; 118 118 case MAC_IDE_PB: 119 119 base = IDE_BASE; 120 - ack_intr = macide_ack_intr; 121 120 irq = IRQ_NUBUS_C; 122 121 break; 123 122 case MAC_IDE_BABOON: 124 123 base = BABOON_BASE; 125 - ack_intr = NULL; 126 124 d.port_ops = NULL; 127 125 irq = IRQ_BABOON_1; 128 126 break; ··· 130 134 printk(KERN_INFO "ide: Macintosh %s IDE controller\n", 131 135 mac_ide_name[macintosh_config->ide_type - 1]); 132 136 133 - macide_setup_ports(&hw, base, irq, ack_intr); 137 + macide_setup_ports(&hw, base, irq); 134 138 135 139 return ide_host_add(&d, hws, 1, NULL); 136 140 }
+2 -5
drivers/ide/q40ide.c
··· 51 51 /* 52 52 * Addresses are pretranslated for Q40 ISA access. 53 53 */ 54 - static void q40_ide_setup_ports(struct ide_hw *hw, unsigned long base, 55 - ide_ack_intr_t *ack_intr, 56 - int irq) 54 + static void q40_ide_setup_ports(struct ide_hw *hw, unsigned long base, int irq) 57 55 { 58 56 memset(hw, 0, sizeof(*hw)); 59 57 /* BIG FAT WARNING: ··· 67 69 hw->io_ports.ctl_addr = Q40_ISA_IO_B(base + 0x206); 68 70 69 71 hw->irq = irq; 70 - hw->ack_intr = ack_intr; 71 72 } 72 73 73 74 static void q40ide_input_data(ide_drive_t *drive, struct ide_cmd *cmd, ··· 153 156 release_region(pcide_bases[i], 8); 154 157 continue; 155 158 } 156 - q40_ide_setup_ports(&hw[i], pcide_bases[i], NULL, 159 + q40_ide_setup_ports(&hw[i], pcide_bases[i], 157 160 q40ide_default_irq(pcide_bases[i])); 158 161 159 162 hws[i] = &hw[i];
+1 -9
include/linux/ide.h
··· 157 157 #define REQ_UNPARK_HEADS 0x23 158 158 159 159 /* 160 - * Check for an interrupt and acknowledge the interrupt status 161 - */ 162 - struct hwif_s; 163 - typedef int (ide_ack_intr_t)(struct hwif_s *); 164 - 165 - /* 166 160 * hwif_chipset_t is used to keep track of the specific hardware 167 161 * chipset used by each IDE interface, if known. 168 162 */ ··· 179 185 }; 180 186 181 187 int irq; /* our irq number */ 182 - ide_ack_intr_t *ack_intr; /* acknowledge interrupt */ 183 188 struct device *dev, *parent; 184 189 unsigned long config; 185 190 }; ··· 629 636 void (*maskproc)(ide_drive_t *, int); 630 637 void (*quirkproc)(ide_drive_t *); 631 638 void (*clear_irq)(ide_drive_t *); 639 + int (*test_irq)(struct hwif_s *); 632 640 633 641 u8 (*mdma_filter)(ide_drive_t *); 634 642 u8 (*udma_filter)(ide_drive_t *); ··· 694 700 hwif_chipset_t chipset; /* sub-module for tuning.. */ 695 701 696 702 struct device *dev; 697 - 698 - ide_ack_intr_t *ack_intr; 699 703 700 704 void (*rw_disk)(ide_drive_t *, struct request *); 701 705