This source file includes following definitions.
- fieldbus_dev_unregister
- fieldbus_dev_register
- fieldbus_dev_area_updated
- fieldbus_dev_online_changed
1
2
3
4
5
6
7 #ifndef __FIELDBUS_DEV_H
8 #define __FIELDBUS_DEV_H
9
10 #include <linux/cdev.h>
11 #include <linux/wait.h>
12
13 enum fieldbus_dev_type {
14 FIELDBUS_DEV_TYPE_UNKNOWN = 0,
15 FIELDBUS_DEV_TYPE_PROFINET,
16 };
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40 struct fieldbus_dev {
41 ssize_t (*read_area)(struct fieldbus_dev *fbdev, char __user *buf,
42 size_t size, loff_t *offset);
43 ssize_t (*write_area)(struct fieldbus_dev *fbdev,
44 const char __user *buf, size_t size,
45 loff_t *offset);
46 size_t write_area_sz, read_area_sz;
47 const char *card_name;
48 enum fieldbus_dev_type fieldbus_type;
49 bool (*enable_get)(struct fieldbus_dev *fbdev);
50 int (*fieldbus_id_get)(struct fieldbus_dev *fbdev, char *buf,
51 size_t max_size);
52 int (*simple_enable_set)(struct fieldbus_dev *fbdev, bool enable);
53 struct device *parent;
54
55
56 int id;
57 struct cdev cdev;
58 struct device *dev;
59 int dc_event;
60 wait_queue_head_t dc_wq;
61 bool online;
62 };
63
64 #if IS_ENABLED(CONFIG_FIELDBUS_DEV)
65
66
67
68
69
70
71 void fieldbus_dev_unregister(struct fieldbus_dev *fb);
72
73
74
75
76
77
78 int __must_check fieldbus_dev_register(struct fieldbus_dev *fb);
79
80
81
82
83
84
85
86 void fieldbus_dev_area_updated(struct fieldbus_dev *fb);
87
88
89
90
91
92
93 void fieldbus_dev_online_changed(struct fieldbus_dev *fb, bool online);
94
95 #else
96
97 static inline void fieldbus_dev_unregister(struct fieldbus_dev *fb) {}
98 static inline int __must_check fieldbus_dev_register(struct fieldbus_dev *fb)
99 {
100 return -ENOTSUPP;
101 }
102
103 static inline void fieldbus_dev_area_updated(struct fieldbus_dev *fb) {}
104 static inline void fieldbus_dev_online_changed(struct fieldbus_dev *fb,
105 bool online) {}
106
107 #endif
108 #endif