dri-devel Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] drm/fb-helper: Silence defined but not used warning
@ 2015-08-04 13:22 Geert Uytterhoeven
  2015-08-04 13:22 ` [PATCH 1/2] drm/fb-helper: Clarify drm_fb_helper_restore_fbdev_mode*() Geert Uytterhoeven
                   ` (2 more replies)
  0 siblings, 3 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2015-08-04 13:22 UTC (permalink / raw)
  To: David Airlie; +Cc: dri-devel, linux-kernel, Geert Uytterhoeven

From: Geert Uytterhoeven <geert+renesas@glider.be>

	Hi,

If CONFIG_MAGIC_SYSRQ is not set:

    drivers/gpu/drm/drm_fb_helper.c:390:13: warning: 'drm_fb_helper_force_kernel_mode' defined but not used [-Wunused-function]
     static bool drm_fb_helper_force_kernel_mode(void)
		 ^

As just silencing this warning would require moving two functions (one
of them having obsolete documentation) inside the #ifdef, I fixed the
documentation first.

This patch series is against next-20150803.

Geert Uytterhoeven (2):
  drm/fb-helper: Clarify drm_fb_helper_restore_fbdev_mode*()
  drm/fb-helper: Move drm_fb_helper_force_kernel_mode() inside #ifdef

 drivers/gpu/drm/drm_fb_helper.c | 71 ++++++++++++++++-------------------------
 1 file changed, 28 insertions(+), 43 deletions(-)

-- 
1.9.1

Gr{oetje,eeting}s,

						Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
							    -- Linus Torvalds

^ permalink raw reply	[flat|nested] 4+ messages in thread

* [PATCH 1/2] drm/fb-helper: Clarify drm_fb_helper_restore_fbdev_mode*()
  2015-08-04 13:22 [PATCH 0/2] drm/fb-helper: Silence defined but not used warning Geert Uytterhoeven
@ 2015-08-04 13:22 ` Geert Uytterhoeven
  2015-08-04 13:22 ` [PATCH 2/2] drm/fb-helper: Move drm_fb_helper_force_kernel_mode() inside #ifdef Geert Uytterhoeven
  2015-08-04 13:49 ` [PATCH 0/2] drm/fb-helper: Silence defined but not used warning Daniel Vetter
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2015-08-04 13:22 UTC (permalink / raw)
  To: David Airlie; +Cc: dri-devel, linux-kernel, Geert Uytterhoeven

From: Geert Uytterhoeven <geert+renesas@glider.be>

As of commit 5ea1f752ae04be40 ("drm: add
drm_fb_helper_restore_fbdev_mode_unlocked()"),
drm_fb_helper_restore_fbdev_mode() is no longer public, and drivers
should call drm_fb_helper_restore_fbdev_mode_unlocked() from their
->lastclose callbacks instead.

Update the documentation to reflect this, and absorb the one liner
drm_fb_helper_restore_fbdev_mode() into its single caller.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpu/drm/drm_fb_helper.c | 21 +++------------------
 1 file changed, 3 insertions(+), 18 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index e4bbb53096029718..7278c23ea98b9918 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -56,8 +56,8 @@ static LIST_HEAD(kernel_fb_helper_list);
  * Teardown is done with drm_fb_helper_fini().
  *
  * At runtime drivers should restore the fbdev console by calling
- * drm_fb_helper_restore_fbdev_mode() from their ->lastclose callback. They
- * should also notify the fb helper code from updates to the output
+ * drm_fb_helper_restore_fbdev_mode_unlocked() from their ->lastclose callback.
+ * They should also notify the fb helper code from updates to the output
  * configuration by calling drm_fb_helper_hotplug_event(). For easier
  * integration with the output polling code in drm_crtc_helper.c the modeset
  * code provides a ->output_poll_changed callback.
@@ -354,21 +354,6 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 	}
 	return error;
 }
-/**
- * drm_fb_helper_restore_fbdev_mode - restore fbdev configuration
- * @fb_helper: fbcon to restore
- *
- * This should be called from driver's drm ->lastclose callback
- * when implementing an fbcon on top of kms using this helper. This ensures that
- * the user isn't greeted with a black screen when e.g. X dies.
- *
- * Use this variant if you need to bypass locking (panic), or already
- * hold all modeset locks.  Otherwise use drm_fb_helper_restore_fbdev_mode_unlocked()
- */
-static bool drm_fb_helper_restore_fbdev_mode(struct drm_fb_helper *fb_helper)
-{
-	return restore_fbdev_mode(fb_helper);
-}
 
 /**
  * drm_fb_helper_restore_fbdev_mode_unlocked - restore fbdev configuration
@@ -417,7 +402,7 @@ static bool drm_fb_helper_force_kernel_mode(void)
 			continue;
 
 		drm_modeset_lock_all(dev);
-		ret = drm_fb_helper_restore_fbdev_mode(helper);
+		ret = restore_fbdev_mode(helper);
 		if (ret)
 			error = true;
 		drm_modeset_unlock_all(dev);
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] drm/fb-helper: Move drm_fb_helper_force_kernel_mode() inside #ifdef
  2015-08-04 13:22 [PATCH 0/2] drm/fb-helper: Silence defined but not used warning Geert Uytterhoeven
  2015-08-04 13:22 ` [PATCH 1/2] drm/fb-helper: Clarify drm_fb_helper_restore_fbdev_mode*() Geert Uytterhoeven
@ 2015-08-04 13:22 ` Geert Uytterhoeven
  2015-08-04 13:49 ` [PATCH 0/2] drm/fb-helper: Silence defined but not used warning Daniel Vetter
  2 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2015-08-04 13:22 UTC (permalink / raw)
  To: David Airlie; +Cc: dri-devel, linux-kernel, Geert Uytterhoeven

