diff options
author | Andy Lutomirski <luto@MIT.EDU> | 2011-05-26 10:13:34 -0400 |
---|---|---|
committer | Paul Mundt <lethal@linux-sh.org> | 2011-06-02 17:18:07 +0900 |
commit | bb8b26627267a82c49f47fc52a0785f079a7b063 (patch) | |
tree | bb1559a35d5417a6dd08790b50ba8a99bdc90f68 /drivers | |
parent | da0241f12bf785f74e57ad6d67abdf269216f76b (diff) | |
download | lwn-bb8b26627267a82c49f47fc52a0785f079a7b063.tar.gz lwn-bb8b26627267a82c49f47fc52a0785f079a7b063.zip |
efifb: Disallow manual bind and unbind
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 <luto@mit.edu>
Signed-off-by: Peter Jones <pjones@redhat.com>
Signed-off-by: Paul Mundt <lethal@linux-sh.org>
Diffstat (limited to 'drivers')
-rw-r--r-- | 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 8cb31e106b9e..69c49dfce9cf 100644 --- a/drivers/video/efifb.c +++ b/drivers/video/efifb.c @@ -330,7 +330,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; @@ -500,7 +500,6 @@ err_release_mem: } static struct platform_driver efifb_driver = { - .probe = efifb_probe, .driver = { .name = "efifb", }, @@ -531,13 +530,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); |