Skip to contentSkip to conversation

drm/gma500: Remove unused helper psb_fbdev_fb_setcolreg()

PATCH In review Thomas Zimmermann 2 participants 2 messages Sep 29, 2025

Subsystems (4)
lore
Share & tools
lore

Thomas Zimmermann

author maintainer
#0 lore raw

PATCH 1/1 drm/gma500: Remove unused helper psb_fbdev_fb_setcolreg()

Remove psb_fbdev_fb_setcolreg(), which hasn't been called in almost a decade.

Gma500 commit 4d8d096e9ae8 ("gma500: introduce the framebuffer support code") added the helper psb_fbdev_fb_setcolreg() for setting the fbdev palette via fbdev's fb_setcolreg callback. Later
commit 3da6c2f3b730 ("drm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops") set several default helpers for fbdev emulation, including fb_setcmap.

The fbdev subsystem always prefers fb_setcmap over fb_setcolreg. [1] Hence, the gma500 code is no longer in use and gma500 has been using drm_fb_helper_setcmap() for several years without issues.

Fixes 3da6c2f3b730 ("drm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops")
Cc Patrik Jakobsson <[email protected]>
Cc Stefan Christ <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc <[email protected]> # v4.10+
---
 drivers/gpu/drm/gma500/fbdev.c | 43 ----------------------------------
 1 file changed, 43 deletions(-)
drivers/gpu/drm/gma500/fbdev.c +0 -43
index 32d31e5f5f1a..a6af21514cff 100644
@@ -50,48 +50,6 @@ static const struct vm_operations_struct psb_fbdev_vm_ops = {
  * struct fb_ops
  */
 
-#define CMAP_TOHW(_val, _width) ((((_val) << (_width)) + 0x7FFF - (_val)) >> 16)
-
-static int psb_fbdev_fb_setcolreg(unsigned int regno,
-				  unsigned int red, unsigned int green,
-				  unsigned int blue, unsigned int transp,
-				  struct fb_info *info)
-{
-	struct drm_fb_helper *fb_helper = info->par;
-	struct drm_framebuffer *fb = fb_helper->fb;
-	uint32_t v;
-
-	if (!fb)
-		return -ENOMEM;
-
-	if (regno > 255)
-		return 1;
-
-	red = CMAP_TOHW(red, info->var.red.length);
-	blue = CMAP_TOHW(blue, info->var.blue.length);
-	green = CMAP_TOHW(green, info->var.green.length);
-	transp = CMAP_TOHW(transp, info->var.transp.length);
-
-	v = (red << info->var.red.offset) |
-	    (green << info->var.green.offset) |
-	    (blue << info->var.blue.offset) |
-	    (transp << info->var.transp.offset);
-
-	if (regno < 16) {
-		switch (fb->format->cpp[0] * 8) {
-		case 16:
-			((uint32_t *) info->pseudo_palette)[regno] = v;
-			break;
-		case 24:
-		case 32:
-			((uint32_t *) info->pseudo_palette)[regno] = v;
-			break;
-		}
-	}
-
-	return 0;
-}
-
 static int psb_fbdev_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
 {
 	if (vma->vm_pgoff != 0)
@@ -135,7 +93,6 @@ static const struct fb_ops psb_fbdev_fb_ops = {
 	.owner = THIS_MODULE,
 	__FB_DEFAULT_IOMEM_OPS_RDWR,
 	DRM_FB_HELPER_DEFAULT_OPS,
-	.fb_setcolreg = psb_fbdev_fb_setcolreg,
 	__FB_DEFAULT_IOMEM_OPS_DRAW,
 	.fb_mmap = psb_fbdev_fb_mmap,
 	.fb_destroy = psb_fbdev_fb_destroy,
Signature · 1 line
2.51.0
maintainer Acked-by on v1 1/1
#1 lore raw
Quoted 15 lines · Thomas Zimmermann

Remove psb_fbdev_fb_setcolreg(), which hasn't been called in almost a decade.

Gma500 commit 4d8d096e9ae8 ("gma500: introduce the framebuffer support code") added the helper psb_fbdev_fb_setcolreg() for setting the fbdev palette via fbdev's fb_setcolreg callback. Later
commit 3da6c2f3b730 ("drm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops") set several default helpers for fbdev emulation, including fb_setcmap.

The fbdev subsystem always prefers fb_setcmap over fb_setcolreg. [1] Hence, the gma500 code is no longer in use and gma500 has been using drm_fb_helper_setcmap() for several years without issues.

Quoted 8 lines
Fixes 3da6c2f3b730 ("drm/gma500: use DRM_FB_HELPER_DEFAULT_OPS for fb_ops")
Cc Patrik Jakobsson <[email protected]>
Cc Stefan Christ <[email protected]>
Cc Daniel Vetter <[email protected]>
Cc <[email protected]> # v4.10+
Quoted 68 lines
---
 drivers/gpu/drm/gma500/fbdev.c | 43 ----------------------------------
 1 file changed, 43 deletions(-)
drivers/gpu/drm/gma500/fbdev.c +0 -44
index 32d31e5f5f1a..a6af21514cff 100644
@@ -50,48 +50,6 @@ static const struct vm_operations_struct psb_fbdev_vm_ops = {
  * struct fb_ops
  */
 
-#define CMAP_TOHW(_val, _width) ((((_val) << (_width)) + 0x7FFF - (_val)) >> 16)
-
-static int psb_fbdev_fb_setcolreg(unsigned int regno,
-                                 unsigned int red, unsigned int green,
-                                 unsigned int blue, unsigned int transp,
-                                 struct fb_info *info)
-{
-       struct drm_fb_helper *fb_helper = info->par;
-       struct drm_framebuffer *fb = fb_helper->fb;
-       uint32_t v;
-
-       if (!fb)
-               return -ENOMEM;
-
-       if (regno > 255)
-               return 1;
-
-       red = CMAP_TOHW(red, info->var.red.length);
-       blue = CMAP_TOHW(blue, info->var.blue.length);
-       green = CMAP_TOHW(green, info->var.green.length);
-       transp = CMAP_TOHW(transp, info->var.transp.length);
-
-       v = (red << info->var.red.offset) |
-           (green << info->var.green.offset) |
-           (blue << info->var.blue.offset) |
-           (transp << info->var.transp.offset);
-
-       if (regno < 16) {
-               switch (fb->format->cpp[0] * 8) {
-               case 16:
-                       ((uint32_t *) info->pseudo_palette)[regno] = v;
-                       break;
-               case 24:
-               case 32:
-                       ((uint32_t *) info->pseudo_palette)[regno] = v;
-                       break;
-               }
-       }
-
-       return 0;
-}
-
 static int psb_fbdev_fb_mmap(struct fb_info *info, struct vm_area_struct *vma)
 {
        if (vma->vm_pgoff != 0)
@@ -135,7 +93,6 @@ static const struct fb_ops psb_fbdev_fb_ops = {
        .owner = THIS_MODULE,
        __FB_DEFAULT_IOMEM_OPS_RDWR,
        DRM_FB_HELPER_DEFAULT_OPS,
-       .fb_setcolreg = psb_fbdev_fb_setcolreg,
        __FB_DEFAULT_IOMEM_OPS_DRAW,
        .fb_mmap = psb_fbdev_fb_mmap,
        .fb_destroy = psb_fbdev_fb_destroy,
--

2.51.0