From patchwork Mon Jan 4 12:17:47 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 7947711 X-Patchwork-Delegate: geert@linux-m68k.org Return-Path: X-Original-To: patchwork-linux-sh@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3C339BEEE5 for ; Mon, 4 Jan 2016 12:17:53 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 70E2420357 for ; Mon, 4 Jan 2016 12:17:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 7BE4A202DD for ; Mon, 4 Jan 2016 12:17:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751603AbcADMRv (ORCPT ); Mon, 4 Jan 2016 07:17:51 -0500 Received: from sauhun.de ([89.238.76.85]:44471 "EHLO pokefinder.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751522AbcADMRu (ORCPT ); Mon, 4 Jan 2016 07:17:50 -0500 Received: from p4fe24e64.dip0.t-ipconnect.de ([79.226.78.100]:54043 helo=katana) by pokefinder.org with esmtpsa (TLS1.2:RSA_AES_128_CBC_SHA1:128) (Exim 4.80) (envelope-from ) id 1aG457-0006RR-8Z for linux-sh@vger.kernel.org; Mon, 04 Jan 2016 13:17:49 +0100 Date: Mon, 4 Jan 2016 13:17:47 +0100 From: Wolfram Sang To: linux-sh@vger.kernel.org Subject: [PATCH v2] of/unittest: Show broken behaviour in the platform bus (fwd) Message-ID: <20160104121746.GE1524@katana> MIME-Version: 1.0 Content-Disposition: inline User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-sh-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-sh@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_TVD_MIME_EPI, 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 FYI, I forgot to cc this list... ----- Forwarded message from Wolfram Sang ----- Date: Mon, 4 Jan 2016 13:13:21 +0100 From: Wolfram Sang To: linux-kernel@vger.kernel.org Cc: Wolfram Sang , Pantelis Antoniou , Rob Herring , Greg Kroah-Hartman , Ricardo Ribalda Delgado , Rob Herring , Frank Rowand , Grant Likely , devicetree@vger.kernel.org Subject: [PATCH v2] of/unittest: Show broken behaviour in the platform bus Message-Id: <1451909614-5519-1-git-send-email-wsa@the-dreams.de> X-Mailer: git-send-email 2.1.4 From: Grant Likely Add a single resource to the test bus device to exercise the platform bus code a little more. This isn't strictly a devicetree test, but it is a corner case that the devicetree runs into. Until we've got platform device unittests, it can live here. It doesn't need to be an explicit text because the kernel will oops when it is wrong. Cc: Pantelis Antoniou Cc: Rob Herring Cc: Greg Kroah-Hartman Cc: Ricardo Ribalda Delgado Signed-off-by: Grant Likely [wsa: added the comment provided by Grant, rebased, and tested] Signed-off-by: Wolfram Sang --- drivers/of/unittest.c | 14 ++++++++++++++ 1 file changed, 14 insertions(+) I found this patch in one of my branches and think it is still worth applying. In v1, Rob wanted a comment added which Grant provided but never folded into the patch. I have done so now :) Note that the fix to this problem was already picked up by Rob. diff --git a/drivers/of/unittest.c b/drivers/of/unittest.c index e16ea5717b7f76..bbff09dee1cf45 100644 --- a/drivers/of/unittest.c +++ b/drivers/of/unittest.c @@ -757,6 +757,11 @@ static void __init of_unittest_match_node(void) } } +static struct resource test_bus_res = { + .start = 0xfffffff8, + .end = 0xfffffff9, + .flags = IORESOURCE_MEM, +}; static const struct platform_device_info test_bus_info = { .name = "unittest-bus", }; @@ -800,6 +805,15 @@ static void __init of_unittest_platform_populate(void) return; test_bus->dev.of_node = np; + /* + * Add a dummy resource to the test bus node after it is + * registered to catch problems with un-inserted resources. The + * DT code doesn't insert the resources, and it has caused the + * kernel to oops in the past. This makes sure the same bug + * doesn't crop up again. + */ + platform_device_add_resources(test_bus, &test_bus_res, 1); + of_platform_populate(np, match, NULL, &test_bus->dev); for_each_child_of_node(np, child) { for_each_child_of_node(child, grandchild)