forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-13 9d77db3c730780c8ef5ccd4b66403ff5675cfe4e
kernel/drivers/video/fbdev/s1d13xxxfb.c
....@@ -721,9 +721,7 @@
721721 xres, yres, xres_virtual, yres_virtual, is_color, is_dual, is_tft);
722722 }
723723
724
-
725
-static int
726
-s1d13xxxfb_remove(struct platform_device *pdev)
724
+static void __s1d13xxxfb_remove(struct platform_device *pdev)
727725 {
728726 struct fb_info *info = platform_get_drvdata(pdev);
729727 struct s1d13xxxfb_par *par = NULL;
....@@ -746,9 +744,17 @@
746744 }
747745
748746 release_mem_region(pdev->resource[0].start,
749
- pdev->resource[0].end - pdev->resource[0].start +1);
747
+ resource_size(&pdev->resource[0]));
750748 release_mem_region(pdev->resource[1].start,
751
- pdev->resource[1].end - pdev->resource[1].start +1);
749
+ resource_size(&pdev->resource[1]));
750
+}
751
+
752
+static int s1d13xxxfb_remove(struct platform_device *pdev)
753
+{
754
+ struct fb_info *info = platform_get_drvdata(pdev);
755
+
756
+ unregister_framebuffer(info);
757
+ __s1d13xxxfb_remove(pdev);
752758 return 0;
753759 }
754760
....@@ -788,14 +794,14 @@
788794 }
789795
790796 if (!request_mem_region(pdev->resource[0].start,
791
- pdev->resource[0].end - pdev->resource[0].start +1, "s1d13xxxfb mem")) {
797
+ resource_size(&pdev->resource[0]), "s1d13xxxfb mem")) {
792798 dev_dbg(&pdev->dev, "request_mem_region failed\n");
793799 ret = -EBUSY;
794800 goto bail;
795801 }
796802
797803 if (!request_mem_region(pdev->resource[1].start,
798
- pdev->resource[1].end - pdev->resource[1].start +1, "s1d13xxxfb regs")) {
804
+ resource_size(&pdev->resource[1]), "s1d13xxxfb regs")) {
799805 dev_dbg(&pdev->dev, "request_mem_region failed\n");
800806 ret = -EBUSY;
801807 goto bail;
....@@ -809,8 +815,8 @@
809815
810816 platform_set_drvdata(pdev, info);
811817 default_par = info->par;
812
- default_par->regs = ioremap_nocache(pdev->resource[1].start,
813
- pdev->resource[1].end - pdev->resource[1].start +1);
818
+ default_par->regs = ioremap(pdev->resource[1].start,
819
+ resource_size(&pdev->resource[1]));
814820 if (!default_par->regs) {
815821 printk(KERN_ERR PFX "unable to map registers\n");
816822 ret = -ENOMEM;
....@@ -818,8 +824,8 @@
818824 }
819825 info->pseudo_palette = default_par->pseudo_palette;
820826
821
- info->screen_base = ioremap_nocache(pdev->resource[0].start,
822
- pdev->resource[0].end - pdev->resource[0].start +1);
827
+ info->screen_base = ioremap(pdev->resource[0].start,
828
+ resource_size(&pdev->resource[0]));
823829
824830 if (!info->screen_base) {
825831 printk(KERN_ERR PFX "unable to map framebuffer\n");
....@@ -857,9 +863,9 @@
857863
858864 info->fix = s1d13xxxfb_fix;
859865 info->fix.mmio_start = pdev->resource[1].start;
860
- info->fix.mmio_len = pdev->resource[1].end - pdev->resource[1].start + 1;
866
+ info->fix.mmio_len = resource_size(&pdev->resource[1]);
861867 info->fix.smem_start = pdev->resource[0].start;
862
- info->fix.smem_len = pdev->resource[0].end - pdev->resource[0].start + 1;
868
+ info->fix.smem_len = resource_size(&pdev->resource[0]);
863869
864870 printk(KERN_INFO PFX "regs mapped at 0x%p, fb %d KiB mapped at 0x%p\n",
865871 default_par->regs, info->fix.smem_len / 1024, info->screen_base);
....@@ -895,7 +901,7 @@
895901 return 0;
896902
897903 bail:
898
- s1d13xxxfb_remove(pdev);
904
+ __s1d13xxxfb_remove(pdev);
899905 return ret;
900906
901907 }