From e9115293f6b4c7f737a5eeba34c2769dfd030e5d Mon Sep 17 00:00:00 2001 From: Tomi Valkeinen 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ä 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