All of lore.kernel.org
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel.vetter@ffwll.ch>
To: DRI Development <dri-devel@lists.freedesktop.org>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>,
	Intel Graphics Development <intel-gfx@lists.freedesktop.org>
Subject: [PATCH 2/4] drm/fb-helper: Use -errno return in restore_mode_unlocked
Date: Tue, 25 Aug 2015 15:45:12 +0200	[thread overview]
Message-ID: <1440510314-8633-2-git-send-email-daniel.vetter@ffwll.ch> (raw)
In-Reply-To: <1440510314-8633-1-git-send-email-daniel.vetter@ffwll.ch>

Using bool and returning true upon error is very uncommon. Also an int
return value is actually what all the callers which did check it seem
to have expected.

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

diff --git a/drivers/gpu/drm/drm_fb_helper.c b/drivers/gpu/drm/drm_fb_helper.c
index 418d299f3b12..83aacb0cc9df 100644
--- a/drivers/gpu/drm/drm_fb_helper.c
+++ b/drivers/gpu/drm/drm_fb_helper.c
@@ -320,11 +320,10 @@ int drm_fb_helper_debug_leave(struct fb_info *info)
 }
 EXPORT_SYMBOL(drm_fb_helper_debug_leave);
 
-static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
+static int restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 {
 	struct drm_device *dev = fb_helper->dev;
 	struct drm_plane *plane;
-	bool error = false;
 	int i;
 
 	drm_warn_on_modeset_not_all_locked(dev);
@@ -348,14 +347,15 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
 		if (crtc->funcs->cursor_set) {
 			ret = crtc->funcs->cursor_set(crtc, NULL, 0, 0, 0);
 			if (ret)
-				error = true;
+				return ret;
 		}
 
 		ret = drm_mode_set_config_internal(mode_set);
 		if (ret)
-			error = true;
+			return ret;
 	}
-	return error;
+
+	return 0;
 }
 
 /**
@@ -365,12 +365,15 @@ static bool restore_fbdev_mode(struct drm_fb_helper *fb_helper)
  * 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.
+ *
+ * RETURNS:
+ * Zero if everything went ok, negative error code otherwise.
  */
-bool drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
+int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
 {
 	struct drm_device *dev = fb_helper->dev;
-	bool ret;
-	bool do_delayed = false;
+	bool do_delayed
+	int ret;
 
 	drm_modeset_lock_all(dev);
 	ret = restore_fbdev_mode(fb_helper);
diff --git a/include/drm/drm_fb_helper.h b/include/drm/drm_fb_helper.h
index dbab4622b58f..67de1f10008e 100644
--- a/include/drm/drm_fb_helper.h
+++ b/include/drm/drm_fb_helper.h
@@ -136,7 +136,7 @@ int drm_fb_helper_set_par(struct fb_info *info);
 int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
 			    struct fb_info *info);
 
-bool drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper);
+int drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper);
 
 struct fb_info *drm_fb_helper_alloc_fbi(struct drm_fb_helper *fb_helper);
 void drm_fb_helper_unregister_fbi(struct drm_fb_helper *fb_helper);
@@ -226,10 +226,10 @@ static inline int drm_fb_helper_check_var(struct fb_var_screeninfo *var,
 	return 0;
 }
 
-static inline bool
+static inline int
 drm_fb_helper_restore_fbdev_mode_unlocked(struct drm_fb_helper *fb_helper)
 {
-	return true;
+	return 0;
 }
 
 static inline struct fb_info *
-- 
1.8.3.1

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2015-08-25 13:45 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-08-25 13:45 [PATCH 1/4] drm: Make drm_fb_unregister/remove accept NULL fb Daniel Vetter
2015-08-25 13:45 ` Daniel Vetter [this message]
2015-08-25 15:20   ` [PATCH] drm/fb-helper: Use -errno return in restore_mode_unlocked Daniel Vetter
2015-08-25 19:20     ` Rob Clark
2015-08-26 11:36       ` Daniel Vetter
2015-08-29 19:04     ` shuang.he
2015-08-25 13:45 ` [PATCH 3/4] drm/fb-helper: Add module option to disable fbdev emulation Daniel Vetter
2015-08-26  5:12   ` Archit Taneja
2015-08-26  8:44     ` Archit Taneja
2015-08-26 11:34       ` Daniel Vetter
2015-08-26 11:37         ` Daniel Vetter
2015-08-26 12:29           ` Archit Taneja
2015-08-26 12:51             ` Daniel Vetter
2015-08-26 12:18         ` Archit Taneja
2015-08-25 13:45 ` [PATCH 4/4] fbdev: Debug knob to register without holding console_lock Daniel Vetter
2015-08-25 13:45   ` Daniel Vetter
2015-08-25 19:24   ` Rob Clark
2015-08-25 19:24     ` Rob Clark
2015-09-01 10:32     ` Tomi Valkeinen
2015-09-01 10:32       ` Tomi Valkeinen
2015-09-01 14:34       ` Rob Clark
2015-09-01 14:34         ` Rob Clark
2015-09-01 14:41         ` Tomi Valkeinen
2015-09-01 14:41           ` Tomi Valkeinen
2015-09-01 15:12           ` Rob Clark
2015-09-01 15:12             ` Rob Clark
2015-09-01 15:31             ` Daniel Vetter
2015-09-01 15:31               ` Daniel Vetter
2015-09-24 10:56         ` Tomi Valkeinen
2015-09-24 10:56           ` Tomi Valkeinen
2015-12-07 17:32   ` Tomi Valkeinen
2015-12-07 17:32     ` Tomi Valkeinen
2015-12-08  8:19     ` Daniel Vetter
2015-12-08  8:19       ` Daniel Vetter
2015-12-08  8:26       ` Tomi Valkeinen
2015-12-08  8:26         ` Tomi Valkeinen
2015-08-25 19:19 ` [PATCH 1/4] drm: Make drm_fb_unregister/remove accept NULL fb Rob Clark

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1440510314-8633-2-git-send-email-daniel.vetter@ffwll.ch \
    --to=daniel.vetter@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.