From patchwork Thu Jul 4 12:25:07 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 2823161 Return-Path: X-Original-To: patchwork-dri-devel@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 E8DC79F3C3 for ; Thu, 4 Jul 2013 12:32:59 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C60EC20172 for ; Thu, 4 Jul 2013 12:32:58 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 9DF1520171 for ; Thu, 4 Jul 2013 12:32:57 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id A6810E66BE for ; Thu, 4 Jul 2013 05:32:57 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f43.google.com (mail-ee0-f43.google.com [74.125.83.43]) by gabe.freedesktop.org (Postfix) with ESMTP id 0A1ACE6685 for ; Thu, 4 Jul 2013 05:26:34 -0700 (PDT) Received: by mail-ee0-f43.google.com with SMTP id l10so749631eei.30 for ; Thu, 04 Jul 2013 05:26:33 -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:x-mailer:in-reply-to:references; bh=+GMa2R4JFT7KZbajZy/6/9sVvu9MuaJgmq5QGEQ7qv8=; b=DRF/0twp+TrS1qkXp0Fi4tiZ/D8svOA54RSAla7GEYoeGlmc0mcQhlIwGNDIzsAnks EiSuVYcjPwttHP2k4jad879csONeJDzPYKCcdD2jhwky8Qo0vRNGTf4icvx5BPMJGoG3 KN/hknkws/lR45RNB0vmdYdPKI2CF1sp+OfMhUiiccNTROzGm5WfNVPz9S+HcW9E79YN nuPR5TK3SeM42T8g4vsyhETdBFBKj479fSYzdkvTAO7PHzciPkuU6wiraLUmyUNs2McY 0er79uqpj7U8xJ4KDvban/TaWLbWHh4kM6bWM03CHmk9x/cbAcUrnjuT7M+KOKYUf9rp uC8w== X-Received: by 10.15.31.9 with SMTP id x9mr6470396eeu.103.1372940793647; Thu, 04 Jul 2013 05:26:33 -0700 (PDT) Received: from localhost.localdomain (stgt-5f718597.pool.mediaWays.net. [95.113.133.151]) by mx.google.com with ESMTPSA id n5sm4678843eed.9.2013.07.04.05.26.32 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Jul 2013 05:26:33 -0700 (PDT) From: David Herrmann To: linux-kernel@vger.kernel.org Subject: [PATCH v2 07/14] fbdev: efifb: bind to efi-framebuffer Date: Thu, 4 Jul 2013 14:25:07 +0200 Message-Id: <1372940714-12470-8-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.3.2 In-Reply-To: <1372940714-12470-1-git-send-email-dh.herrmann@gmail.com> References: <1372940714-12470-1-git-send-email-dh.herrmann@gmail.com> Cc: Peter Jones , dri-devel@lists.freedesktop.org X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org Errors-To: dri-devel-bounces+patchwork-dri-devel=patchwork.kernel.org@lists.freedesktop.org X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_MED, 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 Instead of creating a dummy device, we now bind to the efi-fb device which is provided by x86 initialization code. Signed-off-by: David Herrmann --- drivers/video/efifb.c | 68 +++++++++++++++++---------------------------------- 1 file changed, 22 insertions(+), 46 deletions(-) diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c index e493bcb..2a8286e 100644 --- a/drivers/video/efifb.c +++ b/drivers/video/efifb.c @@ -96,7 +96,7 @@ void vga_set_default_device(struct pci_dev *pdev) default_vga = pdev; } -static int __init efifb_setup(char *options) +static int efifb_setup(char *options) { char *this_opt; int i; @@ -153,13 +153,28 @@ static int __init efifb_setup(char *options) return 0; } -static int __init efifb_probe(struct platform_device *dev) +static int efifb_probe(struct platform_device *dev) { struct fb_info *info; int err; unsigned int size_vmode; unsigned int size_remap; unsigned int size_total; + char *option = NULL; + + if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) + return -ENODEV; + + if (fb_get_options("efifb", &option)) + return -ENODEV; + efifb_setup(option); + + /* We don't get linelength from UGA Draw Protocol, only from + * EFI Graphics Protocol. So if it's not in DMI, and it's not + * passed in from the user, we really can't use the framebuffer. + */ + if (!screen_info.lfb_linelength) + return -ENODEV; if (!screen_info.lfb_depth) screen_info.lfb_depth = 32; @@ -323,51 +338,12 @@ err_release_mem: } static struct platform_driver efifb_driver = { - .driver = { - .name = "efifb", + .driver = { + .name = "efi-framebuffer", + .owner = THIS_MODULE, }, + .probe = efifb_probe, }; -static struct platform_device efifb_device = { - .name = "efifb", -}; - -static int __init efifb_init(void) -{ - int ret; - char *option = NULL; - - if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) - return -ENODEV; - - if (fb_get_options("efifb", &option)) - return -ENODEV; - efifb_setup(option); - - /* We don't get linelength from UGA Draw Protocol, only from - * EFI Graphics Protocol. So if it's not in DMI, and it's not - * passed in from the user, we really can't use the framebuffer. - */ - if (!screen_info.lfb_linelength) - return -ENODEV; - - ret = platform_device_register(&efifb_device); - if (ret) - return ret; - - /* - * This is not just an optimization. We will interfere - * with a real driver if we get reprobed, so don't allow - * it. - */ - ret = platform_driver_probe(&efifb_driver, efifb_probe); - if (ret) { - platform_device_unregister(&efifb_device); - return ret; - } - - return ret; -} -module_init(efifb_init); - +module_platform_driver(efifb_driver); MODULE_LICENSE("GPL");