From patchwork Wed Nov 12 22:08:42 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: 5292001 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 C3C099F2F1 for ; Wed, 12 Nov 2014 22:09:54 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DA656201FB for ; Wed, 12 Nov 2014 22:09:52 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 02EC7201F2 for ; Wed, 12 Nov 2014 22:09:52 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752626AbaKLWJb (ORCPT ); Wed, 12 Nov 2014 17:09:31 -0500 Received: from mx1.redhat.com ([209.132.183.28]:60543 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752423AbaKLWJ3 (ORCPT ); Wed, 12 Nov 2014 17:09:29 -0500 Received: from int-mx11.intmail.prod.int.phx2.redhat.com (int-mx11.intmail.prod.int.phx2.redhat.com [10.5.11.24]) by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id sACM8r3g021480 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=FAIL); Wed, 12 Nov 2014 17:08:54 -0500 Received: from shalem.localdomain.com (vpn1-6-163.ams2.redhat.com [10.36.6.163]) by int-mx11.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id sACM8jeW002193; Wed, 12 Nov 2014 17:08:50 -0500 From: Hans de Goede To: Tomi Valkeinen Cc: Stephen Warren , Jean-Christophe Plagniol-Villard , Grant Likely , Rob Herring , Luc Verhaegen , Maxime Ripard , Mike Turquette , 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 2/4] simplefb: Add support for enumerating simplefb dt nodes in /chosen Date: Wed, 12 Nov 2014 23:08:42 +0100 Message-Id: <1415830124-28787-2-git-send-email-hdegoede@redhat.com> In-Reply-To: <1415830124-28787-1-git-send-email-hdegoede@redhat.com> References: <1415830124-28787-1-git-send-email-hdegoede@redhat.com> X-Scanned-By: MIMEDefang 2.68 on 10.5.11.24 Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-7.5 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 --- drivers/video/fbdev/simplefb.c | 33 ++++++++++++++++++++++++++++++++- 1 file changed, 32 insertions(+), 1 deletion(-) diff --git a/drivers/video/fbdev/simplefb.c b/drivers/video/fbdev/simplefb.c index cd96edd..be7d288 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", @@ -385,7 +386,37 @@ static struct platform_driver simplefb_driver = { .probe = simplefb_probe, .remove = simplefb_remove, }; -module_platform_driver(simplefb_driver); + +static int __init simplefb_init(void) +{ + int i, ret; + char name[16]; + struct device_node *np; + + ret = platform_driver_register(&simplefb_driver); + if (ret) + return ret; + + for (i = 0; ; i++) { + snprintf(name, sizeof(name), "framebuffer%d", i); + np = of_find_node_by_name(of_chosen, name); + if (!np) + break; + + /* of_platform_device_create will check status for us */ + of_platform_device_create(np, NULL, NULL); + } + + return 0; +} + +static void __exit simplefb_exit(void) +{ + platform_driver_unregister(&simplefb_driver); +} + +module_init(simplefb_init); +module_exit(simplefb_exit); MODULE_AUTHOR("Stephen Warren "); MODULE_DESCRIPTION("Simple framebuffer driver");