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: 3529251 Return-Path: X-Original-To: patchwork-linux-fbdev@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 A20379F1C3 for ; Thu, 23 Jan 2014 14:18:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 5547E200F0 for ; Thu, 23 Jan 2014 14:18:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 08E8C2018B for ; Thu, 23 Jan 2014 14:18:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754078AbaAWOPy (ORCPT ); Thu, 23 Jan 2014 09:15:54 -0500 Received: from mail-wg0-f49.google.com ([74.125.82.49]:55612 "EHLO mail-wg0-f49.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753250AbaAWOPw (ORCPT ); Thu, 23 Jan 2014 09:15:52 -0500 Received: by mail-wg0-f49.google.com with SMTP id a1so1522500wgh.4 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 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 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> 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 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);