[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20081013134239.GB13565@2ka.mipt.ru>
Date: Mon, 13 Oct 2008 17:42:40 +0400
From: Evgeniy Polyakov <johnpol@....mipt.ru>
To: Madhusudhan Chikkature <madhu.cr@...com>
Cc: Andrew Morton <akpm@...ux-foundation.org>,
"Gadiyar, Anand" <gadiyar@...com>, linux-kernel@...r.kernel.org,
linux-omap@...r.kernel.org
Subject: Re: [PATCH 1/5] HDQ Driver for OMAP2430/3430
Hi.
On Mon, Oct 13, 2008 at 06:55:43PM +0530, Madhusudhan Chikkature (madhu.cr@...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
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists