diff options
Diffstat (limited to 'include/linux')
-rw-r--r-- | include/linux/enclosure.h | 129 | ||||
-rw-r--r-- | include/linux/hrtimer.h | 5 | ||||
-rw-r--r-- | include/linux/input.h | 7 | ||||
-rw-r--r-- | include/linux/ktime.h | 3 |
4 files changed, 138 insertions, 6 deletions
diff --git a/include/linux/enclosure.h b/include/linux/enclosure.h new file mode 100644 index 000000000000..a5978f18ca40 --- /dev/null +++ b/include/linux/enclosure.h | |||
@@ -0,0 +1,129 @@ | |||
1 | /* | ||
2 | * Enclosure Services | ||
3 | * | ||
4 | * Copyright (C) 2008 James Bottomley <James.Bottomley@HansenPartnership.com> | ||
5 | * | ||
6 | **----------------------------------------------------------------------------- | ||
7 | ** | ||
8 | ** This program is free software; you can redistribute it and/or | ||
9 | ** modify it under the terms of the GNU General Public License | ||
10 | ** version 2 as published by the Free Software Foundation. | ||
11 | ** | ||
12 | ** This program is distributed in the hope that it will be useful, | ||
13 | ** but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
14 | ** MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
15 | ** GNU General Public License for more details. | ||
16 | ** | ||
17 | ** You should have received a copy of the GNU General Public License | ||
18 | ** along with this program; if not, write to the Free Software | ||
19 | ** Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
20 | ** | ||
21 | **----------------------------------------------------------------------------- | ||
22 | */ | ||
23 | #ifndef _LINUX_ENCLOSURE_H_ | ||
24 | #define _LINUX_ENCLOSURE_H_ | ||
25 | |||
26 | #include <linux/device.h> | ||
27 | #include <linux/list.h> | ||
28 | |||
29 | /* A few generic types ... taken from ses-2 */ | ||
30 | enum enclosure_component_type { | ||
31 | ENCLOSURE_COMPONENT_DEVICE = 0x01, | ||
32 | ENCLOSURE_COMPONENT_ARRAY_DEVICE = 0x17, | ||
33 | }; | ||
34 | |||
35 | /* ses-2 common element status */ | ||
36 | enum enclosure_status { | ||
37 | ENCLOSURE_STATUS_UNSUPPORTED = 0, | ||
38 | ENCLOSURE_STATUS_OK, | ||
39 | ENCLOSURE_STATUS_CRITICAL, | ||
40 | ENCLOSURE_STATUS_NON_CRITICAL, | ||
41 | ENCLOSURE_STATUS_UNRECOVERABLE, | ||
42 | ENCLOSURE_STATUS_NOT_INSTALLED, | ||
43 | ENCLOSURE_STATUS_UNKNOWN, | ||
44 | ENCLOSURE_STATUS_UNAVAILABLE, | ||
45 | }; | ||
46 | |||
47 | /* SFF-8485 activity light settings */ | ||
48 | enum enclosure_component_setting { | ||
49 | ENCLOSURE_SETTING_DISABLED = 0, | ||
50 | ENCLOSURE_SETTING_ENABLED = 1, | ||
51 | ENCLOSURE_SETTING_BLINK_A_ON_OFF = 2, | ||
52 | ENCLOSURE_SETTING_BLINK_A_OFF_ON = 3, | ||
53 | ENCLOSURE_SETTING_BLINK_B_ON_OFF = 6, | ||
54 | ENCLOSURE_SETTING_BLINK_B_OFF_ON = 7, | ||
55 | }; | ||
56 | |||
57 | struct enclosure_device; | ||
58 | struct enclosure_component; | ||
59 | struct enclosure_component_callbacks { | ||
60 | void (*get_status)(struct enclosure_device *, | ||
61 | struct enclosure_component *); | ||
62 | int (*set_status)(struct enclosure_device *, | ||
63 | struct enclosure_component *, | ||
64 | enum enclosure_status); | ||
65 | void (*get_fault)(struct enclosure_device *, | ||
66 | struct enclosure_component *); | ||
67 | int (*set_fault)(struct enclosure_device *, | ||
68 | struct enclosure_component *, | ||
69 | enum enclosure_component_setting); | ||
70 | void (*get_active)(struct enclosure_device *, | ||
71 | struct enclosure_component *); | ||
72 | int (*set_active)(struct enclosure_device *, | ||
73 | struct enclosure_component *, | ||
74 | enum enclosure_component_setting); | ||
75 | void (*get_locate)(struct enclosure_device *, | ||
76 | struct enclosure_component *); | ||
77 | int (*set_locate)(struct enclosure_device *, | ||
78 | struct enclosure_component *, | ||
79 | enum enclosure_component_setting); | ||
80 | }; | ||
81 | |||
82 | |||
83 | struct enclosure_component { | ||
84 | void *scratch; | ||
85 | struct class_device cdev; | ||
86 | enum enclosure_component_type type; | ||
87 | int number; | ||
88 | int fault; | ||
89 | int active; | ||
90 | int locate; | ||
91 | enum enclosure_status status; | ||
92 | }; | ||
93 | |||
94 | struct enclosure_device { | ||
95 | void *scratch; | ||
96 | struct list_head node; | ||
97 | struct class_device cdev; | ||
98 | struct enclosure_component_callbacks *cb; | ||
99 | int components; | ||
100 | struct enclosure_component component[0]; | ||
101 | }; | ||
102 | |||
103 | static inline struct enclosure_device * | ||
104 | to_enclosure_device(struct class_device *dev) | ||
105 | { | ||
106 | return container_of(dev, struct enclosure_device, cdev); | ||
107 | } | ||
108 | |||
109 | static inline struct enclosure_component * | ||
110 | to_enclosure_component(struct class_device *dev) | ||
111 | { | ||
112 | return container_of(dev, struct enclosure_component, cdev); | ||
113 | } | ||
114 | |||
115 | struct enclosure_device * | ||
116 | enclosure_register(struct device *, const char *, int, | ||
117 | struct enclosure_component_callbacks *); | ||
118 | void enclosure_unregister(struct enclosure_device *); | ||
119 | struct enclosure_component * | ||
120 | enclosure_component_register(struct enclosure_device *, unsigned int, | ||
121 | enum enclosure_component_type, const char *); | ||
122 | int enclosure_add_device(struct enclosure_device *enclosure, int component, | ||
123 | struct device *dev); | ||
124 | int enclosure_remove_device(struct enclosure_device *enclosure, int component); | ||
125 | struct enclosure_device *enclosure_find(struct device *dev); | ||
126 | int enclosure_for_each_device(int (*fn)(struct enclosure_device *, void *), | ||
127 | void *data); | ||
128 | |||
129 | #endif /* _LINUX_ENCLOSURE_H_ */ | ||
diff --git a/include/linux/hrtimer.h b/include/linux/hrtimer.h index 8371b664b41f..203591e23210 100644 --- a/include/linux/hrtimer.h +++ b/include/linux/hrtimer.h | |||
@@ -225,11 +225,14 @@ static inline int hrtimer_is_hres_active(struct hrtimer *timer) | |||
225 | * idea of the (in)accuracy of timers. Timer values are rounded up to | 225 | * idea of the (in)accuracy of timers. Timer values are rounded up to |
226 | * this resolution values. | 226 | * this resolution values. |
227 | */ | 227 | */ |
228 | # define KTIME_HIGH_RES (ktime_t) { .tv64 = 1 } | 228 | # define HIGH_RES_NSEC 1 |
229 | # define KTIME_HIGH_RES (ktime_t) { .tv64 = HIGH_RES_NSEC } | ||
230 | # define MONOTONIC_RES_NSEC HIGH_RES_NSEC | ||
229 | # define KTIME_MONOTONIC_RES KTIME_HIGH_RES | 231 | # define KTIME_MONOTONIC_RES KTIME_HIGH_RES |
230 | 232 | ||
231 | #else | 233 | #else |
232 | 234 | ||
235 | # define MONOTONIC_RES_NSEC LOW_RES_NSEC | ||
233 | # define KTIME_MONOTONIC_RES KTIME_LOW_RES | 236 | # define KTIME_MONOTONIC_RES KTIME_LOW_RES |
234 | 237 | ||
235 | /* | 238 | /* |
diff --git a/include/linux/input.h b/include/linux/input.h index 056a17a4f34f..1bdc39a8c76c 100644 --- a/include/linux/input.h +++ b/include/linux/input.h | |||
@@ -1020,7 +1020,6 @@ struct ff_effect { | |||
1020 | * @going_away: marks devices that are in a middle of unregistering and | 1020 | * @going_away: marks devices that are in a middle of unregistering and |
1021 | * causes input_open_device*() fail with -ENODEV. | 1021 | * causes input_open_device*() fail with -ENODEV. |
1022 | * @dev: driver model's view of this device | 1022 | * @dev: driver model's view of this device |
1023 | * @cdev: union for struct device pointer | ||
1024 | * @h_list: list of input handles associated with the device. When | 1023 | * @h_list: list of input handles associated with the device. When |
1025 | * accessing the list dev->mutex must be held | 1024 | * accessing the list dev->mutex must be held |
1026 | * @node: used to place the device onto input_dev_list | 1025 | * @node: used to place the device onto input_dev_list |
@@ -1085,9 +1084,6 @@ struct input_dev { | |||
1085 | int going_away; | 1084 | int going_away; |
1086 | 1085 | ||
1087 | struct device dev; | 1086 | struct device dev; |
1088 | union { /* temporarily so while we switching to struct device */ | ||
1089 | struct device *dev; | ||
1090 | } cdev; | ||
1091 | 1087 | ||
1092 | struct list_head h_list; | 1088 | struct list_head h_list; |
1093 | struct list_head node; | 1089 | struct list_head node; |
@@ -1311,6 +1307,9 @@ static inline void input_set_abs_params(struct input_dev *dev, int axis, int min | |||
1311 | dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); | 1307 | dev->absbit[BIT_WORD(axis)] |= BIT_MASK(axis); |
1312 | } | 1308 | } |
1313 | 1309 | ||
1310 | int input_get_keycode(struct input_dev *dev, int scancode, int *keycode); | ||
1311 | int input_set_keycode(struct input_dev *dev, int scancode, int keycode); | ||
1312 | |||
1314 | extern struct class input_class; | 1313 | extern struct class input_class; |
1315 | 1314 | ||
1316 | /** | 1315 | /** |
diff --git a/include/linux/ktime.h b/include/linux/ktime.h index a6ddec141f96..36c542b70c6d 100644 --- a/include/linux/ktime.h +++ b/include/linux/ktime.h | |||
@@ -316,7 +316,8 @@ static inline ktime_t ktime_sub_us(const ktime_t kt, const u64 usec) | |||
316 | * idea of the (in)accuracy of timers. Timer values are rounded up to | 316 | * idea of the (in)accuracy of timers. Timer values are rounded up to |
317 | * this resolution values. | 317 | * this resolution values. |
318 | */ | 318 | */ |
319 | #define KTIME_LOW_RES (ktime_t){ .tv64 = TICK_NSEC } | 319 | #define LOW_RES_NSEC TICK_NSEC |
320 | #define KTIME_LOW_RES (ktime_t){ .tv64 = LOW_RES_NSEC } | ||
320 | 321 | ||
321 | /* Get the monotonic time in timespec format: */ | 322 | /* Get the monotonic time in timespec format: */ |
322 | extern void ktime_get_ts(struct timespec *ts); | 323 | extern void ktime_get_ts(struct timespec *ts); |