diff mbox

[04/16] drm/fb-helper: kill drm_fb_helper_restore

Message ID 1359044448-3861-5-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter Jan. 24, 2013, 4:20 p.m. UTC
It's only used internally for the sysrq and panic handlers provided by
the drm fb helper implementation. Hence just inline it, kill the
export and remove the confusing kerneldoc. Driver's are supposed to
call drm_fb_helper_restore_fbdev_mode on lastclose.

Note that locking is totally fubar - the sysrq case doesn't take any
locks at all. The panic handler probably shouldn't take any locks
since it'll only make things worse. Otoh it's probably better to
switch things over to the atomic modeset callbacks (and disable the
panic handler for those drivers which don't implement it).

But that's both better done in separate patches.

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/drm_fb_helper.c |   23 ++++++++---------------
 include/drm/drm_fb_helper.h     |    1 -
 2 files changed, 8 insertions(+), 16 deletions(-)

Comments

Rob Clark Feb. 11, 2013, 10:08 p.m. UTC | #1
On Thu, Jan 24, 2013 at 10:20 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> It's only used internally for the sysrq and panic handlers provided by
> the drm fb helper implementation. Hence just inline it, kill the
> export and remove the confusing kerneldoc. Driver's are supposed to
> call drm_fb_helper_restore_fbdev_mode on lastclose.
>
> Note that locking is totally fubar - the sysrq case doesn't take any
> locks at all. The panic handler probably shouldn't take any locks
> since it'll only make things worse. Otoh it's probably better to
> switch things over to the atomic modeset callbacks (and disable the
> panic handler for those drivers which don't implement it).
>
> But that's both better done in separate patches.
>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Reviewed-by: Rob Clark <robdclark@gmail.com>

> ---
>  drivers/gpu/drm/drm_fb_helper.c |   23 ++++++++---------------
>  include/drm/drm_fb_helper.h     |    1 -
>  2 files changed, 8 insertions(+), 16 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
> index 0439cb0..6d689f2 100644
> --- a/drivers/gpu/drm/drm_fb_helper.c
> +++ b/drivers/gpu/drm/drm_fb_helper.c
> @@ -261,6 +261,10 @@ bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)
>  }
>  EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode);
>
> +/*
> + * restore fbcon display for all kms driver's using this helper, used for sysrq
> + * and panic handling.
> + */
>  static bool drm_fb_helper_force_kernel_mode(void)
>  {
>         bool ret, error = false;
> @@ -299,20 +303,6 @@ static struct notifier_block paniced = {
>         .notifier_call = drm_fb_helper_panic,
>  };
>
> -/**
> - * drm_fb_helper_restore - restore the framebuffer console (kernel) config
> - *
> - * Restore's the kernel's fbcon mode, used for lastclose & panic paths.
> - */
> -void drm_fb_helper_restore(void)
> -{
> -       bool ret;
> -       ret = drm_fb_helper_force_kernel_mode();
> -       if (ret == true)
> -               DRM_ERROR("Failed to restore crtc configuration\n");
> -}
> -EXPORT_SYMBOL(drm_fb_helper_restore);
> -
>  static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
>  {
>         struct drm_device *dev = fb_helper->dev;
> @@ -334,7 +324,10 @@ static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
>  #ifdef CONFIG_MAGIC_SYSRQ
>  static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
>  {
> -       drm_fb_helper_restore();
> +       bool ret;
> +       ret = drm_fb_helper_force_kernel_mode();
> +       if (ret == true)
> +               DRM_ERROR("Failed to restore crtc configuration\n");
>  }
>  static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn);
>
> diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
> index 5120b01..ba32505 100644
> --- a/include/drm/drm_fb_helper.h
> +++ b/include/drm/drm_fb_helper.h
> @@ -103,7 +103,6 @@ int drm_fb_helper_setcolreg(unsigned regno,
>                             struct fb_info *info);
>
>  bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper);
> -void drm_fb_helper_restore(void);
>  void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
>                             uint32_t fb_width, uint32_t fb_height);
>  void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,
> --
> 1.7.10.4
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 0439cb0..6d689f2 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -261,6 +261,10 @@  bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 }
 EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode);
 
+/*
+ * restore fbcon display for all kms driver's using this helper, used for sysrq
+ * and panic handling.
+ */
 static bool drm_fb_helper_force_kernel_mode(void)
 {
 	bool ret, error = false;
@@ -299,20 +303,6 @@  static struct notifier_block paniced = {
 	.notifier_call = drm_fb_helper_panic,
 };
 
-/**
- * drm_fb_helper_restore - restore the framebuffer console (kernel) config
- *
- * Restore's the kernel's fbcon mode, used for lastclose & panic paths.
- */
-void drm_fb_helper_restore(void)
-{
-	bool ret;
-	ret = drm_fb_helper_force_kernel_mode();
-	if (ret == true)
-		DRM_ERROR("Failed to restore crtc configuration\n");
-}
-EXPORT_SYMBOL(drm_fb_helper_restore);
-
 static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
 {
 	struct drm_device *dev = fb_helper->dev;
@@ -334,7 +324,10 @@  static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
 #ifdef CONFIG_MAGIC_SYSRQ
 static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
 {
-	drm_fb_helper_restore();
+	bool ret;
+	ret = drm_fb_helper_force_kernel_mode();
+	if (ret == true)
+		DRM_ERROR("Failed to restore crtc configuration\n");
 }
 static DECLARE_WORK(drm_fb_helper_restore_work, drm_fb_helper_restore_work_fn);
 
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index 5120b01..ba32505 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -103,7 +103,6 @@  int drm_fb_helper_setcolreg(unsigned regno,
 			    struct fb_info *info);
 
 bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper);
-void drm_fb_helper_restore(void);
 void drm_fb_helper_fill_var(struct fb_info *info, struct drm_fb_helper *fb_helper,
 			    uint32_t fb_width, uint32_t fb_height);
 void drm_fb_helper_fill_fix(struct fb_info *info, uint32_t pitch,