Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

+5 -4
+5 -4
drivers/i2c/busses/i2c-stub.c
··· 29 29 #include <linux/i2c.h> 30 30 31 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 36 static unsigned short chip_addr[MAX_CHIPS]; 34 37 module_param_array(chip_addr, ushort, NULL, S_IRUGO); 35 38 MODULE_PARM_DESC(chip_addr, 36 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 42 module_param(functionality, ulong, S_IRUGO | S_IWUSR); 40 43 MODULE_PARM_DESC(functionality, "Override functionality bitfield"); 41 44 ··· 159 156 160 157 static u32 stub_func(struct i2c_adapter *adapter) 161 158 { 162 - return (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | 163 - I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | 164 - I2C_FUNC_SMBUS_I2C_BLOCK) & functionality; 159 + return STUB_FUNC & functionality; 165 160 } 166 161 167 162 static const struct i2c_algorithm smbus_algorithm = {