From patchwork Wed Jan 8 12:51:17 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 3453561 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id AE51D9F374 for ; Wed, 8 Jan 2014 12:54:25 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 997992012F for ; Wed, 8 Jan 2014 12:54:24 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 5898020120 for ; Wed, 8 Jan 2014 12:54:23 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W0se1-0005IG-2W; Wed, 08 Jan 2014 12:54:01 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1W0sds-0003G9-J3; Wed, 08 Jan 2014 12:53:52 +0000 Received: from mail-bk0-x230.google.com ([2a00:1450:4008:c01::230]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1W0sdo-0003Ee-Sk for linux-arm-kernel@lists.infradead.org; Wed, 08 Jan 2014 12:53:49 +0000 Received: by mail-bk0-f48.google.com with SMTP id r7so654965bkg.21 for ; Wed, 08 Jan 2014 04:53:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=gfLUQ84X2by5I9Ya5x3/Z4yf1mEgorC/GQJHwbBMDNA=; b=l0rxp3W1iitgr6EHMmP0Glyj+yLmsC6MbZGG/FFZB+jtejvLJo47DmgCdXwkhpEbn2 DmfOHHXuyQNryHJVPlAx4le8nVp49Xi12xzfvjih4LRu4LBogXRWfL1M0oOg7zi8sKjA CRXUubdRon+VAcIxfUcSfQWwwlsR1ddeoK5KhGkljp33ypTOEV3MiVoar+xaDD9ox+fQ VUugjFKHkojbkBQmjYEQfoGQtR69wxZLKdDmTS7UeXdP4XGF+B7w2IQ6Y1ZEdDIUPqM5 JJsBEjEJF4/pclskD8GYXAxO20vzFQllA0RhuP6E1jIQPyyJCLMpP3PSnsYdF6b8WpSi bD4g== X-Received: by 10.204.113.136 with SMTP id a8mr3351005bkq.73.1389185605466; Wed, 08 Jan 2014 04:53:25 -0800 (PST) Received: from localhost (port-50680.pppoe.wtnet.de. [46.59.198.151]) by mx.google.com with ESMTPSA id tn8sm1753734bkb.16.2014.01.08.04.53.24 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 08 Jan 2014 04:53:24 -0800 (PST) From: Thierry Reding To: Tony Lindgren Subject: [PATCH] driver-core: platform: Resolve DT interrupt references late Date: Wed, 8 Jan 2014 13:51:17 +0100 Message-Id: <1389185477-507-1-git-send-email-treding@nvidia.com> X-Mailer: git-send-email 1.8.4.2 In-Reply-To: <20140108011957.GK5074@atomide.com> References: <20140108011957.GK5074@atomide.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140108_075349_062337_A305CDD5 X-CRM114-Status: GOOD ( 16.47 ) X-Spam-Score: -2.0 (--) Cc: devicetree@vger.kernel.org, Paul Walmsley , Russell King - ARM Linux , linux-kernel@vger.kernel.org, Grant Likely , linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP When devices are probed from the device tree, any interrupts that they reference are resolved at device creation time. This causes problems if the interrupt provider hasn't been registered yet at that time, which results in the interrupt being set to 0. This is especially bad for platform devices because they are created at a very early stage during boot when the majority of interrupt providers haven't had a chance to be probed yet. One of the platform where this causes major issues is OMAP. Note that this patch is the easy way out to fix a large part of the problems for now. A more proper solution for the long term would be to transition drivers to an API that always resolves resources of any kind (not only interrupts) at probe time. For some background and discussion on possible solutions, see: https://lkml.org/lkml/2013/11/22/520 Acked-by: Rob Herring Signed-off-by: Thierry Reding --- Note that this is somewhat urgent and should if at all possible go into v3.13 before the release. drivers/base/platform.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/base/platform.c b/drivers/base/platform.c index 3a94b799f166..c894d1af3a5e 100644 --- a/drivers/base/platform.c +++ b/drivers/base/platform.c @@ -13,6 +13,7 @@ #include #include #include +#include #include #include #include @@ -87,7 +88,12 @@ int platform_get_irq(struct platform_device *dev, unsigned int num) return -ENXIO; return dev->archdata.irqs[num]; #else - struct resource *r = platform_get_resource(dev, IORESOURCE_IRQ, num); + struct resource *r; + + if (IS_ENABLED(CONFIG_OF) && dev->dev.of_node) + return irq_of_parse_and_map(dev->dev.of_node, num); + + r = platform_get_resource(dev, IORESOURCE_IRQ, num); return r ? r->start : -ENXIO; #endif