From patchwork Thu Jan 23 14:14:56 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 3529011 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 C1746C02DC for ; Thu, 23 Jan 2014 14:16:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id B6F92201BA for ; Thu, 23 Jan 2014 14:16:10 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B8D7A201B9 for ; Thu, 23 Jan 2014 14:16:09 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 92C99FBF69; Thu, 23 Jan 2014 06:16:02 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-we0-f181.google.com (mail-we0-f181.google.com [74.125.82.181]) by gabe.freedesktop.org (Postfix) with ESMTP id E65DFFBC15 for ; Thu, 23 Jan 2014 06:15:53 -0800 (PST) Received: by mail-we0-f181.google.com with SMTP id u56so1228222wes.12 for ; Thu, 23 Jan 2014 06:15:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=SNDnmZDHB0FmvJyTkB9fpwfOJYPSqzSs4hj/8hKhVMs=; b=M5lDihQ/n3XgyBD2PDMpcHy6GKyCtWnolI5Z99x7aiWPgfT10FUL2upnmZ+RLe0xgu 8OlixW3GGyBq69TRtldsddC6w+mZC0uzDgjeKdHSrGtZHWj1e3nVMgMrPJKgAeWlMq1O HigYqx2VwI3h8cpaqztsNmUwqk3ymo/YV2UzmVK04YU1lOQ/Ydjcx9DG5x3ieyzhjBy8 ip7mLdr3cXdl2csu5UiBWxD35nSXlemCfDUcB+9zpIBDGqqH6cKOpMrr9dTthX2QnSfx IhzrFCYh/Z01j7DLN/cLjJEWD5nkPKbZ6a1sPNqvZkRWCniY1nwGbFp1MzTPqUnlouaU EOLA== X-Received: by 10.180.97.37 with SMTP id dx5mr7637258wib.53.1390486553043; Thu, 23 Jan 2014 06:15:53 -0800 (PST) Received: from david-ub.localdomain (stgt-5f71be19.pool.mediaWays.net. [95.113.190.25]) by mx.google.com with ESMTPSA id ci4sm22667871wjc.21.2014.01.23.06.15.50 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Jan 2014 06:15:52 -0800 (PST) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [PATCH 04/11] fbdev: vesafb: add dev->remove() callback Date: Thu, 23 Jan 2014 15:14:56 +0100 Message-Id: <1390486503-1504-5-git-send-email-dh.herrmann@gmail.com> X-Mailer: git-send-email 1.8.5.3 In-Reply-To: <1390486503-1504-1-git-send-email-dh.herrmann@gmail.com> References: <1390486503-1504-1-git-send-email-dh.herrmann@gmail.com> Cc: linux-fbdev@vger.kernel.org, Daniel Vetter , linux-kernel@vger.kernel.org, Tomi Valkeinen , Ingo Molnar 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@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org X-Spam-Status: No, score=-4.6 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 If x86-sysfb platform-devices are removed from a system, we should properly unload vesafb. Otherwise, we end up releasing the parent while our vesa framebuffer is still running. This currently works just fine, but will cause problems on handover to real hw. So add the ->remove() callback and unregister vesafb. Signed-off-by: David Herrmann --- drivers/video/vesafb.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 1c7da3b..6170e7f 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c @@ -179,7 +179,6 @@ static void vesafb_destroy(struct fb_info *info) if (info->screen_base) iounmap(info->screen_base); release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); - framebuffer_release(info); } static struct fb_ops vesafb_ops = { @@ -297,6 +296,7 @@ static int vesafb_probe(struct platform_device *dev) release_mem_region(vesafb_fix.smem_start, size_total); return -ENOMEM; } + platform_set_drvdata(dev, info); info->pseudo_palette = info->par; info->par = NULL; @@ -499,12 +499,23 @@ err: return err; } +static int vesafb_remove(struct platform_device *pdev) +{ + struct fb_info *info = platform_get_drvdata(pdev); + + unregister_framebuffer(info); + framebuffer_release(info); + + return 0; +} + static struct platform_driver vesafb_driver = { .driver = { .name = "vesa-framebuffer", .owner = THIS_MODULE, }, .probe = vesafb_probe, + .remove = vesafb_remove, }; module_platform_driver(vesafb_driver);