Commit c5aa6928 authored by Jean Delvare's avatar Jean Delvare

i2c-stub: Expose the default functionality flags

It is easier to adjust the flags when you know their default value.
Signed-off-by: default avatarJean Delvare <khali@linux-fr.org>
Cc: Mark M. Hoffman <mhoffman@lightlink.com>
parent e624dbd3
...@@ -29,13 +29,16 @@ ...@@ -29,13 +29,16 @@
#include <linux/i2c.h> #include <linux/i2c.h>
#define MAX_CHIPS 10 #define MAX_CHIPS 10
#define STUB_FUNC (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | \
I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA | \
I2C_FUNC_SMBUS_I2C_BLOCK)
static unsigned short chip_addr[MAX_CHIPS]; static unsigned short chip_addr[MAX_CHIPS];
module_param_array(chip_addr, ushort, NULL, S_IRUGO); module_param_array(chip_addr, ushort, NULL, S_IRUGO);
MODULE_PARM_DESC(chip_addr, MODULE_PARM_DESC(chip_addr,
"Chip addresses (up to 10, between 0x03 and 0x77)"); "Chip addresses (up to 10, between 0x03 and 0x77)");
static unsigned long functionality = ~0UL; static unsigned long functionality = STUB_FUNC;
module_param(functionality, ulong, S_IRUGO | S_IWUSR); module_param(functionality, ulong, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(functionality, "Override functionality bitfield"); MODULE_PARM_DESC(functionality, "Override functionality bitfield");
...@@ -156,9 +159,7 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags, ...@@ -156,9 +159,7 @@ static s32 stub_xfer(struct i2c_adapter * adap, u16 addr, unsigned short flags,
static u32 stub_func(struct i2c_adapter *adapter) static u32 stub_func(struct i2c_adapter *adapter)
{ {
return (I2C_FUNC_SMBUS_QUICK | I2C_FUNC_SMBUS_BYTE | return STUB_FUNC & functionality;
I2C_FUNC_SMBUS_BYTE_DATA | I2C_FUNC_SMBUS_WORD_DATA |
I2C_FUNC_SMBUS_I2C_BLOCK) & functionality;
} }
static const struct i2c_algorithm smbus_algorithm = { static const struct i2c_algorithm smbus_algorithm = {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment