From: Jean Delvare <khali@linux-fr.org>
To: David Miller <davem@davemloft.net>
Cc: Krzysztof Halasa <khc@pm.waw.pl>,
linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org
Subject: Re: I2C from interrupt context?
Date: Fri, 7 Nov 2008 10:11:18 +0100 [thread overview]
Message-ID: <20081107101118.286f3713@hyperion.delvare> (raw)
In-Reply-To: <20081106.154754.02648408.davem@davemloft.net>
On Thu, 06 Nov 2008 15:47:54 -0800 (PST), David Miller wrote:
> From: Krzysztof Halasa <khc@pm.waw.pl>
> Date: Fri, 07 Nov 2008 00:44:48 +0100
>
> [ Fixed i2c list address, it's now hosted at vger ]
>
> > I'm updating my EEPROM console logger and have encountered a problem
> > - the logger (as any console) can be called with hardware interrupts
> > disabled and/or from interrupt context. It needs to write to I^2C
> > (using ARM (Xscale) GPIO) and possibly SMBUS-only EEPROM chip. Is it
> > at all supposed to be possible?
>
> Not really. The I2C operations need to be able to sleep and that's
> not allowed in interrupt context.
That's not totally correct. Since kernel 2.6.25, i2c_transfer()
supports being called in contexts where it cannot sleep. Of course, for
it to work, the underlying i2c adapter driver must also not sleep. As I
recall, only the i2c-pxa driver was explicitly modified to support this
at the moment (see member use_pio of struct pxa_i2c) but other drivers
could be modified in a similar way (and some i2c adapter drivers may be
naturally non-sleeping - everything based on i2c-algo-bit is likely to
fall into this category.)
The situation is far from perfect though. For one thing, I seem to
recall that Andrew Morton didn't like the approach taken in
i2c_transfer(). For another, i2c_smbus_xfer() was not yet modified so
at this point only I2C-level transactions can be non-sleeping,
SMBus-level transactions can't. But all this could be fixed by anyone
who cares about these specific issues.
--
Jean Delvare
next prev parent reply other threads:[~2008-11-07 9:11 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-11-06 23:44 Krzysztof Halasa
2008-11-06 23:47 ` David Miller
2008-11-07 9:11 ` Jean Delvare [this message]
2008-11-07 16:05 ` Krzysztof Halasa
2008-11-11 7:57 ` 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=20081107101118.286f3713@hyperion.delvare \
--to=khali@linux-fr.org \
--cc=davem@davemloft.net \
--cc=khc@pm.waw.pl \
--cc=linux-i2c@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®