From patchwork Thu May 26 14:13:34 2011 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Lutomirski X-Patchwork-Id: 820972 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by demeter2.kernel.org (8.14.4/8.14.3) with ESMTP id p4QEDx6w011604 for ; Thu, 26 May 2011 14:14:04 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1757970Ab1EZOOE (ORCPT ); Thu, 26 May 2011 10:14:04 -0400 Received: from DMZ-MAILSEC-SCANNER-6.MIT.EDU ([18.7.68.35]:57650 "EHLO dmz-mailsec-scanner-6.mit.edu" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752435Ab1EZOOD (ORCPT ); Thu, 26 May 2011 10:14:03 -0400 X-AuditID: 12074423-b7babae000007c6b-62-4dde6023b10f Received: from mailhub-auth-1.mit.edu ( [18.9.21.35]) by dmz-mailsec-scanner-6.mit.edu (Symantec Messaging Gateway) with SMTP id DF.EF.31851.3206EDD4; Thu, 26 May 2011 10:13:55 -0400 (EDT) Received: from outgoing.mit.edu (OUTGOING-AUTH.MIT.EDU [18.7.22.103]) by mailhub-auth-1.mit.edu (8.13.8/8.9.2) with ESMTP id p4QEE1gV007232; Thu, 26 May 2011 10:14:01 -0400 Received: from localhost (207-172-69-77.c3-0.smr-ubr3.sbo-smr.ma.static.cable.rcn.com [207.172.69.77]) (authenticated bits=0) (User authenticated as luto@ATHENA.MIT.EDU) by outgoing.mit.edu (8.13.6/8.12.4) with ESMTP id p4QEDwgc028133 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES128-SHA bits=128 verify=NOT); Thu, 26 May 2011 10:14:01 -0400 (EDT) From: Andy Lutomirski To: Peter Jones , linux-fbdev@vger.kernel.org Cc: Andy Lutomirski Subject: [PATCH 4/4] efifb: Disallow manual bind and unbind Date: Thu, 26 May 2011 10:13:34 -0400 Message-Id: <7c160d075ca68ffd4eef4d0a64ef5fa49fa2c40e.1306418703.git.luto@mit.edu> X-Mailer: git-send-email 1.7.5.1 In-Reply-To: References: In-Reply-To: References: X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFnrAIsWRmVeSWpSXmKPExsUixCmqrKuccM/X4NJydou+K0fZLU70fWC1 6Fp4g92B2WPnrLvsHu/3XWXz+LxJLoA5issmJTUnsyy1SN8ugStj3+yZTAWTeSt+r//L2sB4 iquLkZNDQsBE4sa0CawQtpjEhXvr2boYuTiEBPYxSkyddwrK2cAo0fFiCROE84xJ4tqC9ewg LWwCKhIdSx8wgdgiAg4Ss1b1soDYzAJKEk/2fAMbKyxgLdG9agkbiM0ioCoxdedeoF52Dl6B IIkDpRCLFSSuXJkH1skpYCDxtuMZUCcH0Cp9iS3rDHAIT2AUWMDIsIpRNiW3Sjc3MTOnODVZ tzg5MS8vtUjXTC83s0QvNaV0EyMo2NhdlHcw/jmodIhRgINRiYd3gcJdXyHWxLLiytxDjJIc TEqivMZx93yF+JLyUyozEosz4otKc1KLDzFKcDArifAqRQHleFMSK6tSi/JhUtIcLErivHMl 1X2FBNITS1KzU1MLUotgsjIcHEoSvJtBhgoWpaanVqRl5pQgpJk4OEGG8wANXwJSw1tckJhb nJkOkT/FaMzx9NOPA4wcU2//PsAoxJKXn5cqJQ4xTgCkNKM0D24aLGG8YhQHek6Ydz1IFQ8w 2cDNewW0iglolc7vuyCrShIRUlINjPFV7CmHPsU45HjFhZ9ruWh3tvMw30/J0DtnSuwnfYlw 6r3u53NyU5H/oq8PN4p4Td0ldjP22AUuFpmOpUcyROyCd73n/nekwPnsu6Mi7klfqlRO5fU7 Mb2LSt/5cMc+w52bFzbsvRXoUZGb6rfS9/TsrV7BxeJuU2J3lp4IiW5dZ7BmQptDsBJLcUai oRZzUXEiAPcVI3LzAgAA Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Greylist: IP, sender and recipient auto-whitelisted, not delayed by milter-greylist-4.2.6 (demeter2.kernel.org [140.211.167.43]); Thu, 26 May 2011 14:14:04 +0000 (UTC) Both were buggy: bind would happily scribble over a real graphics device and unbind wouldn't destroy the framebuffer. Hotplugging efifb makes no sense anyway, so just disable it. As an added benefit, we save some runtime memory. Signed-off-by: Andy Lutomirski Signed-off-by: Peter Jones --- drivers/video/efifb.c | 21 ++++++++++++++------- 1 files changed, 14 insertions(+), 7 deletions(-) diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c index 39bbfa9..f67717e 100644 --- a/drivers/video/efifb.c +++ b/drivers/video/efifb.c @@ -331,7 +331,7 @@ static int __init efifb_setup(char *options) return 0; } -static int __devinit efifb_probe(struct platform_device *dev) +static int __init efifb_probe(struct platform_device *dev) { struct fb_info *info; int err; @@ -501,7 +501,6 @@ err_release_mem: } static struct platform_driver efifb_driver = { - .probe = efifb_probe, .driver = { .name = "efifb", }, @@ -532,13 +531,21 @@ static int __init efifb_init(void) if (!screen_info.lfb_linelength) return -ENODEV; - ret = platform_driver_register(&efifb_driver); + ret = platform_device_register(&efifb_device); + if (ret) + return ret; - if (!ret) { - ret = platform_device_register(&efifb_device); - if (ret) - platform_driver_unregister(&efifb_driver); + /* + * This is not just an optimization. We will interfere + * with a real driver if we get reprobed, so don't allow + * it. + */ + ret = platform_driver_probe(&efifb_driver, efifb_probe); + if (ret) { + platform_device_unregister(&efifb_driver); + return ret; } + return ret; } module_init(efifb_init);