[PATCH v2] i2c-tools: code cleanup: remove unused parts of kernel UAPI

Bartosz Golaszewski bartekgola at gmail.com
Wed Sep 2 16:20:52 UTC 2015


The implementation is more or less feature complete. Remove the parts of
kernel UAPI copied from include/uapi/linux/i2c.h that aren't used.

Signed-off-by: Bartosz Golaszewski <bartekgola at gmail.com>
---
v2:
- update comments as well

v1:
http://lists.busybox.net/pipermail/busybox/2015-September/083345.html

 miscutils/i2c_tools.c | 26 ++++++--------------------
 1 file changed, 6 insertions(+), 20 deletions(-)

diff --git a/miscutils/i2c_tools.c b/miscutils/i2c_tools.c
index 38d90ff..a61e38e 100644
--- a/miscutils/i2c_tools.c
+++ b/miscutils/i2c_tools.c
@@ -62,29 +62,24 @@
 #include "libbb.h"
 
 /*
+ * The below structures and defines have been copied from the user API headers
+ * from the linux kernel.
+ */
+
+/*
  * /dev/i2c-X ioctl commands. The ioctl's parameter is always an unsigned long,
  * except for:
  *    - I2C_FUNCS, takes pointer to an unsigned long
- *    - I2C_RDWR, takes pointer to struct i2c_rdwr_ioctl_data
  *    - I2C_SMBUS, takes pointer to struct i2c_smbus_ioctl_data
  */
 
-/*
- * NOTE: Slave address is 7 or 10 bits, but 10-bit addresses
- * are not supported due to code brokenness.
- */
-
 /* Use this slave address. */
 #define I2C_SLAVE	0x0703
 /* Use this slave address, even if it is already in use by a driver. */
 #define I2C_SLAVE_FORCE	0x0706
-/* 0 for 7 bit addrs, != 0 for 10 bit. */
-#define I2C_TENBIT	0x0704
 /* Get the adapter functionality mask. */
 #define I2C_FUNCS	0x0705
-/* Combined R/W transfer (one STOP only). */
-#define I2C_RDWR	0x0707
-/* != 0 to use PEC with SMBus. */
+/* <ioctl arg> != 0 to use PEC with SMBus. */
 #define I2C_PEC		0x0708
 /* SMBus transfer. */
 #define I2C_SMBUS	0x0720
@@ -97,12 +92,6 @@ struct i2c_smbus_ioctl_data {
 	union i2c_smbus_data *data;
 };
 
-/* Structure used in the I2C_RDWR ioctl call. */
-struct i2c_rdwr_ioctl_data {
-	struct i2c_msg *msgs;	/* Pointers to i2c_msgs. */
-	uint32_t nmsgs;		/* Number of i2c_msgs. */
-};
-
 /* As specified in SMBus standard. */
 #define I2C_SMBUS_BLOCK_MAX		32
 /* Not specified but we use same structure. */
@@ -116,7 +105,6 @@ union i2c_smbus_data {
 	uint8_t block[I2C_SMBUS_BLOCK_MAX + 2];
 };
 
-#define I2C_RDRW_IOCTL_MAX_MSGS		42
 #define I2C_MAX_REGS			256
 
 /* Smbus_access read or write markers. */
@@ -140,8 +128,6 @@ union i2c_smbus_data {
 
 /* Defines to determine what functionality is present. */
 #define I2C_FUNC_I2C				0x00000001
-#define I2C_FUNC_10BIT_ADDR			0x00000002
-#define I2C_FUNC_PROTOCOL_MANGLING		0x00000004
 #define I2C_FUNC_SMBUS_PEC			0x00000008
 #define I2C_FUNC_SMBUS_BLOCK_PROC_CALL		0x00008000
 #define I2C_FUNC_SMBUS_QUICK			0x00010000
-- 
2.1.4



More information about the busybox mailing list