From: Geert Uytterhoeven <geert+renesas@glider.be>

If CONFIG_MAGIC_SYSRQ is not set:

    drivers/gpu/drm/drm_fb_helper.c:390:13: warning: 'drm_fb_helper_force_kernel_mode' defined but not used [-Wunused-function]
     static bool drm_fb_helper_force_kernel_mode(void)
		 ^

Move drm_fb_helper_force_kernel_mode() inside the existing #ifdef to fix
this.

Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be>
---
 drivers/gpu/drm/drm_fb_helper.c | 50 ++++++++++++++++++++---------------------
 1 file changed, 25 insertions(+), 25 deletions(-)

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 7278c23ea98b9918..5875059a7625ed27 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -383,6 +383,31 @@ bool drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
 }
 EXPORT_SYMBOL(drm_fb_helper_restore_fbdev_mode_unlocked);
 
+static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
+{
+	struct drm_device *dev = fb_helper->dev;
+	struct drm_crtc *crtc;
+	int bound = 0, crtcs_bound = 0;
+
+	/* Sometimes user space wants everything disabled, so don't steal the
+	 * display if there's a master. */
+	if (dev->primary->master)
+		return false;
+
+	drm_for_each_crtc(crtc, dev) {
+		if (crtc->primary->fb)
+			crtcs_bound++;
+		if (crtc->primary->fb == fb_helper->fb)
+			bound++;
+	}
+
+	if (bound < crtcs_bound)
+		return false;
+
+	return true;
+}
+
+#ifdef CONFIG_MAGIC_SYSRQ
 /*
  * restore fbcon display for all kms driver's using this helper, used for sysrq
  * and panic handling.
@@ -410,31 +435,6 @@ static bool drm_fb_helper_force_kernel_mode(void)
 	return error;
 }
 
-static bool drm_fb_helper_is_bound(struct drm_fb_helper *fb_helper)
-{
-	struct drm_device *dev = fb_helper->dev;
-	struct drm_crtc *crtc;
-	int bound = 0, crtcs_bound = 0;
-
-	/* Sometimes user space wants everything disabled, so don't steal the
-	 * display if there's a master. */
-	if (dev->primary->master)
-		return false;
-
-	drm_for_each_crtc(crtc, dev) {
-		if (crtc->primary->fb)
-			crtcs_bound++;
-		if (crtc->primary->fb == fb_helper->fb)
-			bound++;
-	}
-
-	if (bound < crtcs_bound)
-		return false;
-
-	return true;
-}
-
-#ifdef CONFIG_MAGIC_SYSRQ
 static void drm_fb_helper_restore_work_fn(struct work_struct *ignored)
 {
 	bool ret;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 0/2] drm/fb-helper: Silence defined but not used warning
  2015-08-04 13:22 [PATCH 0/2] drm/fb-helper: Silence defined but not used warning Geert Uytterhoeven
  2015-08-04 13:22 ` [PATCH 1/2] drm/fb-helper: Clarify drm_fb_helper_restore_fbdev_mode*() Geert Uytterhoeven
  2015-08-04 13:22 ` [PATCH 2/2] drm/fb-helper: Move drm_fb_helper_force_kernel_mode() inside #ifdef Geert Uytterhoeven
@ 2015-08-04 13:49 ` Daniel Vetter
  2 siblings, 0 replies; 4+ messages in thread
From: Daniel Vetter @ 2015-08-04 13:49 UTC (permalink / raw)
  To: Geert Uytterhoeven; +Cc: dri-devel, linux-kernel, Geert Uytterhoeven

On Tue, Aug 04, 2015 at 03:22:09PM +0200, Geert Uytterhoeven wrote:
> From: Geert Uytterhoeven <geert+renesas@glider.be>
> 
> 	Hi,
> 
> If CONFIG_MAGIC_SYSRQ is not set:
> 
>     drivers/gpu/drm/drm_fb_helper.c:390:13: warning: 'drm_fb_helper_force_kernel_mode' defined but not used [-Wunused-function]
>      static bool drm_fb_helper_force_kernel_mode(void)
> 		 ^
> 
> As just silencing this warning would require moving two functions (one
> of them having obsolete documentation) inside the #ifdef, I fixed the
> documentation first.
> 
> This patch series is against next-20150803.
> 
> Geert Uytterhoeven (2):
>   drm/fb-helper: Clarify drm_fb_helper_restore_fbdev_mode*()
>   drm/fb-helper: Move drm_fb_helper_force_kernel_mode() inside #ifdef

Thanks, both applied to drm-misc.
-Daniel

> 
>  drivers/gpu/drm/drm_fb_helper.c | 71 ++++++++++++++++-------------------------
>  1 file changed, 28 insertions(+), 43 deletions(-)
> 
> -- 
> 1.9.1
> 
> Gr{oetje,eeting}s,
> 
> 						Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like that.
> 							    -- Linus Torvalds
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-08-04 13:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-08-04 13:22 [PATCH 0/2] drm/fb-helper: Silence defined but not used warning Geert Uytterhoeven
2015-08-04 13:22 ` [PATCH 1/2] drm/fb-helper: Clarify drm_fb_helper_restore_fbdev_mode*() Geert Uytterhoeven
2015-08-04 13:22 ` [PATCH 2/2] drm/fb-helper: Move drm_fb_helper_force_kernel_mode() inside #ifdef Geert Uytterhoeven
2015-08-04 13:49 ` [PATCH 0/2] drm/fb-helper: Silence defined but not used warning Daniel Vetter

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox