* [PATCH] ptp: ixp46x: remove NO_IRQ handling
@ 2016-09-06 14:28 Arnd Bergmann
2016-09-06 16:39 ` Richard Cochran
0 siblings, 1 reply; 3+ messages in thread
From: Arnd Bergmann @ 2016-09-06 14:28 UTC (permalink / raw)
To: Richard Cochran
Cc: Arnd Bergmann, David S. Miller, Kefeng Wang, netdev, linux-kernel
gpio_to_irq does not return NO_IRQ but instead returns a negative
error code on failure. Returning NO_IRQ from the function has no
negative effects as we only compare the result to the expected
interrupt number, but it's better to return a proper failure
code for consistency, and we should remove NO_IRQ from the kernel
entirely.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
drivers/ptp/ptp_ixp46x.c | 15 ++++++++-------
1 file changed, 8 insertions(+), 7 deletions(-)
diff --git a/drivers/ptp/ptp_ixp46x.c b/drivers/ptp/ptp_ixp46x.c
index ee4f183ef9ee..fbcb940b6348 100644
--- a/drivers/ptp/ptp_ixp46x.c
+++ b/drivers/ptp/ptp_ixp46x.c
@@ -268,18 +268,19 @@ static int setup_interrupt(int gpio)
return err;
irq = gpio_to_irq(gpio);
+ if (irq < 0)
+ return irq;
- if (NO_IRQ == irq)
- return NO_IRQ;
-
- if (irq_set_irq_type(irq, IRQF_TRIGGER_FALLING)) {
+ err = irq_set_irq_type(irq, IRQF_TRIGGER_FALLING);
+ if (err) {
pr_err("cannot set trigger type for irq %d\n", irq);
- return NO_IRQ;
+ return err;
}
- if (request_irq(irq, isr, 0, DRIVER, &ixp_clock)) {
+ err = request_irq(irq, isr, 0, DRIVER, &ixp_clock);
+ if (err)
pr_err("request_irq failed for irq %d\n", irq);
- return NO_IRQ;
+ return err;
}
return irq;
--
2.9.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] ptp: ixp46x: remove NO_IRQ handling
2016-09-06 14:28 [PATCH] ptp: ixp46x: remove NO_IRQ handling Arnd Bergmann
@ 2016-09-06 16:39 ` Richard Cochran
2016-09-06 19:18 ` Arnd Bergmann
0 siblings, 1 reply; 3+ messages in thread
From: Richard Cochran @ 2016-09-06 16:39 UTC (permalink / raw)
To: Arnd Bergmann; +Cc: David S. Miller, Kefeng Wang, netdev, linux-kernel
On Tue, Sep 06, 2016 at 04:28:30PM +0200, Arnd Bergmann wrote:
> gpio_to_irq does not return NO_IRQ but instead returns a negative
> error code on failure. Returning NO_IRQ from the function has no
> negative effects as we only compare the result to the expected
> interrupt number, but it's better to return a proper failure
> code for consistency, and we should remove NO_IRQ from the kernel
> entirely.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Richard Cochran <richardcochran@gmail.com>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] ptp: ixp46x: remove NO_IRQ handling
2016-09-06 16:39 ` Richard Cochran
@ 2016-09-06 19:18 ` Arnd Bergmann
0 siblings, 0 replies; 3+ messages in thread
From: Arnd Bergmann @ 2016-09-06 19:18 UTC (permalink / raw)
To: Richard Cochran; +Cc: David S. Miller, Kefeng Wang, netdev, linux-kernel
On Tuesday, September 6, 2016 6:39:10 PM CEST Richard Cochran wrote:
> On Tue, Sep 06, 2016 at 04:28:30PM +0200, Arnd Bergmann wrote:
> > gpio_to_irq does not return NO_IRQ but instead returns a negative
> > error code on failure. Returning NO_IRQ from the function has no
> > negative effects as we only compare the result to the expected
> > interrupt number, but it's better to return a proper failure
> > code for consistency, and we should remove NO_IRQ from the kernel
> > entirely.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
>
> Acked-by: Richard Cochran <richardcochran@gmail.com>
Thanks!
I just realized that the randconfig builder had not picked up this
one and there was a typo. I'll send a replacement patch with your
Ack added in.
Arnd
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2016-09-06 19:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-09-06 14:28 [PATCH] ptp: ixp46x: remove NO_IRQ handling Arnd Bergmann
2016-09-06 16:39 ` Richard Cochran
2016-09-06 19:18 ` Arnd Bergmann
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.