#define pr_fmt(fmt) …
#include <linux/errno.h>
#include <linux/i2c.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/list.h>
#include <linux/module.h>
#include <linux/slab.h>
#define MAX_CHIPS …
#define STUB_FUNC_DEFAULT …
#define STUB_FUNC_ALL …
static unsigned short chip_addr[MAX_CHIPS];
module_param_array(…);
MODULE_PARM_DESC(…) …;
static unsigned long functionality = …;
module_param(functionality, ulong, S_IRUGO | S_IWUSR);
MODULE_PARM_DESC(…) …;
static u8 bank_reg[MAX_CHIPS];
module_param_array(…);
MODULE_PARM_DESC(…) …;
static u8 bank_mask[MAX_CHIPS];
module_param_array(…);
MODULE_PARM_DESC(…) …;
static u8 bank_start[MAX_CHIPS];
module_param_array(…);
MODULE_PARM_DESC(…) …;
static u8 bank_end[MAX_CHIPS];
module_param_array(…);
MODULE_PARM_DESC(…) …;
struct smbus_block_data { … };
struct stub_chip { … };
static struct stub_chip *stub_chips;
static int stub_chips_nr;
static struct smbus_block_data *stub_find_block(struct device *dev,
struct stub_chip *chip,
u8 command, bool create)
{ … }
static u16 *stub_get_wordp(struct stub_chip *chip, u8 offset)
{ … }
static s32 stub_xfer(struct i2c_adapter *adap, u16 addr, unsigned short flags,
char read_write, u8 command, int size, union i2c_smbus_data *data)
{ … }
static u32 stub_func(struct i2c_adapter *adapter)
{ … }
static const struct i2c_algorithm smbus_algorithm = …;
static struct i2c_adapter stub_adapter = …;
static int __init i2c_stub_allocate_banks(int i)
{ … }
static void i2c_stub_free(void)
{ … }
static int __init i2c_stub_init(void)
{ … }
static void __exit i2c_stub_exit(void)
{ … }
MODULE_AUTHOR(…) …;
MODULE_DESCRIPTION(…) …;
MODULE_LICENSE(…) …;
module_init(i2c_stub_init);
module_exit(i2c_stub_exit);