Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1477457 > unrolled thread

[PATCH] ptp: ixp46x: remove NO_IRQ handling

Started byArnd Bergmann <arnd@arndb.de>
First post2016-09-06 16:30 +0200
Last post2016-09-06 21:20 +0200
Articles 3 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] ptp: ixp46x: remove NO_IRQ handling Arnd Bergmann <arnd@arndb.de> - 2016-09-06 16:30 +0200
    Re: [PATCH] ptp: ixp46x: remove NO_IRQ handling Richard Cochran <richardcochran@gmail.com> - 2016-09-06 18:40 +0200
      Re: [PATCH] ptp: ixp46x: remove NO_IRQ handling Arnd Bergmann <arnd@arndb.de> - 2016-09-06 21:20 +0200

#1477457 — [PATCH] ptp: ixp46x: remove NO_IRQ handling

FromArnd Bergmann <arnd@arndb.de>
Date2016-09-06 16:30 +0200
Subject[PATCH] ptp: ixp46x: remove NO_IRQ handling
Message-ID<sepxT-3ab-3@gated-at.bofh.it>
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

[toc] | [next] | [standalone]


#1477599

FromRichard Cochran <richardcochran@gmail.com>
Date2016-09-06 18:40 +0200
Message-ID<serzI-4pL-35@gated-at.bofh.it>
In reply to#1477457
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>

[toc] | [prev] | [next] | [standalone]


#1477773

FromArnd Bergmann <arnd@arndb.de>
Date2016-09-06 21:20 +0200
Message-ID<seu4x-655-1@gated-at.bofh.it>
In reply to#1477599
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

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web