diff options
author | Jean Delvare <khali@linux-fr.org> | 2010-05-21 12:40:56 -0400 |
---|---|---|
committer | Jean Delvare <khali@linux-fr.org> | 2010-05-21 12:40:56 -0400 |
commit | c5aa69285c573e42042530be86b7af6f5fe9e240 (patch) | |
tree | 9cf9d795b9471d78bba341632d45d2da82540948 /drivers/i2c/busses | |
parent | e624dbd32446f40caad05284bf6cb8a5337d2048 (diff) |
i2c-stub: Expose the default functionality flags
It is easier to adjust the flags when you know their default value.
Signed-off-by: Jean Delvare <khali@linux-fr.org>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
Diffstat (limited to 'drivers/i2c/busses')
-rw-r--r-- | drivers/i2c/busses/i2c-stub.c | 9 |
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/i2c/busses/i2c-stub.c b/drivers/i2c/busses/i2c-stub.c index 0c770eabe85e..b1b3447942c9 100644 --- a/drivers/i2c/busses/i2c-stub.c +++ b/drivers/i2c/busses/i2c-stub.c | |||
@@ -29,13 +29,16 @@ | |||
29 | #include <linux/i2c.h> | 29 | #include <linux/i2c.h> |
30 | 30 | ||
31 | #define MAX_CHIPS 10 | 31 | #define MAX_CHIPS 10 |
32 | #define STUB_FUNC (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | \ | ||
33 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | \ | ||
34 | I2C_FUNC_SMBUS_I2C_BLOCK) | ||
32 | 35 | ||
33 | static unsigned short chip_addr[MAX_CHIPS]; | 36 | static unsigned short chip_addr[MAX_CHIPS]; |
34 | module_param_array(chip_addr, ushort, NULL, S_IRUGO); | 37 | module_param_array(chip_addr, ushort, NULL, S_IRUGO); |
35 | MODULE_PARM_DESC(chip_addr, | 38 | MODULE_PARM_DESC(chip_addr, |
36 | "Chip addresses (up to 10, between 0x03 and 0x77)"); | 39 | "Chip addresses (up to 10, between 0x03 and 0x77)"); |
37 | 40 | ||
38 | static unsigned long functionality = ~0UL; | 41 | static unsigned long functionality = STUB_FUNC; |
39 | module_param(functionality, ulong, S_IRUGO | S_IWUSR); | 42 | module_param(functionality, ulong, S_IRUGO | S_IWUSR); |
40 | MODULE_PARM_DESC(functionality, "Override functionality bitfield"); | 43 | MODULE_PARM_DESC(functionality, "Override functionality bitfield"); |
41 | 44 | ||
@@ -156,9 +159,7 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, | |||
156 | 159 | ||
157 | static u32 stub_func(struct i2c_adapter *adapter) | 160 | static u32 stub_func(struct i2c_adapter *adapter) |
158 | { | 161 | { |
159 | return (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | | 162 | return STUB_FUNC & functionality; |
160 | I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | | ||
161 | I2C_FUNC_SMBUS_I2C_BLOCK) & functionality; | ||
162 | } | 163 | } |
163 | 164 | ||
164 | static const struct i2c_algorithm smbus_algorithm = { | 165 | static const struct i2c_algorithm smbus_algorithm = { |