4 * This program is free software; you can redistribute it and/or modify it under
5 * the terms of the GNU General Public License version 2 as published by the
6 * Free Software Foundation.
9 #include <linux/device.h>
11 #define to_siox_device(_dev) container_of((_dev), struct siox_device, dev)
13 struct list_head node; /* node in smaster->devices */
14 struct siox_master *smaster;
24 u8 status_written_lastcycle;
28 unsigned int watchdog_errors;
29 unsigned int status_errors;
31 struct kernfs_node *status_errors_kn;
32 struct kernfs_node *watchdog_kn;
33 struct kernfs_node *watchdog_errors_kn;
34 struct kernfs_node *connected_kn;
37 bool siox_device_synced(struct siox_device *sdevice);
38 bool siox_device_connected(struct siox_device *sdevice);
41 int (*probe)(struct siox_device *sdevice);
42 int (*remove)(struct siox_device *sdevice);
43 void (*shutdown)(struct siox_device *sdevice);
46 * buf is big enough to hold sdev->inbytes - 1 bytes, the status byte
47 * is in the scope of the framework.
49 int (*set_data)(struct siox_device *sdevice, u8 status, u8 buf[]);
51 * buf is big enough to hold sdev->outbytes - 1 bytes, the status byte
52 * is in the scope of the framework
54 int (*get_data)(struct siox_device *sdevice, const u8 buf[]);
56 struct device_driver driver;
59 static inline struct siox_driver *to_siox_driver(struct device_driver *driver)
62 return container_of(driver, struct siox_driver, driver);
67 int __siox_driver_register(struct siox_driver *sdriver, struct module *owner);
69 static inline int siox_driver_register(struct siox_driver *sdriver)
71 return __siox_driver_register(sdriver, THIS_MODULE);
74 static inline void siox_driver_unregister(struct siox_driver *sdriver)
76 return driver_unregister(&sdriver->driver);