summaryrefslogtreecommitdiff
path: root/recipes/linux/linux-omap-pm/dss2/0113-DSS2-Fix-omapfb-framebuffer-name.patch
blob: 020e065a76516ef43904031238d0f989d291f414 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
From e9115293f6b4c7f737a5eeba34c2769dfd030e5d Mon Sep 17 00:00:00 2001
From: Tomi Valkeinen <tomi.valkeinen@nokia.com>
Date: Fri, 12 Jun 2009 11:25:19 +0300
Subject: [PATCH 113/146] DSS2: Fix omapfb framebuffer name
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Transfer-Encoding: 8bit

After clearing the fix and var screeninfos fix.id should be reset to
the proper value. Move the relevant memset() and strncpy() calls into
a helper function which does the right thing.

Signed-off-by: Ville Syrjälä <ville.syrjala@nokia.com>

Conflicts:

	drivers/video/omap2/omapfb/omapfb-main.c
---
 drivers/video/omap2/omapfb/omapfb-main.c |   30 +++++++++++++++---------------
 1 files changed, 15 insertions(+), 15 deletions(-)

diff --git a/drivers/video/omap2/omapfb/omapfb-main.c b/drivers/video/omap2/omapfb/omapfb-main.c
index b4ac9ec..dc9c06c 100644
--- a/drivers/video/omap2/omapfb/omapfb-main.c
+++ b/drivers/video/omap2/omapfb/omapfb-main.c
@@ -1171,6 +1171,13 @@ static void omapfb_free_fbmem(struct fb_info *fbi)
 	rg->size = 0;
 }
 
+static void clear_fb_info(struct fb_info *fbi)
+{
+	memset(&fbi->var, 0, sizeof(fbi->var));
+	memset(&fbi->fix, 0, sizeof(fbi->fix));
+	strlcpy(fbi->fix.id, MODULE_NAME, sizeof(fbi->fix.id));
+}
+
 static int omapfb_free_all_fbmem(struct omapfb2_device *fbdev)
 {
 	int i;
@@ -1180,8 +1187,7 @@ static int omapfb_free_all_fbmem(struct omapfb2_device *fbdev)
 	for (i = 0; i < fbdev->num_fbs; i++) {
 		struct fb_info *fbi = fbdev->fbs[i];
 		omapfb_free_fbmem(fbi);
-		memset(&fbi->fix, 0, sizeof(fbi->fix));
-		memset(&fbi->var, 0, sizeof(fbi->var));
+		clear_fb_info(fbi);
 	}
 
 	return 0;
@@ -1509,8 +1515,7 @@ int omapfb_realloc_fbmem(struct fb_info *fbi, unsigned long size, int type)
 	omapfb_free_fbmem(fbi);
 
 	if (size == 0) {
-		memset(&fbi->fix, 0, sizeof(fbi->fix));
-		memset(&fbi->var, 0, sizeof(fbi->var));
+		clear_fb_info(fbi);
 		return 0;
 	}
 
@@ -1520,10 +1525,8 @@ int omapfb_realloc_fbmem(struct fb_info *fbi, unsigned long size, int type)
 		if (old_size)
 			omapfb_alloc_fbmem(fbi, old_size, old_paddr);
 
-		if (rg->size == 0) {
-			memset(&fbi->fix, 0, sizeof(fbi->fix));
-			memset(&fbi->var, 0, sizeof(fbi->var));
-		}
+		if (rg->size == 0)
+			clear_fb_info(fbi);
 
 		return r;
 	}
@@ -1556,8 +1559,7 @@ int omapfb_realloc_fbmem(struct fb_info *fbi, unsigned long size, int type)
 	return 0;
 err:
 	omapfb_free_fbmem(fbi);
-	memset(&fbi->fix, 0, sizeof(fbi->fix));
-	memset(&fbi->var, 0, sizeof(fbi->var));
+	clear_fb_info(fbi);
 	return r;
 }
 
@@ -1565,7 +1567,6 @@ err:
 int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi)
 {
 	struct fb_var_screeninfo *var = &fbi->var;
-	struct fb_fix_screeninfo *fix = &fbi->fix;
 	struct omap_dss_device *display = fb2display(fbi);
 	struct omapfb_info *ofbi = FB2OFB(fbi);
 	int r = 0;
@@ -1574,11 +1575,8 @@ int omapfb_fb_init(struct omapfb2_device *fbdev, struct fb_info *fbi)
 	fbi->flags = FBINFO_FLAG_DEFAULT;
 	fbi->pseudo_palette = fbdev->pseudo_palette;
 
-	strncpy(fix->id, MODULE_NAME, sizeof(fix->id));
-
 	if (ofbi->region.size == 0) {
-		memset(&fbi->fix, 0, sizeof(fbi->fix));
-		memset(&fbi->var, 0, sizeof(fbi->var));
+		clear_fb_info(fbi);
 		return 0;
 	}
 
@@ -1728,6 +1726,8 @@ static int omapfb_create_framebuffers(struct omapfb2_device *fbdev)
 			return -ENOMEM;
 		}
 
+		clear_fb_info(fbi);
+
 		fbdev->fbs[i] = fbi;
 
 		ofbi = FB2OFB(fbi);
-- 
1.6.2.4