~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/include/linux/siox.h

Version: ~ [ linux-6.11.5 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.58 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.114 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.169 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.228 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.284 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.322 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 /* SPDX-License-Identifier: GPL-2.0-only */
  2 /*
  3  * Copyright (C) 2015 Pengutronix, Uwe Kleine-König <kernel@pengutronix.de>
  4  */
  5 
  6 #include <linux/device.h>
  7 
  8 #define to_siox_device(_dev)    container_of((_dev), struct siox_device, dev)
  9 struct siox_device {
 10         struct list_head node; /* node in smaster->devices */
 11         struct siox_master *smaster;
 12         struct device dev;
 13 
 14         const char *type;
 15         size_t inbytes;
 16         size_t outbytes;
 17         u8 statustype;
 18 
 19         u8 status_read_clean;
 20         u8 status_written;
 21         u8 status_written_lastcycle;
 22         bool connected;
 23 
 24         /* statistics */
 25         unsigned int watchdog_errors;
 26         unsigned int status_errors;
 27 
 28         struct kernfs_node *status_errors_kn;
 29         struct kernfs_node *watchdog_kn;
 30         struct kernfs_node *watchdog_errors_kn;
 31         struct kernfs_node *connected_kn;
 32 };
 33 
 34 bool siox_device_synced(struct siox_device *sdevice);
 35 bool siox_device_connected(struct siox_device *sdevice);
 36 
 37 struct siox_driver {
 38         int (*probe)(struct siox_device *sdevice);
 39         void (*remove)(struct siox_device *sdevice);
 40         void (*shutdown)(struct siox_device *sdevice);
 41 
 42         /*
 43          * buf is big enough to hold sdev->inbytes - 1 bytes, the status byte
 44          * is in the scope of the framework.
 45          */
 46         int (*set_data)(struct siox_device *sdevice, u8 status, u8 buf[]);
 47         /*
 48          * buf is big enough to hold sdev->outbytes - 1 bytes, the status byte
 49          * is in the scope of the framework
 50          */
 51         int (*get_data)(struct siox_device *sdevice, const u8 buf[]);
 52 
 53         struct device_driver driver;
 54 };
 55 
 56 static inline struct siox_driver *to_siox_driver(struct device_driver *driver)
 57 {
 58         if (driver)
 59                 return container_of(driver, struct siox_driver, driver);
 60         else
 61                 return NULL;
 62 }
 63 
 64 int __siox_driver_register(struct siox_driver *sdriver, struct module *owner);
 65 
 66 static inline int siox_driver_register(struct siox_driver *sdriver)
 67 {
 68         return __siox_driver_register(sdriver, THIS_MODULE);
 69 }
 70 
 71 static inline void siox_driver_unregister(struct siox_driver *sdriver)
 72 {
 73         return driver_unregister(&sdriver->driver);
 74 }
 75 
 76 /*
 77  * module_siox_driver() - Helper macro for drivers that don't do
 78  * anything special in module init/exit.  This eliminates a lot of
 79  * boilerplate.  Each module may only use this macro once, and
 80  * calling it replaces module_init() and module_exit()
 81  */
 82 #define module_siox_driver(__siox_driver) \
 83         module_driver(__siox_driver, siox_driver_register, \
 84                         siox_driver_unregister)
 85 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php