Merge tag 'modules-for-v5.12' of git://git.kernel.org/pub/scm/linux/kernel/git/jeyu...
[linux-2.6-microblaze.git] / drivers / gpu / drm / drm_fb_helper.c
index 4b81195..b9a6167 100644 (file)
@@ -946,11 +946,15 @@ static int setcmap_legacy(struct fb_cmap *cmap, struct fb_info *info)
        drm_modeset_lock_all(fb_helper->dev);
        drm_client_for_each_modeset(modeset, &fb_helper->client) {
                crtc = modeset->crtc;
-               if (!crtc->funcs->gamma_set || !crtc->gamma_size)
-                       return -EINVAL;
+               if (!crtc->funcs->gamma_set || !crtc->gamma_size) {
+                       ret = -EINVAL;
+                       goto out;
+               }
 
-               if (cmap->start + cmap->len > crtc->gamma_size)
-                       return -EINVAL;
+               if (cmap->start + cmap->len > crtc->gamma_size) {
+                       ret = -EINVAL;
+                       goto out;
+               }
 
                r = crtc->gamma_store;
                g = r + crtc->gamma_size;
@@ -963,8 +967,9 @@ static int setcmap_legacy(struct fb_cmap *cmap, struct fb_info *info)
                ret = crtc->funcs->gamma_set(crtc, r, g, b,
                                             crtc->gamma_size, NULL);
                if (ret)
-                       return ret;
+                       goto out;
        }
+out:
        drm_modeset_unlock_all(fb_helper->dev);
 
        return ret;
@@ -1054,6 +1059,11 @@ retry:
                        goto out_state;
                }
 
+               /*
+                * FIXME: This always uses gamma_lut. Some HW have only
+                * degamma_lut, in which case we should reset gamma_lut and set
+                * degamma_lut. See drm_crtc_legacy_gamma_set().
+                */
                replaced  = drm_property_replace_blob(&crtc_state->degamma_lut,
                                                      NULL);
                replaced |= drm_property_replace_blob(&crtc_state->ctm, NULL);
@@ -2486,6 +2496,11 @@ void drm_fbdev_generic_setup(struct drm_device *dev,
                return;
        }
 
+       /*
+        * FIXME: This mixes up depth with bpp, which results in a glorious
+        * mess, resulting in some drivers picking wrong fbdev defaults and
+        * others wrong preferred_depth defaults.
+        */
        if (!preferred_bpp)
                preferred_bpp = dev->mode_config.preferred_depth;
        if (!preferred_bpp)
@@ -2499,24 +2514,3 @@ void drm_fbdev_generic_setup(struct drm_device *dev,
        drm_client_register(&fb_helper->client);
 }
 EXPORT_SYMBOL(drm_fbdev_generic_setup);
-
-/* The Kconfig DRM_KMS_HELPER selects FRAMEBUFFER_CONSOLE (if !EXPERT)
- * but the module doesn't depend on any fb console symbols.  At least
- * attempt to load fbcon to avoid leaving the system without a usable console.
- */
-int __init drm_fb_helper_modinit(void)
-{
-#if defined(CONFIG_FRAMEBUFFER_CONSOLE_MODULE) && !defined(CONFIG_EXPERT)
-       const char name[] = "fbcon";
-       struct module *fbcon;
-
-       mutex_lock(&module_mutex);
-       fbcon = find_module(name);
-       mutex_unlock(&module_mutex);
-
-       if (!fbcon)
-               request_module_nowait(name);
-#endif
-       return 0;
-}
-EXPORT_SYMBOL(drm_fb_helper_modinit);