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: 3529271 Return-Path: X-Original-To: patchwork-linux-fbdev@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 B5636C02DC for ; Thu, 23 Jan 2014 14:19:09 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 4D50820108 for ; Thu, 23 Jan 2014 14:19:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C6115200F0 for ; Thu, 23 Jan 2014 14:19:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932163AbaAWOSf (ORCPT ); Thu, 23 Jan 2014 09:18:35 -0500 Received: from mail-wg0-f44.google.com ([74.125.82.44]:40438 "EHLO mail-wg0-f44.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754066AbaAWOPy (ORCPT ); Thu, 23 Jan 2014 09:15:54 -0500 Received: by mail-wg0-f44.google.com with SMTP id l18so1514289wgh.23 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 Cc: Ingo Molnar , linux-fbdev@vger.kernel.org, Dave Airlie , Daniel Vetter , Tomi Valkeinen , linux-kernel@vger.kernel.org, Tom Gundersen , David Herrmann 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> 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.3 required=5.0 tests=BAYES_00, DKIM_ADSP_CUSTOM_MED, DKIM_SIGNED, FREEMAIL_FROM, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, T_DKIM_INVALID, UNPARSEABLE_RELAY autolearn=ham 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);