patch-2.3.42 linux/include/linux/i2c-dev.h

Next file: linux/include/linux/i2c-elektor.h
Previous file: linux/include/linux/auto_fs.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.3.41/linux/include/linux/i2c-dev.h linux/include/linux/i2c-dev.h
@@ -19,7 +19,7 @@
     Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
 */
 
-/* $Id: i2c-dev.h,v 1.3 1999/12/21 23:45:58 frodo Exp $ */
+/* $Id: i2c-dev.h,v 1.6 2000/01/24 21:56:58 frodo Exp $ */
 
 #ifndef I2C_DEV_H
 #define I2C_DEV_H
@@ -33,10 +33,10 @@
 
 /* This is the structure as used in the I2C_SMBUS ioctl call */
 struct i2c_smbus_ioctl_data {
-  char read_write;
-  __u8 command;
-  int size;
-  union i2c_smbus_data *data;
+	char read_write;
+	__u8 command;
+	int size;
+	union i2c_smbus_data *data;
 };
 
 #ifndef __KERNEL__
@@ -46,79 +46,83 @@
 extern inline __s32 i2c_smbus_access(int file, char read_write, __u8 command, 
                                      int size, union i2c_smbus_data *data)
 {
-  struct i2c_smbus_ioctl_data args;
+	struct i2c_smbus_ioctl_data args;
 
-  args.read_write = read_write;
-  args.command = command;
-  args.size = size;
-  args.data = data;
-  return ioctl(file,I2C_SMBUS,&args);
+	args.read_write = read_write;
+	args.command = command;
+	args.size = size;
+	args.data = data;
+	return ioctl(file,I2C_SMBUS,&args);
 }
 
 
 extern inline __s32 i2c_smbus_write_quick(int file, __u8 value)
 {
-  return i2c_smbus_access(file,value,0,I2C_SMBUS_QUICK,NULL);
+	return i2c_smbus_access(file,value,0,I2C_SMBUS_QUICK,NULL);
 }
-
+	
 extern inline __s32 i2c_smbus_read_byte(int file)
 {
-  union i2c_smbus_data data;
-  if (i2c_smbus_access(file,I2C_SMBUS_READ,0,I2C_SMBUS_BYTE,&data))
-    return -1;
-  else
-    return 0x0FF & data.byte;
+	union i2c_smbus_data data;
+	if (i2c_smbus_access(file,I2C_SMBUS_READ,0,I2C_SMBUS_BYTE,&data))
+		return -1;
+	else
+		return 0x0FF & data.byte;
 }
 
 extern inline __s32 i2c_smbus_write_byte(int file, __u8 value)
 {
-  return i2c_smbus_access(file,I2C_SMBUS_WRITE,value, I2C_SMBUS_BYTE,NULL);
+	return i2c_smbus_access(file,I2C_SMBUS_WRITE,value,
+	                        I2C_SMBUS_BYTE,NULL);
 }
 
 extern inline __s32 i2c_smbus_read_byte_data(int file, __u8 command)
 {
-  union i2c_smbus_data data;
-  if (i2c_smbus_access(file,I2C_SMBUS_READ,command,I2C_SMBUS_BYTE_DATA,&data))
-    return -1;
-  else
-    return 0x0FF & data.byte;
+	union i2c_smbus_data data;
+	if (i2c_smbus_access(file,I2C_SMBUS_READ,command,
+	                     I2C_SMBUS_BYTE_DATA,&data))
+		return -1;
+	else
+		return 0x0FF & data.byte;
 }
 
 extern inline __s32 i2c_smbus_write_byte_data(int file, __u8 command, 
                                               __u8 value)
 {
-  union i2c_smbus_data data;
-  data.byte = value;
-  return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,I2C_SMBUS_BYTE_DATA,
-                          &data);
+	union i2c_smbus_data data;
+	data.byte = value;
+	return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
+	                        I2C_SMBUS_BYTE_DATA, &data);
 }
 
 extern inline __s32 i2c_smbus_read_word_data(int file, __u8 command)
 {
-  union i2c_smbus_data data;
-  if (i2c_smbus_access(file,I2C_SMBUS_READ,command,I2C_SMBUS_WORD_DATA,&data))
-    return -1;
-  else
-    return 0x0FFFF & data.word;
+	union i2c_smbus_data data;
+	if (i2c_smbus_access(file,I2C_SMBUS_READ,command,
+	                     I2C_SMBUS_WORD_DATA,&data))
+		return -1;
+	else
+		return 0x0FFFF & data.word;
 }
 
 extern inline __s32 i2c_smbus_write_word_data(int file, __u8 command, 
                                               __u16 value)
 {
-  union i2c_smbus_data data;
-  data.word = value;
-  return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,I2C_SMBUS_WORD_DATA, 
-                          &data);
+	union i2c_smbus_data data;
+	data.word = value;
+	return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
+	                        I2C_SMBUS_WORD_DATA, &data);
 }
 
 extern inline __s32 i2c_smbus_process_call(int file, __u8 command, __u16 value)
 {
-  union i2c_smbus_data data;
-  data.word = value;
-  if (i2c_smbus_access(file,I2C_SMBUS_WRITE,command,I2C_SMBUS_PROC_CALL,&data))
-    return -1;
-  else
-    return 0x0FFFF & data.word;
+	union i2c_smbus_data data;
+	data.word = value;
+	if (i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
+	                     I2C_SMBUS_PROC_CALL,&data))
+		return -1;
+	else
+		return 0x0FFFF & data.word;
 }
 
 
@@ -126,29 +130,30 @@
 extern inline __s32 i2c_smbus_read_block_data(int file, __u8 command, 
                                               __u8 *values)
 {
-  union i2c_smbus_data data;
-  int i;
-  if (i2c_smbus_access(file,I2C_SMBUS_READ,command,I2C_SMBUS_BLOCK_DATA,&data))
-    return -1;
-  else {
-    for (i = 1; i <= data.block[0]; i++)
-      values[i-1] = data.block[i];
-    return data.block[0];
-  }
+	union i2c_smbus_data data;
+	int i;
+	if (i2c_smbus_access(file,I2C_SMBUS_READ,command,
+	                     I2C_SMBUS_BLOCK_DATA,&data))
+		return -1;
+	else {
+		for (i = 1; i <= data.block[0]; i++)
+			values[i-1] = data.block[i];
+			return data.block[0];
+	}
 }
 
 extern inline __s32 i2c_smbus_write_block_data(int file, __u8 command, 
                                                __u8 length, __u8 *values)
 {
-  union i2c_smbus_data data;
-  int i;
-  if (length > 32)
-    length = 32;
-  for (i = 1; i <= length; i++)
-    data.block[i] = values[i-1];
-  data.block[0] = length;
-  return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,I2C_SMBUS_BLOCK_DATA,
-                          &data);
+	union i2c_smbus_data data;
+	int i;
+	if (length > 32)
+		length = 32;
+	for (i = 1; i <= length; i++)
+		data.block[i] = values[i-1];
+	data.block[0] = length;
+	return i2c_smbus_access(file,I2C_SMBUS_WRITE,command,
+	                        I2C_SMBUS_BLOCK_DATA, &data);
 }
 
 #endif /* ndef __KERNEL__ */

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)