All of lore.kernel.org
 help / color / mirror / Atom feed
diff for duplicates of <42418BC1.2020608@acm.org>

diff --git a/a/1.txt b/N1/1.txt
index e268cfc..8b13789 100644
--- a/a/1.txt
+++ b/N1/1.txt
@@ -1,8 +1 @@
 
--------------- next part --------------
-A non-text attachment was scrubbed...
-Name: i2c_breakup_formatting.diff
-Type: text/x-patch
-Size: 8607 bytes
-Desc: not available
-Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20050323/3d9066fd/i2c_breakup_formatting.bin
diff --git a/N1/2.hdr b/N1/2.hdr
new file mode 100644
index 0000000..c456603
--- /dev/null
+++ b/N1/2.hdr
@@ -0,0 +1,5 @@
+Content-Type: text/x-patch;
+ name="i2c_breakup_formatting.diff"
+Content-Transfer-Encoding: 7bit
+Content-Disposition: inline;
+ filename="i2c_breakup_formatting.diff"
diff --git a/N1/2.txt b/N1/2.txt
new file mode 100644
index 0000000..89edb68
--- /dev/null
+++ b/N1/2.txt
@@ -0,0 +1,275 @@
+This patch reorganizes the I2C SMBus formatting code to make it more
+suitable for the upcoming non-blocking changes.
+
+The I2C main functions do the following:
+
+ Format the data for transmission
+ Send the data to the next layer down for handling
+ Clean up the results
+
+The original code did all this in single big function.  This patch
+breaks the formatting and cleanup operations into separate functions.
+Beyond one big function being ugly, the non-blocking code needs this
+because it needs to perform these separately.  When you start the
+operation, the non-blocking code needs to do the format then return.
+Later on, when the operation is complete, the thread of execution
+handling the completion will do the cleanup.
+
+This patch does create some functions with lots of parameters.  That
+goes away in a future patch that consolidates the data for an I2C
+operation into a single data structure.
+
+Signed-off-by: Corey Minyard <minyard@acm.org>
+
+Index: linux-2.6.11-mm1/drivers/i2c/i2c-core.c
+===================================================================
+--- linux-2.6.11-mm1.orig/drivers/i2c/i2c-core.c
++++ linux-2.6.11-mm1/drivers/i2c/i2c-core.c
+@@ -1038,25 +1038,127 @@
+ 	}
+ }
+ 
+-/* Simulate a SMBus command using the i2c protocol 
+-   No checking of parameters is done!  */
+-static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, 
+-                                   unsigned short flags,
+-                                   char read_write, u8 command, int size, 
+-                                   union i2c_smbus_data * data)
+-{
+-	/* So we need to generate a series of msgs. In the case of writing, we
+-	  need to use only one message; when reading, we need two. We initialize
+-	  most things with sane defaults, to keep the code below somewhat
+-	  simpler. */
+-	unsigned char msgbuf0[34];
+-	unsigned char msgbuf1[34];
++static int i2c_smbus_complete_entry(struct i2c_adapter * adapter, u16 addr,
++				    unsigned short flags, char read_write,
++				    u8 command, int size,
++				    union i2c_smbus_data * data,
++				    int swpec, u8 partial,
++				    int result)
++{
++	if (result < 0)
++		return result;
++
++	if(swpec &&
++	   size != I2C_SMBUS_QUICK &&
++	   size != I2C_SMBUS_I2C_BLOCK_DATA &&
++	   (read_write == I2C_SMBUS_READ ||
++	    size == I2C_SMBUS_PROC_CALL_PEC ||
++	    size == I2C_SMBUS_BLOCK_PROC_CALL_PEC)) {
++		if(i2c_smbus_check_pec(addr,
++				       command,
++				       size,
++				       partial,
++				       data))
++			return -EINVAL;
++	}
++
++	return 0;
++}
++
++static void i2c_smbus_format_entry(struct i2c_adapter * adapter, u16 addr,
++				   unsigned short *flags, char read_write,
++				   u8 command, int *size,
++				   union i2c_smbus_data * data,
++				   int *swpec, u8 *partial)
++{
++	*swpec = 0;
++	*partial = 0;
++	*flags &= I2C_M_TEN | I2C_CLIENT_PEC;
++	if((*flags & I2C_CLIENT_PEC) &&
++	   !(i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HWPEC_CALC))) {
++		*swpec = 1;
++		if(read_write == I2C_SMBUS_READ &&
++		   *size == I2C_SMBUS_BLOCK_DATA)
++			*size = I2C_SMBUS_BLOCK_DATA_PEC;
++		else if(*size == I2C_SMBUS_PROC_CALL)
++			*size = I2C_SMBUS_PROC_CALL_PEC;
++		else if(*size == I2C_SMBUS_BLOCK_PROC_CALL) {
++			unsigned char *sdata = data->block;
++			i2c_smbus_add_pec(addr, command, I2C_SMBUS_BLOCK_DATA,
++					  data);
++			*partial = sdata[sdata[0] + 1];
++			*size = I2C_SMBUS_BLOCK_PROC_CALL_PEC;
++		} else if(read_write == I2C_SMBUS_WRITE &&
++		          *size != I2C_SMBUS_QUICK &&
++		          *size != I2C_SMBUS_I2C_BLOCK_DATA)
++			*size = i2c_smbus_add_pec(addr, command, *size, data);
++	}
++}
++
++static int i2c_smbus_emu_complete(struct i2c_adapter * adapter, u16 addr,
++				  unsigned short flags, char read_write,
++				  u8 command, int size, 
++				  union i2c_smbus_data * data,
++				  struct i2c_msg *msg,
++				  int swpec, u8 partial,
++				  int result)
++{
++	unsigned char *msgbuf0 = msg[0].buf;
++	unsigned char *msgbuf1 = msg[1].buf;
++	int i;
++
++
++	if (result < 0)
++		return result;
++
++	if (read_write != I2C_SMBUS_READ)
++		return result;
++
++	switch(size) {
++	case I2C_SMBUS_BYTE:
++		data->byte = msgbuf0[0];
++		break;
++	case I2C_SMBUS_BYTE_DATA:
++		data->byte = msgbuf1[0];
++		break;
++	case I2C_SMBUS_WORD_DATA: 
++	case I2C_SMBUS_PROC_CALL:
++		data->word = msgbuf1[0]|(msgbuf1[1] << 8);
++		break;
++	case I2C_SMBUS_I2C_BLOCK_DATA:
++		/* fixed at 32 for now */
++		data->block[0] = I2C_SMBUS_I2C_BLOCK_MAX;
++		for (i = 0; i < I2C_SMBUS_I2C_BLOCK_MAX; i++)
++			data->block[i+1] = msgbuf1[i];
++		break;
++	}
++
++	return i2c_smbus_complete_entry(adapter, addr, flags,
++					read_write, command,
++					size, data, swpec, partial, result);
++}
++
++static int i2c_smbus_emu_format(struct i2c_adapter *adapter, u16 addr,
++				unsigned short flags, char read_write,
++				u8 command, int size, 
++				union i2c_smbus_data * data,
++				struct i2c_msg *msg)
++{
++	/* So we need to generate a series of msgs. In the case of
++	   writing, we need to use only one message; when reading, we
++	   need two. We initialize most things with sane defaults, to
++	   keep the code below somewhat simpler. */
++	unsigned char *msgbuf0 = msg[0].buf;
+ 	int num = read_write == I2C_SMBUS_READ?2:1;
+-	struct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, 
+-	                          { addr, flags | I2C_M_RD, 0, msgbuf1 }
+-	                        };
+ 	int i;
+ 
++	msg[0].addr = addr;
++	msg[0].flags = flags;
++	msg[0].len = 1;
++	msg[1].addr = addr;
++	msg[1].flags = flags | I2C_M_RD;
++	msg[1].len = 0;
++
+ 	msgbuf0[0] = command;
+ 	switch(size) {
+ 	case I2C_SMBUS_QUICK:
+@@ -1143,28 +1245,6 @@
+ 		return -1;
+ 	}
+ 
+-	if (i2c_transfer(adapter, msg, num) < 0)
+-		return -1;
+-
+-	if (read_write == I2C_SMBUS_READ)
+-		switch(size) {
+-			case I2C_SMBUS_BYTE:
+-				data->byte = msgbuf0[0];
+-				break;
+-			case I2C_SMBUS_BYTE_DATA:
+-				data->byte = msgbuf1[0];
+-				break;
+-			case I2C_SMBUS_WORD_DATA: 
+-			case I2C_SMBUS_PROC_CALL:
+-				data->word = msgbuf1[0] | (msgbuf1[1] << 8);
+-				break;
+-			case I2C_SMBUS_I2C_BLOCK_DATA:
+-				/* fixed at 32 for now */
+-				data->block[0] = I2C_SMBUS_I2C_BLOCK_MAX;
+-				for (i = 0; i < I2C_SMBUS_I2C_BLOCK_MAX; i++)
+-					data->block[i+1] = msgbuf1[i];
+-				break;
+-		}
+ 	return 0;
+ }
+ 
+@@ -1176,42 +1256,42 @@
+ 	s32 res;
+ 	int swpec = 0;
+ 	u8 partial = 0;
++	struct i2c_algorithm *algo = adapter->algo;
+ 
+-	flags &= I2C_M_TEN | I2C_CLIENT_PEC;
+-	if((flags & I2C_CLIENT_PEC) &&
+-	   !(i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HWPEC_CALC))) {
+-		swpec = 1;
+-		if(read_write == I2C_SMBUS_READ &&
+-		   size == I2C_SMBUS_BLOCK_DATA)
+-			size = I2C_SMBUS_BLOCK_DATA_PEC;
+-		else if(size == I2C_SMBUS_PROC_CALL)
+-			size = I2C_SMBUS_PROC_CALL_PEC;
+-		else if(size == I2C_SMBUS_BLOCK_PROC_CALL) {
+-			i2c_smbus_add_pec(addr, command,
+-		                          I2C_SMBUS_BLOCK_DATA, data);
+-			partial = data->block[data->block[0] + 1];
+-			size = I2C_SMBUS_BLOCK_PROC_CALL_PEC;
+-		} else if(read_write == I2C_SMBUS_WRITE &&
+-		          size != I2C_SMBUS_QUICK &&
+-		          size != I2C_SMBUS_I2C_BLOCK_DATA)
+-			size = i2c_smbus_add_pec(addr, command, size, data);
+-	}
+ 
+-	if (adapter->algo->smbus_xfer) {
++	i2c_smbus_format_entry(adapter, addr, &flags,
++			       read_write, command,
++			       &size, data, &swpec, &partial);
++
++	if (algo->smbus_xfer) {
+ 		down(&adapter->bus_lock);
+-		res = adapter->algo->smbus_xfer(adapter,addr,flags,read_write,
+-		                                command,size,data);
++		res = adapter->algo->smbus_xfer(adapter, addr, flags,
++						read_write, command,
++						size, data);
+ 		up(&adapter->bus_lock);
+-	} else
+-		res = i2c_smbus_xfer_emulated(adapter,addr,flags,read_write,
+-	                                      command,size,data);
+-
+-	if(res >= 0 && swpec &&
+-	   size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA &&
+-	   (read_write == I2C_SMBUS_READ || size == I2C_SMBUS_PROC_CALL_PEC ||
+-	    size == I2C_SMBUS_BLOCK_PROC_CALL_PEC)) {
+-		if(i2c_smbus_check_pec(addr, command, size, partial, data))
+-			return -1;
++		res = i2c_smbus_complete_entry(adapter, addr, flags,
++					       read_write, command,
++					       size, data, swpec, partial,
++					       res);
++	} else {
++		unsigned char msgbuf0[34];
++		unsigned char msgbuf1[34];
++		struct i2c_msg msg[2];
++
++		msg[0].buf = msgbuf0;
++		msg[1].buf = msgbuf1;
++		if (i2c_smbus_emu_format(adapter, addr, flags,
++					 read_write, command,
++					 size, data, msg))
++			res = -EINVAL;
++		else {
++			res = i2c_transfer(adapter, msg, 2);
++			res = i2c_smbus_emu_complete(adapter, addr, flags,
++						     read_write, command,
++						     size, data, msg,
++						     swpec, partial,
++						     res);
++		}
+ 	}
+ 	return res;
+ }
diff --git a/a/content_digest b/N1/content_digest
index b651ba2..a0624bf 100644
--- a/a/content_digest
+++ b/N1/content_digest
@@ -1,18 +1,288 @@
- "From\0minyard@acm.org (Corey Minyard)\0"
- "Subject\0[PATCH] I2C Part 2 - Break up the formatting code into individual\0"
- "Date\0Thu, 19 May 2005 06:25:45 +0000\0"
+ "From\0Corey Minyard <minyard@acm.org>\0"
+ "Subject\0[PATCH] I2C Part 2 - Break up the formatting code into individual functions\0"
+ "Date\0Wed, 23 Mar 2005 09:31:13 -0600\0"
  "To\0Greg KH <greg@kroah.com>"
   lkml <linux-kernel@vger.kernel.org>
  " Sensors <sensors@stimpy.netroedge.com>\0"
