From patchwork Thu Jan 23 14:14:55 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Herrmann X-Patchwork-Id: 3529001 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 CCF639F1C3 for ; Thu, 23 Jan 2014 14:16:07 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id C9078201B9 for ; Thu, 23 Jan 2014 14:16:06 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id B9FF2201B6 for ; Thu, 23 Jan 2014 14:16:05 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6B224FBCC8; Thu, 23 Jan 2014 06:16:01 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-we0-f176.google.com (mail-we0-f176.google.com [74.125.82.176]) by gabe.freedesktop.org (Postfix) with ESMTP id 7AF56FBBE4 for ; Thu, 23 Jan 2014 06:15:52 -0800 (PST) Received: by mail-we0-f176.google.com with SMTP id t61so1187053wes.7 for ; Thu, 23 Jan 2014 06:15:51 -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=J9xE/mQ4aD5HVg7CARMcoCd/OCjNn8PbwqZtQzaYhis=; b=zYWTNBIxQ1PHzjQVhwHPHc6zS+PIu1njDBNccKULfZi7Oe4eNiLeFNumej4hIrcuca norVcEqG60gR7ONgcod2C3N55JRwO5PbocOJyDg7u3o34KlLLT4bCmJ7YGYxAt0QJHRY S+8v9qtMbJnaHbecz8g1clIi5kiZu7mkeoOee/86pmblQSKVnwpsI9ROVHostEhU/g+5 4AmS6G07ep0EBkMM9tYP/fLTTVP44Tn08wp0cLbjeRi0nAHFMDLX6p3dTmWNH+/i8eAy +ESoy/PM/7GmEWJXX0HOkfM69hOv+ys/VXqZlhjeH4nEEZVfuECxWoxv93FNWH6XXtUd UlgA== X-Received: by 10.194.185.237 with SMTP id ff13mr1934312wjc.64.1390486550477; Thu, 23 Jan 2014 06:15:50 -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.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 23 Jan 2014 06:15:49 -0800 (PST) From: David Herrmann To: dri-devel@lists.freedesktop.org Subject: [PATCH 03/11] fbdev: efifb: add dev->remove() callback Date: Thu, 23 Jan 2014 15:14:55 +0100 Message-Id: <1390486503-1504-4-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 efifb. Otherwise, we end up releasing the parent while our efi 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 efifb. Signed-off-by: David Herrmann --- drivers/video/efifb.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c index cd7c0df..ae9618f 100644 --- a/drivers/video/efifb.c +++ b/drivers/video/efifb.c @@ -73,7 +73,6 @@ static void efifb_destroy(struct fb_info *info) release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); fb_dealloc_cmap(&info->cmap); - framebuffer_release(info); } static struct fb_ops efifb_ops = { @@ -244,6 +243,7 @@ static int efifb_probe(struct platform_device *dev) err = -ENOMEM; goto err_release_mem; } + platform_set_drvdata(dev, info); info->pseudo_palette = info->par; info->par = NULL; @@ -337,12 +337,23 @@ err_release_mem: return err; } +static int efifb_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 efifb_driver = { .driver = { .name = "efi-framebuffer", .owner = THIS_MODULE, }, .probe = efifb_probe, + .remove = efifb_remove, }; module_platform_driver(efifb_driver);