VSF Documented
driver.h
Go to the documentation of this file.
1#ifndef __VSF_LINUX_DEVICE_DRIVER_H__
2#define __VSF_LINUX_DEVICE_DRIVER_H__
3
4#include <linux/types.h>
5#include <linux/module.h>
6#include <linux/pm.h>
7#include <linux/device/bus.h>
8
9#ifdef __cplusplus
10extern "C" {
11#endif
12
13#define module_driver(__driver, __register, __unregister, ...) \
14static void __init __driver##_init(void) \
15{ \
16 __register(&(__driver) , ##__VA_ARGS__); \
17} \
18module_init(__driver##_init); \
19static void __exit __driver##_exit(void) \
20{ \
21 __unregister(&(__driver) , ##__VA_ARGS__); \
22} \
23module_exit(__driver##_exit);
24
25#define module_driver_init(__driver) \
26module_run_init(__driver##_init)
27
29 const char *name;
30 struct bus_type *bus;
31
32 struct module *owner;
33 const char *mod_name;
34
35 int (*probe)(struct device *dev);
36 int (*remove)(struct device *dev);
37 void (*shutdown)(struct device *dev);
38 int (*suspend)(struct device *dev);
39 int (*resume)(struct device *dev);
40};
41
42extern int driver_register(struct device_driver *drv);
43extern void driver_unregister(struct device_driver *drv);
44
45#ifdef __cplusplus
46}
47#endif
48
49#endif
void driver_unregister(struct device_driver *drv)
Definition vsf_linux_core.c:598
int driver_register(struct device_driver *drv)
Definition vsf_linux_core.c:593
Definition bus.h:15
Definition driver.h:28
int(* resume)(struct device *dev)
Definition driver.h:39
const char * mod_name
Definition driver.h:33
struct module * owner
Definition driver.h:32
int(* remove)(struct device *dev)
Definition driver.h:36
const char * name
Definition driver.h:29
struct bus_type * bus
Definition driver.h:30
int(* probe)(struct device *dev)
Definition driver.h:35
void(* shutdown)(struct device *dev)
Definition driver.h:37
int(* suspend)(struct device *dev)
Definition driver.h:38
Definition device.h:33
Definition module.h:46