From patchwork Wed Apr 23 22:57:40 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 4045041 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 ABCE99F1F4 for ; Wed, 23 Apr 2014 23:09:08 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B4239202DD for ; Wed, 23 Apr 2014 23:09:07 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (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 DFBCB202B8 for ; Wed, 23 Apr 2014 23:09:06 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wd6FP-0007MG-42; Wed, 23 Apr 2014 23:06:35 +0000 Received: from mail-ob0-x22d.google.com ([2607:f8b0:4003:c01::22d]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1Wd6FN-0007LX-Cd for linux-arm-kernel@lists.infradead.org; Wed, 23 Apr 2014 23:06:33 +0000 Received: by mail-ob0-f173.google.com with SMTP id wn1so1818655obc.18 for ; Wed, 23 Apr 2014 16:06:11 -0700 (PDT) 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=qxwqanm/55MS+n9rQb6oxeCQpAuZRjg6wPBYiwpQ49M=; b=cL99Fd4oHxTLJPNTXlHiARWVFjxj2IDsiCTdtoQssAKEPcxOq1ayMqw2h5B39jM9mn Xfus2Jz4hY0zBxlGz4doGijY5a0rckpM+tPcZk3vyEn5yswgcwC6MNJfxYfokI3287oZ +D/rjQoht175oBIfxRlx85pTtk/ZOHshy8qf5ifv6wtvizVRsnt9tt3pZDTNz83xDX96 Yn8eI06doK5V/pJERGhBm9H0TnI7FpuXlHHYFhR+aSAe6Bid7nT/RtrH3Z9D8oqyBpa0 k+ZFMtbxBf76otZcyrNFWH7BBe/hmXGRDtJtq8FCLXvQs0v/duZXdCNyn11hKZcR2nME Xstw== X-Received: by 10.60.133.81 with SMTP id pa17mr40406447oeb.35.1398293881425; Wed, 23 Apr 2014 15:58:01 -0700 (PDT) Received: from localhost.localdomain (72-48-77-163.dyn.grandenetworks.net. [72.48.77.163]) by mx.google.com with ESMTPSA id cq1sm9577790oeb.4.2014.04.23.15.58.00 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 23 Apr 2014 15:58:00 -0700 (PDT) From: Rob Herring To: Russell King , Tony Lindgren , Grant Likely , Greg Kroah-Hartman Subject: [PATCH 1/2] of: selftest: add deferred probe interrupt test Date: Wed, 23 Apr 2014 17:57:40 -0500 Message-Id: <1398293861-7682-2-git-send-email-robherring2@gmail.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1398293861-7682-1-git-send-email-robherring2@gmail.com> References: <1398293861-7682-1-git-send-email-robherring2@gmail.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140423_160633_501930_D5AA28CF X-CRM114-Status: GOOD ( 13.59 ) X-Spam-Score: 0.1 (/) Cc: devicetree@vger.kernel.org, Jean-Jacques Hiblot , Rob Herring , linux-kernel@vger.kernel.org, thierry.reding@gmail.com, 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=-2.4 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, 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 From: Rob Herring Signed-off-by: Rob Herring --- drivers/of/selftest.c | 32 ++++++++++++++++++++++++++ drivers/of/testcase-data/tests-interrupts.dtsi | 12 ++++++++++ 2 files changed, 44 insertions(+) diff --git a/drivers/of/selftest.c b/drivers/of/selftest.c index ae44500..fe70b86 100644 --- a/drivers/of/selftest.c +++ b/drivers/of/selftest.c @@ -10,6 +10,7 @@ #include #include #include +#include #include #include #include @@ -427,6 +428,36 @@ static void __init of_selftest_match_node(void) } } +static void __init of_selftest_platform_populate(void) +{ + int irq; + struct device_node *np; + struct platform_device *pdev; + + np = of_find_node_by_path("/testcase-data"); + of_platform_populate(np, of_default_bus_match_table, NULL, NULL); + + /* Test that a missing irq domain returns -EPROBE_DEFER */ + np = of_find_node_by_path("/testcase-data/testcase-device1"); + pdev = of_find_device_by_node(np); + if (!pdev) + selftest(0, "device 1 creation failed\n"); + irq = platform_get_irq(pdev, 0); + if (irq != -EPROBE_DEFER) + selftest(0, "device deferred probe failed - %d\n", irq); + + /* Test that a parsing failure does not return -EPROBE_DEFER */ + np = of_find_node_by_path("/testcase-data/testcase-device2"); + pdev = of_find_device_by_node(np); + if (!pdev) + selftest(0, "device 2 creation failed\n"); + irq = platform_get_irq(pdev, 0); + if (irq >= 0 || irq == -EPROBE_DEFER) + selftest(0, "device parsing error failed - %d\n", irq); + + selftest(1, "passed"); +} + static int __init of_selftest(void) { struct device_node *np; @@ -445,6 +476,7 @@ static int __init of_selftest(void) of_selftest_parse_interrupts(); of_selftest_parse_interrupts_extended(); of_selftest_match_node(); + of_selftest_platform_populate(); pr_info("end of selftest - %i passed, %i failed\n", selftest_results.passed, selftest_results.failed); return 0; diff --git a/drivers/of/testcase-data/tests-interrupts.dtsi b/drivers/of/testcase-data/tests-interrupts.dtsi index c843720..45cbdf8 100644 --- a/drivers/of/testcase-data/tests-interrupts.dtsi +++ b/drivers/of/testcase-data/tests-interrupts.dtsi @@ -54,5 +54,17 @@ <&test_intmap1 1 2>; }; }; + + testcase-device1 { + compatible = "testcase-device"; + interrupt-parent = <&test_intc0>; + interrupts = <1>; + }; + + testcase-device2 { + compatible = "testcase-device"; + interrupts = <1>; + }; }; + };