lkml.org 
[lkml]   [2008]   [Oct]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 1/5] HDQ Driver for OMAP2430/3430
Hi.

On Mon, Oct 13, 2008 at 06:55:43PM +0530, Madhusudhan Chikkature (madhu.cr@ti.com) wrote:
> >> +static int hdq_write_byte(struct hdq_data *hdq_data, u8 val, u8 *status)
> >> +{
> >> + int ret;
> >> + u8 tmp_status;
> >> + unsigned long irqflags;
> >> +
> >> + *status = 0;
> >> +
> >> + spin_lock_irqsave(&hdq_data->hdq_spinlock, irqflags);
> >> + /* clear interrupt flags via a dummy read */
> >> + hdq_reg_in(hdq_data, OMAP_HDQ_INT_STATUS);
> >> + /* ISR loads it with new INT_STATUS */
> >> + hdq_data->hdq_irqstatus = 0;
> >> + spin_unlock_irqrestore(&hdq_data->hdq_spinlock, irqflags);
> >> +
> >> + hdq_reg_out(hdq_data, OMAP_HDQ_TX_DATA, val);
> >> +
> >> + /* set the GO bit */
> >> + hdq_reg_merge(hdq_data, OMAP_HDQ_CTRL_STATUS, OMAP_HDQ_CTRL_STATUS_GO,
> >> + OMAP_HDQ_CTRL_STATUS_DIR | OMAP_HDQ_CTRL_STATUS_GO);
> >> + /* wait for the TXCOMPLETE bit */
> >> + ret = wait_event_interruptible_timeout(hdq_wait_queue,
> >> + hdq_data->hdq_irqstatus, OMAP_HDQ_TIMEOUT);
> >> + if (ret < 0) {
> >> + dev_dbg(hdq_data->dev, "wait interrupted");
> >> + return -EINTR;
> >> + }
> >
> > Is this desirable? The user hits ^C and the driver bails out?
> >
> > I assume so, but was this tested?
>
> Andrew, What is the test scenario you mean here? A user hitting ^C when the driver is waiting for the TXCOMPLETE bit?

Just plain return looks suspicious, is there some kind of a race between
calling code (which for example frees hdq_data) and the path, which sets
the bit and wakes up this thread?

--
Evgeniy Polyakov


\
 
 \ /
  Last update: 2008-10-13 15:43    [W:0.055 / U:0.680 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site