All of lore.kernel.org
 help / color / mirror / Atom feed
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: linux-fbdev@vger.kernel.org, linux-omap@vger.kernel.org,
	Archit Taneja <archit@ti.com>
Cc: Jyri Sarha <jsarha@ti.com>, Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH 03/15] OMAPDSS: DISPC: clean up dispc_mgr_timings_ok
Date: Tue, 24 Jun 2014 10:03:48 +0000	[thread overview]
Message-ID: <1403604240-16738-4-git-send-email-tomi.valkeinen@ti.com> (raw)
In-Reply-To: <1403604240-16738-1-git-send-email-tomi.valkeinen@ti.com>

dispc_mgr_timings_ok() is a bit confusing how it handles the return
value.

Change the function to just return immediately when a timing is deemed
not valid, making the code much easier to follow.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/fbdev/omap2/dss/dispc.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c
index 37373b61784e..be053aa80880 100644
--- a/drivers/video/fbdev/omap2/dss/dispc.c
+++ b/drivers/video/fbdev/omap2/dss/dispc.c
@@ -2879,22 +2879,24 @@ static bool _dispc_mgr_pclk_ok(enum omap_channel channel,
 bool dispc_mgr_timings_ok(enum omap_channel channel,
 		const struct omap_video_timings *timings)
 {
-	bool timings_ok;
-
-	timings_ok = _dispc_mgr_size_ok(timings->x_res, timings->y_res);
+	if (!_dispc_mgr_size_ok(timings->x_res, timings->y_res))
+		return false;
 
-	timings_ok &= _dispc_mgr_pclk_ok(channel, timings->pixelclock);
+	if (!_dispc_mgr_pclk_ok(channel, timings->pixelclock))
+		return false;
 
 	if (dss_mgr_is_lcd(channel)) {
 		/* TODO: OMAP4+ supports interlace for LCD outputs */
-		timings_ok &= timings->interlace = false;
+		if (timings->interlace)
+			return false;
 
-		timings_ok &= _dispc_lcd_timings_ok(timings->hsw, timings->hfp,
+		if (!_dispc_lcd_timings_ok(timings->hsw, timings->hfp,
 				timings->hbp, timings->vsw, timings->vfp,
-				timings->vbp);
+				timings->vbp))
+			return false;
 	}
 
-	return timings_ok;
+	return true;
 }
 
 static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw,
-- 
1.9.1


WARNING: multiple messages have this Message-ID (diff)
From: Tomi Valkeinen <tomi.valkeinen@ti.com>
To: linux-fbdev@vger.kernel.org, linux-omap@vger.kernel.org,
	Archit Taneja <archit@ti.com>
Cc: Jyri Sarha <jsarha@ti.com>, Tomi Valkeinen <tomi.valkeinen@ti.com>
Subject: [PATCH 03/15] OMAPDSS: DISPC: clean up dispc_mgr_timings_ok
Date: Tue, 24 Jun 2014 13:03:48 +0300	[thread overview]
Message-ID: <1403604240-16738-4-git-send-email-tomi.valkeinen@ti.com> (raw)
In-Reply-To: <1403604240-16738-1-git-send-email-tomi.valkeinen@ti.com>

dispc_mgr_timings_ok() is a bit confusing how it handles the return
value.

Change the function to just return immediately when a timing is deemed
not valid, making the code much easier to follow.

Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
---
 drivers/video/fbdev/omap2/dss/dispc.c | 18 ++++++++++--------
 1 file changed, 10 insertions(+), 8 deletions(-)

diff --git a/drivers/video/fbdev/omap2/dss/dispc.c b/drivers/video/fbdev/omap2/dss/dispc.c
index 37373b61784e..be053aa80880 100644
--- a/drivers/video/fbdev/omap2/dss/dispc.c
+++ b/drivers/video/fbdev/omap2/dss/dispc.c
@@ -2879,22 +2879,24 @@ static bool _dispc_mgr_pclk_ok(enum omap_channel channel,
 bool dispc_mgr_timings_ok(enum omap_channel channel,
 		const struct omap_video_timings *timings)
 {
-	bool timings_ok;
-
-	timings_ok = _dispc_mgr_size_ok(timings->x_res, timings->y_res);
+	if (!_dispc_mgr_size_ok(timings->x_res, timings->y_res))
+		return false;
 
-	timings_ok &= _dispc_mgr_pclk_ok(channel, timings->pixelclock);
+	if (!_dispc_mgr_pclk_ok(channel, timings->pixelclock))
+		return false;
 
 	if (dss_mgr_is_lcd(channel)) {
 		/* TODO: OMAP4+ supports interlace for LCD outputs */
-		timings_ok &= timings->interlace == false;
+		if (timings->interlace)
+			return false;
 
-		timings_ok &= _dispc_lcd_timings_ok(timings->hsw, timings->hfp,
+		if (!_dispc_lcd_timings_ok(timings->hsw, timings->hfp,
 				timings->hbp, timings->vsw, timings->vfp,
-				timings->vbp);
+				timings->vbp))
+			return false;
 	}
 
-	return timings_ok;
+	return true;
 }
 
 static void _dispc_mgr_set_lcd_timings(enum omap_channel channel, int hsw,
-- 
1.9.1


  parent reply	other threads:[~2014-06-24 10:03 UTC|newest]

Thread overview: 44+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-06-24 10:03 [PATCH 00/15] OMAPDSS: HDMI infoframe & cleanup Tomi Valkeinen
2014-06-24 10:03 ` Tomi Valkeinen
2014-06-24 10:03 ` [PATCH 01/15] OMAPDSS: DISPC: fix debugfs reg dump Tomi Valkeinen
2014-06-24 10:03   ` Tomi Valkeinen
2014-06-24 10:03 ` [PATCH 02/15] OMAPDSS: DISPC: reject interlace for lcd out Tomi Valkeinen
2014-06-24 10:03   ` Tomi Valkeinen
2014-06-24 10:03 ` Tomi Valkeinen [this message]
2014-06-24 10:03   ` [PATCH 03/15] OMAPDSS: DISPC: clean up dispc_mgr_timings_ok Tomi Valkeinen
2014-06-24 10:03 ` [PATCH 04/15] OMAPDSS: HDMI: fix name conflict Tomi Valkeinen
2014-06-24 10:03   ` Tomi Valkeinen
2014-06-24 10:03 ` [PATCH 05/15] OMAPDSS: Kconfig: select HDMI Tomi Valkeinen
2014-06-24 10:03   ` Tomi Valkeinen
2014-06-24 10:03 ` [PATCH 06/15] OMAPDSS: HDMI4: use common AVI infoframe support Tomi Valkeinen
2014-06-24 10:03   ` Tomi Valkeinen
2014-06-24 10:03 ` [PATCH 07/15] OMAPDSS: HDMI5: " Tomi Valkeinen
2014-06-24 10:03   ` Tomi Valkeinen
2014-06-24 10:03 ` [PATCH 08/15] OMAPDSS: HDMI: remove custom avi infoframe Tomi Valkeinen
2014-06-24 10:03   ` Tomi Valkeinen
2014-06-24 10:03 ` [PATCH 09/15] OMAPDSS: add hdmi ops to hdmi_ops and omap_dss_driver Tomi Valkeinen
2014-06-24 10:03   ` Tomi Valkeinen
2014-06-24 10:03 ` [PATCH 10/15] OMAPDSS: add hdmi ops to hdmi-connector and tpd12s015 Tomi Valkeinen
2014-06-24 10:03   ` Tomi Valkeinen
2014-06-24 10:03 ` [PATCH 11/15] OMAPDSS: HDMI: add infoframe and hdmi_dvi_mode fields Tomi Valkeinen
2014-06-24 10:03   ` Tomi Valkeinen
2014-06-24 10:03 ` [PATCH 12/15] OMAPDSS: HDMI4: add support to set infoframe & HDMI mode Tomi Valkeinen
2014-06-24 10:03   ` Tomi Valkeinen
2014-06-24 10:03 ` [PATCH 13/15] OMAPDSS: HDMI5: " Tomi Valkeinen
2014-06-24 10:03   ` Tomi Valkeinen
2014-06-24 10:03 ` [PATCH 14/15] OMAPDSS: HDMI: remove the unused code Tomi Valkeinen
2014-06-24 10:03   ` Tomi Valkeinen
2014-06-26 19:05   ` Jyri Sarha
2014-06-26 19:05     ` Jyri Sarha
2014-06-27 10:16     ` Tomi Valkeinen
2014-06-27 10:16       ` Tomi Valkeinen
2014-06-27 10:20       ` Tomi Valkeinen
2014-06-27 10:20         ` Tomi Valkeinen
2014-06-24 10:04 ` [PATCH 15/15] drm/omap: Add infoframe & dvi/hdmi mode support Tomi Valkeinen
2014-06-24 10:04   ` Tomi Valkeinen
2014-06-25 11:03   ` Archit Taneja
2014-06-25 11:15     ` Archit Taneja
2014-06-25 11:29     ` Tomi Valkeinen
2014-06-25 11:29       ` Tomi Valkeinen
2014-07-03  5:55   ` Tomi Valkeinen
2014-07-03  5:55     ` Tomi Valkeinen

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=1403604240-16738-4-git-send-email-tomi.valkeinen@ti.com \
    --to=tomi.valkeinen@ti.com \
    --cc=archit@ti.com \
    --cc=jsarha@ti.com \
    --cc=linux-fbdev@vger.kernel.org \
    --cc=linux-omap@vger.kernel.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.