From patchwork Fri Nov 14 11:03:14 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hans de Goede X-Patchwork-Id: 5304961 Return-Path: X-Original-To: patchwork-linux-fbdev@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 B47339F2ED for ; Fri, 14 Nov 2014 11:04:20 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id E665020154 for ; Fri, 14 Nov 2014 11:04:18 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B129F201DD for ; Fri, 14 Nov 2014 11:04:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S965229AbaKNLEL (ORCPT ); Fri, 14 Nov 2014 06:04:11 -0500 Received: from mx1.redhat.com ([209.132.183.28]:55627 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S965226AbaKNLEH (ORCPT ); Fri, 14 Nov 2014 06:04:07 -0500 Received: from int-mx09.intmail.prod.int.phx2.redhat.com (int-mx09.intmail.prod.int.phx2.redhat.com [10.5.11.22]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sAEB3Pve020857 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Fri, 14 Nov 2014 06:03:26 -0500 Received: from shalem.localdomain.com (vpn1-7-79.ams2.redhat.com [10.36.7.79]) by int-mx09.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sAEB3HZs016438; Fri, 14 Nov 2014 06:03:23 -0500 From: Hans de Goede To: Tomi Valkeinen Cc: Stephen Warren , Jean-Christophe Plagniol-Villard , Grant Likely , Rob Herring , Luc Verhaegen , Maxime Ripard , David Herrmann , Geert Uytterhoeven , linux-fbdev@vger.kernel.org, linux-arm-kernel@lists.infradead.org, devicetree , linux-sunxi@googlegroups.com, Hans de Goede Subject: [PATCH v5 3/5] simplefb: Add support for enumerating simplefb dt nodes in /chosen Date: Fri, 14 Nov 2014 12:03:14 +0100 Message-Id: <1415962996-31712-3-git-send-email-hdegoede@redhat.com> In-Reply-To: <1415962996-31712-1-git-send-email-hdegoede@redhat.com> References: <1415962996-31712-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.22 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, 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 Update simplefb to support the new preferred location for simplefb dt nodes under /chosen. Signed-off-by: Hans de Goede --- Changes in v2: -Make name array larger in case we ever encounter more then 10000 framebuffers Changes in v3: -Switch to for_each_child_of_node to loop over the nodes under chosen Changes in v4: -Wrap the chosen enumeration code in #ifdef CONFIG_OF, as simplefb is used on non devicetree platforms too -simplefb can only be built-in, so drop the module_exit function calling platform_driver_unregister Changes in v5: -Cleanup #ifdef CONFIG_OF handling --- drivers/video/fbdev/simplefb.c | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index d192946..74c5edd 100644 --- a/drivers/video/fbdev/simplefb.c +++ b/drivers/video/fbdev/simplefb.c @@ -27,6 +27,7 @@ #include #include #include +#include static struct fb_fix_screeninfo simplefb_fix = { .id = "simple", @@ -392,7 +393,27 @@ static struct platform_driver simplefb_driver = { .probe = simplefb_probe, .remove = simplefb_remove, }; -module_platform_driver(simplefb_driver); + +static int __init simplefb_init(void) +{ + int ret; + struct device_node *np; + + ret = platform_driver_register(&simplefb_driver); + if (ret) + return ret; + + if (IS_ENABLED(CONFIG_OF) && of_chosen) { + for_each_child_of_node(of_chosen, np) { + if (of_device_is_compatible(np, "simple-framebuffer")) + of_platform_device_create(np, NULL, NULL); + } + } + + return 0; +} + +module_init(simplefb_init); MODULE_AUTHOR("Stephen Warren "); MODULE_DESCRIPTION("Simple framebuffer driver");