linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/2] OMAP: DSS2: Fix DSS core init fail path
@ 2010-05-06 11:59 Jani Nikula
  2010-05-06 11:59 ` [PATCH 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup Jani Nikula
  2010-05-07  8:07 ` [PATCH 0/2] OMAP: DSS2: Fix DSS core init fail path Tomi Valkeinen
  0 siblings, 2 replies; 11+ messages in thread
From: Jani Nikula @ 2010-05-06 11:59 UTC (permalink / raw)
  To: Tomi.Valkeinen, khilman; +Cc: linux-fbdev-devel, linux-omap, ext-jani.1.nikula

Hi -

These patches fix the broken DSS omap_dss_probe() fail path, reported by Kevin
Hilman [1].

Kevin, could you please check this with your setup too? It would be much
appreciated.

[1] http://www.mail-archive.com/linux-omap@vger.kernel.org/msg27112.html


BR,
Jani.


Jani Nikula (2):
  OMAP: DSS2: omap_dss_probe() conditional compilation cleanup
  OMAP: DSS2: Fix omap_dss_probe() error path

 drivers/video/omap2/dss/core.c |   85 ++++++++++++++++++++++++---------------
 drivers/video/omap2/dss/dss.h  |   40 +++++++++++++++++++
 2 files changed, 92 insertions(+), 33 deletions(-)


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

* [PATCH 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup
  2010-05-06 11:59 [PATCH 0/2] OMAP: DSS2: Fix DSS core init fail path Jani Nikula
@ 2010-05-06 11:59 ` Jani Nikula
  2010-05-06 11:59   ` [PATCH 2/2] OMAP: DSS2: Fix omap_dss_probe() error path Jani Nikula
  2010-05-06 18:52   ` [PATCH 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup Kevin Hilman
  2010-05-07  8:07 ` [PATCH 0/2] OMAP: DSS2: Fix DSS core init fail path Tomi Valkeinen
  1 sibling, 2 replies; 11+ messages in thread
From: Jani Nikula @ 2010-05-06 11:59 UTC (permalink / raw)
  To: Tomi.Valkeinen, khilman; +Cc: linux-fbdev-devel, linux-omap, ext-jani.1.nikula

From: Jani Nikula <ext-jani.1.nikula@nokia.com>

Move a number of #ifdefs from code into dss.h and elsewhere, and
conditionally define no-op static inline functions, cleaning up the
code. This style is according to Documentation/SubmittingPatches.

Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
 drivers/video/omap2/dss/core.c |   31 +++++++++++--------------------
 drivers/video/omap2/dss/dss.h  |   40 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 51 insertions(+), 20 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 7ebe50b..92ee067 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -482,6 +482,14 @@ static void dss_uninitialize_debugfs(void)
 	if (dss_debugfs_dir)
 		debugfs_remove_recursive(dss_debugfs_dir);
 }
+#else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
+static inline int dss_initialize_debugfs(void)
+{
+	return 0;
+}
+static inline void dss_uninitialize_debugfs(void)
+{
+}
 #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
 
 /* PLATFORM DEVICE */
@@ -518,13 +526,11 @@ static int omap_dss_probe(struct platform_device *pdev)
 		goto fail0;
 	}
 
-#ifdef CONFIG_OMAP2_DSS_RFBI
 	r = rfbi_init();
 	if (r) {
 		DSSERR("Failed to initialize rfbi\n");
 		goto fail0;
 	}
-#endif
 
 	r = dpi_init(pdev);
 	if (r) {
@@ -537,35 +543,30 @@ static int omap_dss_probe(struct platform_device *pdev)
 		DSSERR("Failed to initialize dispc\n");
 		goto fail0;
 	}
-#ifdef CONFIG_OMAP2_DSS_VENC
+
 	r = venc_init(pdev);
 	if (r) {
 		DSSERR("Failed to initialize venc\n");
 		goto fail0;
 	}
