From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1756870AbZJCSjQ (ORCPT ); Sat, 3 Oct 2009 14:39:16 -0400 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1756781AbZJCSjQ (ORCPT ); Sat, 3 Oct 2009 14:39:16 -0400 Received: from mail-yx0-f199.google.com ([209.85.210.199]:43758 "EHLO mail-yx0-f199.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1756710AbZJCSjO convert rfc822-to-8bit (ORCPT ); Sat, 3 Oct 2009 14:39:14 -0400 DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc:content-type:content-transfer-encoding; b=UBBuTdMZhmcE+O3ZQFt4JXCbFYHtOg7IO4CUZunphhc/7GrQbQ+ngMAUhuea4zwZJ0 hcREzw10e8f9kEOck6n+lWdg8UvtUZuPPt02UkE0MwHlIYjmT0vgfLcibZne80Iu+wcV VkFNqSimjWUbkyo9j+Wdin/QyAcVssro9s+8I= MIME-Version: 1.0 In-Reply-To: <20091002224413.11962.12302.stgit@localhost> References: <20091002223510.11962.21751.stgit@localhost> <20091002224413.11962.12302.stgit@localhost> From: Cory Maccarrone Date: Sat, 3 Oct 2009 11:38:18 -0700 Message-ID: <6cb013310910031138k6086d1faje44d1582e5db9422@mail.gmail.com> Subject: Re: [PATCH 6/8] omapfb: Condition mutex acquisition To: Tony Lindgren Cc: linux-arm-kernel@lists.infradead.org, Imre Deak , Sergio Aguirre , linux-omap@vger.kernel.org, linux-kernel@vger.kernel.org, Tomi Valkeinen Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 2, 2009 at 3:44 PM, Tony Lindgren wrote: > > From: Sergio Aguirre > > This fixes a bug introduced by this commit ID: > >  commit 537a1bf059fa312355696fa6db80726e655e7f17 >  Author: Krzysztof Helt >  Date:   Tue Jun 30 11:41:29 2009 -0700 > >    fbdev: add mutex for fb_mmap locking > > In which a mutex was added when changing smem_start and smem_len fields, > so the mutex inside the fb_mmap() call is actually used. > > The problem was that set_fb_fix, which modifies the above 2 fields, > was called before and after registering the framebuffer, > which when used before registration, lead to a failed attempt to > use an uninitialized mutex. > > Solution: Don't use mutex before framebuffer registration. > > Signed-off-by: Sergio Aguirre > Acked-by: Tomi Valkeinen > Acked-by: Imre Deak > Signed-off-by: Tony Lindgren > --- >  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) > > -- > To unsubscribe from this list: send the line "unsubscribe linux-omap" in > the body of a message to majordomo@vger.kernel.org > More majordomo info at  http://vger.kernel.org/majordomo-info.html Tested-by: Cory Maccarrone This patch works beautifully for omap850-based devices. I need only add a board file and LCD resolution parameters, and I get a fully working framebuffer. I have tested with linux-omap master (commit 6469d1c660f8751ff39836c81970cdbe46953057), adding only the board/lcd files on HTC Herald. - Cory