[ARM] 5118/1: pxafb: add exit and remove handlers

This patch adds exit and remove handlers to pxafb so that it can be loaded
and unloaded as a module.

Signed-off-by: Jaya Kumar <jayakumar.lkml@gmail.com>
Acked-by: Krzysztof Helt <krzysztof.h1@wp.pl>
Acked-by: Eric Miao <eric.miao@marvell.com>
Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
This commit is contained in:
Jaya Kumar 2008-06-22 04:27:28 +01:00 коммит произвёл Russell King
Родитель 5a2cc50f16
Коммит 9f17f28748
1 изменённых файлов: 44 добавлений и 0 удалений

Просмотреть файл

@ -1777,11 +1777,49 @@ failed:
return ret; return ret;
} }
static int __devexit pxafb_remove(struct platform_device *dev)
{
struct pxafb_info *fbi = platform_get_drvdata(dev);
struct resource *r;
int irq;
struct fb_info *info;
if (!fbi)
return 0;
info = &fbi->fb;
unregister_framebuffer(info);
pxafb_disable_controller(fbi);
if (fbi->fb.cmap.len)
fb_dealloc_cmap(&fbi->fb.cmap);
irq = platform_get_irq(dev, 0);
free_irq(irq, fbi);
dma_free_writecombine(&dev->dev, fbi->map_size,
fbi->map_cpu, fbi->map_dma);
iounmap(fbi->mmio_base);
r = platform_get_resource(dev, IORESOURCE_MEM, 0);
release_mem_region(r->start, r->end - r->start + 1);
clk_put(fbi->clk);
kfree(fbi);
return 0;
}
static struct platform_driver pxafb_driver = { static struct platform_driver pxafb_driver = {
.probe = pxafb_probe, .probe = pxafb_probe,
.remove = pxafb_remove,
.suspend = pxafb_suspend, .suspend = pxafb_suspend,
.resume = pxafb_resume, .resume = pxafb_resume,
.driver = { .driver = {
.owner = THIS_MODULE,
.name = "pxa2xx-fb", .name = "pxa2xx-fb",
}, },
}; };
@ -1794,7 +1832,13 @@ static int __devinit pxafb_init(void)
return platform_driver_register(&pxafb_driver); return platform_driver_register(&pxafb_driver);
} }
static void __exit pxafb_exit(void)
{
platform_driver_unregister(&pxafb_driver);
}
module_init(pxafb_init); module_init(pxafb_init);
module_exit(pxafb_exit);
MODULE_DESCRIPTION("loadable framebuffer driver for PXA"); MODULE_DESCRIPTION("loadable framebuffer driver for PXA");
MODULE_LICENSE("GPL"); MODULE_LICENSE("GPL");