mirror of
https://github.com/adulau/aha.git
synced 2024-12-27 19:26:25 +00:00
[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>
This commit is contained in:
parent
01e7ae8c13
commit
3f2e40df0e
9 changed files with 25 additions and 50 deletions
|
@ -137,13 +137,6 @@ static unsigned char amiga_read_status(struct parport *p)
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* as this ports irq handling is already done, we use a generic funktion */
|
|
||||||
static irqreturn_t amiga_interrupt(int irq, void *dev_id)
|
|
||||||
{
|
|
||||||
parport_generic_irq(irq, (struct parport *) dev_id);
|
|
||||||
return IRQ_HANDLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void amiga_enable_irq(struct parport *p)
|
static void amiga_enable_irq(struct parport *p)
|
||||||
{
|
{
|
||||||
enable_irq(IRQ_AMIGA_CIAA_FLG);
|
enable_irq(IRQ_AMIGA_CIAA_FLG);
|
||||||
|
@ -255,7 +248,7 @@ static int __init parport_amiga_init(void)
|
||||||
if (!p)
|
if (!p)
|
||||||
goto out_port;
|
goto out_port;
|
||||||
|
|
||||||
err = request_irq(IRQ_AMIGA_CIAA_FLG, amiga_interrupt, 0, p->name, p);
|
err = request_irq(IRQ_AMIGA_CIAA_FLG, parport_irq_handler, 0, p->name, p);
|
||||||
if (err)
|
if (err)
|
||||||
goto out_irq;
|
goto out_irq;
|
||||||
|
|
||||||
|
|
|
@ -103,13 +103,6 @@ parport_atari_restore_state(struct parport *p, struct parport_state *s)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
static irqreturn_t
|
|
||||||
parport_atari_interrupt(int irq, void *dev_id)
|
|
||||||
{
|
|
||||||
parport_generic_irq(irq, (struct parport *) dev_id);
|
|
||||||
return IRQ_HANDLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void
|
static void
|
||||||
parport_atari_enable_irq(struct parport *p)
|
parport_atari_enable_irq(struct parport *p)
|
||||||
{
|
{
|
||||||
|
@ -208,7 +201,7 @@ static int __init parport_atari_init(void)
|
||||||
&parport_atari_ops);
|
&parport_atari_ops);
|
||||||
if (!p)
|
if (!p)
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
if (request_irq(IRQ_MFP_BUSY, parport_atari_interrupt,
|
if (request_irq(IRQ_MFP_BUSY, parport_irq_handler,
|
||||||
IRQ_TYPE_SLOW, p->name, p)) {
|
IRQ_TYPE_SLOW, p->name, p)) {
|
||||||
parport_put_port (p);
|
parport_put_port (p);
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
|
|
|
@ -232,14 +232,6 @@ parport_ax88796_restore_state(struct parport *p, struct parport_state *s)
|
||||||
writeb(s->u.ax88796.cpr, dd->spp_cpr);
|
writeb(s->u.ax88796.cpr, dd->spp_cpr);
|
||||||
}
|
}
|
||||||
|
|
||||||
static irqreturn_t
|
|
||||||
parport_ax88796_interrupt(int irq, void *dev_id)
|
|
||||||
{
|
|
||||||
parport_generic_irq(irq, dev_id);
|
|
||||||
return IRQ_HANDLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static struct parport_operations parport_ax88796_ops = {
|
static struct parport_operations parport_ax88796_ops = {
|
||||||
.write_data = parport_ax88796_write_data,
|
.write_data = parport_ax88796_write_data,
|
||||||
.read_data = parport_ax88796_read_data,
|
.read_data = parport_ax88796_read_data,
|
||||||
|
@ -344,7 +336,7 @@ static int parport_ax88796_probe(struct platform_device *pdev)
|
||||||
|
|
||||||
if (irq >= 0) {
|
if (irq >= 0) {
|
||||||
/* request irq */
|
/* request irq */
|
||||||
ret = request_irq(irq, parport_ax88796_interrupt,
|
ret = request_irq(irq, parport_irq_handler,
|
||||||
IRQF_TRIGGER_FALLING, pdev->name, pp);
|
IRQF_TRIGGER_FALLING, pdev->name, pp);
|
||||||
|
|
||||||
if (ret < 0)
|
if (ret < 0)
|
||||||
|
|
|
@ -80,12 +80,6 @@ static int clear_epp_timeout(struct parport *pb)
|
||||||
* of these are in parport_gsc.h.
|
* of these are in parport_gsc.h.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static irqreturn_t parport_gsc_interrupt(int irq, void *dev_id)
|
|
||||||
{
|
|
||||||
parport_generic_irq(irq, (struct parport *) dev_id);
|
|
||||||
return IRQ_HANDLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
void parport_gsc_init_state(struct pardevice *dev, struct parport_state *s)
|
void parport_gsc_init_state(struct pardevice *dev, struct parport_state *s)
|
||||||
{
|
{
|
||||||
s->u.pc.ctr = 0xc | (dev->irq_func ? 0x10 : 0x0);
|
s->u.pc.ctr = 0xc | (dev->irq_func ? 0x10 : 0x0);
|
||||||
|
@ -324,7 +318,7 @@ struct parport *__devinit parport_gsc_probe_port (unsigned long base,
|
||||||
printk("]\n");
|
printk("]\n");
|
||||||
|
|
||||||
if (p->irq != PARPORT_IRQ_NONE) {
|
if (p->irq != PARPORT_IRQ_NONE) {
|
||||||
if (request_irq (p->irq, parport_gsc_interrupt,
|
if (request_irq (p->irq, parport_irq_handler,
|
||||||
0, p->name, p)) {
|
0, p->name, p)) {
|
||||||
printk (KERN_WARNING "%s: irq %d in use, "
|
printk (KERN_WARNING "%s: irq %d in use, "
|
||||||
"resorting to polled operation\n",
|
"resorting to polled operation\n",
|
||||||
|
|
|
@ -778,14 +778,16 @@ static irqreturn_t parport_ip32_interrupt(int irq, void *dev_id)
|
||||||
struct parport * const p = dev_id;
|
struct parport * const p = dev_id;
|
||||||
struct parport_ip32_private * const priv = p->physport->private_data;
|
struct parport_ip32_private * const priv = p->physport->private_data;
|
||||||
enum parport_ip32_irq_mode irq_mode = priv->irq_mode;
|
enum parport_ip32_irq_mode irq_mode = priv->irq_mode;
|
||||||
|
|
||||||
switch (irq_mode) {
|
switch (irq_mode) {
|
||||||
case PARPORT_IP32_IRQ_FWD:
|
case PARPORT_IP32_IRQ_FWD:
|
||||||
parport_generic_irq(irq, p);
|
return parport_irq_handler(irq, dev_id);
|
||||||
break;
|
|
||||||
case PARPORT_IP32_IRQ_HERE:
|
case PARPORT_IP32_IRQ_HERE:
|
||||||
parport_ip32_wakeup(p);
|
parport_ip32_wakeup(p);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
return IRQ_HANDLED;
|
return IRQ_HANDLED;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -272,13 +272,6 @@ static int clear_epp_timeout(struct parport *pb)
|
||||||
* of these are in parport_pc.h.
|
* of these are in parport_pc.h.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
static irqreturn_t parport_pc_interrupt(int irq, void *dev_id)
|
|
||||||
{
|
|
||||||
parport_generic_irq(irq, (struct parport *) dev_id);
|
|
||||||
/* FIXME! Was it really ours? */
|
|
||||||
return IRQ_HANDLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void parport_pc_init_state(struct pardevice *dev, struct parport_state *s)
|
static void parport_pc_init_state(struct pardevice *dev, struct parport_state *s)
|
||||||
{
|
{
|
||||||
s->u.pc.ctr = 0xc;
|
s->u.pc.ctr = 0xc;
|
||||||
|
@ -2301,7 +2294,7 @@ struct parport *parport_pc_probe_port (unsigned long int base,
|
||||||
EPP_res = NULL;
|
EPP_res = NULL;
|
||||||
}
|
}
|
||||||
if (p->irq != PARPORT_IRQ_NONE) {
|
if (p->irq != PARPORT_IRQ_NONE) {
|
||||||
if (request_irq (p->irq, parport_pc_interrupt,
|
if (request_irq (p->irq, parport_irq_handler,
|
||||||
0, p->name, p)) {
|
0, p->name, p)) {
|
||||||
printk (KERN_WARNING "%s: irq %d in use, "
|
printk (KERN_WARNING "%s: irq %d in use, "
|
||||||
"resorting to polled operation\n",
|
"resorting to polled operation\n",
|
||||||
|
|
|
@ -46,12 +46,6 @@
|
||||||
#define dprintk(x)
|
#define dprintk(x)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static irqreturn_t parport_sunbpp_interrupt(int irq, void *dev_id)
|
|
||||||
{
|
|
||||||
parport_generic_irq(irq, (struct parport *) dev_id);
|
|
||||||
return IRQ_HANDLED;
|
|
||||||
}
|
|
||||||
|
|
||||||
static void parport_sunbpp_disable_irq(struct parport *p)
|
static void parport_sunbpp_disable_irq(struct parport *p)
|
||||||
{
|
{
|
||||||
struct bpp_regs __iomem *regs = (struct bpp_regs __iomem *)p->base;
|
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)
|
||||||
p->size = size;
|
p->size = size;
|
||||||
p->dev = &sdev->ofdev.dev;
|
p->dev = &sdev->ofdev.dev;
|
||||||
|
|
||||||
if ((err = request_irq(p->irq, parport_sunbpp_interrupt,
|
if ((err = request_irq(p->irq, parport_irq_handler,
|
||||||
IRQF_SHARED, p->name, p)) != 0) {
|
IRQF_SHARED, p->name, p)) != 0) {
|
||||||
goto out_put_port;
|
goto out_put_port;
|
||||||
}
|
}
|
||||||
|
|
|
@ -995,6 +995,15 @@ void parport_release(struct pardevice *dev)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
irqreturn_t parport_irq_handler(int irq, void *dev_id)
|
||||||
|
{
|
||||||
|
struct parport *port = dev_id;
|
||||||
|
|
||||||
|
parport_generic_irq(irq, port);
|
||||||
|
|
||||||
|
return IRQ_HANDLED;
|
||||||
|
}
|
||||||
|
|
||||||
/* Exported symbols for modules. */
|
/* Exported symbols for modules. */
|
||||||
|
|
||||||
EXPORT_SYMBOL(parport_claim);
|
EXPORT_SYMBOL(parport_claim);
|
||||||
|
@ -1011,5 +1020,6 @@ EXPORT_SYMBOL(parport_get_port);
|
||||||
EXPORT_SYMBOL(parport_put_port);
|
EXPORT_SYMBOL(parport_put_port);
|
||||||
EXPORT_SYMBOL(parport_find_number);
|
EXPORT_SYMBOL(parport_find_number);
|
||||||
EXPORT_SYMBOL(parport_find_base);
|
EXPORT_SYMBOL(parport_find_base);
|
||||||
|
EXPORT_SYMBOL(parport_irq_handler);
|
||||||
|
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
|
@ -100,6 +100,7 @@ typedef enum {
|
||||||
#include <linux/proc_fs.h>
|
#include <linux/proc_fs.h>
|
||||||
#include <linux/spinlock.h>
|
#include <linux/spinlock.h>
|
||||||
#include <linux/wait.h>
|
#include <linux/wait.h>
|
||||||
|
#include <linux/irqreturn.h>
|
||||||
#include <asm/system.h>
|
#include <asm/system.h>
|
||||||
#include <asm/ptrace.h>
|
#include <asm/ptrace.h>
|
||||||
#include <asm/semaphore.h>
|
#include <asm/semaphore.h>
|
||||||
|
@ -366,6 +367,9 @@ extern void parport_unregister_driver (struct parport_driver *);
|
||||||
extern struct parport *parport_find_number (int);
|
extern struct parport *parport_find_number (int);
|
||||||
extern struct parport *parport_find_base (unsigned long);
|
extern struct parport *parport_find_base (unsigned long);
|
||||||
|
|
||||||
|
/* generic irq handler, if it suits your needs */
|
||||||
|
extern irqreturn_t parport_irq_handler(int irq, void *dev_id);
|
||||||
|
|
||||||
/* Reference counting for ports. */
|
/* Reference counting for ports. */
|
||||||
extern struct parport *parport_get_port (struct parport *);
|
extern struct parport *parport_get_port (struct parport *);
|
||||||
extern void parport_put_port (struct parport *);
|
extern void parport_put_port (struct parport *);
|
||||||
|
@ -514,7 +518,7 @@ extern void parport_daisy_deselect_all (struct parport *port);
|
||||||
extern int parport_daisy_select (struct parport *port, int daisy, int mode);
|
extern int parport_daisy_select (struct parport *port, int daisy, int mode);
|
||||||
|
|
||||||
/* Lowlevel drivers _can_ call this support function to handle irqs. */
|
/* Lowlevel drivers _can_ call this support function to handle irqs. */
|
||||||
static __inline__ void parport_generic_irq(int irq, struct parport *port)
|
static inline void parport_generic_irq(int irq, struct parport *port)
|
||||||
{
|
{
|
||||||
parport_ieee1284_interrupt (irq, port);
|
parport_ieee1284_interrupt (irq, port);
|
||||||
read_lock(&port->cad_lock);
|
read_lock(&port->cad_lock);
|
||||||
|
|
Loading…
Reference in a new issue