public inbox for linux-omap@vger.kernel.org
 help / color / mirror / Atom feed
From: Tony Lindgren <tony@atomide.com>
To: Felipe Balbi <felipe.balbi@nokia.com>
Cc: "Tereshonkov Roman (Nokia-D/Helsinki)"
	<roman.tereshonkov@nokia.com>,
	"linux-omap@vger.kernel.org" <linux-omap@vger.kernel.org>
Subject: Re: [PATCH] OMAP3: SDTI: Prevent access to sdti writing if module is not initialized.
Date: Fri, 27 Feb 2009 10:35:25 -0800	[thread overview]
Message-ID: <20090227183524.GI11594@atomide.com> (raw)
In-Reply-To: <20090216113303.GL21181@scadufax.research.nokia.com>

* Felipe Balbi <felipe.balbi@nokia.com> [090216 03:50]:
> On Thu, Feb 12, 2009 at 12:39:28PM +0100, Tereshonkov Roman wrote:
> > The function sti_channel_write_trace can be run from process and interrupt
> > context. It has to be completed before other sti_channel_write_trace calls.
> > 
> > Prevent sdti writing when SDTI module is not initialized.

Roman, can you please create a patch against the mainline tree and send
this driver to LKML for integration? I think pretty much the only thing
you should do is get rid of the OMAP_TAG_STI_CONSOLE and use get that
option from kernel command line like all the other consoles do.

Regards,

Tony

> > Signed-off-by: Roman Tereshonkov <roman.tereshonkov@nokia.com>
> 
> Acked-by: Felipe Balbi <felipe.balbi@nokia.com>
> 
> > ---
> >  drivers/misc/sti/sdti.c |   15 ++++++++++++---
> >  1 files changed, 12 insertions(+), 3 deletions(-)
> > 
> > diff --git a/drivers/misc/sti/sdti.c b/drivers/misc/sti/sdti.c
> > index 8c27504..31780de 100644
> > --- a/drivers/misc/sti/sdti.c
> > +++ b/drivers/misc/sti/sdti.c
> > @@ -37,20 +37,25 @@
> >  static struct clk *sdti_fck, *sdti_ick;
> >  void __iomem *sti_base, *sti_channel_base;
> >  static DEFINE_SPINLOCK(sdti_lock);
> > +static int sdti_initialized;
> > 
> >  void sti_channel_write_trace(int len, int id, void *data,
> >                                 unsigned int channel)
> >  {
> >         const u8 *tpntr = data;
> > +       unsigned long flags;
> > 
> > -       spin_lock_irq(&sdti_lock);
> > +       spin_lock_irqsave(&sdti_lock, flags);
> > +
> > +       if (unlikely(!sdti_initialized))
> > +               goto skip;
> > 
> >         sti_channel_writeb(id, channel);
> >         while (len--)
> >                 sti_channel_writeb(*tpntr++, channel);
> >         sti_channel_flush(channel);
> > -
> > -       spin_unlock_irq(&sdti_lock);
> > + skip:
> > +       spin_unlock_irqrestore(&sdti_lock, flags);
> >  }
> >  EXPORT_SYMBOL(sti_channel_write_trace);
> > 
> > @@ -117,6 +122,10 @@ static int __init omap_sdti_init(void)
> >         /* Enable SDTI */
> >         sti_writel((1 << 31) | (i & 0x3FFFFFFF), SDTI_WINCTRL);
> > 
> > +       spin_lock_irq(&sdti_lock);
> > +       sdti_initialized = 1;
> > +       spin_unlock_irq(&sdti_lock);
> > +
> >         i = sti_readl(SDTI_REVISION);
> >         snprintf(buf, sizeof(buf), "OMAP SDTI support loaded (HW v%u.%u)\n",
> >                 (i >> 4) & 0x0f, i & 0x0f);
> > --
> > 1.5.5.1
> > 
> > --
> > 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
> 
> -- 
> balbi
> --
> 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

  reply	other threads:[~2009-02-27 18:35 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2009-02-12 11:39 [PATCH] OMAP3: SDTI: Prevent access to sdti writing if module is not initialized Roman Tereshonkov
2009-02-16 11:33 ` Felipe Balbi
2009-02-27 18:35   ` Tony Lindgren [this message]
2009-02-27 19:00     ` Felipe Balbi
2009-02-28 10:08       ` Juha Yrjola
2009-03-02  8:27         ` Lauri Leukkunen
2009-03-02 11:31           ` Juha Yrjola
2009-03-02 12:15             ` Lauri Leukkunen

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20090227183524.GI11594@atomide.com \
    --to=tony@atomide.com \
    --cc=felipe.balbi@nokia.com \
    --cc=linux-omap@vger.kernel.org \
    --cc=roman.tereshonkov@nokia.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox