From patchwork Tue Dec 6 23:16:26 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anton Vorontsov X-Patchwork-Id: 129849 X-Patchwork-Delegate: davem@davemloft.net Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by ozlabs.org (Postfix) with ESMTP id AF4AB1007D5 for ; Wed, 7 Dec 2011 10:16:48 +1100 (EST) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754608Ab1LFXQc (ORCPT ); Tue, 6 Dec 2011 18:16:32 -0500 Received: from mail-ey0-f174.google.com ([209.85.215.174]:53696 "EHLO mail-ey0-f174.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753333Ab1LFXQc (ORCPT ); Tue, 6 Dec 2011 18:16:32 -0500 Received: by eaak14 with SMTP id k14so5666081eaa.19 for ; Tue, 06 Dec 2011 15:16:30 -0800 (PST) Received: by 10.213.21.26 with SMTP id h26mr2809585ebb.8.1323213390390; Tue, 06 Dec 2011 15:16:30 -0800 (PST) Received: from localhost (mail.dev.rtsoft.ru. [213.79.90.226]) by mx.google.com with ESMTPS id cc2sm36501142bkb.8.2011.12.06.15.16.27 (version=TLSv1/SSLv3 cipher=OTHER); Tue, 06 Dec 2011 15:16:29 -0800 (PST) Date: Wed, 7 Dec 2011 03:16:26 +0400 From: Anton Vorontsov To: Linus Torvalds Cc: Rob Herring , Ingo Molnar , Jeff Garzik , Grant Likely , Stephen Rothwell , devicetree-discuss@lists.ozlabs.org, LKML , linux-ide@vger.kernel.org, Randy Dunlap , linux-next@vger.kernel.org, Andrew Morton , Alan Cox Subject: [PATCH v3] of/irq: Get rid of NO_IRQ usage Message-ID: <20111206231626.GA31683@oksana.dev.rtsoft.ru> References: <20111110151852.GA7465@oksana.dev.rtsoft.ru> <20111110152541.GA3207@oksana.dev.rtsoft.ru> <4EDE877A.4080708@gmail.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-ide-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-ide@vger.kernel.org PPC32/64 defines NO_IRQ to zero, so no problems expected. ARM defines NO_IRQ to -1, but OF code relies on IRQ domains support, which returns correct ('0') value in 'no irq' case. So everything should be fine. Other arches might break if some of their OF drivers rely on NO_IRQ being not 0. If so, the drivers must be fixed, finally. Signed-off-by: Anton Vorontsov Acked-by: Wolfram Sang --- On Tue, Dec 06, 2011 at 01:25:07PM -0800, Linus Torvalds wrote: > On Tue, Dec 6, 2011 at 1:22 PM, Rob Herring wrote: > > > > This warning code is really ugly. Can we just drop it? In my searching > > of in kernel dts files, there's only 1 instance I have found (Versatile > > AB watchdog) that would hit this. > > I do agree. Especially since we never got any input on whether it works or not. > > > If not, you don't need to handle irq_create_of_mapping return as that is > > already always 0 for no irq or error. > > Yeah, I'd like to just remove NO_IRQ from the OF paths. Afaik, it > hasn't worked as NO_IRQ before anyway, so even if the rest of the > drivers end up continuing using NO_IRQ, the OF-enabled ones on ARM > should just stop. There can't be many of those yet. Okay, here it goes. drivers/of/irq.c | 13 ++++--------- 1 files changed, 4 insertions(+), 9 deletions(-) diff --git a/drivers/of/irq.c b/drivers/of/irq.c index 791270b..ac6da0d 100644 --- a/drivers/of/irq.c +++ b/drivers/of/irq.c @@ -26,11 +26,6 @@ #include #include -/* For archs that don't support NO_IRQ (such as x86), provide a dummy value */ -#ifndef NO_IRQ -#define NO_IRQ 0 -#endif - /** * irq_of_parse_and_map - Parse and map an interrupt into linux virq space * @device: Device node of the device whose interrupt is to be mapped @@ -44,7 +39,7 @@ unsigned int irq_of_parse_and_map(struct device_node *dev, int index) struct of_irq oirq; if (of_irq_map_one(dev, index, &oirq)) - return NO_IRQ; + return 0; return irq_create_of_mapping(oirq.controller, oirq.specifier, oirq.size); @@ -345,7 +340,7 @@ int of_irq_to_resource(struct device_node *dev, int index, struct resource *r) /* Only dereference the resource if both the * resource and the irq are valid. */ - if (r && irq != NO_IRQ) { + if (r && irq) { r->start = r->end = irq; r->flags = IORESOURCE_IRQ; r->name = dev->full_name; @@ -363,7 +358,7 @@ int of_irq_count(struct device_node *dev) { int nr = 0; - while (of_irq_to_resource(dev, nr, NULL) != NO_IRQ) + while (of_irq_to_resource(dev, nr, NULL)) nr++; return nr; @@ -383,7 +378,7 @@ int of_irq_to_resource_table(struct device_node *dev, struct resource *res, int i; for (i = 0; i < nr_irqs; i++, res++) - if (of_irq_to_resource(dev, i, res) == NO_IRQ) + if (!of_irq_to_resource(dev, i, res)) break; return i;