Re: [PATCH 1/3] Improve type handling in interrupt handlers
On Saturday 19 January 2008 07:41:41 Jeff Garzik wrote: > FWIW, I have been working in this area extensively. Excellent... > Check out the 'irq-cleanups' and 'irq-remove' branches of > git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git Your irq-cleanups branch is nice work! But AFAICT these patches are not included in your irq-cleanups branch. Did you want me to switch my patch over to irqreturn_t and send them for you to roll in? Cheers, Rusty. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] Improve type handling in interrupt handlers
Rusty Russell wrote: On Saturday 19 January 2008 07:41:41 Jeff Garzik wrote: You should be using irq_handler_t for all these. Well, these are your drivers, but for mine I dislike the obfuscation. It's not like you can declare the function itself to be an irq_handler_t, so it's a strange turd to drop in a driver. The others need to be irq_handler_t because that's the precise type that's being used in each particularly situation. Each time the code re-creates that definition creates a problem for future irq handler changes of any type, really. As I noted, I've fixed all this crap already, and read through each one of those drivers. Jeff -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] Improve type handling in interrupt handlers
On Saturday 19 January 2008 07:41:41 Jeff Garzik wrote: > You should be using irq_handler_t for all these. Well, these are your drivers, but for mine I dislike the obfuscation. It's not like you can declare the function itself to be an irq_handler_t, so it's a strange turd to drop in a driver. > (Coincedentally, doing so makes it easier for me to later on remove the > almost-never-used 'irq' argument from all irq handlers) Slightly, but the compiler would tell you if you miss one, so I don't think this is real. Cheers, Rusty. -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] Improve type handling in interrupt handlers
Rusty Russell wrote: This improves typechecking of interrupt handlers by removing unnecessary (void *) casts and storing handlers in correctly-typed variables. Signed-off-by: Rusty Russell <[EMAIL PROTECTED]> Cc: Jeff Garzik <[EMAIL PROTECTED]> Cc: Ash Willis <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] FWIW, I have been working in this area extensively. Check out the 'irq-cleanups' and 'irq-remove' branches of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git (irq-remove is built on top of irq-cleanups) diff -r 0fe1a980708b drivers/net/eth16i.c --- a/drivers/net/eth16i.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/eth16i.c Thu Jan 17 15:42:00 2008 +1100 @@ -529,7 +529,7 @@ static int __init eth16i_probe1(struct n /* Try to obtain interrupt vector */ - if ((retval = request_irq(dev->irq, (void *)_interrupt, 0, cardname, dev))) { + if ((retval = request_irq(dev->irq, eth16i_interrupt, 0, cardname, dev))) { printk(KERN_WARNING "%s at %#3x, but is unusable due to conflicting IRQ %d.\n", cardname, ioaddr, dev->irq); goto out; diff -r 0fe1a980708b drivers/net/ewrk3.c --- a/drivers/net/ewrk3.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/ewrk3.c Thu Jan 17 15:42:00 2008 +1100 @@ -635,7 +635,7 @@ static int ewrk3_open(struct net_device STOP_EWRK3; if (!lp->hard_strapped) { - if (request_irq(dev->irq, (void *) ewrk3_interrupt, 0, "ewrk3", dev)) { + if (request_irq(dev->irq, ewrk3_interrupt, 0, "ewrk3", dev)) { printk("ewrk3_open(): Requested IRQ%d is busy\n", dev->irq); status = -EAGAIN; } else { diff -r 0fe1a980708b drivers/net/skfp/skfddi.c --- a/drivers/net/skfp/skfddi.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/skfp/skfddi.c Thu Jan 17 15:42:00 2008 +1100 @@ -495,7 +495,7 @@ static int skfp_open(struct net_device * PRINTK(KERN_INFO "entering skfp_open\n"); /* Register IRQ - support shared interrupts by passing device ptr */ - err = request_irq(dev->irq, (void *) skfp_interrupt, IRQF_SHARED, + err = request_irq(dev->irq, skfp_interrupt, IRQF_SHARED, dev->name, dev); if (err) return err; ACK all of the above diff -r 0fe1a980708b include/pcmcia/cs.h --- a/include/pcmcia/cs.h Thu Jan 17 14:48:56 2008 +1100 +++ b/include/pcmcia/cs.h Thu Jan 17 15:42:01 2008 +1100 @@ -170,7 +170,7 @@ typedef struct irq_req_t { u_int Attributes; u_int AssignedIRQ; u_int IRQInfo1, IRQInfo2; /* IRQInfo2 is ignored */ -void *Handler; +int(*Handler)(int, void *); void *Instance; } irq_req_t; diff -r 0fe1a980708b sound/pci/als300.c --- a/sound/pci/als300.cThu Jan 17 14:48:56 2008 +1100 +++ b/sound/pci/als300.cThu Jan 17 15:42:01 2008 +1100 @@ -678,7 +678,7 @@ static int __devinit snd_als300_create(s struct snd_als300 **rchip) { struct snd_als300 *chip; - void *irq_handler; + int (*irq_handler)(int, void *); int err; static struct snd_device_ops ops = { diff -r 0fe1a980708b drivers/net/e1000e/netdev.c --- a/drivers/net/e1000e/netdev.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/e1000e/netdev.c Thu Jan 17 15:42:00 2008 +1100 @@ -935,7 +935,7 @@ static int e1000_request_irq(struct e100 static int e1000_request_irq(struct e1000_adapter *adapter) { struct net_device *netdev = adapter->netdev; - void (*handler) = _intr; + int (*handler)(int, void *) = _intr; int irq_flags = IRQF_SHARED; int err; diff -r 0fe1a980708b drivers/net/e1000/e1000_main.c --- a/drivers/net/e1000/e1000_main.cThu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/e1000/e1000_main.cThu Jan 17 15:42:00 2008 +1100 @@ -299,7 +299,7 @@ static int e1000_request_irq(struct e100 static int e1000_request_irq(struct e1000_adapter *adapter) { struct net_device *netdev = adapter->netdev; - void (*handler) = _intr; + irqreturn_t (*handler)(int, void *) = _intr; int irq_flags = IRQF_SHARED; int err; NAK the rest. You should be using irq_handler_t for all these. (Coincedentally, doing so makes it easier for me to later on remove the almost-never-used 'irq' argument from all irq handlers) Jeff -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] Improve type handling in interrupt handlers
This improves typechecking of interrupt handlers by removing unnecessary (void *) casts and storing handlers in correctly-typed variables. Signed-off-by: Rusty Russell <[EMAIL PROTECTED]> Cc: Jeff Garzik <[EMAIL PROTECTED]> Cc: Ash Willis <[EMAIL PROTECTED]> Cc: [EMAIL PROTECTED] --- drivers/net/e1000/e1000_main.c |2 +- drivers/net/e1000e/netdev.c|2 +- drivers/net/eth16i.c |2 +- drivers/net/ewrk3.c|2 +- drivers/net/skfp/skfddi.c |2 +- include/pcmcia/cs.h|2 +- sound/pci/als300.c |2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff -r 0fe1a980708b drivers/net/eth16i.c --- a/drivers/net/eth16i.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/eth16i.c Thu Jan 17 15:42:00 2008 +1100 @@ -529,7 +529,7 @@ static int __init eth16i_probe1(struct n /* Try to obtain interrupt vector */ - if ((retval = request_irq(dev->irq, (void *)_interrupt, 0, cardname, dev))) { + if ((retval = request_irq(dev->irq, eth16i_interrupt, 0, cardname, dev))) { printk(KERN_WARNING "%s at %#3x, but is unusable due to conflicting IRQ %d.\n", cardname, ioaddr, dev->irq); goto out; diff -r 0fe1a980708b drivers/net/ewrk3.c --- a/drivers/net/ewrk3.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/ewrk3.c Thu Jan 17 15:42:00 2008 +1100 @@ -635,7 +635,7 @@ static int ewrk3_open(struct net_device STOP_EWRK3; if (!lp->hard_strapped) { - if (request_irq(dev->irq, (void *) ewrk3_interrupt, 0, "ewrk3", dev)) { + if (request_irq(dev->irq, ewrk3_interrupt, 0, "ewrk3", dev)) { printk("ewrk3_open(): Requested IRQ%d is busy\n", dev->irq); status = -EAGAIN; } else { diff -r 0fe1a980708b drivers/net/skfp/skfddi.c --- a/drivers/net/skfp/skfddi.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/skfp/skfddi.c Thu Jan 17 15:42:00 2008 +1100 @@ -495,7 +495,7 @@ static int skfp_open(struct net_device * PRINTK(KERN_INFO "entering skfp_open\n"); /* Register IRQ - support shared interrupts by passing device ptr */ - err = request_irq(dev->irq, (void *) skfp_interrupt, IRQF_SHARED, + err = request_irq(dev->irq, skfp_interrupt, IRQF_SHARED, dev->name, dev); if (err) return err; diff -r 0fe1a980708b include/pcmcia/cs.h --- a/include/pcmcia/cs.h Thu Jan 17 14:48:56 2008 +1100 +++ b/include/pcmcia/cs.h Thu Jan 17 15:42:01 2008 +1100 @@ -170,7 +170,7 @@ typedef struct irq_req_t { u_int Attributes; u_int AssignedIRQ; u_int IRQInfo1, IRQInfo2; /* IRQInfo2 is ignored */ -void *Handler; +int(*Handler)(int, void *); void *Instance; } irq_req_t; diff -r 0fe1a980708b sound/pci/als300.c --- a/sound/pci/als300.cThu Jan 17 14:48:56 2008 +1100 +++ b/sound/pci/als300.cThu Jan 17 15:42:01 2008 +1100 @@ -678,7 +678,7 @@ static int __devinit snd_als300_create(s struct snd_als300 **rchip) { struct snd_als300 *chip; - void *irq_handler; + int (*irq_handler)(int, void *); int err; static struct snd_device_ops ops = { diff -r 0fe1a980708b drivers/net/e1000e/netdev.c --- a/drivers/net/e1000e/netdev.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/e1000e/netdev.c Thu Jan 17 15:42:00 2008 +1100 @@ -935,7 +935,7 @@ static int e1000_request_irq(struct e100 static int e1000_request_irq(struct e1000_adapter *adapter) { struct net_device *netdev = adapter->netdev; - void (*handler) = _intr; + int (*handler)(int, void *) = _intr; int irq_flags = IRQF_SHARED; int err; diff -r 0fe1a980708b drivers/net/e1000/e1000_main.c --- a/drivers/net/e1000/e1000_main.cThu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/e1000/e1000_main.cThu Jan 17 15:42:00 2008 +1100 @@ -299,7 +299,7 @@ static int e1000_request_irq(struct e100 static int e1000_request_irq(struct e1000_adapter *adapter) { struct net_device *netdev = adapter->netdev; - void (*handler) = _intr; + irqreturn_t (*handler)(int, void *) = _intr; int irq_flags = IRQF_SHARED; int err; -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] Improve type handling in interrupt handlers
On Saturday 19 January 2008 07:41:41 Jeff Garzik wrote: FWIW, I have been working in this area extensively. Excellent... Check out the 'irq-cleanups' and 'irq-remove' branches of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git Your irq-cleanups branch is nice work! But AFAICT these patches are not included in your irq-cleanups branch. Did you want me to switch my patch over to irqreturn_t and send them for you to roll in? Cheers, Rusty. -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[PATCH 1/3] Improve type handling in interrupt handlers
This improves typechecking of interrupt handlers by removing unnecessary (void *) casts and storing handlers in correctly-typed variables. Signed-off-by: Rusty Russell [EMAIL PROTECTED] Cc: Jeff Garzik [EMAIL PROTECTED] Cc: Ash Willis [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] --- drivers/net/e1000/e1000_main.c |2 +- drivers/net/e1000e/netdev.c|2 +- drivers/net/eth16i.c |2 +- drivers/net/ewrk3.c|2 +- drivers/net/skfp/skfddi.c |2 +- include/pcmcia/cs.h|2 +- sound/pci/als300.c |2 +- 7 files changed, 7 insertions(+), 7 deletions(-) diff -r 0fe1a980708b drivers/net/eth16i.c --- a/drivers/net/eth16i.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/eth16i.c Thu Jan 17 15:42:00 2008 +1100 @@ -529,7 +529,7 @@ static int __init eth16i_probe1(struct n /* Try to obtain interrupt vector */ - if ((retval = request_irq(dev-irq, (void *)eth16i_interrupt, 0, cardname, dev))) { + if ((retval = request_irq(dev-irq, eth16i_interrupt, 0, cardname, dev))) { printk(KERN_WARNING %s at %#3x, but is unusable due to conflicting IRQ %d.\n, cardname, ioaddr, dev-irq); goto out; diff -r 0fe1a980708b drivers/net/ewrk3.c --- a/drivers/net/ewrk3.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/ewrk3.c Thu Jan 17 15:42:00 2008 +1100 @@ -635,7 +635,7 @@ static int ewrk3_open(struct net_device STOP_EWRK3; if (!lp-hard_strapped) { - if (request_irq(dev-irq, (void *) ewrk3_interrupt, 0, ewrk3, dev)) { + if (request_irq(dev-irq, ewrk3_interrupt, 0, ewrk3, dev)) { printk(ewrk3_open(): Requested IRQ%d is busy\n, dev-irq); status = -EAGAIN; } else { diff -r 0fe1a980708b drivers/net/skfp/skfddi.c --- a/drivers/net/skfp/skfddi.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/skfp/skfddi.c Thu Jan 17 15:42:00 2008 +1100 @@ -495,7 +495,7 @@ static int skfp_open(struct net_device * PRINTK(KERN_INFO entering skfp_open\n); /* Register IRQ - support shared interrupts by passing device ptr */ - err = request_irq(dev-irq, (void *) skfp_interrupt, IRQF_SHARED, + err = request_irq(dev-irq, skfp_interrupt, IRQF_SHARED, dev-name, dev); if (err) return err; diff -r 0fe1a980708b include/pcmcia/cs.h --- a/include/pcmcia/cs.h Thu Jan 17 14:48:56 2008 +1100 +++ b/include/pcmcia/cs.h Thu Jan 17 15:42:01 2008 +1100 @@ -170,7 +170,7 @@ typedef struct irq_req_t { u_int Attributes; u_int AssignedIRQ; u_int IRQInfo1, IRQInfo2; /* IRQInfo2 is ignored */ -void *Handler; +int(*Handler)(int, void *); void *Instance; } irq_req_t; diff -r 0fe1a980708b sound/pci/als300.c --- a/sound/pci/als300.cThu Jan 17 14:48:56 2008 +1100 +++ b/sound/pci/als300.cThu Jan 17 15:42:01 2008 +1100 @@ -678,7 +678,7 @@ static int __devinit snd_als300_create(s struct snd_als300 **rchip) { struct snd_als300 *chip; - void *irq_handler; + int (*irq_handler)(int, void *); int err; static struct snd_device_ops ops = { diff -r 0fe1a980708b drivers/net/e1000e/netdev.c --- a/drivers/net/e1000e/netdev.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/e1000e/netdev.c Thu Jan 17 15:42:00 2008 +1100 @@ -935,7 +935,7 @@ static int e1000_request_irq(struct e100 static int e1000_request_irq(struct e1000_adapter *adapter) { struct net_device *netdev = adapter-netdev; - void (*handler) = e1000_intr; + int (*handler)(int, void *) = e1000_intr; int irq_flags = IRQF_SHARED; int err; diff -r 0fe1a980708b drivers/net/e1000/e1000_main.c --- a/drivers/net/e1000/e1000_main.cThu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/e1000/e1000_main.cThu Jan 17 15:42:00 2008 +1100 @@ -299,7 +299,7 @@ static int e1000_request_irq(struct e100 static int e1000_request_irq(struct e1000_adapter *adapter) { struct net_device *netdev = adapter-netdev; - void (*handler) = e1000_intr; + irqreturn_t (*handler)(int, void *) = e1000_intr; int irq_flags = IRQF_SHARED; int err; -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
Re: [PATCH 1/3] Improve type handling in interrupt handlers
Rusty Russell wrote: This improves typechecking of interrupt handlers by removing unnecessary (void *) casts and storing handlers in correctly-typed variables. Signed-off-by: Rusty Russell [EMAIL PROTECTED] Cc: Jeff Garzik [EMAIL PROTECTED] Cc: Ash Willis [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] FWIW, I have been working in this area extensively. Check out the 'irq-cleanups' and 'irq-remove' branches of git://git.kernel.org/pub/scm/linux/kernel/git/jgarzik/misc-2.6.git (irq-remove is built on top of irq-cleanups) diff -r 0fe1a980708b drivers/net/eth16i.c --- a/drivers/net/eth16i.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/eth16i.c Thu Jan 17 15:42:00 2008 +1100 @@ -529,7 +529,7 @@ static int __init eth16i_probe1(struct n /* Try to obtain interrupt vector */ - if ((retval = request_irq(dev-irq, (void *)eth16i_interrupt, 0, cardname, dev))) { + if ((retval = request_irq(dev-irq, eth16i_interrupt, 0, cardname, dev))) { printk(KERN_WARNING %s at %#3x, but is unusable due to conflicting IRQ %d.\n, cardname, ioaddr, dev-irq); goto out; diff -r 0fe1a980708b drivers/net/ewrk3.c --- a/drivers/net/ewrk3.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/ewrk3.c Thu Jan 17 15:42:00 2008 +1100 @@ -635,7 +635,7 @@ static int ewrk3_open(struct net_device STOP_EWRK3; if (!lp-hard_strapped) { - if (request_irq(dev-irq, (void *) ewrk3_interrupt, 0, ewrk3, dev)) { + if (request_irq(dev-irq, ewrk3_interrupt, 0, ewrk3, dev)) { printk(ewrk3_open(): Requested IRQ%d is busy\n, dev-irq); status = -EAGAIN; } else { diff -r 0fe1a980708b drivers/net/skfp/skfddi.c --- a/drivers/net/skfp/skfddi.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/skfp/skfddi.c Thu Jan 17 15:42:00 2008 +1100 @@ -495,7 +495,7 @@ static int skfp_open(struct net_device * PRINTK(KERN_INFO entering skfp_open\n); /* Register IRQ - support shared interrupts by passing device ptr */ - err = request_irq(dev-irq, (void *) skfp_interrupt, IRQF_SHARED, + err = request_irq(dev-irq, skfp_interrupt, IRQF_SHARED, dev-name, dev); if (err) return err; ACK all of the above diff -r 0fe1a980708b include/pcmcia/cs.h --- a/include/pcmcia/cs.h Thu Jan 17 14:48:56 2008 +1100 +++ b/include/pcmcia/cs.h Thu Jan 17 15:42:01 2008 +1100 @@ -170,7 +170,7 @@ typedef struct irq_req_t { u_int Attributes; u_int AssignedIRQ; u_int IRQInfo1, IRQInfo2; /* IRQInfo2 is ignored */ -void *Handler; +int(*Handler)(int, void *); void *Instance; } irq_req_t; diff -r 0fe1a980708b sound/pci/als300.c --- a/sound/pci/als300.cThu Jan 17 14:48:56 2008 +1100 +++ b/sound/pci/als300.cThu Jan 17 15:42:01 2008 +1100 @@ -678,7 +678,7 @@ static int __devinit snd_als300_create(s struct snd_als300 **rchip) { struct snd_als300 *chip; - void *irq_handler; + int (*irq_handler)(int, void *); int err; static struct snd_device_ops ops = { diff -r 0fe1a980708b drivers/net/e1000e/netdev.c --- a/drivers/net/e1000e/netdev.c Thu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/e1000e/netdev.c Thu Jan 17 15:42:00 2008 +1100 @@ -935,7 +935,7 @@ static int e1000_request_irq(struct e100 static int e1000_request_irq(struct e1000_adapter *adapter) { struct net_device *netdev = adapter-netdev; - void (*handler) = e1000_intr; + int (*handler)(int, void *) = e1000_intr; int irq_flags = IRQF_SHARED; int err; diff -r 0fe1a980708b drivers/net/e1000/e1000_main.c --- a/drivers/net/e1000/e1000_main.cThu Jan 17 14:48:56 2008 +1100 +++ b/drivers/net/e1000/e1000_main.cThu Jan 17 15:42:00 2008 +1100 @@ -299,7 +299,7 @@ static int e1000_request_irq(struct e100 static int e1000_request_irq(struct e1000_adapter *adapter) { struct net_device *netdev = adapter-netdev; - void (*handler) = e1000_intr; + irqreturn_t (*handler)(int, void *) = e1000_intr; int irq_flags = IRQF_SHARED; int err; NAK the rest. You should be using irq_handler_t for all these. (Coincedentally, doing so makes it easier for me to later on remove the almost-never-used 'irq' argument from all irq handlers) Jeff -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/