0001
0002
0003
0004
0005 #include <linux/kernel.h>
0006 #include <linux/kthread.h>
0007 #include <linux/siox.h>
0008
0009 #define to_siox_master(_dev) container_of((_dev), struct siox_master, dev)
0010 struct siox_master {
0011
0012 int busno;
0013 int (*pushpull)(struct siox_master *smaster,
0014 size_t setbuf_len, const u8 setbuf[],
0015 size_t getbuf_len, u8 getbuf[]);
0016
0017
0018 unsigned long poll_interval;
0019
0020
0021 struct mutex lock;
0022 bool active;
0023 struct module *owner;
0024 struct device dev;
0025 unsigned int num_devices;
0026 struct list_head devices;
0027
0028 size_t setbuf_len, getbuf_len;
0029 size_t buf_len;
0030 u8 *buf;
0031 u8 status;
0032
0033 unsigned long last_poll;
0034 struct task_struct *poll_thread;
0035 };
0036
0037 static inline void *siox_master_get_devdata(struct siox_master *smaster)
0038 {
0039 return dev_get_drvdata(&smaster->dev);
0040 }
0041
0042 struct siox_master *siox_master_alloc(struct device *dev, size_t size);
0043 static inline void siox_master_put(struct siox_master *smaster)
0044 {
0045 put_device(&smaster->dev);
0046 }
0047
0048 int siox_master_register(struct siox_master *smaster);
0049 void siox_master_unregister(struct siox_master *smaster);