-#endif
+
 	if (cpu_is_omap34xx()) {
-#ifdef CONFIG_OMAP2_DSS_SDI
 		r = sdi_init(skip_init);
 		if (r) {
 			DSSERR("Failed to initialize SDI\n");
 			goto fail0;
 		}
-#endif
-#ifdef CONFIG_OMAP2_DSS_DSI
+
 		r = dsi_init(pdev);
 		if (r) {
 			DSSERR("Failed to initialize DSI\n");
 			goto fail0;
 		}
-#endif
 	}
 
-#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
 	r = dss_initialize_debugfs();
 	if (r)
 		goto fail0;
-#endif
 
 	for (i = 0; i < pdata->num_devices; ++i) {
 		struct omap_dss_device *dssdev = pdata->devices[i];
@@ -593,25 +594,15 @@ static int omap_dss_remove(struct platform_device *pdev)
 	int i;
 	int c;
 
-#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
 	dss_uninitialize_debugfs();
-#endif
 
-#ifdef CONFIG_OMAP2_DSS_VENC
 	venc_exit();
-#endif
 	dispc_exit();
 	dpi_exit();
-#ifdef CONFIG_OMAP2_DSS_RFBI
 	rfbi_exit();
-#endif
 	if (cpu_is_omap34xx()) {
-#ifdef CONFIG_OMAP2_DSS_DSI
 		dsi_exit();
-#endif
-#ifdef CONFIG_OMAP2_DSS_SDI
 		sdi_exit();
-#endif
 	}
 
 	dss_exit();
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 24326a5..65f95ee 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -242,11 +242,22 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck,
 		struct dispc_clock_info *dispc_cinfo);
 
 /* SDI */
+#ifdef CONFIG_OMAP2_DSS_SDI
 int sdi_init(bool skip_init);
 void sdi_exit(void);
 int sdi_init_display(struct omap_dss_device *display);
+#else
+static inline int sdi_init(bool skip_init)
+{
+	return 0;
+}
+static inline void sdi_exit(void)
+{
+}
+#endif
 
 /* DSI */
+#ifdef CONFIG_OMAP2_DSS_DSI
 int dsi_init(struct platform_device *pdev);
 void dsi_exit(void);
 
@@ -270,6 +281,15 @@ void dsi_pll_uninit(void);
 void dsi_get_overlay_fifo_thresholds(enum omap_plane plane,
 		u32 fifo_size, enum omap_burst_size *burst_size,
 		u32 *fifo_low, u32 *fifo_high);
+#else
+static inline int dsi_init(struct platform_device *pdev)
+{
+	return 0;
+}
+static inline void dsi_exit(void)
+{
+}
+#endif
 
 /* DPI */
 int dpi_init(struct platform_device *pdev);
@@ -362,12 +382,23 @@ int dispc_get_clock_div(struct dispc_clock_info *cinfo);
 
 
 /* VENC */
+#ifdef CONFIG_OMAP2_DSS_VENC
 int venc_init(struct platform_device *pdev);
 void venc_exit(void);
 void venc_dump_regs(struct seq_file *s);
 int venc_init_display(struct omap_dss_device *display);
+#else
+static inline int venc_init(struct platform_device *pdev)
+{
+	return 0;
+}
+static inline void venc_exit(void)
+{
+}
+#endif
 
 /* RFBI */
+#ifdef CONFIG_OMAP2_DSS_RFBI
 int rfbi_init(void);
 void rfbi_exit(void);
 void rfbi_dump_regs(struct seq_file *s);
