diff options
author | Haojian Zhuang <haojian.zhuang@gmail.com> | 2010-08-29 20:32:16 -0400 |
---|---|---|
committer | Eric Miao <eric.y.miao@gmail.com> | 2010-10-09 05:07:23 -0400 |
commit | ba1aa3248e484e5cc39a74ae418232bd5c877a90 (patch) | |
tree | 6dc722661c3d9568bfe6b387cc8d7c4f91b0035c /drivers/video/pxa168fb.c | |
parent | 6aafc5f394fce437bf005b59034d7e5917778a99 (diff) |
ARM: pxa168fb: add .remove function
The pxa168fb driver is missing .remove function so the framebuffer isn't
correctly shut down when the module is removed.
Signed-off-by: Marek Vasut <marek.vasut@gmail.com>
Signed-off-by: Haojian Zhuang <haojian.zhuang@marvell.com>
Signed-off-by: Eric Miao <eric.y.miao@gmail.com>
Diffstat (limited to 'drivers/video/pxa168fb.c')
-rw-r--r-- | drivers/video/pxa168fb.c | 47 |
1 files changed, 47 insertions, 0 deletions
diff --git a/drivers/video/pxa168fb.c b/drivers/video/pxa168fb.c index a31a77ff6f3d..cea6403ae71c 100644 --- a/drivers/video/pxa168fb.c +++ b/drivers/video/pxa168fb.c | |||
@@ -784,12 +784,53 @@ failed: | |||
784 | return ret; | 784 | return ret; |
785 | } | 785 | } |
786 | 786 | ||
787 | static int __devexit pxa168fb_remove(struct platform_device *pdev) | ||
788 | { | ||
789 | struct pxa168fb_info *fbi = platform_get_drvdata(pdev); | ||
790 | struct fb_info *info; | ||
791 | int irq; | ||
792 | unsigned int data; | ||
793 | |||
794 | if (!fbi) | ||
795 | return 0; | ||
796 | |||
797 | /* disable DMA transfer */ | ||
798 | data = readl(fbi->reg_base + LCD_SPU_DMA_CTRL0); | ||
799 | data &= ~CFG_GRA_ENA_MASK; | ||
800 | writel(data, fbi->reg_base + LCD_SPU_DMA_CTRL0); | ||
801 | |||
802 | info = fbi->info; | ||
803 | |||
804 | unregister_framebuffer(info); | ||
805 | |||
806 | writel(GRA_FRAME_IRQ0_ENA(0x0), fbi->reg_base + SPU_IRQ_ENA); | ||
807 | |||
808 | if (info->cmap.len) | ||
809 | fb_dealloc_cmap(&info->cmap); | ||
810 | |||
811 | irq = platform_get_irq(pdev, 0); | ||
812 | free_irq(irq, fbi); | ||
813 | |||
814 | dma_free_writecombine(fbi->dev, PAGE_ALIGN(info->fix.smem_len), | ||
815 | info->screen_base, info->fix.smem_start); | ||
816 | |||
817 | iounmap(fbi->reg_base); | ||
818 | |||
819 | clk_disable(fbi->clk); | ||
820 | clk_put(fbi->clk); | ||
821 | |||
822 | framebuffer_release(info); | ||
823 | |||
824 | return 0; | ||
825 | } | ||
826 | |||
787 | static struct platform_driver pxa168fb_driver = { | 827 | static struct platform_driver pxa168fb_driver = { |
788 | .driver = { | 828 | .driver = { |
789 | .name = "pxa168-fb", | 829 | .name = "pxa168-fb", |
790 | .owner = THIS_MODULE, | 830 | .owner = THIS_MODULE, |
791 | }, | 831 | }, |
792 | .probe = pxa168fb_probe, | 832 | .probe = pxa168fb_probe, |
833 | .remove = __devexit_p(pxa168fb_remove), | ||
793 | }; | 834 | }; |
794 | 835 | ||
795 | static int __init pxa168fb_init(void) | 836 | static int __init pxa168fb_init(void) |
@@ -798,6 +839,12 @@ static int __init pxa168fb_init(void) | |||
798 | } | 839 | } |
799 | module_init(pxa168fb_init); | 840 | module_init(pxa168fb_init); |
800 | 841 | ||
842 | static void __exit pxa168fb_exit(void) | ||
843 | { | ||
844 | platform_driver_unregister(&pxa168fb_driver); | ||
845 | } | ||
846 | module_exit(pxa168fb_exit); | ||
847 | |||
801 | MODULE_AUTHOR("Lennert Buytenhek <buytenh@marvell.com> " | 848 | MODULE_AUTHOR("Lennert Buytenhek <buytenh@marvell.com> " |
802 | "Green Wan <gwan@marvell.com>"); | 849 | "Green Wan <gwan@marvell.com>"); |
803 | MODULE_DESCRIPTION("Framebuffer driver for PXA168/910"); | 850 | MODULE_DESCRIPTION("Framebuffer driver for PXA168/910"); |