aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/misc/thinkpad_acpi.h
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@debian.org>2007-04-21 10:08:33 -0400
committerLen Brown <len.brown@intel.com>2007-04-21 23:30:33 -0400
commita5763f2223ce3fdbc75923f8c948fc7b59ed2f96 (patch)
tree1995d92dbebe9727c9abb7107d9e1fa84ed2d792 /drivers/misc/thinkpad_acpi.h
parentfe08bc4b4fd1371fad111675a564e4d2ebbf39ea (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.h51
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 */
118static struct proc_dir_entry *proc_dir; 119static struct proc_dir_entry *proc_dir;
119static int thinkpad_acpi_driver_init(void);
120static int thinkpad_acpi_driver_read(char *p);
121 120
122/* procfs helpers */ 121/* procfs helpers */
123static int dispatch_read(char *page, char **start, off_t off, int count, 122static 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
143struct ibm_struct { 142struct 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
168static struct ibm_struct ibms[]; 167struct ibm_init_struct {
168 char param[32];
169
170 int (*init) (struct ibm_init_struct *);
171 struct ibm_struct *data;
172};
173
174static struct list_head tpacpi_all_drivers;
175
176static struct ibm_init_struct ibms_init[];
169static int set_ibm_param(const char *val, struct kernel_param *kp); 177static int set_ibm_param(const char *val, struct kernel_param *kp);
170static int ibm_init(struct ibm_struct *ibm); 178static int ibm_init(struct ibm_init_struct *iibm);
171static void ibm_exit(struct ibm_struct *ibm); 179static void ibm_exit(struct ibm_struct *ibm);
172 180
173/* ACPI devices */ 181
174static void dispatch_notify(acpi_handle handle, u32 event, void *data); 182/*
175static int setup_notify(struct ibm_struct *ibm); 183 * procfs master subdriver
176static int ibm_device_add(struct acpi_device *device); 184 */
177static int register_tpacpi_subdriver(struct ibm_struct *ibm); 185static int thinkpad_acpi_driver_init(struct ibm_init_struct *iibm);
186static 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;
188static acpi_handle bay_handle, bay_ej_handle; 197static acpi_handle bay_handle, bay_ej_handle;
189static acpi_handle bay2_handle, bay2_ej_handle; 198static acpi_handle bay2_handle, bay2_ej_handle;
190 199
191static int bay_init(void); 200static int bay_init(struct ibm_init_struct *iibm);
192static void bay_notify(struct ibm_struct *ibm, u32 event); 201static void bay_notify(struct ibm_struct *ibm, u32 event);
193static int bay_read(char *p); 202static int bay_read(char *p);
194static int bay_write(char *buf); 203static int bay_write(char *buf);
@@ -211,7 +220,7 @@ static int beep_write(char *buf);
211 220
212static int bluetooth_supported; 221static int bluetooth_supported;
213 222
214static int bluetooth_init(void); 223static int bluetooth_init(struct ibm_init_struct *iibm);
215static int bluetooth_status(void); 224static int bluetooth_status(void);
216static int bluetooth_read(char *p); 225static int bluetooth_read(char *p);
217static int bluetooth_write(char *buf); 226static int bluetooth_write(char *buf);
@@ -224,7 +233,7 @@ static int bluetooth_write(char *buf);
224static struct backlight_device *ibm_backlight_device; 233static struct backlight_device *ibm_backlight_device;
225static int brightness_offset = 0x31; 234static int brightness_offset = 0x31;
226 235
227static int brightness_init(void); 236static int brightness_init(struct ibm_init_struct *iibm);
228static void brightness_exit(void); 237static void brightness_exit(void);
229static int brightness_get(struct backlight_device *bd); 238static int brightness_get(struct backlight_device *bd);
230static int brightness_set(int value); 239static int brightness_set(int value);
@@ -306,7 +315,7 @@ static int fan_watchdog_maxinterval;
306 315
307static acpi_handle fans_handle, gfan_handle, sfan_handle; 316static acpi_handle fans_handle, gfan_handle, sfan_handle;
308 317
309static int fan_init(void); 318static int fan_init(struct ibm_init_struct *iibm);
310static void fan_exit(void); 319static void fan_exit(void);
311static int fan_get_status(u8 *status); 320static int fan_get_status(u8 *status);
312static int fan_get_speed(unsigned int *speed); 321static int fan_get_speed(unsigned int *speed);
@@ -334,7 +343,7 @@ static int hotkey_mask_supported;
334static int hotkey_orig_status; 343static int hotkey_orig_status;
335static int hotkey_orig_mask; 344static int hotkey_orig_mask;
336 345
337static int hotkey_init(void); 346static int hotkey_init(struct ibm_init_struct *iibm);
338static void hotkey_exit(void); 347static void hotkey_exit(void);
339static int hotkey_get(int *status, int *mask); 348static int hotkey_get(int *status, int *mask);
340static int hotkey_set(int status, int mask); 349static int hotkey_set(int status, int mask);
@@ -363,7 +372,7 @@ enum { /* For TPACPI_LED_OLD */
363static enum led_access_mode led_supported; 372static enum led_access_mode led_supported;
364static acpi_handle led_handle; 373static acpi_handle led_handle;
365 374
366static int led_init(void); 375static int led_init(struct ibm_init_struct *iibm);
367static int led_read(char *p); 376static int led_read(char *p);
368static int led_write(char *buf); 377static int led_write(char *buf);
369 378
@@ -375,7 +384,7 @@ static int light_supported;
375static int light_status_supported; 384static int light_status_supported;
376static acpi_handle lght_handle, ledb_handle; 385static acpi_handle lght_handle, ledb_handle;
377 386
378static int light_init(void); 387static int light_init(struct ibm_init_struct *iibm);
379static int light_read(char *p); 388static int light_read(char *p);
380static int light_write(char *buf); 389static 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
400static int thermal_init(void); 409static int thermal_init(struct ibm_init_struct *iibm);
401static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s); 410static int thermal_get_sensors(struct ibm_thermal_sensors_struct *s);
402static int thermal_read(char *p); 411static int thermal_read(char *p);
403 412
@@ -417,7 +426,7 @@ static enum video_access_mode video_supported;
417static int video_orig_autosw; 426static int video_orig_autosw;
418static acpi_handle vid_handle, vid2_handle; 427static acpi_handle vid_handle, vid2_handle;
419 428
420static int video_init(void); 429static int video_init(struct ibm_init_struct *iibm);
421static void video_exit(void); 430static void video_exit(void);
422static int video_status(void); 431static int video_status(void);
423static int video_autosw(void); 432static int video_autosw(void);
@@ -444,7 +453,7 @@ static int volume_write(char *buf);
444 453
445static int wan_supported; 454static int wan_supported;
446 455
447static int wan_init(void); 456static int wan_init(struct ibm_init_struct *iibm);
448static int wan_status(void); 457static int wan_status(void);
449static int wan_read(char *p); 458static int wan_read(char *p);
450static int wan_write(char *buf); 459static int wan_write(char *buf);