Skip to content

Commit

Permalink
Merge tag 'i2c-for-6.7-final' of git://git.kernel.org/pub/scm/linux/k…
Browse files Browse the repository at this point in the history
…ernel/git/wsa/linux

Pull i2c fixes from Wolfram Sang:
 "Improve the detection when to run atomic transfer handlers for kernels
  with preemption disabled. This removes some false positive splats a
  number of users were seeing if their driver didn't have support for
  atomic transfers.

  Also, fix a typo in the docs while we are here"

* tag 'i2c-for-6.7-final' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
  i2c: core: Fix atomic xfer check for non-preempt config
  Documentation/i2c: fix spelling error in i2c-address-translators
  • Loading branch information
torvalds committed Jan 6, 2024
2 parents 95c8a35 + a3368e1 commit 52b1853
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Documentation/i2c/i2c-address-translators.rst
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ Transaction:
- Physical I2C transaction on bus A, slave address 0x20
- ATR chip detects transaction on address 0x20, finds it in table,
propagates transaction on bus B with address translated to 0x10,
keeps clock streched on bus A waiting for reply
keeps clock stretched on bus A waiting for reply
- Slave X chip (on bus B) detects transaction at its own physical
address 0x10 and replies normally
- ATR chip stops clock stretching and forwards reply on bus A,
Expand Down
4 changes: 3 additions & 1 deletion drivers/i2c/i2c-core.h
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
* i2c-core.h - interfaces internal to the I2C framework
*/

#include <linux/kconfig.h>
#include <linux/rwsem.h>

struct i2c_devinfo {
Expand All @@ -29,7 +30,8 @@ int i2c_dev_irq_from_resources(const struct resource *resources,
*/
static inline bool i2c_in_atomic_xfer_mode(void)
{
return system_state > SYSTEM_RUNNING && !preemptible();
return system_state > SYSTEM_RUNNING &&
(IS_ENABLED(CONFIG_PREEMPT_COUNT) ? !preemptible() : irqs_disabled());
}

static inline int __i2c_lock_bus_helper(struct i2c_adapter *adap)
Expand Down

0 comments on commit 52b1853

Please sign in to comment.