aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/parport
diff options
context:
space:
mode:
authorJeff Garzik <jeff@garzik.org>2007-10-19 01:42:14 -0400
committerJeff Garzik <jeff@garzik.org>2007-10-23 19:53:15 -0400
commit3f2e40df0e1d7694224c3083b0bebd129039a40a (patch)
tree3d0d8c2a9dd1f873e5638a132abc5d40c6ff583b /drivers/parport
parent01e7ae8c13bb06a2ce622ebace33bb7e28ef596c (diff)
[PARPORT] Consolidate code copies into a single generic irq handler
Several arches used the exact same code for their parport irq handling. Make that code generic, in parport_irq_handler(). Also, s/__inline__/inline/ in include/linux/parport.h. Signed-off-by: Jeff Garzik <jgarzik@redhat.com>
Diffstat (limited to 'drivers/parport')
-rw-r--r--drivers/parport/parport_amiga.c9
-rw-r--r--drivers/parport/parport_atari.c9
-rw-r--r--drivers/parport/parport_ax88796.c10
-rw-r--r--drivers/parport/parport_gsc.c8
-rw-r--r--drivers/parport/parport_ip32.c6
-rw-r--r--drivers/parport/parport_pc.c9
-rw-r--r--drivers/parport/parport_sunbpp.c8
-rw-r--r--drivers/parport/share.c10
8 files changed, 20 insertions, 49 deletions
diff --git a/drivers/parport/parport_amiga.c b/drivers/parport/parport_amiga.c
index a0afaee5ebe5..1586e1caa2f5 100644
--- a/drivers/parport/parport_amiga.c
+++ b/drivers/parport/parport_amiga.c
@@ -137,13 +137,6 @@ static unsigned char amiga_read_status(struct parport *p)
137 return status; 137 return status;
138} 138}
139 139
140/* as this ports irq handling is already done, we use a generic funktion */
141static irqreturn_t amiga_interrupt(int irq, void *dev_id)
142{
143 parport_generic_irq(irq, (struct parport *) dev_id);
144 return IRQ_HANDLED;
145}
146
147static void amiga_enable_irq(struct parport *p) 140static void amiga_enable_irq(struct parport *p)
148{ 141{
149 enable_irq(IRQ_AMIGA_CIAA_FLG); 142 enable_irq(IRQ_AMIGA_CIAA_FLG);
@@ -255,7 +248,7 @@ static int __init parport_amiga_init(void)
255 if (!p) 248 if (!p)
256 goto out_port; 249 goto out_port;
257 250
258 err = request_irq(IRQ_AMIGA_CIAA_FLG, amiga_interrupt, 0, p->name, p); 251 err = request_irq(IRQ_AMIGA_CIAA_FLG, parport_irq_handler, 0, p->name, p);
259 if (err) 252 if (err)
260 goto out_irq; 253 goto out_irq;
261 254
diff --git a/drivers/parport/parport_atari.c b/drivers/parport/parport_atari.c
index 6ea9929b8c7f..ad4cdd256137 100644
--- a/drivers/parport/parport_atari.c
+++ b/drivers/parport/parport_atari.c
@@ -103,13 +103,6 @@ parport_atari_restore_state(struct parport *p, struct parport_state *s)
103{ 103{
104} 104}
105 105
106static irqreturn_t
107parport_atari_interrupt(int irq, void *dev_id)
108{
109 parport_generic_irq(irq, (struct parport *) dev_id);
110 return IRQ_HANDLED;
111}
112
113static void 106static void
114parport_atari_enable_irq(struct parport *p) 107parport_atari_enable_irq(struct parport *p)
115{ 108{
@@ -208,7 +201,7 @@ static int __init parport_atari_init(void)
208 &parport_atari_ops); 201 &parport_atari_ops);
209 if (!p) 202 if (!p)
210 return -ENODEV; 203 return -ENODEV;
211 if (request_irq(IRQ_MFP_BUSY, parport_atari_interrupt, 204 if (request_irq(IRQ_MFP_BUSY, parport_irq_handler,
212 IRQ_TYPE_SLOW, p->name, p)) { 205 IRQ_TYPE_SLOW, p->name, p)) {
213 parport_put_port (p); 206 parport_put_port (p);
214 return -ENODEV; 207 return -ENODEV;
diff --git a/drivers/parport/parport_ax88796.c b/drivers/parport/parport_ax88796.c
index 74f4e9742c6c..4ec220b2eae7 100644
--- a/drivers/parport/parport_ax88796.c
+++ b/drivers/parport/parport_ax88796.c
@@ -232,14 +232,6 @@ parport_ax88796_restore_state(struct parport *p, struct parport_state *s)
232 writeb(s->u.ax88796.cpr, dd->spp_cpr); 232 writeb(s->u.ax88796.cpr, dd->spp_cpr);
233} 233}
234 234
235static irqreturn_t
236parport_ax88796_interrupt(int irq, void *dev_id)
237{
238 parport_generic_irq(irq, dev_id);
239 return IRQ_HANDLED;
240}
241
242
243static struct parport_operations parport_ax88796_ops = { 235static struct parport_operations parport_ax88796_ops = {
244 .write_data = parport_ax88796_write_data, 236 .write_data = parport_ax88796_write_data,
245 .read_data = parport_ax88796_read_data, 237 .read_data = parport_ax88796_read_data,
@@ -344,7 +336,7 @@ static int parport_ax88796_probe(struct platform_device *pdev)
344 336
345 if (irq >= 0) { 337 if (irq >= 0) {
346 /* request irq */ 338 /* request irq */
347 ret = request_irq(irq, parport_ax88796_interrupt, 339 ret = request_irq(irq, parport_irq_handler,
348 IRQF_TRIGGER_FALLING, pdev->name, pp); 340 IRQF_TRIGGER_FALLING, pdev->name, pp);
349 341
350 if (ret < 0) 342 if (ret < 0)
diff --git a/drivers/parport/parport_gsc.c b/drivers/parport/parport_gsc.c
index 43652ba523eb..0e77ae2b71a0 100644
--- a/drivers/parport/parport_gsc.c
+++ b/drivers/parport/parport_gsc.c
@@ -80,12 +80,6 @@ static int clear_epp_timeout(struct parport *pb)
80 * of these are in parport_gsc.h. 80 * of these are in parport_gsc.h.
81 */ 81 */
82 82
83static irqreturn_t parport_gsc_interrupt(int irq, void *dev_id)
84{
85 parport_generic_irq(irq, (struct parport *) dev_id);
86 return IRQ_HANDLED;
87}
88
89void parport_gsc_init_state(struct pardevice *dev, struct parport_state *s) 83void parport_gsc_init_state(struct pardevice *dev, struct parport_state *s)
90{ 84{
91 s->u.pc.ctr = 0xc | (dev->irq_func ? 0x10 : 0x0); 85 s->u.pc.ctr = 0xc | (dev->irq_func ? 0x10 : 0x0);
@@ -324,7 +318,7 @@ struct parport *__devinit parport_gsc_probe_port (unsigned long base,
324 printk("]\n"); 318 printk("]\n");
325 319
326 if (p->irq != PARPORT_IRQ_NONE) { 320 if (p->irq != PARPORT_IRQ_NONE) {
327 if (request_irq (p->irq, parport_gsc_interrupt, 321 if (request_irq (p->irq, parport_irq_handler,
328 0, p->name, p)) { 322 0, p->name, p)) {
329 printk (KERN_WARNING "%s: irq %d in use, " 323 printk (KERN_WARNING "%s: irq %d in use, "
330 "resorting to polled operation\n", 324 "resorting to polled operation\n",
diff --git a/drivers/parport/parport_ip32.c b/drivers/parport/parport_ip32.c
index ec44efdbb84e..6d58bf895b1a 100644
--- a/drivers/parport/parport_ip32.c
+++ b/drivers/parport/parport_ip32.c
@@ -778,14 +778,16 @@ static irqreturn_t parport_ip32_interrupt(int irq, void *dev_id)
778 struct parport * const p = dev_id; 778 struct parport * const p = dev_id;
779 struct parport_ip32_private * const priv = p->physport->private_data; 779 struct parport_ip32_private * const priv = p->physport->private_data;
780 enum parport_ip32_irq_mode irq_mode = priv->irq_mode; 780 enum parport_ip32_irq_mode irq_mode = priv->irq_mode;
781
781 switch (irq_mode) { 782 switch (irq_mode) {
782 case PARPORT_IP32_IRQ_FWD: 783 case PARPORT_IP32_IRQ_FWD:
783 parport_generic_irq(irq, p); 784 return parport_irq_handler(irq, dev_id);
784 break; 785
785 case PARPORT_IP32_IRQ_HERE: 786 case PARPORT_IP32_IRQ_HERE:
786 parport_ip32_wakeup(p); 787 parport_ip32_wakeup(p);
787 break; 788 break;
788 } 789 }
790
789 return IRQ_HANDLED; 791 return IRQ_HANDLED;
790} 792}
791 793
diff --git a/drivers/parport/parport_pc.c b/drivers/parport/parport_pc.c
index e2be84001105..e9743d3efaf6 100644
--- a/drivers/parport/parport_pc.c
+++ b/drivers/parport/parport_pc.c
@@ -272,13 +272,6 @@ static int clear_epp_timeout(struct parport *pb)
272 * of these are in parport_pc.h. 272 * of these are in parport_pc.h.
273 */ 273 */
274 274
275static irqreturn_t parport_pc_interrupt(int irq, void *dev_id)
276{
277 parport_generic_irq(irq, (struct parport *) dev_id);
278 /* FIXME! Was it really ours? */
279 return IRQ_HANDLED;
280}
281
282static void parport_pc_init_state(struct pardevice *dev, struct parport_state *s) 275static void parport_pc_init_state(struct pardevice *dev, struct parport_state *s)
283{ 276{
284 s->u.pc.ctr = 0xc; 277 s->u.pc.ctr = 0xc;
@@ -2301,7 +2294,7 @@ struct parport *parport_pc_probe_port (unsigned long int base,
2301 EPP_res = NULL; 2294 EPP_res = NULL;
2302 } 2295 }
2303 if (p->irq != PARPORT_IRQ_NONE) { 2296 if (p->irq != PARPORT_IRQ_NONE) {
2304 if (request_irq (p->irq, parport_pc_interrupt, 2297 if (request_irq (p->irq, parport_irq_handler,
2305 0, p->name, p)) { 2298 0, p->name, p)) {
2306 printk (KERN_WARNING "%s: irq %d in use, " 2299 printk (KERN_WARNING "%s: irq %d in use, "
2307 "resorting to polled operation\n", 2300 "resorting to polled operation\n",
diff --git a/drivers/parport/parport_sunbpp.c b/drivers/parport/parport_sunbpp.c
index d27019c2f860..9d595aa91e46 100644
--- a/drivers/parport/parport_sunbpp.c
+++ b/drivers/parport/parport_sunbpp.c
@@ -46,12 +46,6 @@
46#define dprintk(x) 46#define dprintk(x)
47#endif 47#endif
48 48
49static irqreturn_t parport_sunbpp_interrupt(int irq, void *dev_id)
50{
51 parport_generic_irq(irq, (struct parport *) dev_id);
52 return IRQ_HANDLED;
53}
54
55static void parport_sunbpp_disable_irq(struct parport *p) 49static void parport_sunbpp_disable_irq(struct parport *p)
56{ 50{
57 struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base; 51 struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
@@ -324,7 +318,7 @@ static int __devinit init_one_port(struct sbus_dev *sdev)
324 p->size = size; 318 p->size = size;
325 p->dev = &sdev->ofdev.dev; 319 p->dev = &sdev->ofdev.dev;
326 320
327 if ((err = request_irq(p->irq, parport_sunbpp_interrupt, 321 if ((err = request_irq(p->irq, parport_irq_handler,
328 IRQF_SHARED, p->name, p)) != 0) { 322 IRQF_SHARED, p->name, p)) != 0) {
329 goto out_put_port; 323 goto out_put_port;
330 } 324 }
diff --git a/drivers/parport/share.c b/drivers/parport/share.c
index cd66442acfee..414c52a5883a 100644
--- a/drivers/parport/share.c
+++ b/drivers/parport/share.c
@@ -995,6 +995,15 @@ void parport_release(struct pardevice *dev)
995 } 995 }
996} 996}
997 997
998irqreturn_t parport_irq_handler(int irq, void *dev_id)
999{
1000 struct parport *port = dev_id;
1001
1002 parport_generic_irq(irq, port);
1003
1004 return IRQ_HANDLED;
1005}
1006
998/* Exported symbols for modules. */ 1007/* Exported symbols for modules. */
999 1008
1000EXPORT_SYMBOL(parport_claim); 1009EXPORT_SYMBOL(parport_claim);
@@ -1011,5 +1020,6 @@ EXPORT_SYMBOL(parport_get_port);
1011EXPORT_SYMBOL(parport_put_port); 1020EXPORT_SYMBOL(parport_put_port);
1012EXPORT_SYMBOL(parport_find_number); 1021EXPORT_SYMBOL(parport_find_number);
1013EXPORT_SYMBOL(parport_find_base); 1022EXPORT_SYMBOL(parport_find_base);
1023EXPORT_SYMBOL(parport_irq_handler);
1014 1024
1015MODULE_LICENSE("GPL"); 1025MODULE_LICENSE("GPL");