@@ -379,6 +410,15 @@ void rfbi_transfer_area(u16 width, u16 height,
 void rfbi_set_timings(int rfbi_module, struct rfbi_timings *t);
 unsigned long rfbi_get_max_tx_rate(void);
 int rfbi_init_display(struct omap_dss_device *display);
+#else
+static inline int rfbi_init(void)
+{
+	return 0;
+}
+static inline void rfbi_exit(void)
+{
+}
+#endif
 
 
 #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
-- 
1.6.5.2


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

* [PATCH 2/2] OMAP: DSS2: Fix omap_dss_probe() error path
  2010-05-06 11:59 ` [PATCH 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup Jani Nikula
@ 2010-05-06 11:59   ` Jani Nikula
  2010-05-06 18:54     ` Kevin Hilman
  2010-05-06 18:52   ` [PATCH 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup Kevin Hilman
  1 sibling, 1 reply; 11+ messages in thread
From: Jani Nikula @ 2010-05-06 11:59 UTC (permalink / raw)
  To: Tomi.Valkeinen, khilman; +Cc: linux-fbdev-devel, linux-omap, ext-jani.1.nikula

From: Jani Nikula <ext-jani.1.nikula@nokia.com>

Perform graceful cleanup on errors instead of just bailing out.

Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
 drivers/video/omap2/dss/core.c |   54 ++++++++++++++++++++++++++++++---------
 1 files changed, 41 insertions(+), 13 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 92ee067..b3a498f 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -507,7 +507,7 @@ static int omap_dss_probe(struct platform_device *pdev)
 
 	r = dss_get_clocks();
 	if (r)
-		goto fail0;
+		goto err_clocks;
 
 	dss_clk_enable_all_no_ctx();
 
@@ -523,57 +523,64 @@ static int omap_dss_probe(struct platform_device *pdev)
 	r = dss_init(skip_init);
 	if (r) {
 		DSSERR("Failed to initialize DSS\n");
-		goto fail0;
+		goto err_dss;
 	}
 
 	r = rfbi_init();
 	if (r) {
 		DSSERR("Failed to initialize rfbi\n");
-		goto fail0;
+		goto err_rfbi;
 	}
 
 	r = dpi_init(pdev);
 	if (r) {
 		DSSERR("Failed to initialize dpi\n");
-		goto fail0;
+		goto err_dpi;
 	}
 
 	r = dispc_init();
 	if (r) {
 		DSSERR("Failed to initialize dispc\n");
-		goto fail0;
+		goto err_dispc;
 	}
 
 	r = venc_init(pdev);
 	if (r) {
 		DSSERR("Failed to initialize venc\n");
-		goto fail0;
+		goto err_venc;
 	}
 
 	if (cpu_is_omap34xx()) {
 		r = sdi_init(skip_init);
 		if (r) {
 			DSSERR("Failed to initialize SDI\n");
-			goto fail0;
+			goto err_sdi;
 		}
 
 		r = dsi_init(pdev);
 		if (r) {
 			DSSERR("Failed to initialize DSI\n");
-			goto fail0;
+			goto err_dsi;
 		}
 	}
 
 	r = dss_initialize_debugfs();
 	if (r)
-		goto fail0;
+		goto err_debugfs;
 
 	for (i = 0; i < pdata->num_devices; ++i) {
 		struct omap_dss_device *dssdev = pdata->devices[i];
 
 		r = omap_dss_register_device(dssdev);
-		if (r)
-			DSSERR("device reg failed %d\n", i);
+		if (r) {
+			DSSERR("device %d %s register failed %d\n", i,
+				dssdev->name ?: "unnamed", r);
+
+			while (--i >= 0)
+				omap_dss_unregister_device(pdata->devices[i]);
+
+			goto err_register;
+		}
 
 		if (def_disp_name && strcmp(def_disp_name, dssdev->name) == 0)
 			pdata->default_device = dssdev;
@@ -583,8 +590,29 @@ static int omap_dss_probe(struct platform_device *pdev)
 
 	return 0;
 
-	/* XXX fail correctly */
-fail0:
+err_register:
+	dss_uninitialize_debugfs();
+err_debugfs:
+	if (cpu_is_omap34xx())
+		dsi_exit();
+err_dsi:
+	if (cpu_is_omap34xx())
+		sdi_exit();
+err_sdi:
+	venc_exit();
+err_venc:
+	dispc_exit();
+err_dispc:
+	dpi_exit();
+err_dpi:
+	rfbi_exit();
+err_rfbi:
+	dss_exit();
+err_dss:
+	dss_clk_disable_all_no_ctx();
+	dss_put_clocks();
+err_clocks:
+
 	return r;
 }
 
-- 
1.6.5.2


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

* Re: [PATCH 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup
  2010-05-06 11:59 ` [PATCH 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup Jani Nikula
  2010-05-06 11:59   ` [PATCH 2/2] OMAP: DSS2: Fix omap_dss_probe() error path Jani Nikula
@ 2010-05-06 18:52   ` Kevin Hilman
  1 sibling, 0 replies; 11+ messages in thread
From: Kevin Hilman @ 2010-05-06 18:52 UTC (permalink / raw)
  To: Jani Nikula; +Cc: Tomi.Valkeinen, linux-fbdev-devel, linux-omap

Jani Nikula <ext-jani.1.nikula@nokia.com> writes:

> From: Jani Nikula <ext-jani.1.nikula@nokia.com>
>
> Move a number of #ifdefs from code into dss.h and elsewhere, and
> conditionally define no-op static inline functions, cleaning up the
> code. This style is according to Documentation/SubmittingPatches.
>
> Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>

Indeed, this helps readability greatly.

Acked-by: Kevin Hilman <khilman@deeprootsystems.com>

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

* Re: [PATCH 2/2] OMAP: DSS2: Fix omap_dss_probe() error path
  2010-05-06 11:59   ` [PATCH 2/2] OMAP: DSS2: Fix omap_dss_probe() error path Jani Nikula
@ 2010-05-06 18:54     ` Kevin Hilman
  2010-05-07 12:12       ` Jani Nikula
  0 siblings, 1 reply; 11+ messages in thread
From: Kevin Hilman @ 2010-05-06 18:54 UTC (permalink / raw)
  To: Jani Nikula; +Cc: Tomi.Valkeinen, linux-fbdev-devel, linux-omap

Jani Nikula <ext-jani.1.nikula@nokia.com> writes:

> From: Jani Nikula <ext-jani.1.nikula@nokia.com>
>
> Perform graceful cleanup on errors instead of just bailing out.
>
> Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>

Tested-by: Kevin Hilman <khilman@deeprootsystems.com>

Nice.  Much cleaner than my previous one.

Tested on my n900, and with failed init, clocks are turned off
and doesn't prevent suspend.

Thanks,

Kevin

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

* Re: [PATCH 0/2] OMAP: DSS2: Fix DSS core init fail path
  2010-05-06 11:59 [PATCH 0/2] OMAP: DSS2: Fix DSS core init fail path Jani Nikula
  2010-05-06 11:59 ` [PATCH 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup Jani Nikula
@ 2010-05-07  8:07 ` Tomi Valkeinen
  2010-05-07  9:58   ` [PATCH v2 " Jani Nikula
  1 sibling, 1 reply; 11+ messages in thread
From: Tomi Valkeinen @ 2010-05-07  8:07 UTC (permalink / raw)
  To: Nikula Jani.1 (EXT-Nixu/Helsinki)
  Cc: khilman@deeprootsystems.com,
	linux-fbdev-devel@lists.sourceforge.net,
	linux-omap@vger.kernel.org

Hi,

On Thu, 2010-05-06 at 13:59 +0200, Nikula Jani.1 (EXT-Nixu/Helsinki)
wrote:
> Hi -
> 
> These patches fix the broken DSS omap_dss_probe() fail path, reported by Kevin
> Hilman [1].
> 
> Kevin, could you please check this with your setup too? It would be much
> appreciated.
> 
> [1] http://www.mail-archive.com/linux-omap@vger.kernel.org/msg27112.html

Jani, I just noticed that this conflicts with the following patch in my
for-next branch:

commit 36b33efe80eb07e3447107c2bdba3c674c10a41a
Author: Roger Quadros <roger.quadros@nokia.com>
Date:   Wed Mar 17 13:35:19 2010 +0100

    OMAP: DSS2: Add Kconfig option for DPI display type
    
    This allows us to disable DPI on systems that do not have it
    
    Signed-off-by: Roger Quadros <roger.quadros@nokia.com>
    Signed-off-by: Tomi Valkeinen <tomi.valkeinen@nokia.com>

Can you rebase the patches on top of my for-next branch?

 Tomi



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

* [PATCH v2 0/2] OMAP: DSS2: Fix DSS core init fail path
  2010-05-07  8:07 ` [PATCH 0/2] OMAP: DSS2: Fix DSS core init fail path Tomi Valkeinen
@ 2010-05-07  9:58   ` Jani Nikula
  2010-05-07  9:58     ` [PATCH v2 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup Jani Nikula
  2010-05-10  7:01     ` [PATCH v2 0/2] OMAP: DSS2: Fix DSS core init fail path Tomi Valkeinen
  0 siblings, 2 replies; 11+ messages in thread
From: Jani Nikula @ 2010-05-07  9:58 UTC (permalink / raw)
  To: Tomi.Valkeinen, khilman; +Cc: linux-fbdev-devel, linux-omap, ext-jani.1.nikula

Hi -

These patches fix the broken DSS omap_dss_probe() fail path, reported by Kevin
Hilman [1].

v2:
 - rebased against [2]

[1] http://www.mail-archive.com/linux-omap@vger.kernel.org/msg27112.html
[2] git://gitorious.org/linux-omap-dss2/linux.git


BR,
Jani.


Jani Nikula (2):
  OMAP: DSS2: omap_dss_probe() conditional compilation cleanup
  OMAP: DSS2: Fix omap_dss_probe() error path

 drivers/video/omap2/dss/core.c |   89 +++++++++++++++++++++++----------------
 drivers/video/omap2/dss/dss.h  |   50 ++++++++++++++++++++++
 2 files changed, 102 insertions(+), 37 deletions(-)


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

* [PATCH v2 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup
  2010-05-07  9:58   ` [PATCH v2 " Jani Nikula
@ 2010-05-07  9:58     ` Jani Nikula
  2010-05-07  9:58       ` [PATCH v2 2/2] OMAP: DSS2: Fix omap_dss_probe() error path Jani Nikula
  2010-05-10  7:01     ` [PATCH v2 0/2] OMAP: DSS2: Fix DSS core init fail path Tomi Valkeinen
  1 sibling, 1 reply; 11+ messages in thread
From: Jani Nikula @ 2010-05-07  9:58 UTC (permalink / raw)
  To: Tomi.Valkeinen, khilman; +Cc: linux-fbdev-devel, linux-omap, ext-jani.1.nikula

From: Jani Nikula <ext-jani.1.nikula@nokia.com>

Move a number of #ifdefs from code into dss.h and elsewhere, and
conditionally define no-op static inline functions, cleaning up the
code. This style is according to Documentation/SubmittingPatches.

Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
 drivers/video/omap2/dss/core.c |   35 ++++++++-------------------
 drivers/video/omap2/dss/dss.h  |   50 ++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+), 24 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 6d54467..92ee067 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -482,6 +482,14 @@ static void dss_uninitialize_debugfs(void)
 	if (dss_debugfs_dir)
 		debugfs_remove_recursive(dss_debugfs_dir);
 }
+#else /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
+static inline int dss_initialize_debugfs(void)
+{
+	return 0;
+}
+static inline void dss_uninitialize_debugfs(void)
+{
+}
 #endif /* CONFIG_DEBUG_FS && CONFIG_OMAP2_DSS_DEBUG_SUPPORT */
 
 /* PLATFORM DEVICE */
@@ -518,56 +526,47 @@ static int omap_dss_probe(struct platform_device *pdev)
 		goto fail0;
 	}
 
-#ifdef CONFIG_OMAP2_DSS_RFBI
 	r = rfbi_init();
 	if (r) {
 		DSSERR("Failed to initialize rfbi\n");
 		goto fail0;
 	}
-#endif
 
-#ifdef CONFIG_OMAP2_DSS_DPI
 	r = dpi_init(pdev);
 	if (r) {
 		DSSERR("Failed to initialize dpi\n");
 		goto fail0;
 	}
-#endif
 
 	r = dispc_init();
 	if (r) {
 		DSSERR("Failed to initialize dispc\n");
 		goto fail0;
 	}
-#ifdef CONFIG_OMAP2_DSS_VENC
+
 	r = venc_init(pdev);
 	if (r) {
 		DSSERR("Failed to initialize venc\n");
 		goto fail0;
 	}
-#endif
+
 	if (cpu_is_omap34xx()) {
-#ifdef CONFIG_OMAP2_DSS_SDI
 		r = sdi_init(skip_init);
 		if (r) {
 			DSSERR("Failed to initialize SDI\n");
 			goto fail0;
 		}
-#endif
-#ifdef CONFIG_OMAP2_DSS_DSI
+
 		r = dsi_init(pdev);
 		if (r) {
 			DSSERR("Failed to initialize DSI\n");
 			goto fail0;
 		}
-#endif
 	}
 
-#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
 	r = dss_initialize_debugfs();
 	if (r)
 		goto fail0;
-#endif
 
 	for (i = 0; i < pdata->num_devices; ++i) {
 		struct omap_dss_device *dssdev = pdata->devices[i];
@@ -595,27 +594,15 @@ static int omap_dss_remove(struct platform_device *pdev)
 	int i;
 	int c;
 
-#if defined(CONFIG_DEBUG_FS) && defined(CONFIG_OMAP2_DSS_DEBUG_SUPPORT)
 	dss_uninitialize_debugfs();
-#endif
 
-#ifdef CONFIG_OMAP2_DSS_VENC
 	venc_exit();
-#endif
 	dispc_exit();
-#ifdef CONFIG_OMAP2_DSS_DPI
 	dpi_exit();
-#endif
-#ifdef CONFIG_OMAP2_DSS_RFBI
 	rfbi_exit();
-#endif
 	if (cpu_is_omap34xx()) {
-#ifdef CONFIG_OMAP2_DSS_DSI
 		dsi_exit();
-#endif
-#ifdef CONFIG_OMAP2_DSS_SDI
 		sdi_exit();
-#endif
 	}
 
 	dss_exit();
diff --git a/drivers/video/omap2/dss/dss.h b/drivers/video/omap2/dss/dss.h
index 24326a5..786f433 100644
--- a/drivers/video/omap2/dss/dss.h
+++ b/drivers/video/omap2/dss/dss.h
@@ -242,11 +242,22 @@ int dss_calc_clock_div(bool is_tft, unsigned long req_pck,
 		struct dispc_clock_info *dispc_cinfo);
 
 /* SDI */
+#ifdef CONFIG_OMAP2_DSS_SDI
 int sdi_init(bool skip_init);
 void sdi_exit(void);
 int sdi_init_display(struct omap_dss_device *display);
+#else
+static inline int sdi_init(bool skip_init)
+{
+	return 0;
+}
+static inline void sdi_exit(void)
+{
+}
+#endif
 
 /* DSI */
+#ifdef CONFIG_OMAP2_DSS_DSI
 int dsi_init(struct platform_device *pdev);
 void dsi_exit(void);
 
@@ -270,11 +281,30 @@ void dsi_pll_uninit(void);
 void dsi_get_overlay_fifo_thresholds(enum omap_plane plane,
 		u32 fifo_size, enum omap_burst_size *burst_size,
 		u32 *fifo_low, u32 *fifo_high);
+#else
+static inline int dsi_init(struct platform_device *pdev)
+{
+	return 0;
+}
+static inline void dsi_exit(void)
+{
+}
+#endif
 
 /* DPI */
+#ifdef CONFIG_OMAP2_DSS_DPI
 int dpi_init(struct platform_device *pdev);
 void dpi_exit(void);
 int dpi_init_display(struct omap_dss_device *dssdev);
+#else
+static inline int dpi_init(struct platform_device *pdev)
+{
+	return 0;
+}
+static inline void dpi_exit(void)
+{
+}
+#endif
 
 /* DISPC */
 int dispc_init(void);
@@ -362,12 +392,23 @@ int dispc_get_clock_div(struct dispc_clock_info *cinfo);
 
 
 /* VENC */
+#ifdef CONFIG_OMAP2_DSS_VENC
 int venc_init(struct platform_device *pdev);
 void venc_exit(void);
 void venc_dump_regs(struct seq_file *s);
 int venc_init_display(struct omap_dss_device *display);
+#else
+static inline int venc_init(struct platform_device *pdev)
+{
+	return 0;
+}
+static inline void venc_exit(void)
+{
+}
+#endif
 
 /* RFBI */
+#ifdef CONFIG_OMAP2_DSS_RFBI
 int rfbi_init(void);
 void rfbi_exit(void);
 void rfbi_dump_regs(struct seq_file *s);
@@ -379,6 +420,15 @@ void rfbi_transfer_area(u16 width, u16 height,
 void rfbi_set_timings(int rfbi_module, struct rfbi_timings *t);
 unsigned long rfbi_get_max_tx_rate(void);
 int rfbi_init_display(struct omap_dss_device *display);
+#else
+static inline int rfbi_init(void)
+{
+	return 0;
+}
+static inline void rfbi_exit(void)
+{
+}
+#endif
 
 
 #ifdef CONFIG_OMAP2_DSS_COLLECT_IRQ_STATS
-- 
1.6.5.2


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

* [PATCH v2 2/2] OMAP: DSS2: Fix omap_dss_probe() error path
  2010-05-07  9:58     ` [PATCH v2 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup Jani Nikula
@ 2010-05-07  9:58       ` Jani Nikula
  0 siblings, 0 replies; 11+ messages in thread
From: Jani Nikula @ 2010-05-07  9:58 UTC (permalink / raw)
  To: Tomi.Valkeinen, khilman; +Cc: linux-fbdev-devel, linux-omap, ext-jani.1.nikula

From: Jani Nikula <ext-jani.1.nikula@nokia.com>

Perform graceful cleanup on errors instead of just bailing out.

Signed-off-by: Jani Nikula <ext-jani.1.nikula@nokia.com>
---
 drivers/video/omap2/dss/core.c |   54 ++++++++++++++++++++++++++++++---------
 1 files changed, 41 insertions(+), 13 deletions(-)

diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
index 92ee067..b3a498f 100644
--- a/drivers/video/omap2/dss/core.c
+++ b/drivers/video/omap2/dss/core.c
@@ -507,7 +507,7 @@ static int omap_dss_probe(struct platform_device *pdev)
 
 	r = dss_get_clocks();
 	if (r)
-		goto fail0;
+		goto err_clocks;
 
 	dss_clk_enable_all_no_ctx();
 
@@ -523,57 +523,64 @@ static int omap_dss_probe(struct platform_device *pdev)
 	r = dss_init(skip_init);
 	if (r) {
 		DSSERR("Failed to initialize DSS\n");
-		goto fail0;
+		goto err_dss;
 	}
 
 	r = rfbi_init();
 	if (r) {
 		DSSERR("Failed to initialize rfbi\n");
-		goto fail0;
+		goto err_rfbi;
 	}
 
 	r = dpi_init(pdev);
 	if (r) {
 		DSSERR("Failed to initialize dpi\n");
-		goto fail0;
+		goto err_dpi;
 	}
 
 	r = dispc_init();
 	if (r) {
 		DSSERR("Failed to initialize dispc\n");
-		goto fail0;
+		goto err_dispc;
 	}
 
 	r = venc_init(pdev);
 	if (r) {
 		DSSERR("Failed to initialize venc\n");
-		goto fail0;
+		goto err_venc;
 	}
 
 	if (cpu_is_omap34xx()) {
 		r = sdi_init(skip_init);
 		if (r) {
 			DSSERR("Failed to initialize SDI\n");
-			goto fail0;
+			goto err_sdi;
 		}
 
 		r = dsi_init(pdev);
 		if (r) {
 			DSSERR("Failed to initialize DSI\n");
-			goto fail0;
+			goto err_dsi;
 		}
 	}
 
 	r = dss_initialize_debugfs();
 	if (r)
-		goto fail0;
+		goto err_debugfs;
 
 	for (i = 0; i < pdata->num_devices; ++i) {
 		struct omap_dss_device *dssdev = pdata->devices[i];
 
 		r = omap_dss_register_device(dssdev);
-		if (r)
-			DSSERR("device reg failed %d\n", i);
+		if (r) {
+			DSSERR("device %d %s register failed %d\n", i,
+				dssdev->name ?: "unnamed", r);
+
+			while (--i >= 0)
+				omap_dss_unregister_device(pdata->devices[i]);
+
+			goto err_register;
+		}
 
 		if (def_disp_name && strcmp(def_disp_name, dssdev->name) == 0)
 			pdata->default_device = dssdev;
@@ -583,8 +590,29 @@ static int omap_dss_probe(struct platform_device *pdev)
 
 	return 0;
 
-	/* XXX fail correctly */
-fail0:
+err_register:
+	dss_uninitialize_debugfs();
+err_debugfs:
+	if (cpu_is_omap34xx())
+		dsi_exit();
+err_dsi:
+	if (cpu_is_omap34xx())
+		sdi_exit();
+err_sdi:
+	venc_exit();
+err_venc:
+	dispc_exit();
+err_dispc:
+	dpi_exit();
+err_dpi:
+	rfbi_exit();
+err_rfbi:
+	dss_exit();
+err_dss:
+	dss_clk_disable_all_no_ctx();
+	dss_put_clocks();
+err_clocks:
+
 	return r;
 }
 
-- 
1.6.5.2


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

* Re: [PATCH 2/2] OMAP: DSS2: Fix omap_dss_probe() error path
  2010-05-06 18:54     ` Kevin Hilman
@ 2010-05-07 12:12       ` Jani Nikula
  0 siblings, 0 replies; 11+ messages in thread
From: Jani Nikula @ 2010-05-07 12:12 UTC (permalink / raw)
  To: ext Kevin Hilman
  Cc: Valkeinen Tomi (Nokia-D/Helsinki),
	linux-fbdev-devel@lists.sourceforge.net,
	linux-omap@vger.kernel.org



On Thu, 6 May 2010, ext Kevin Hilman wrote:

> Tested on my n900, and with failed init, clocks are turned off
> and doesn't prevent suspend.

Many thanks for testing this, Kevin!

BR,
Jani.


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

* Re: [PATCH v2 0/2] OMAP: DSS2: Fix DSS core init fail path
  2010-05-07  9:58   ` [PATCH v2 " Jani Nikula
  2010-05-07  9:58     ` [PATCH v2 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup Jani Nikula
@ 2010-05-10  7:01     ` Tomi Valkeinen
  1 sibling, 0 replies; 11+ messages in thread
From: Tomi Valkeinen @ 2010-05-10  7:01 UTC (permalink / raw)
  To: Nikula Jani.1 (EXT-Nixu/Helsinki)
  Cc: khilman@deeprootsystems.com,
	linux-fbdev-devel@lists.sourceforge.net,
	linux-omap@vger.kernel.org

On Fri, 2010-05-07 at 11:58 +0200, Nikula Jani.1 (EXT-Nixu/Helsinki)
wrote:
> Hi -
> 
> These patches fix the broken DSS omap_dss_probe() fail path, reported by Kevin
> Hilman [1].

Thanks, looks good. Applied to my DSS tree.

 Tomi



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

end of thread, other threads:[~2010-05-10  7:01 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-05-06 11:59 [PATCH 0/2] OMAP: DSS2: Fix DSS core init fail path Jani Nikula
2010-05-06 11:59 ` [PATCH 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup Jani Nikula
2010-05-06 11:59   ` [PATCH 2/2] OMAP: DSS2: Fix omap_dss_probe() error path Jani Nikula
2010-05-06 18:54     ` Kevin Hilman
2010-05-07 12:12       ` Jani Nikula
2010-05-06 18:52   ` [PATCH 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup Kevin Hilman
2010-05-07  8:07 ` [PATCH 0/2] OMAP: DSS2: Fix DSS core init fail path Tomi Valkeinen
2010-05-07  9:58   ` [PATCH v2 " Jani Nikula
2010-05-07  9:58     ` [PATCH v2 1/2] OMAP: DSS2: omap_dss_probe() conditional compilation cleanup Jani Nikula
2010-05-07  9:58       ` [PATCH v2 2/2] OMAP: DSS2: Fix omap_dss_probe() error path Jani Nikula
2010-05-10  7:01     ` [PATCH v2 0/2] OMAP: DSS2: Fix DSS core init fail path Tomi Valkeinen

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).