From patchwork Tue Sep 29 14:14:05 2009 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Aguirre Rodriguez, Sergio Alberto" X-Patchwork-Id: 50551 X-Patchwork-Delegate: tomi.valkeinen@nokia.com Received: from vger.kernel.org (vger.kernel.org [209.132.176.167]) by demeter.kernel.org (8.14.2/8.14.2) with ESMTP id n8TEH2Da021499 for ; Tue, 29 Sep 2009 14:17:03 GMT Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752626AbZI2OQx (ORCPT ); Tue, 29 Sep 2009 10:16:53 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1752553AbZI2OQw (ORCPT ); Tue, 29 Sep 2009 10:16:52 -0400 Received: from bear.ext.ti.com ([192.94.94.41]:38985 "EHLO bear.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751901AbZI2OQv (ORCPT ); Tue, 29 Sep 2009 10:16:51 -0400 Received: from dlep34.itg.ti.com ([157.170.170.115]) by bear.ext.ti.com (8.13.7/8.13.7) with ESMTP id n8TEGr2g026170 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-SHA bits=256 verify=NO); Tue, 29 Sep 2009 09:16:54 -0500 Received: from dlep26.itg.ti.com (localhost [127.0.0.1]) by dlep34.itg.ti.com (8.13.7/8.13.7) with ESMTP id n8TEGrrn000406; Tue, 29 Sep 2009 09:16:53 -0500 (CDT) Received: from dlee74.ent.ti.com (localhost [127.0.0.1]) by dlep26.itg.ti.com (8.13.8/8.13.8) with ESMTP id n8TEGr0U010100; Tue, 29 Sep 2009 09:16:53 -0500 (CDT) Received: from dlee02.ent.ti.com ([157.170.170.17]) by dlee74.ent.ti.com ([157.170.170.8]) with mapi; Tue, 29 Sep 2009 09:16:53 -0500 From: "Aguirre Rodriguez, Sergio Alberto" To: "tomi.valkeinen@nokia.com" , "imre.deak@nokia.com" CC: "linux-omap@vger.kernel.org" Date: Tue, 29 Sep 2009 09:14:05 -0500 Subject: [RFC][PATCH] omapfb: Condition mutex acquisition Thread-Topic: [RFC][PATCH] omapfb: Condition mutex acquisition Thread-Index: AQHKQQ9udwNYPA6aX0OVgMwcMGKS9g== Message-ID: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: yes X-MS-TNEF-Correlator: acceptlanguage: en-US MIME-Version: 1.0 Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org From: Sergio Aguirre Acquiring mutex before framebuffer registration doesn't make sense, As there's no danger of external access to the memory related fields. NOTE: PLEASE REVIEW! I'M NOT AN EXPERT ON THIS. Signed-off-by: Sergio Aguirre --- drivers/video/omap/omapfb_main.c | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) From bba2d89ea45ec0359dec6fe21c1756ad3406e347 Mon Sep 17 00:00:00 2001 From: Sergio Aguirre Date: Tue, 29 Sep 2009 07:44:19 -0500 Subject: [PATCH] omapfb: Condition mutex acquisition Acquiring mutex before framebuffer registration doesn't make sense, As there's no danger of external access to the memory related fields. NOTE: PLEASE REVIEW! I'M NOT AN EXPERT ON THIS. Signed-off-by: Sergio Aguirre --- drivers/video/omap/omapfb_main.c | 22 ++++++++++++++-------- 1 files changed, 14 insertions(+), 8 deletions(-) diff --git a/drivers/video/omap/omapfb_main.c b/drivers/video/omap/omapfb_main.c index 125e605..0d0c8c8 100644 --- a/drivers/video/omap/omapfb_main.c +++ b/drivers/video/omap/omapfb_main.c @@ -393,7 +393,7 @@ static void omapfb_sync(struct fb_info *fbi) * Set fb_info.fix fields and also updates fbdev. * When calling this fb_info.var must be set up already. */ -static void set_fb_fix(struct fb_info *fbi) +static void set_fb_fix(struct fb_info *fbi, int from_init) { struct fb_fix_screeninfo *fix = &fbi->fix; struct fb_var_screeninfo *var = &fbi->var; @@ -403,10 +403,16 @@ static void set_fb_fix(struct fb_info *fbi) rg = &plane->fbdev->mem_desc.region[plane->idx]; fbi->screen_base = rg->vaddr; - mutex_lock(&fbi->mm_lock); - fix->smem_start = rg->paddr; - fix->smem_len = rg->size; - mutex_unlock(&fbi->mm_lock); + + if (!from_init) { + mutex_lock(&fbi->mm_lock); + fix->smem_start = rg->paddr; + fix->smem_len = rg->size; + mutex_unlock(&fbi->mm_lock); + } else { + fix->smem_start = rg->paddr; + fix->smem_len = rg->size; + } fix->type = FB_TYPE_PACKED_PIXELS; bpp = var->bits_per_pixel; @@ -704,7 +710,7 @@ static int omapfb_set_par(struct fb_info *fbi) int r = 0; omapfb_rqueue_lock(fbdev); - set_fb_fix(fbi); + set_fb_fix(fbi, 0); r = ctrl_change_mode(fbi); omapfb_rqueue_unlock(fbdev); @@ -904,7 +910,7 @@ static int omapfb_setup_mem(struct fb_info *fbi, struct omapfb_mem_info *mi) if (old_size != size) { if (size) { memcpy(&fbi->var, new_var, sizeof(fbi->var)); - set_fb_fix(fbi); + set_fb_fix(fbi, 0); } else { /* * Set these explicitly to indicate that the @@ -1504,7 +1510,7 @@ static int fbinfo_init(struct omapfb_device *fbdev, struct fb_info *info) var->bits_per_pixel = fbdev->panel->bpp; set_fb_var(info, var); - set_fb_fix(info); + set_fb_fix(info, 1); r = fb_alloc_cmap(&info->cmap, 16, 0); if (r != 0) -- 1.6.0.4