Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit bced8635 authored by Linus Torvalds's avatar Linus Torvalds
Browse files
* 'i2c-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/jdelvare/staging:
  i2c-algo-bit: Add pre- and post-xfer hooks
  at24: Init dynamic bin_attribute structures
  i2c: Drop configure option I2C_DEBUG_CHIP
  tsl2550: Move from i2c/chips to misc
  i2c-i801: Don't use the block buffer for I2C block writes
  i2c-powermac: Be less verbose in the absence of real errors.
  i2c-smbus: Use device_lock/device_unlock
parents ceb804cd 0a9c1475
Loading
Loading
Loading
Loading
+0 −9
Original line number Diff line number Diff line
@@ -73,7 +73,6 @@ config I2C_SMBUS

source drivers/i2c/algos/Kconfig
source drivers/i2c/busses/Kconfig
source drivers/i2c/chips/Kconfig

config I2C_DEBUG_CORE
	bool "I2C Core debugging messages"
@@ -98,12 +97,4 @@ config I2C_DEBUG_BUS
	  a problem with I2C support and want to see more of what is going
	  on.

config I2C_DEBUG_CHIP
	bool "I2C Chip debugging messages"
	help
	  Say Y here if you want the I2C chip drivers to produce a bunch of
	  debug messages to the system log.  Select this if you are having
	  a problem with I2C support and want to see more of what is going
	  on.

endif # I2C
+1 −1
Original line number Diff line number Diff line
@@ -6,7 +6,7 @@ obj-$(CONFIG_I2C_BOARDINFO) += i2c-boardinfo.o
obj-$(CONFIG_I2C)		+= i2c-core.o
obj-$(CONFIG_I2C_SMBUS)		+= i2c-smbus.o
obj-$(CONFIG_I2C_CHARDEV)	+= i2c-dev.o
obj-y				+= busses/ chips/ algos/
obj-y				+= algos/ busses/

ifeq ($(CONFIG_I2C_DEBUG_CORE),y)
EXTRA_CFLAGS += -DDEBUG
+9 −0
Original line number Diff line number Diff line
@@ -522,6 +522,12 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
	int i, ret;
	unsigned short nak_ok;

	if (adap->pre_xfer) {
		ret = adap->pre_xfer(i2c_adap);
		if (ret < 0)
			return ret;
	}

	bit_dbg(3, &i2c_adap->dev, "emitting start condition\n");
	i2c_start(adap);
	for (i = 0; i < num; i++) {
@@ -570,6 +576,9 @@ static int bit_xfer(struct i2c_adapter *i2c_adap,
bailout:
	bit_dbg(3, &i2c_adap->dev, "emitting stop condition\n");
	i2c_stop(adap);

	if (adap->post_xfer)
		adap->post_xfer(i2c_adap);
	return ret;
}

+4 −2
Original line number Diff line number Diff line
@@ -416,9 +416,11 @@ static int i801_block_transaction(union i2c_smbus_data *data, char read_write,
		data->block[0] = 32;	/* max for SMBus block reads */
	}

	/* Experience has shown that the block buffer can only be used for
	   SMBus (not I2C) block transactions, even though the datasheet
	   doesn't mention this limitation. */
	if ((i801_features & FEATURE_BLOCK_BUFFER)
	 && !(command == I2C_SMBUS_I2C_BLOCK_DATA
	      && read_write == I2C_SMBUS_READ)
	 && command != I2C_SMBUS_I2C_BLOCK_DATA
	 && i801_set_block_buffer_mode() == 0)
		result = i801_block_transaction_by_block(data, read_write,
							 hwpec);
+18 −7
Original line number Diff line number Diff line
@@ -122,9 +122,14 @@ static s32 i2c_powermac_smbus_xfer( struct i2c_adapter* adap,

	rc = pmac_i2c_xfer(bus, addrdir, subsize, subaddr, buf, len);
	if (rc) {
		if (rc == -ENXIO)
			dev_dbg(&adap->dev,
				"I2C transfer at 0x%02x failed, size %d, "
				"err %d\n", addrdir >> 1, size, rc);
		else
			dev_err(&adap->dev,
			"I2C transfer at 0x%02x failed, size %d, err %d\n",
			addrdir >> 1, size, rc);
				"I2C transfer at 0x%02x failed, size %d, "
				"err %d\n", addrdir >> 1, size, rc);
		goto bail;
	}

@@ -175,10 +180,16 @@ static int i2c_powermac_master_xfer( struct i2c_adapter *adap,
		goto bail;
	}
	rc = pmac_i2c_xfer(bus, addrdir, 0, 0, msgs->buf, msgs->len);
	if (rc < 0)
	if (rc < 0) {
		if (rc == -ENXIO)
			dev_dbg(&adap->dev, "I2C %s 0x%02x failed, err %d\n",
				addrdir & 1 ? "read from" : "write to",
				addrdir >> 1, rc);
		else
			dev_err(&adap->dev, "I2C %s 0x%02x failed, err %d\n",
			addrdir & 1 ? "read from" : "write to", addrdir >> 1,
			rc);
				addrdir & 1 ? "read from" : "write to",
				addrdir >> 1, rc);
	}
 bail:
	pmac_i2c_close(bus);
	return rc < 0 ? rc : 1;
Loading