- "\00:1\0"
+ "\01:1\0"
  "b\0"
+ "\01:2\0"
+ "fn\0i2c_breakup_formatting.diff\0"
+ "b\0"
+ "This patch reorganizes the I2C SMBus formatting code to make it more\n"
+ "suitable for the upcoming non-blocking changes.\n"
+ "\n"
+ "The I2C main functions do the following:\n"
+ "\n"
+ " Format the data for transmission\n"
+ " Send the data to the next layer down for handling\n"
+ " Clean up the results\n"
+ "\n"
+ "The original code did all this in single big function.  This patch\n"
+ "breaks the formatting and cleanup operations into separate functions.\n"
+ "Beyond one big function being ugly, the non-blocking code needs this\n"
+ "because it needs to perform these separately.  When you start the\n"
+ "operation, the non-blocking code needs to do the format then return.\n"
+ "Later on, when the operation is complete, the thread of execution\n"
+ "handling the completion will do the cleanup.\n"
+ "\n"
+ "This patch does create some functions with lots of parameters.  That\n"
+ "goes away in a future patch that consolidates the data for an I2C\n"
+ "operation into a single data structure.\n"
+ "\n"
+ "Signed-off-by: Corey Minyard <minyard@acm.org>\n"
  "\n"
- "-------------- next part --------------\n"
- "A non-text attachment was scrubbed...\n"
- "Name: i2c_breakup_formatting.diff\n"
- "Type: text/x-patch\n"
- "Size: 8607 bytes\n"
- "Desc: not available\n"
- Url : http://lists.lm-sensors.org/pipermail/lm-sensors/attachments/20050323/3d9066fd/i2c_breakup_formatting.bin
+ "Index: linux-2.6.11-mm1/drivers/i2c/i2c-core.c\n"
+ "===================================================================\n"
+ "--- linux-2.6.11-mm1.orig/drivers/i2c/i2c-core.c\n"
+ "+++ linux-2.6.11-mm1/drivers/i2c/i2c-core.c\n"
+ "@@ -1038,25 +1038,127 @@\n"
+ " \t}\n"
+ " }\n"
+ " \n"
+ "-/* Simulate a SMBus command using the i2c protocol \n"
+ "-   No checking of parameters is done!  */\n"
+ "-static s32 i2c_smbus_xfer_emulated(struct i2c_adapter * adapter, u16 addr, \n"
+ "-                                   unsigned short flags,\n"
+ "-                                   char read_write, u8 command, int size, \n"
+ "-                                   union i2c_smbus_data * data)\n"
+ "-{\n"
+ "-\t/* So we need to generate a series of msgs. In the case of writing, we\n"
+ "-\t  need to use only one message; when reading, we need two. We initialize\n"
+ "-\t  most things with sane defaults, to keep the code below somewhat\n"
+ "-\t  simpler. */\n"
+ "-\tunsigned char msgbuf0[34];\n"
+ "-\tunsigned char msgbuf1[34];\n"
+ "+static int i2c_smbus_complete_entry(struct i2c_adapter * adapter, u16 addr,\n"
+ "+\t\t\t\t    unsigned short flags, char read_write,\n"
+ "+\t\t\t\t    u8 command, int size,\n"
+ "+\t\t\t\t    union i2c_smbus_data * data,\n"
+ "+\t\t\t\t    int swpec, u8 partial,\n"
+ "+\t\t\t\t    int result)\n"
+ "+{\n"
+ "+\tif (result < 0)\n"
+ "+\t\treturn result;\n"
+ "+\n"
+ "+\tif(swpec &&\n"
+ "+\t   size != I2C_SMBUS_QUICK &&\n"
+ "+\t   size != I2C_SMBUS_I2C_BLOCK_DATA &&\n"
+ "+\t   (read_write == I2C_SMBUS_READ ||\n"
+ "+\t    size == I2C_SMBUS_PROC_CALL_PEC ||\n"
+ "+\t    size == I2C_SMBUS_BLOCK_PROC_CALL_PEC)) {\n"
+ "+\t\tif(i2c_smbus_check_pec(addr,\n"
+ "+\t\t\t\t       command,\n"
+ "+\t\t\t\t       size,\n"
+ "+\t\t\t\t       partial,\n"
+ "+\t\t\t\t       data))\n"
+ "+\t\t\treturn -EINVAL;\n"
+ "+\t}\n"
+ "+\n"
+ "+\treturn 0;\n"
+ "+}\n"
+ "+\n"
+ "+static void i2c_smbus_format_entry(struct i2c_adapter * adapter, u16 addr,\n"
+ "+\t\t\t\t   unsigned short *flags, char read_write,\n"
+ "+\t\t\t\t   u8 command, int *size,\n"
+ "+\t\t\t\t   union i2c_smbus_data * data,\n"
+ "+\t\t\t\t   int *swpec, u8 *partial)\n"
+ "+{\n"
+ "+\t*swpec = 0;\n"
+ "+\t*partial = 0;\n"
+ "+\t*flags &= I2C_M_TEN | I2C_CLIENT_PEC;\n"
+ "+\tif((*flags & I2C_CLIENT_PEC) &&\n"
+ "+\t   !(i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HWPEC_CALC))) {\n"
+ "+\t\t*swpec = 1;\n"
+ "+\t\tif(read_write == I2C_SMBUS_READ &&\n"
+ "+\t\t   *size == I2C_SMBUS_BLOCK_DATA)\n"
+ "+\t\t\t*size = I2C_SMBUS_BLOCK_DATA_PEC;\n"
+ "+\t\telse if(*size == I2C_SMBUS_PROC_CALL)\n"
+ "+\t\t\t*size = I2C_SMBUS_PROC_CALL_PEC;\n"
+ "+\t\telse if(*size == I2C_SMBUS_BLOCK_PROC_CALL) {\n"
+ "+\t\t\tunsigned char *sdata = data->block;\n"
+ "+\t\t\ti2c_smbus_add_pec(addr, command, I2C_SMBUS_BLOCK_DATA,\n"
+ "+\t\t\t\t\t  data);\n"
+ "+\t\t\t*partial = sdata[sdata[0] + 1];\n"
+ "+\t\t\t*size = I2C_SMBUS_BLOCK_PROC_CALL_PEC;\n"
+ "+\t\t} else if(read_write == I2C_SMBUS_WRITE &&\n"
+ "+\t\t          *size != I2C_SMBUS_QUICK &&\n"
+ "+\t\t          *size != I2C_SMBUS_I2C_BLOCK_DATA)\n"
+ "+\t\t\t*size = i2c_smbus_add_pec(addr, command, *size, data);\n"
+ "+\t}\n"
+ "+}\n"
+ "+\n"
+ "+static int i2c_smbus_emu_complete(struct i2c_adapter * adapter, u16 addr,\n"
+ "+\t\t\t\t  unsigned short flags, char read_write,\n"
+ "+\t\t\t\t  u8 command, int size, \n"
+ "+\t\t\t\t  union i2c_smbus_data * data,\n"
+ "+\t\t\t\t  struct i2c_msg *msg,\n"
+ "+\t\t\t\t  int swpec, u8 partial,\n"
+ "+\t\t\t\t  int result)\n"
+ "+{\n"
+ "+\tunsigned char *msgbuf0 = msg[0].buf;\n"
+ "+\tunsigned char *msgbuf1 = msg[1].buf;\n"
+ "+\tint i;\n"
+ "+\n"
+ "+\n"
+ "+\tif (result < 0)\n"
+ "+\t\treturn result;\n"
+ "+\n"
+ "+\tif (read_write != I2C_SMBUS_READ)\n"
+ "+\t\treturn result;\n"
+ "+\n"
+ "+\tswitch(size) {\n"
+ "+\tcase I2C_SMBUS_BYTE:\n"
+ "+\t\tdata->byte = msgbuf0[0];\n"
+ "+\t\tbreak;\n"
+ "+\tcase I2C_SMBUS_BYTE_DATA:\n"
+ "+\t\tdata->byte = msgbuf1[0];\n"
+ "+\t\tbreak;\n"
+ "+\tcase I2C_SMBUS_WORD_DATA: \n"
+ "+\tcase I2C_SMBUS_PROC_CALL:\n"
+ "+\t\tdata->word = msgbuf1[0]|(msgbuf1[1] << 8);\n"
+ "+\t\tbreak;\n"
+ "+\tcase I2C_SMBUS_I2C_BLOCK_DATA:\n"
+ "+\t\t/* fixed at 32 for now */\n"
+ "+\t\tdata->block[0] = I2C_SMBUS_I2C_BLOCK_MAX;\n"
+ "+\t\tfor (i = 0; i < I2C_SMBUS_I2C_BLOCK_MAX; i++)\n"
+ "+\t\t\tdata->block[i+1] = msgbuf1[i];\n"
+ "+\t\tbreak;\n"
+ "+\t}\n"
+ "+\n"
+ "+\treturn i2c_smbus_complete_entry(adapter, addr, flags,\n"
+ "+\t\t\t\t\tread_write, command,\n"
+ "+\t\t\t\t\tsize, data, swpec, partial, result);\n"
+ "+}\n"
+ "+\n"
+ "+static int i2c_smbus_emu_format(struct i2c_adapter *adapter, u16 addr,\n"
+ "+\t\t\t\tunsigned short flags, char read_write,\n"
+ "+\t\t\t\tu8 command, int size, \n"
+ "+\t\t\t\tunion i2c_smbus_data * data,\n"
+ "+\t\t\t\tstruct i2c_msg *msg)\n"
+ "+{\n"
+ "+\t/* So we need to generate a series of msgs. In the case of\n"
+ "+\t   writing, we need to use only one message; when reading, we\n"
+ "+\t   need two. We initialize most things with sane defaults, to\n"
+ "+\t   keep the code below somewhat simpler. */\n"
+ "+\tunsigned char *msgbuf0 = msg[0].buf;\n"
+ " \tint num = read_write == I2C_SMBUS_READ?2:1;\n"
+ "-\tstruct i2c_msg msg[2] = { { addr, flags, 1, msgbuf0 }, \n"
+ "-\t                          { addr, flags | I2C_M_RD, 0, msgbuf1 }\n"
+ "-\t                        };\n"
+ " \tint i;\n"
+ " \n"
+ "+\tmsg[0].addr = addr;\n"
+ "+\tmsg[0].flags = flags;\n"
+ "+\tmsg[0].len = 1;\n"
+ "+\tmsg[1].addr = addr;\n"
+ "+\tmsg[1].flags = flags | I2C_M_RD;\n"
+ "+\tmsg[1].len = 0;\n"
+ "+\n"
+ " \tmsgbuf0[0] = command;\n"
+ " \tswitch(size) {\n"
+ " \tcase I2C_SMBUS_QUICK:\n"
+ "@@ -1143,28 +1245,6 @@\n"
+ " \t\treturn -1;\n"
+ " \t}\n"
+ " \n"
+ "-\tif (i2c_transfer(adapter, msg, num) < 0)\n"
+ "-\t\treturn -1;\n"
+ "-\n"
+ "-\tif (read_write == I2C_SMBUS_READ)\n"
+ "-\t\tswitch(size) {\n"
+ "-\t\t\tcase I2C_SMBUS_BYTE:\n"
+ "-\t\t\t\tdata->byte = msgbuf0[0];\n"
+ "-\t\t\t\tbreak;\n"
+ "-\t\t\tcase I2C_SMBUS_BYTE_DATA:\n"
+ "-\t\t\t\tdata->byte = msgbuf1[0];\n"
+ "-\t\t\t\tbreak;\n"
+ "-\t\t\tcase I2C_SMBUS_WORD_DATA: \n"
+ "-\t\t\tcase I2C_SMBUS_PROC_CALL:\n"
+ "-\t\t\t\tdata->word = msgbuf1[0] | (msgbuf1[1] << 8);\n"
+ "-\t\t\t\tbreak;\n"
+ "-\t\t\tcase I2C_SMBUS_I2C_BLOCK_DATA:\n"
+ "-\t\t\t\t/* fixed at 32 for now */\n"
+ "-\t\t\t\tdata->block[0] = I2C_SMBUS_I2C_BLOCK_MAX;\n"
+ "-\t\t\t\tfor (i = 0; i < I2C_SMBUS_I2C_BLOCK_MAX; i++)\n"
+ "-\t\t\t\t\tdata->block[i+1] = msgbuf1[i];\n"
+ "-\t\t\t\tbreak;\n"
+ "-\t\t}\n"
+ " \treturn 0;\n"
+ " }\n"
+ " \n"
+ "@@ -1176,42 +1256,42 @@\n"
+ " \ts32 res;\n"
+ " \tint swpec = 0;\n"
+ " \tu8 partial = 0;\n"
+ "+\tstruct i2c_algorithm *algo = adapter->algo;\n"
+ " \n"
+ "-\tflags &= I2C_M_TEN | I2C_CLIENT_PEC;\n"
+ "-\tif((flags & I2C_CLIENT_PEC) &&\n"
+ "-\t   !(i2c_check_functionality(adapter, I2C_FUNC_SMBUS_HWPEC_CALC))) {\n"
+ "-\t\tswpec = 1;\n"
+ "-\t\tif(read_write == I2C_SMBUS_READ &&\n"
+ "-\t\t   size == I2C_SMBUS_BLOCK_DATA)\n"
+ "-\t\t\tsize = I2C_SMBUS_BLOCK_DATA_PEC;\n"
+ "-\t\telse if(size == I2C_SMBUS_PROC_CALL)\n"
+ "-\t\t\tsize = I2C_SMBUS_PROC_CALL_PEC;\n"
+ "-\t\telse if(size == I2C_SMBUS_BLOCK_PROC_CALL) {\n"
+ "-\t\t\ti2c_smbus_add_pec(addr, command,\n"
+ "-\t\t                          I2C_SMBUS_BLOCK_DATA, data);\n"
+ "-\t\t\tpartial = data->block[data->block[0] + 1];\n"
+ "-\t\t\tsize = I2C_SMBUS_BLOCK_PROC_CALL_PEC;\n"
+ "-\t\t} else if(read_write == I2C_SMBUS_WRITE &&\n"
+ "-\t\t          size != I2C_SMBUS_QUICK &&\n"
+ "-\t\t          size != I2C_SMBUS_I2C_BLOCK_DATA)\n"
+ "-\t\t\tsize = i2c_smbus_add_pec(addr, command, size, data);\n"
+ "-\t}\n"
+ " \n"
+ "-\tif (adapter->algo->smbus_xfer) {\n"
+ "+\ti2c_smbus_format_entry(adapter, addr, &flags,\n"
+ "+\t\t\t       read_write, command,\n"
+ "+\t\t\t       &size, data, &swpec, &partial);\n"
+ "+\n"
+ "+\tif (algo->smbus_xfer) {\n"
+ " \t\tdown(&adapter->bus_lock);\n"
+ "-\t\tres = adapter->algo->smbus_xfer(adapter,addr,flags,read_write,\n"
+ "-\t\t                                command,size,data);\n"
+ "+\t\tres = adapter->algo->smbus_xfer(adapter, addr, flags,\n"
+ "+\t\t\t\t\t\tread_write, command,\n"
+ "+\t\t\t\t\t\tsize, data);\n"
+ " \t\tup(&adapter->bus_lock);\n"
+ "-\t} else\n"
+ "-\t\tres = i2c_smbus_xfer_emulated(adapter,addr,flags,read_write,\n"
+ "-\t                                      command,size,data);\n"
+ "-\n"
+ "-\tif(res >= 0 && swpec &&\n"
+ "-\t   size != I2C_SMBUS_QUICK && size != I2C_SMBUS_I2C_BLOCK_DATA &&\n"
+ "-\t   (read_write == I2C_SMBUS_READ || size == I2C_SMBUS_PROC_CALL_PEC ||\n"
+ "-\t    size == I2C_SMBUS_BLOCK_PROC_CALL_PEC)) {\n"
+ "-\t\tif(i2c_smbus_check_pec(addr, command, size, partial, data))\n"
+ "-\t\t\treturn -1;\n"
+ "+\t\tres = i2c_smbus_complete_entry(adapter, addr, flags,\n"
+ "+\t\t\t\t\t       read_write, command,\n"
+ "+\t\t\t\t\t       size, data, swpec, partial,\n"
+ "+\t\t\t\t\t       res);\n"
+ "+\t} else {\n"
+ "+\t\tunsigned char msgbuf0[34];\n"
+ "+\t\tunsigned char msgbuf1[34];\n"
+ "+\t\tstruct i2c_msg msg[2];\n"
+ "+\n"
+ "+\t\tmsg[0].buf = msgbuf0;\n"
+ "+\t\tmsg[1].buf = msgbuf1;\n"
+ "+\t\tif (i2c_smbus_emu_format(adapter, addr, flags,\n"
+ "+\t\t\t\t\t read_write, command,\n"
+ "+\t\t\t\t\t size, data, msg))\n"
+ "+\t\t\tres = -EINVAL;\n"
+ "+\t\telse {\n"
+ "+\t\t\tres = i2c_transfer(adapter, msg, 2);\n"
+ "+\t\t\tres = i2c_smbus_emu_complete(adapter, addr, flags,\n"
+ "+\t\t\t\t\t\t     read_write, command,\n"
+ "+\t\t\t\t\t\t     size, data, msg,\n"
+ "+\t\t\t\t\t\t     swpec, partial,\n"
+ "+\t\t\t\t\t\t     res);\n"
+ "+\t\t}\n"
+ " \t}\n"
+ " \treturn res;\n"
+  }
 
-5923bb4780022838e78e67c7eb647263e04931c780d4a8e02cd315a9dbcca7c3
+e8e7b655aee46ac72e6c2becb71641c28ffdd8dc30e1dc09983f52db8e966684

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.