diff options
author | Henrique de Moraes Holschuh <hmh@debian.org> | 2007-04-21 10:08:33 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2007-04-21 23:30:33 -0400 |
commit | a5763f2223ce3fdbc75923f8c948fc7b59ed2f96 (patch) | |
tree | 1995d92dbebe9727c9abb7107d9e1fa84ed2d792 /drivers/misc/thinkpad_acpi.h | |
parent | fe08bc4b4fd1371fad111675a564e4d2ebbf39ea (diff) |
ACPI: thinkpad-acpi: uncouple subdriver init from ibms struct
Move the .init method from ibms struct to another struct, and use a list
head to control which subdrivers have been activated.
This allows us to have the subdriver init methods marked __init, saving
quite a lot of .text size, and even a bit of .data size as some data can
now be made __initdata.
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/misc/thinkpad_acpi.h')
-rw-r--r-- | drivers/misc/thinkpad_acpi.h | 51 |
1 files changed, 30 insertions, 21 deletions
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h index beb1447a7f3f..97467b71b727 100644 --- a/drivers/misc/thinkpad_acpi.h +++ b/drivers/misc/thinkpad_acpi.h | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/string.h> | 31 | #include <linux/string.h> |
32 | #include <linux/list.h> | ||
32 | 33 | ||
33 | #include <linux/proc_fs.h> | 34 | #include <linux/proc_fs.h> |
34 | #include <linux/backlight.h> | 35 | #include <linux/backlight.h> |
@@ -116,8 +117,6 @@ static void ibm_handle_init(char *name, | |||
116 | 117 | ||
117 | /* procfs support */ | 118 | /* procfs support */ |
118 | static struct proc_dir_entry *proc_dir; | 119 | static struct proc_dir_entry *proc_dir; |
119 | static int thinkpad_acpi_driver_init(void); | ||
120 | static int thinkpad_acpi_driver_read(char *p); | ||
121 | 120 | ||
122 | /* procfs helpers */ | 121 | /* procfs helpers */ |
123 | static int dispatch_read(char *page, char **start, off_t off, int count, | 122 | static int dispatch_read(char *page, char **start, off_t off, int count, |
@@ -142,12 +141,10 @@ static void thinkpad_acpi_module_exit(void); | |||
142 | 141 | ||
143 | struct ibm_struct { | 142 | struct ibm_struct { |
144 | char *name; | 143 | char *name; |
145 | char param[32]; | ||
146 | 144 | ||
147 | char *hid; | 145 | char *hid; |
148 | struct acpi_driver *driver; | 146 | struct acpi_driver *driver; |
149 | 147 | ||
150 | int (*init) (void); | ||
151 | int (*read) (char *); | 148 | int (*read) (char *); |
152 | int (*write) (char *); | 149 | int (*write) (char *); |
153 | void (*exit) (void); | 150 | void (*exit) (void); |
@@ -157,6 +154,8 @@ struct ibm_struct { | |||
157 | int type; | 154 | int type; |
158 | struct acpi_device *device; | 155 | struct acpi_device *device; |
159 | 156 | ||
157 | struct list_head all_drivers; | ||
158 | |||
160 | int driver_registered; | 159 | int driver_registered; |
161 | int proc_created; | 160 | int proc_created; |
162 | int init_called; | 161 | int init_called; |
@@ -165,16 +164,26 @@ struct ibm_struct { | |||
165 | int experimental; | 164 | int experimental; |
166 | }; | 165 | }; |
167 | 166 | ||
168 | static struct ibm_struct ibms[]; | 167 | struct ibm_init_struct { |
168 | char param[32]; | ||
169 | |||
170 | int (*init) (struct ibm_init_struct *); | ||
171 | struct ibm_struct *data; | ||
172 | }; | ||
173 | |||
174 | static struct list_head tpacpi_all_drivers; | ||
175 | |||
176 | static struct ibm_init_struct ibms_init[]; | ||
169 | static int set_ibm_param(const char *val, struct kernel_param *kp); | 177 | static int set_ibm_param(const char *val, struct kernel_param *kp); |
170 | static int ibm_init(struct ibm_struct *ibm); | 178 | static int ibm_init(struct ibm_init_struct *iibm); |
171 | static void ibm_exit(struct ibm_struct *ibm); | 179 | static void ibm_exit(struct ibm_struct *ibm); |
172 | 180 | ||
173 | /* ACPI devices */ | 181 | |
174 | static void dispatch_notify(acpi_handle handle, u32 event, void *data); | 182 | /* |
175 | static int setup_notify(struct ibm_struct *ibm); | 183 | * procfs master subdriver |
176 | static int ibm_device_add(struct acpi_device *device); | 184 | */ |
177 | static int register_tpacpi_subdriver(struct ibm_struct *ibm); | 185 | static int thinkpad_acpi_driver_init(struct ibm_init_struct *iibm); |
186 | static int thinkpad_acpi_driver_read(char *p); | ||
178 | 187 | ||
179 | 188 | ||
180 | /* | 189 | /* |
@@ -188,7 +197,7 @@ static int bay_status2_supported, bay_eject2_supported; | |||
188 | static acpi_handle bay_handle, bay_ej_handle; | 197 | static acpi_handle bay_handle, bay_ej_handle; |
189 | static acpi_handle bay2_handle, bay2_ej_handle; | 198 | static acpi_handle bay2_handle, bay2_ej_handle; |
190 | 199 | ||
191 | static int bay_init(void); | 200 | static int bay_init(struct ibm_init_struct *iibm); |
192 | static void bay_notify(struct ibm_struct *ibm, u32 event); | 201 | static void bay_notify(struct ibm_struct *ibm, u32 event); |
193 | static int bay_read(char *p); | 202 | static int bay_read(char *p); |
194 | static int bay_write(char *buf); | 203 | static int bay_write(char *buf); |
@@ -211,7 +220,7 @@ static int beep_write(char *buf); | |||
211 | 220 | ||
212 | static int bluetooth_supported; | 221 | static int bluetooth_supported; |
213 | 222 | ||
214 | static int bluetooth_init(void); | 223 | static int bluetooth_init(struct ibm_init_struct *iibm); |
215 | static int bluetooth_status(void); | 224 | static int bluetooth_status(void); |
216 | static int bluetooth_read(char *p); | 225 | static int bluetooth_read(char *p); |
217 | static int bluetooth_write(char *buf); | 226 | static int bluetooth_write(char *buf); |
@@ -224,7 +233,7 @@ static int bluetooth_write(char *buf); | |||
224 | static struct backlight_device *ibm_backlight_device; | 233 | static struct backlight_device *ibm_backlight_device; |
225 | static int brightness_offset = 0x31; | 234 | static int brightness_offset = 0x31; |
226 | 235 | ||
227 | static int brightness_init(void); | 236 | static int brightness_init(struct ibm_init_struct *iibm); |
228 | static void brightness_exit(void); | 237 | static void brightness_exit(void); |
229 | static int brightness_get(struct backlight_device *bd); | 238 | static int brightness_get(struct backlight_device *bd); |
230 | static int brightness_set(int value); | 239 | static int brightness_set(int value); |
@@ -306,7 +315,7 @@ static int fan_watchdog_maxinterval; | |||
306 | 315 | ||
307 | static acpi_handle fans_handle, gfan_handle, sfan_handle; | 316 | static acpi_handle fans_handle, gfan_handle, sfan_handle; |
308 | 317 | ||
309 | static int fan_init(void); | 318 | static int fan_init(struct ibm_init_struct *iibm); |
310 | static void fan_exit(void); | 319 | static void fan_exit(void); |
311 | static int fan_get_status(u8 *status); | 320 | static int fan_get_status(u8 *status); |
312 | static int fan_get_speed(unsigned int *speed); | 321 | static int fan_get_speed(unsigned int *speed); |
@@ -334,7 +343,7 @@ static int hotkey_mask_supported; | |||
334 | static int hotkey_orig_status; | 343 | static int hotkey_orig_status; |
335 | static int hotkey_orig_mask; | 344 | static int hotkey_orig_mask; |
336 | 345 | ||
337 | static int hotkey_init(void); | 346 | static int hotkey_init(struct ibm_init_struct *iibm); |
338 | static void hotkey_exit(void); | 347 | static void hotkey_exit(void); |
339 | static int hotkey_get(int *status, int *mask); | 348 | static int hotkey_get(int *status, int *mask); |
340 | static int hotkey_set(int status, int mask); | 349 | static int hotkey_set(int status, int mask); |
@@ -363,7 +372,7 @@ enum { /* For TPACPI_LED_OLD */ | |||
363 | static enum led_access_mode led_supported; | 372 | static enum led_access_mode led_supported; |
364 | static acpi_handle led_handle; | 373 | static acpi_handle led_handle; |
365 | 374 | ||
366 | static int led_init(void); | 375 | static int led_init(struct ibm_init_struct *iibm); |
367 | static int led_read(char *p); | 376 | static int led_read(char *p); |
368 | static int led_write(char *buf); | 377 | static int led_write(char *buf); |
369 | 378 | ||
@@ -375,7 +384,7 @@ static int light_supported; | |||
375 | static int light_status_supported; | 384 | static int light_status_supported; |
376 | static acpi_handle lght_handle, ledb_handle; | 385 | static acpi_handle lght_handle, ledb_handle; |
377 | 386 | ||
378 | static int light_init(void); | 387 | static int light_init(struct ibm_init_struct *iibm); |
379 | static int light_read(char *p); | 388 | static int light_read(char *p); |
380 | static int light_write(char *buf); | 389 | static int light_write(char *buf); |
381 | 390 | ||
@@ -397,7 +406,7 @@ struct ibm_thermal_sensors_struct { | |||
397 | s32 temp[TPACPI_MAX_THERMAL_SENSORS]; | 406 | s32 temp[TPACPI_MAX_THERMAL_SENSORS]; |
398 | }; | 407 | }; |
399 | 408 | ||
400 | static int thermal_init(void); | 409 | static int thermal_init(struct ibm_init_struct *iibm); |
401 | static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s); | 410 | static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s); |
402 | static int thermal_read(char *p); | 411 | static int thermal_read(char *p); |
403 | 412 | ||
@@ -417,7 +426,7 @@ static enum video_access_mode video_supported; | |||
417 | static int video_orig_autosw; | 426 | static int video_orig_autosw; |
418 | static acpi_handle vid_handle, vid2_handle; | 427 | static acpi_handle vid_handle, vid2_handle; |
419 | 428 | ||
420 | static int video_init(void); | 429 | static int video_init(struct ibm_init_struct *iibm); |
421 | static void video_exit(void); | 430 | static void video_exit(void); |
422 | static int video_status(void); | 431 | static int video_status(void); |
423 | static int video_autosw(void); | 432 | static int video_autosw(void); |
@@ -444,7 +453,7 @@ static int volume_write(char *buf); | |||
444 | 453 | ||
445 | static int wan_supported; | 454 | static int wan_supported; |
446 | 455 | ||
447 | static int wan_init(void); | 456 | static int wan_init(struct ibm_init_struct *iibm); |
448 | static int wan_status(void); | 457 | static int wan_status(void); |
449 | static int wan_read(char *p); | 458 | static int wan_read(char *p); |
450 | static int wan_write(char *buf); | 459 | static int wan_write(char *buf); |