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: 3453541 Return-Path: X-Original-To: patchwork-linux-omap@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 D24829F374 for ; Wed, 8 Jan 2014 12:53:31 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id ADAFA2012F for ; Wed, 8 Jan 2014 12:53:30 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 83DC520120 for ; Wed, 8 Jan 2014 12:53:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756524AbaAHMx2 (ORCPT ); Wed, 8 Jan 2014 07:53:28 -0500 Received: from mail-bk0-f41.google.com ([209.85.214.41]:56413 "EHLO mail-bk0-f41.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755664AbaAHMx1 (ORCPT ); Wed, 8 Jan 2014 07:53:27 -0500 Received: by mail-bk0-f41.google.com with SMTP id v15so666987bkz.28 for ; Wed, 08 Jan 2014 04:53:25 -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 Cc: Paul Walmsley , Rob Herring , Grant Likely , Russell King - ARM Linux , devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-omap@vger.kernel.org, linux-arm-kernel@lists.infradead.org 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> Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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