Commit 16bb69c14a42e64faef1ec5c724ffaca916347a1

Authored by Bartlomiej Zolnierkiewicz
1 parent c5dd43ec65

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>

Showing 5 changed files with 48 additions and 81 deletions Side-by-side Diff

drivers/ide/h8300/ide-h8300.c
... ... @@ -90,11 +90,7 @@
90 90 hwif->output_data = h8300_output_data;
91 91  
92 92 hwif->OUTW = mm_outw;
93   - hwif->OUTSW = mm_outsw;
94 93 hwif->INW = mm_inw;
95   - hwif->INSW = mm_insw;
96   - hwif->OUTSL = NULL;
97   - hwif->INSL = NULL;
98 94 }
99 95  
100 96 static int __init h8300_ide_init(void)
drivers/ide/ide-iops.c
... ... @@ -42,16 +42,6 @@
42 42 return (u16) inw(port);
43 43 }
44 44  
45   -static void ide_insw (unsigned long port, void *addr, u32 count)
46   -{
47   - insw(port, addr, count);
48   -}
49   -
50   -static void ide_insl (unsigned long port, void *addr, u32 count)
51   -{
52   - insl(port, addr, count);
53   -}
54   -
55 45 static void ide_outb (u8 val, unsigned long port)
56 46 {
57 47 outb(val, port);
58 48  
59 49  
... ... @@ -67,27 +57,13 @@
67 57 outw(val, port);
68 58 }
69 59  
70   -static void ide_outsw (unsigned long port, void *addr, u32 count)
71   -{
72   - outsw(port, addr, count);
73   -}
74   -
75   -static void ide_outsl (unsigned long port, void *addr, u32 count)
76   -{
77   - outsl(port, addr, count);
78   -}
79   -
80 60 void default_hwif_iops (ide_hwif_t *hwif)
81 61 {
82 62 hwif->OUTB = ide_outb;
83 63 hwif->OUTBSYNC = ide_outbsync;
84 64 hwif->OUTW = ide_outw;
85   - hwif->OUTSW = ide_outsw;
86   - hwif->OUTSL = ide_outsl;
87 65 hwif->INB = ide_inb;
88 66 hwif->INW = ide_inw;
89   - hwif->INSW = ide_insw;
90   - hwif->INSL = ide_insl;
91 67 }
92 68  
93 69 /*
... ... @@ -104,16 +80,6 @@
104 80 return (u16) readw((void __iomem *) port);
105 81 }
106 82  
107   -static void ide_mm_insw (unsigned long port, void *addr, u32 count)
108   -{
109   - __ide_mm_insw((void __iomem *) port, addr, count);
110   -}
111   -
112   -static void ide_mm_insl (unsigned long port, void *addr, u32 count)
113   -{
114   - __ide_mm_insl((void __iomem *) port, addr, count);
115   -}
116   -
117 83 static void ide_mm_outb (u8 value, unsigned long port)
118 84 {
119 85 writeb(value, (void __iomem *) port);
... ... @@ -129,16 +95,6 @@
129 95 writew(value, (void __iomem *) port);
130 96 }
131 97  
132   -static void ide_mm_outsw (unsigned long port, void *addr, u32 count)
133   -{
134   - __ide_mm_outsw((void __iomem *) port, addr, count);
135   -}
136   -
137   -static void ide_mm_outsl (unsigned long port, void *addr, u32 count)
138   -{
139   - __ide_mm_outsl((void __iomem *) port, addr, count);
140   -}
141   -
142 98 void default_hwif_mmiops (ide_hwif_t *hwif)
143 99 {
144 100 hwif->OUTB = ide_mm_outb;
145 101  
... ... @@ -146,12 +102,8 @@
146 102 this one is controller specific! */
147 103 hwif->OUTBSYNC = ide_mm_outbsync;
148 104 hwif->OUTW = ide_mm_outw;
149   - hwif->OUTSW = ide_mm_outsw;
150   - hwif->OUTSL = ide_mm_outsl;
151 105 hwif->INB = ide_mm_inb;
152 106 hwif->INW = ide_mm_inw;
153   - hwif->INSW = ide_mm_insw;
154   - hwif->INSL = ide_mm_insl;
155 107 }
156 108  
157 109 EXPORT_SYMBOL(default_hwif_mmiops);
158 110  
159 111  
160 112  
161 113  
162 114  
... ... @@ -203,24 +155,39 @@
203 155 struct ide_io_ports *io_ports = &hwif->io_ports;
204 156 unsigned long data_addr = io_ports->data_addr;
205 157 u8 io_32bit = drive->io_32bit;
  158 + u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
