From patchwork Thu Jul 4 12:25:06 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 2823151 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 516FFBF4A1 for ; Thu, 4 Jul 2013 12:32:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 151D520172 for ; Thu, 4 Jul 2013 12:32:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id DFCFE20171 for ; Thu, 4 Jul 2013 12:32:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id E439BE668F for ; Thu, 4 Jul 2013 05:32:08 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ee0-f54.google.com (mail-ee0-f54.google.com [74.125.83.54]) by gabe.freedesktop.org (Postfix) with ESMTP id 5EA4BE5E4B for ; Thu, 4 Jul 2013 05:26:33 -0700 (PDT) Received: by mail-ee0-f54.google.com with SMTP id t10so743708eei.27 for ; Thu, 04 Jul 2013 05:26:32 -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=xAixg5tp1R7vDkPWeybSVUrAoleBrpJ+IxS+GC6sUF8=; b=qnEIoQv9ucGvy4DwmgB3/JGkzqLgjlY/xLEd7Hd0bD0eKXQuNi+RgFKm1NF9X1jukP 13pPswbJ2+aDIj69NLEqyy/lSCmnMJNUxErpMX/jTaz89NXbDBwXgdW9cCXtYot4Yv9k CQv08HZ4oBN06fyP0JAVnGEd0ay2uEn8paiCPisqBgRSW3U9hSxxnWIErArP97fbJqoq rWOBuf0/xTtJz+tZQpo71NdlZhx4sCWQ2bQsz4mcLHs80LFrR+EUOjULNBRyQz3zIsZ2 ASxI1QW6XNseRcEggbPinWnQ7hyRyIdKfEPNaqCSdcvdf+3R4yu6WL9cztTEe+LdcG5+ fkkA== X-Received: by 10.14.101.13 with SMTP id a13mr6556514eeg.86.1372940792516; Thu, 04 Jul 2013 05:26:32 -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.31 for (version=TLSv1.2 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 04 Jul 2013 05:26:32 -0700 (PDT) From: David Herrmann To: linux-kernel@vger.kernel.org Subject: [PATCH v2 06/14] fbdev: vesafb: bind to platform-framebuffer device Date: Thu, 4 Jul 2013 14:25:06 +0200 Message-Id: <1372940714-12470-7-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: 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 x86 creates platform-framebuffer platform devices for every system framebuffer. Use these instead of creating a dummy device. This requires us to remove the __init annotations as hotplugging may occur during runtime. Signed-off-by: David Herrmann --- drivers/video/vesafb.c | 55 +++++++++++++++----------------------------------- 1 file changed, 16 insertions(+), 39 deletions(-) diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 501b340..bd83233 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c @@ -29,7 +29,7 @@ /* --------------------------------------------------------------------- */ -static struct fb_var_screeninfo vesafb_defined __initdata = { +static struct fb_var_screeninfo vesafb_defined = { .activate = FB_ACTIVATE_NOW, .height = -1, .width = -1, @@ -40,7 +40,7 @@ static struct fb_var_screeninfo vesafb_defined __initdata = { .vmode = FB_VMODE_NONINTERLACED, }; -static struct fb_fix_screeninfo vesafb_fix __initdata = { +static struct fb_fix_screeninfo vesafb_fix = { .id = "VESA VGA", .type = FB_TYPE_PACKED_PIXELS, .accel = FB_ACCEL_NONE, @@ -48,8 +48,8 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = { static int inverse __read_mostly; static int mtrr __read_mostly; /* disable mtrr */ -static int vram_remap __initdata; /* Set amount of memory to be used */ -static int vram_total __initdata; /* Set total amount of memory */ +static int vram_remap; /* Set amount of memory to be used */ +static int vram_total; /* Set total amount of memory */ static int pmi_setpal __read_mostly = 1; /* pmi for palette changes ??? */ static int ypan __read_mostly; /* 0..nothing, 1..ypan, 2..ywrap */ static void (*pmi_start)(void) __read_mostly; @@ -192,7 +192,7 @@ static struct fb_ops vesafb_ops = { .fb_imageblit = cfb_imageblit, }; -static int __init vesafb_setup(char *options) +static int vesafb_setup(char *options) { char *this_opt; @@ -226,13 +226,18 @@ static int __init vesafb_setup(char *options) return 0; } -static int __init vesafb_probe(struct platform_device *dev) +static int vesafb_probe(struct platform_device *dev) { struct fb_info *info; int i, err; unsigned int size_vmode; unsigned int size_remap; unsigned int size_total; + char *option = NULL; + + /* ignore error return of fb_get_options */ + fb_get_options("vesafb", &option); + vesafb_setup(option); if (screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB) return -ENODEV; @@ -496,40 +501,12 @@ err: } static struct platform_driver vesafb_driver = { - .driver = { - .name = "vesafb", + .driver = { + .name = "vesa-framebuffer", + .owner = THIS_MODULE, }, + .probe = vesafb_probe, }; -static struct platform_device *vesafb_device; - -static int __init vesafb_init(void) -{ - int ret; - char *option = NULL; - - /* ignore error return of fb_get_options */ - fb_get_options("vesafb", &option); - vesafb_setup(option); - - vesafb_device = platform_device_alloc("vesafb", 0); - if (!vesafb_device) - return -ENOMEM; - - ret = platform_device_add(vesafb_device); - if (!ret) { - ret = platform_driver_probe(&vesafb_driver, vesafb_probe); - if (ret) - platform_device_del(vesafb_device); - } - - if (ret) { - platform_device_put(vesafb_device); - vesafb_device = NULL; - } - - return ret; -} -module_init(vesafb_init); - +module_platform_driver(vesafb_driver); MODULE_LICENSE("GPL");