forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-01-03 2f7c68cb55ecb7331f2381deb497c27155f32faf
kernel/drivers/video/fbdev/amifb.c
....@@ -575,6 +575,12 @@
575575 #define downx(x, v) ((v) & -(x))
576576 #define modx(x, v) ((v) & ((x) - 1))
577577
578
+/*
579
+ * FIXME: Use C variants of the code marked with #ifdef __mc68000__
580
+ * in the driver. It shouldn't negatively affect the performance and
581
+ * is required for APUS support (once it is re-added to the kernel).
582
+ * Needs to be tested on the hardware though..
583
+ */
578584 /* if x1 is not a constant, this macro won't make real sense :-) */
579585 #ifdef __mc68000__
580586 #define DIVUL(x1, x2) ({int res; asm("divul %1,%2,%3": "=d" (res): \
....@@ -1855,8 +1861,6 @@
18551861 var->yspot = par->crsr.spot_y;
18561862 if (size > var->height * var->width)
18571863 return -ENAMETOOLONG;
1858
- if (!access_ok(VERIFY_WRITE, data, size))
1859
- return -EFAULT;
18601864 delta = 1 << par->crsr.fmode;
18611865 lspr = lofsprite + (delta << 1);
18621866 if (par->bplcon0 & BPC0_LACE)
....@@ -1886,6 +1890,7 @@
18861890 | ((datawords >> 15) & 1));
18871891 datawords <<= 1;
18881892 #endif
1893
+ /* FIXME: check the return value + test the change */
18891894 put_user(color, data++);
18901895 }
18911896 if (bits > 0) {
....@@ -1935,8 +1940,6 @@
19351940 return -EINVAL;
19361941 if (!var->height)
19371942 return -EINVAL;
1938
- if (!access_ok(VERIFY_READ, data, var->width * var->height))
1939
- return -EFAULT;
19401943 delta = 1 << fmode;
19411944 lofsprite = shfsprite = (u_short *)spritememory;
19421945 lspr = lofsprite + (delta << 1);
....@@ -1956,6 +1959,7 @@
19561959 bits = 16; words = delta; datawords = 0;
19571960 for (width = (short)var->width - 1; width >= 0; width--) {
19581961 unsigned long tdata = 0;
1962
+ /* FIXME: check the return value + test the change */
19591963 get_user(tdata, data);
19601964 data++;
19611965 #ifdef __mc68000__
....@@ -3493,7 +3497,7 @@
34933497 }
34943498
34953499
3496
-static struct fb_ops amifb_ops = {
3500
+static const struct fb_ops amifb_ops = {
34973501 .owner = THIS_MODULE,
34983502 .fb_check_var = amifb_check_var,
34993503 .fb_set_par = amifb_set_par,
....@@ -3554,10 +3558,8 @@
35543558 custom.dmacon = DMAF_ALL | DMAF_MASTER;
35553559
35563560 info = framebuffer_alloc(sizeof(struct amifb_par), &pdev->dev);
3557
- if (!info) {
3558
- dev_err(&pdev->dev, "framebuffer_alloc failed\n");
3561
+ if (!info)
35593562 return -ENOMEM;
3560
- }
35613563
35623564 strcpy(info->fix.id, "Amiga ");
35633565 info->fix.visual = FB_VISUAL_PSEUDOCOLOR;