206 159  
207 160 len++;
208 161  
209 162 if (io_32bit) {
210   - if (io_32bit & 2) {
211   - unsigned long flags;
  163 + unsigned long uninitialized_var(flags);
212 164  
  165 + if (io_32bit & 2) {
213 166 local_irq_save(flags);
214 167 ata_vlb_sync(drive, io_ports->nsect_addr);
215   - hwif->INSL(data_addr, buf, len / 4);
  168 + }
  169 +
  170 + if (mmio)
  171 + __ide_mm_insl((void __iomem *)data_addr, buf, len / 4);
  172 + else
  173 + insl(data_addr, buf, len / 4);
  174 +
  175 + if (io_32bit & 2)
216 176 local_irq_restore(flags);
217   - } else
218   - hwif->INSL(data_addr, buf, len / 4);
219 177  
220   - if ((len & 3) >= 2)
221   - hwif->INSW(data_addr, (u8 *)buf + (len & ~3), 1);
222   - } else
223   - hwif->INSW(data_addr, buf, len / 2);
  178 + if ((len & 3) >= 2) {
  179 + if (mmio)
  180 + __ide_mm_insw((void __iomem *)data_addr,
  181 + (u8 *)buf + (len & ~3), 1);
  182 + else
  183 + insw(data_addr, (u8 *)buf + (len & ~3), 1);
  184 + }
  185 + } else {
  186 + if (mmio)
  187 + __ide_mm_insw((void __iomem *)data_addr, buf, len / 2);
  188 + else
  189 + insw(data_addr, buf, len / 2);
  190 + }
224 191 }
225 192  
226 193 /*
227 194  
228 195  
229 196  
230 197  
231 198  
... ... @@ -233,22 +200,37 @@
233 200 struct ide_io_ports *io_ports = &hwif->io_ports;
234 201 unsigned long data_addr = io_ports->data_addr;
235 202 u8 io_32bit = drive->io_32bit;
  203 + u8 mmio = (hwif->host_flags & IDE_HFLAG_MMIO) ? 1 : 0;
236 204  
237 205 if (io_32bit) {
238   - if (io_32bit & 2) {
239   - unsigned long flags;
  206 + unsigned long uninitialized_var(flags);
240 207  
  208 + if (io_32bit & 2) {
241 209 local_irq_save(flags);
242 210 ata_vlb_sync(drive, io_ports->nsect_addr);
243   - hwif->OUTSL(data_addr, buf, len / 4);
  211 + }
  212 +
  213 + if (mmio)
  214 + __ide_mm_outsl((void __iomem *)data_addr, buf, len / 4);
  215 + else
  216 + outsl(data_addr, buf, len / 4);
  217 +
  218 + if (io_32bit & 2)
244 219 local_irq_restore(flags);
245   - } else
246   - hwif->OUTSL(data_addr, buf, len / 4);
247 220  
248   - if ((len & 3) >= 2)
249   - hwif->OUTSW(data_addr, (u8 *)buf + (len & ~3), 1);
250   - } else
251   - hwif->OUTSW(data_addr, buf, len / 2);
  221 + if ((len & 3) >= 2) {
  222 + if (mmio)
  223 + __ide_mm_outsw((void __iomem *)data_addr,
  224 + (u8 *)buf + (len & ~3), 1);
  225 + else
  226 + outsw(data_addr, (u8 *)buf + (len & ~3), 1);
  227 + }
  228 + } else {
  229 + if (mmio)
  230 + __ide_mm_outsw((void __iomem *)data_addr, buf, len / 2);
  231 + else
  232 + outsw(data_addr, buf, len / 2);
  233 + }
252 234 }
253 235  
254 236 void default_hwif_transport(ide_hwif_t *hwif)
drivers/ide/mips/au1xxx-ide.c
... ... @@ -609,9 +609,6 @@
609 609 #ifdef CONFIG_BLK_DEV_IDE_AU1XXX_PIO_DBDMA
610 610 hwif->input_data = au1xxx_input_data;
611 611 hwif->output_data = au1xxx_output_data;
612   -
613   - hwif->INSW = auide_insw;
614   - hwif->OUTSW = auide_outsw;
615 612 #endif
616 613 hwif->select_data = 0; /* no chipset-specific code */
617 614 hwif->config_data = 0; /* no chipset-specific code */
drivers/ide/pci/scc_pata.c
... ... @@ -669,13 +669,9 @@
669 669  
670 670 hwif->INB = scc_ide_inb;
671 671 hwif->INW = scc_ide_inw;
672   - hwif->INSW = scc_ide_insw;
673   - hwif->INSL = scc_ide_insl;
674 672 hwif->OUTB = scc_ide_outb;
675 673 hwif->OUTBSYNC = scc_ide_outbsync;
676 674 hwif->OUTW = scc_ide_outw;
677   - hwif->OUTSW = scc_ide_outsw;
678   - hwif->OUTSL = scc_ide_outsl;
679 675  
680 676 hwif->dma_base = dma_base;
681 677 hwif->config_data = ports->ctl;
... ... @@ -475,13 +475,9 @@
475 475 void (*OUTB)(u8 addr, unsigned long port);
476 476 void (*OUTBSYNC)(ide_drive_t *drive, u8 addr, unsigned long port);
477 477 void (*OUTW)(u16 addr, unsigned long port);
478   - void (*OUTSW)(unsigned long port, void *addr, u32 count);
479   - void (*OUTSL)(unsigned long port, void *addr, u32 count);
480 478  
481 479 u8 (*INB)(unsigned long port);
482 480 u16 (*INW)(unsigned long port);
483   - void (*INSW)(unsigned long port, void *addr, u32 count);
484   - void (*INSL)(unsigned long port, void *addr, u32 count);
485 481  
486 482 /* dma physical region descriptor table (cpu view) */
487 483 unsigned int *dmatable_cpu;