1 From 5d3426ae63c27b9405be8179beabe1e095b44a35 Mon Sep 17 00:00:00 2001
2 From: Imre Deak <imre.deak@nokia.com>
3 Date: Tue, 5 May 2009 19:00:19 +0200
4 Subject: [PATCH 63/69] DSS2: fix the usage of get_last_off_on_transaction_id
6 The function returns int not unsigned since it can fail. Handle the
7 failing case as if the context had been lost. So now:
9 1. No get_last_off_on_transaction_id func in platform data->
10 never restore the context
11 2. Return val < 0 -> force the restore
12 3. Return val >= 0 do the restore only if the counter has changed.
14 Signed-off-by: Imre Deak <imre.deak@nokia.com>
16 arch/arm/plat-omap/include/mach/display.h | 2 +-
17 drivers/video/omap2/dss/core.c | 18 ++++++++++++------
18 2 files changed, 13 insertions(+), 7 deletions(-)
20 diff --git a/arch/arm/plat-omap/include/mach/display.h b/arch/arm/plat-omap/include/mach/display.h
21 index 45b16ca..31ebb96 100644
22 --- a/arch/arm/plat-omap/include/mach/display.h
23 +++ b/arch/arm/plat-omap/include/mach/display.h
24 @@ -234,7 +234,7 @@ struct device;
26 /* Board specific data */
27 struct omap_dss_board_info {
28 - unsigned (*get_last_off_on_transaction_id)(struct device *dev);
29 + int (*get_last_off_on_transaction_id)(struct device *dev);
30 int (*dsi_power_up)(void);
31 void (*dsi_power_down)(void);
33 diff --git a/drivers/video/omap2/dss/core.c b/drivers/video/omap2/dss/core.c
34 index ae7cd06..6d11b04 100644
35 --- a/drivers/video/omap2/dss/core.c
36 +++ b/drivers/video/omap2/dss/core.c
40 struct platform_device *pdev;
46 @@ -63,22 +63,28 @@ module_param_named(debug, dss_debug, bool, 0644);
50 -static unsigned dss_get_ctx_id(void)
51 +static int dss_get_ctx_id(void)
53 struct omap_dss_board_info *pdata = core.pdev->dev.platform_data;
56 if (!pdata->get_last_off_on_transaction_id)
59 - return pdata->get_last_off_on_transaction_id(&core.pdev->dev);
60 + r = pdata->get_last_off_on_transaction_id(&core.pdev->dev);
62 + dev_err(&core.pdev->dev,
63 + "getting transaction ID failed, will force context restore\n");
69 int dss_need_ctx_restore(void)
71 int id = dss_get_ctx_id();
73 - if (id != core.ctx_id) {
74 - DSSDBG("ctx id %u -> id %u\n",
75 + if (id < 0 || id != core.ctx_id) {
76 + DSSDBG("ctx id %d -> id %d\n",