public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andrew Morton <akpm@linux-foundation.org>
To: "Sonic Zhang" <sonic.adi@gmail.com>
Cc: bryan.wu@analog.com, khali@linux-fr.org,
	linux-kernel@vger.kernel.org, mhfan@ustc.edu
Subject: Re: [PATCH -mm] Blackfin: blackfin i2c driver
Date: Tue, 6 Mar 2007 22:06:41 -0800	[thread overview]
Message-ID: <20070306220641.d7bd92bf.akpm@linux-foundation.org> (raw)
In-Reply-To: <4e5ebad50703062117j5a6866d9x8580060ae0f83a94@mail.gmail.com>

On Wed, 7 Mar 2007 13:17:57 +0800 "Sonic Zhang" <sonic.adi@gmail.com> wrote:

> On 3/6/07, Andrew Morton <akpm@linux-foundation.org> wrote:
> > On Tue, 06 Mar 2007 14:54:18 +0800 "Wu, Bryan" <bryan.wu@analog.com> wrote:
> >
> > > Hi folks,
> > >
> > > [PATCH] Blackfin: blackfin i2c driver
> > >
> 
> > > +     struct i2c_msg *pmsg;
> > > +     int i, ret;
> > > +     int rc = 0;
> > > +
> > > +     if (!(bfin_read_TWI_CONTROL() & TWI_ENA))
> > > +             return -ENXIO;
> > > +
> > > +     down(&iface->twi_lock);
> > > +
> > > +     while (bfin_read_TWI_MASTER_STAT() & BUSBUSY) {
> > > +             up(&iface->twi_lock);
> > > +             schedule();
> > > +             down(&iface->twi_lock);
> > > +     }
> >
> > That's a busy loop until this task's timeslice has expired.  It'll work,
> > but it'll suck a bit.  (Repeated in several places)
> >
> 
> OK, I change it into yield(). So, current process will be move to the
> tail of the run queue. Is that OK with you?

Nope, yield is terribly bad when there are busy processes running: it can
stall for a very long time indeed,

Is this hardware not capable of generating an interrupt when BUSBUSY gets
negated?

I guess not, in which case you're stuck with having to poll it - probably
use a cond_resched() in the loop, and an angry comment.


  reply	other threads:[~2007-03-07  6:07 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2007-03-06  6:54 [PATCH -mm] Blackfin: blackfin i2c driver Wu, Bryan
2007-03-06  7:18 ` Andrew Morton
2007-03-07  5:17   ` Sonic Zhang
2007-03-07  6:06     ` Andrew Morton [this message]
2007-03-07  6:38       ` Wu, Bryan
2007-03-06 21:43 ` Alexey Dobriyan
2007-03-06 23:04   ` Mike Frysinger
2007-03-07  5:57   ` Wu, Bryan
2007-03-07  6:58     ` Jean Delvare
2007-03-07  7:14       ` Andrew Morton
2007-03-07  7:39         ` Wu, Bryan
2007-03-07  7:45           ` Andrew Morton
2007-03-08  3:57             ` trailing whitespace killing (Re: [PATCH -mm] Blackfin: blackfin i2c driver) Oleg Verych
2007-03-08  7:35             ` [PATCH -mm] Blackfin: blackfin i2c driver Jean Delvare
2007-03-07  9:53       ` Wu, Bryan
2007-03-08  9:27         ` Jean Delvare
2007-03-09  4:04           ` Sonic Zhang
2007-03-09  9:47             ` Jean Delvare
2007-03-07  7:02     ` Andrew Morton

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=20070306220641.d7bd92bf.akpm@linux-foundation.org \
    --to=akpm@linux-foundation.org \
    --cc=bryan.wu@analog.com \
    --cc=khali@linux-fr.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mhfan@ustc.edu \
    --cc=sonic.adi@gmail.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