diff options
Diffstat (limited to 'drivers')
118 files changed, 3223 insertions, 1621 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 986410e7b483..ba13896cae40 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -133,9 +133,10 @@ config ACPI_HOTKEY | |||
133 | depends on ACPI_INTERPRETER | 133 | depends on ACPI_INTERPRETER |
134 | depends on EXPERIMENTAL | 134 | depends on EXPERIMENTAL |
135 | depends on !IA64_SGI_SN | 135 | depends on !IA64_SGI_SN |
136 | default m | 136 | default n |
137 | help | 137 | help |
138 | ACPI generic hotkey | 138 | Experimental consolidated hotkey driver. |
139 | If you are unsure, say N. | ||
139 | 140 | ||
140 | config ACPI_FAN | 141 | config ACPI_FAN |
141 | tristate "Fan" | 142 | tristate "Fan" |
diff --git a/drivers/acpi/button.c b/drivers/acpi/button.c index 0f45d45f05a0..8162fd0c21a7 100644 --- a/drivers/acpi/button.c +++ b/drivers/acpi/button.c | |||
@@ -26,6 +26,9 @@ | |||
26 | #include <linux/kernel.h> | 26 | #include <linux/kernel.h> |
27 | #include <linux/module.h> | 27 | #include <linux/module.h> |
28 | #include <linux/init.h> | 28 | #include <linux/init.h> |
29 | #include <linux/types.h> | ||
30 | #include <linux/proc_fs.h> | ||
31 | #include <linux/seq_file.h> | ||
29 | #include <acpi/acpi_bus.h> | 32 | #include <acpi/acpi_bus.h> |
30 | #include <acpi/acpi_drivers.h> | 33 | #include <acpi/acpi_drivers.h> |
31 | 34 | ||
@@ -33,6 +36,9 @@ | |||
33 | #define ACPI_BUTTON_COMPONENT 0x00080000 | 36 | #define ACPI_BUTTON_COMPONENT 0x00080000 |
34 | #define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver" | 37 | #define ACPI_BUTTON_DRIVER_NAME "ACPI Button Driver" |
35 | #define ACPI_BUTTON_CLASS "button" | 38 | #define ACPI_BUTTON_CLASS "button" |
39 | #define ACPI_BUTTON_FILE_INFO "info" | ||
40 | #define ACPI_BUTTON_FILE_STATE "state" | ||
41 | #define ACPI_BUTTON_TYPE_UNKNOWN 0x00 | ||
36 | #define ACPI_BUTTON_NOTIFY_STATUS 0x80 | 42 | #define ACPI_BUTTON_NOTIFY_STATUS 0x80 |
37 | 43 | ||
38 | #define ACPI_BUTTON_SUBCLASS_POWER "power" | 44 | #define ACPI_BUTTON_SUBCLASS_POWER "power" |
@@ -64,6 +70,8 @@ MODULE_LICENSE("GPL"); | |||
64 | 70 | ||
65 | static int acpi_button_add (struct acpi_device *device); | 71 | static int acpi_button_add (struct acpi_device *device); |
66 | static int acpi_button_remove (struct acpi_device *device, int type); | 72 | static int acpi_button_remove (struct acpi_device *device, int type); |
73 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file); | ||
74 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file); | ||
67 | 75 | ||
68 | static struct acpi_driver acpi_button_driver = { | 76 | static struct acpi_driver acpi_button_driver = { |
69 | .name = ACPI_BUTTON_DRIVER_NAME, | 77 | .name = ACPI_BUTTON_DRIVER_NAME, |
@@ -82,6 +90,179 @@ struct acpi_button { | |||
82 | unsigned long pushed; | 90 | unsigned long pushed; |
83 | }; | 91 | }; |
84 | 92 | ||
93 | static struct file_operations acpi_button_info_fops = { | ||
94 | .open = acpi_button_info_open_fs, | ||
95 | .read = seq_read, | ||
96 | .llseek = seq_lseek, | ||
97 | .release = single_release, | ||
98 | }; | ||
99 | |||
100 | static struct file_operations acpi_button_state_fops = { | ||
101 | .open = acpi_button_state_open_fs, | ||
102 | .read = seq_read, | ||
103 | .llseek = seq_lseek, | ||
104 | .release = single_release, | ||
105 | }; | ||
106 | /* -------------------------------------------------------------------------- | ||
107 | FS Interface (/proc) | ||
108 | -------------------------------------------------------------------------- */ | ||
109 | |||
110 | static struct proc_dir_entry *acpi_button_dir; | ||
111 | |||
112 | static int acpi_button_info_seq_show(struct seq_file *seq, void *offset) | ||
113 | { | ||
114 | struct acpi_button *button = (struct acpi_button *) seq->private; | ||
115 | |||
116 | ACPI_FUNCTION_TRACE("acpi_button_info_seq_show"); | ||
117 | |||
118 | if (!button || !button->device) | ||
119 | return_VALUE(0); | ||
120 | |||
121 | seq_printf(seq, "type: %s\n", | ||
122 | acpi_device_name(button->device)); | ||
123 | |||
124 | return_VALUE(0); | ||
125 | } | ||
126 | |||
127 | static int acpi_button_info_open_fs(struct inode *inode, struct file *file) | ||
128 | { | ||
129 | return single_open(file, acpi_button_info_seq_show, PDE(inode)->data); | ||
130 | } | ||
131 | |||
132 | static int acpi_button_state_seq_show(struct seq_file *seq, void *offset) | ||
133 | { | ||
134 | struct acpi_button *button = (struct acpi_button *) seq->private; | ||
135 | acpi_status status; | ||
136 | unsigned long state; | ||
137 | |||
138 | ACPI_FUNCTION_TRACE("acpi_button_state_seq_show"); | ||
139 | |||
140 | if (!button || !button->device) | ||
141 | return_VALUE(0); | ||
142 | |||
143 | status = acpi_evaluate_integer(button->handle,"_LID",NULL,&state); | ||
144 | if (ACPI_FAILURE(status)) { | ||
145 | seq_printf(seq, "state: unsupported\n"); | ||
146 | } | ||
147 | else{ | ||
148 | seq_printf(seq, "state: %s\n", (state ? "open" : "closed")); | ||
149 | } | ||
150 | |||
151 | return_VALUE(0); | ||
152 | } | ||
153 | |||
154 | static int acpi_button_state_open_fs(struct inode *inode, struct file *file) | ||
155 | { | ||
156 | return single_open(file, acpi_button_state_seq_show, PDE(inode)->data); | ||
157 | } | ||
158 | |||
159 | static struct proc_dir_entry *acpi_power_dir; | ||
160 | static struct proc_dir_entry *acpi_sleep_dir; | ||
161 | static struct proc_dir_entry *acpi_lid_dir; | ||
162 | |||
163 | static int | ||
164 | acpi_button_add_fs ( | ||
165 | struct acpi_device *device) | ||
166 | { | ||
167 | struct proc_dir_entry *entry = NULL; | ||
168 | struct acpi_button *button = NULL; | ||
169 | |||
170 | ACPI_FUNCTION_TRACE("acpi_button_add_fs"); | ||
171 | |||
172 | if (!device || !acpi_driver_data(device)) | ||
173 | return_VALUE(-EINVAL); | ||
174 | |||
175 | button = acpi_driver_data(device); | ||
176 | |||
177 | switch (button->type) { | ||
178 | case ACPI_BUTTON_TYPE_POWER: | ||
179 | case ACPI_BUTTON_TYPE_POWERF: | ||
180 | if (!acpi_power_dir) | ||
181 | acpi_power_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_POWER, | ||
182 | acpi_button_dir); | ||
183 | entry = acpi_power_dir; | ||
184 | break; | ||
185 | case ACPI_BUTTON_TYPE_SLEEP: | ||
186 | case ACPI_BUTTON_TYPE_SLEEPF: | ||
187 | if (!acpi_sleep_dir) | ||
188 | acpi_sleep_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_SLEEP, | ||
189 | acpi_button_dir); | ||
190 | entry = acpi_sleep_dir; | ||
191 | break; | ||
192 | case ACPI_BUTTON_TYPE_LID: | ||
193 | if (!acpi_lid_dir) | ||
194 | acpi_lid_dir = proc_mkdir(ACPI_BUTTON_SUBCLASS_LID, | ||
195 | acpi_button_dir); | ||
196 | entry = acpi_lid_dir; | ||
197 | break; | ||
198 | } | ||
199 | |||
200 | if (!entry) | ||
201 | return_VALUE(-ENODEV); | ||
202 | entry->owner = THIS_MODULE; | ||
203 | |||
204 | acpi_device_dir(device) = proc_mkdir(acpi_device_bid(device), entry); | ||
205 | if (!acpi_device_dir(device)) | ||
206 | return_VALUE(-ENODEV); | ||
207 | acpi_device_dir(device)->owner = THIS_MODULE; | ||
208 | |||
209 | /* 'info' [R] */ | ||
210 | entry = create_proc_entry(ACPI_BUTTON_FILE_INFO, | ||
211 | S_IRUGO, acpi_device_dir(device)); | ||
212 | if (!entry) | ||
213 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
214 | "Unable to create '%s' fs entry\n", | ||
215 | ACPI_BUTTON_FILE_INFO)); | ||
216 | else { | ||
217 | entry->proc_fops = &acpi_button_info_fops; | ||
218 | entry->data = acpi_driver_data(device); | ||
219 | entry->owner = THIS_MODULE; | ||
220 | } | ||
221 | |||
222 | /* show lid state [R] */ | ||
223 | if (button->type == ACPI_BUTTON_TYPE_LID) { | ||
224 | entry = create_proc_entry(ACPI_BUTTON_FILE_STATE, | ||
225 | S_IRUGO, acpi_device_dir(device)); | ||
226 | if (!entry) | ||
227 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
228 | "Unable to create '%s' fs entry\n", | ||
229 | ACPI_BUTTON_FILE_INFO)); | ||
230 | else { | ||
231 | entry->proc_fops = &acpi_button_state_fops; | ||
232 | entry->data = acpi_driver_data(device); | ||
233 | entry->owner = THIS_MODULE; | ||
234 | } | ||
235 | } | ||
236 | |||
237 | return_VALUE(0); | ||
238 | } | ||
239 | |||
240 | |||
241 | static int | ||
242 | acpi_button_remove_fs ( | ||
243 | struct acpi_device *device) | ||
244 | { | ||
245 | struct acpi_button *button = NULL; | ||
246 | |||
247 | ACPI_FUNCTION_TRACE("acpi_button_remove_fs"); | ||
248 | |||
249 | button = acpi_driver_data(device); | ||
250 | if (acpi_device_dir(device)) { | ||
251 | if (button->type == ACPI_BUTTON_TYPE_LID) | ||
252 | remove_proc_entry(ACPI_BUTTON_FILE_STATE, | ||
253 | acpi_device_dir(device)); | ||
254 | remove_proc_entry(ACPI_BUTTON_FILE_INFO, | ||
255 | acpi_device_dir(device)); | ||
256 | |||
257 | remove_proc_entry(acpi_device_bid(device), | ||
258 | acpi_device_dir(device)->parent); | ||
259 | acpi_device_dir(device) = NULL; | ||
260 | } | ||
261 | |||
262 | return_VALUE(0); | ||
263 | } | ||
264 | |||
265 | |||
85 | /* -------------------------------------------------------------------------- | 266 | /* -------------------------------------------------------------------------- |
86 | Driver Interface | 267 | Driver Interface |
87 | -------------------------------------------------------------------------- */ | 268 | -------------------------------------------------------------------------- */ |
@@ -121,7 +302,8 @@ acpi_button_notify_fixed ( | |||
121 | 302 | ||
122 | ACPI_FUNCTION_TRACE("acpi_button_notify_fixed"); | 303 | ACPI_FUNCTION_TRACE("acpi_button_notify_fixed"); |
123 | 304 | ||
124 | BUG_ON(!button); | 305 | if (!button) |
306 | return_ACPI_STATUS(AE_BAD_PARAMETER); | ||
125 | 307 | ||
126 | acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); | 308 | acpi_button_notify(button->handle, ACPI_BUTTON_NOTIFY_STATUS, button); |
127 | 309 | ||
@@ -197,6 +379,10 @@ acpi_button_add ( | |||
197 | goto end; | 379 | goto end; |
198 | } | 380 | } |
199 | 381 | ||
382 | result = acpi_button_add_fs(device); | ||
383 | if (result) | ||
384 | goto end; | ||
385 | |||
200 | switch (button->type) { | 386 | switch (button->type) { |
201 | case ACPI_BUTTON_TYPE_POWERF: | 387 | case ACPI_BUTTON_TYPE_POWERF: |
202 | status = acpi_install_fixed_event_handler ( | 388 | status = acpi_install_fixed_event_handler ( |
@@ -240,6 +426,7 @@ acpi_button_add ( | |||
240 | 426 | ||
241 | end: | 427 | end: |
242 | if (result) { | 428 | if (result) { |
429 | acpi_button_remove_fs(device); | ||
243 | kfree(button); | 430 | kfree(button); |
244 | } | 431 | } |
245 | 432 | ||
@@ -280,6 +467,8 @@ acpi_button_remove (struct acpi_device *device, int type) | |||
280 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 467 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
281 | "Error removing notify handler\n")); | 468 | "Error removing notify handler\n")); |
282 | 469 | ||
470 | acpi_button_remove_fs(device); | ||
471 | |||
283 | kfree(button); | 472 | kfree(button); |
284 | 473 | ||
285 | return_VALUE(0); | 474 | return_VALUE(0); |
@@ -293,14 +482,20 @@ acpi_button_init (void) | |||
293 | 482 | ||
294 | ACPI_FUNCTION_TRACE("acpi_button_init"); | 483 | ACPI_FUNCTION_TRACE("acpi_button_init"); |
295 | 484 | ||
485 | acpi_button_dir = proc_mkdir(ACPI_BUTTON_CLASS, acpi_root_dir); | ||
486 | if (!acpi_button_dir) | ||
487 | return_VALUE(-ENODEV); | ||
488 | acpi_button_dir->owner = THIS_MODULE; | ||
296 | result = acpi_bus_register_driver(&acpi_button_driver); | 489 | result = acpi_bus_register_driver(&acpi_button_driver); |
297 | if (result < 0) { | 490 | if (result < 0) { |
491 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); | ||
298 | return_VALUE(-ENODEV); | 492 | return_VALUE(-ENODEV); |
299 | } | 493 | } |
300 | 494 | ||
301 | return_VALUE(0); | 495 | return_VALUE(0); |
302 | } | 496 | } |
303 | 497 | ||
498 | |||
304 | static void __exit | 499 | static void __exit |
305 | acpi_button_exit (void) | 500 | acpi_button_exit (void) |
306 | { | 501 | { |
@@ -308,8 +503,17 @@ acpi_button_exit (void) | |||
308 | 503 | ||
309 | acpi_bus_unregister_driver(&acpi_button_driver); | 504 | acpi_bus_unregister_driver(&acpi_button_driver); |
310 | 505 | ||
506 | if (acpi_power_dir) | ||
507 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_POWER, acpi_button_dir); | ||
508 | if (acpi_sleep_dir) | ||
509 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_SLEEP, acpi_button_dir); | ||
510 | if (acpi_lid_dir) | ||
511 | remove_proc_entry(ACPI_BUTTON_SUBCLASS_LID, acpi_button_dir); | ||
512 | remove_proc_entry(ACPI_BUTTON_CLASS, acpi_root_dir); | ||
513 | |||
311 | return_VOID; | 514 | return_VOID; |
312 | } | 515 | } |
313 | 516 | ||
517 | |||
314 | module_init(acpi_button_init); | 518 | module_init(acpi_button_init); |
315 | module_exit(acpi_button_exit); | 519 | module_exit(acpi_button_exit); |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index fca4140a50a9..1ac5731d45e5 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -59,76 +59,186 @@ ACPI_MODULE_NAME ("acpi_ec") | |||
59 | #define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */ | 59 | #define ACPI_EC_DELAY 50 /* Wait 50ms max. during EC ops */ |
60 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ | 60 | #define ACPI_EC_UDELAY_GLK 1000 /* Wait 1ms max. to get global lock */ |
61 | 61 | ||
62 | #define ACPI_EC_UDELAY 100 /* Poll @ 100us increments */ | ||
63 | #define ACPI_EC_UDELAY_COUNT 1000 /* Wait 10ms max. during EC ops */ | ||
64 | |||
62 | #define ACPI_EC_COMMAND_READ 0x80 | 65 | #define ACPI_EC_COMMAND_READ 0x80 |
63 | #define ACPI_EC_COMMAND_WRITE 0x81 | 66 | #define ACPI_EC_COMMAND_WRITE 0x81 |
64 | #define ACPI_EC_BURST_ENABLE 0x82 | 67 | #define ACPI_EC_BURST_ENABLE 0x82 |
65 | #define ACPI_EC_BURST_DISABLE 0x83 | 68 | #define ACPI_EC_BURST_DISABLE 0x83 |
66 | #define ACPI_EC_COMMAND_QUERY 0x84 | 69 | #define ACPI_EC_COMMAND_QUERY 0x84 |
67 | 70 | ||
68 | static int acpi_ec_add (struct acpi_device *device); | 71 | #define EC_POLLING 0xFF |
72 | #define EC_BURST 0x00 | ||
73 | |||
74 | |||
69 | static int acpi_ec_remove (struct acpi_device *device, int type); | 75 | static int acpi_ec_remove (struct acpi_device *device, int type); |
70 | static int acpi_ec_start (struct acpi_device *device); | 76 | static int acpi_ec_start (struct acpi_device *device); |
71 | static int acpi_ec_stop (struct acpi_device *device, int type); | 77 | static int acpi_ec_stop (struct acpi_device *device, int type); |
78 | static int acpi_ec_burst_add ( struct acpi_device *device); | ||
79 | static int acpi_ec_polling_add ( struct acpi_device *device); | ||
72 | 80 | ||
73 | static struct acpi_driver acpi_ec_driver = { | 81 | static struct acpi_driver acpi_ec_driver = { |
74 | .name = ACPI_EC_DRIVER_NAME, | 82 | .name = ACPI_EC_DRIVER_NAME, |
75 | .class = ACPI_EC_CLASS, | 83 | .class = ACPI_EC_CLASS, |
76 | .ids = ACPI_EC_HID, | 84 | .ids = ACPI_EC_HID, |
77 | .ops = { | 85 | .ops = { |
78 | .add = acpi_ec_add, | 86 | .add = acpi_ec_polling_add, |
79 | .remove = acpi_ec_remove, | 87 | .remove = acpi_ec_remove, |
80 | .start = acpi_ec_start, | 88 | .start = acpi_ec_start, |
81 | .stop = acpi_ec_stop, | 89 | .stop = acpi_ec_stop, |
82 | }, | 90 | }, |
83 | }; | 91 | }; |
84 | 92 | union acpi_ec { | |
85 | struct acpi_ec { | 93 | struct { |
86 | acpi_handle handle; | 94 | u32 mode; |
87 | unsigned long uid; | 95 | acpi_handle handle; |
88 | unsigned long gpe_bit; | 96 | unsigned long uid; |
89 | struct acpi_generic_address status_addr; | 97 | unsigned long gpe_bit; |
90 | struct acpi_generic_address command_addr; | 98 | struct acpi_generic_address status_addr; |
91 | struct acpi_generic_address data_addr; | 99 | struct acpi_generic_address command_addr; |
92 | unsigned long global_lock; | 100 | struct acpi_generic_address data_addr; |
93 | unsigned int expect_event; | 101 | unsigned long global_lock; |
94 | atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/ | 102 | } common; |
95 | atomic_t pending_gpe; | 103 | |
96 | struct semaphore sem; | 104 | struct { |
97 | wait_queue_head_t wait; | 105 | u32 mode; |
106 | acpi_handle handle; | ||
107 | unsigned long uid; | ||
108 | unsigned long gpe_bit; | ||
109 | struct acpi_generic_address status_addr; | ||
110 | struct acpi_generic_address command_addr; | ||
111 | struct acpi_generic_address data_addr; | ||
112 | unsigned long global_lock; | ||
113 | unsigned int expect_event; | ||
114 | atomic_t leaving_burst; /* 0 : No, 1 : Yes, 2: abort*/ | ||
115 | atomic_t pending_gpe; | ||
116 | struct semaphore sem; | ||
117 | wait_queue_head_t wait; | ||
118 | }burst; | ||
119 | |||
120 | struct { | ||
121 | u32 mode; | ||
122 | acpi_handle handle; | ||
123 | unsigned long uid; | ||
124 | unsigned long gpe_bit; | ||
125 | struct acpi_generic_address status_addr; | ||
126 | struct acpi_generic_address command_addr; | ||
127 | struct acpi_generic_address data_addr; | ||
128 | unsigned long global_lock; | ||
129 | spinlock_t lock; | ||
130 | }polling; | ||
98 | }; | 131 | }; |
99 | 132 | ||
133 | static int acpi_ec_polling_wait ( union acpi_ec *ec, u8 event); | ||
134 | static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event); | ||
135 | static int acpi_ec_polling_read ( union acpi_ec *ec, u8 address, u32 *data); | ||
136 | static int acpi_ec_burst_read( union acpi_ec *ec, u8 address, u32 *data); | ||
137 | static int acpi_ec_polling_write ( union acpi_ec *ec, u8 address, u8 data); | ||
138 | static int acpi_ec_burst_write ( union acpi_ec *ec, u8 address, u8 data); | ||
139 | static int acpi_ec_polling_query ( union acpi_ec *ec, u32 *data); | ||
140 | static int acpi_ec_burst_query ( union acpi_ec *ec, u32 *data); | ||
141 | static void acpi_ec_gpe_polling_query ( void *ec_cxt); | ||
142 | static void acpi_ec_gpe_burst_query ( void *ec_cxt); | ||
143 | static u32 acpi_ec_gpe_polling_handler ( void *data); | ||
144 | static u32 acpi_ec_gpe_burst_handler ( void *data); | ||
145 | static acpi_status __init | ||
146 | acpi_fake_ecdt_polling_callback ( | ||
147 | acpi_handle handle, | ||
148 | u32 Level, | ||
149 | void *context, | ||
150 | void **retval); | ||
151 | |||
152 | static acpi_status __init | ||
153 | acpi_fake_ecdt_burst_callback ( | ||
154 | acpi_handle handle, | ||
155 | u32 Level, | ||
156 | void *context, | ||
157 | void **retval); | ||
158 | |||
159 | static int __init | ||
160 | acpi_ec_polling_get_real_ecdt(void); | ||
161 | static int __init | ||
162 | acpi_ec_burst_get_real_ecdt(void); | ||
100 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ | 163 | /* If we find an EC via the ECDT, we need to keep a ptr to its context */ |
101 | static struct acpi_ec *ec_ecdt; | 164 | static union acpi_ec *ec_ecdt; |
102 | 165 | ||
103 | /* External interfaces use first EC only, so remember */ | 166 | /* External interfaces use first EC only, so remember */ |
104 | static struct acpi_device *first_ec; | 167 | static struct acpi_device *first_ec; |
168 | static int acpi_ec_polling_mode = EC_POLLING; | ||
105 | 169 | ||
106 | /* -------------------------------------------------------------------------- | 170 | /* -------------------------------------------------------------------------- |
107 | Transaction Management | 171 | Transaction Management |
108 | -------------------------------------------------------------------------- */ | 172 | -------------------------------------------------------------------------- */ |
109 | 173 | ||
110 | static inline u32 acpi_ec_read_status(struct acpi_ec *ec) | 174 | static inline u32 acpi_ec_read_status(union acpi_ec *ec) |
111 | { | 175 | { |
112 | u32 status = 0; | 176 | u32 status = 0; |
113 | 177 | ||
114 | acpi_hw_low_level_read(8, &status, &ec->status_addr); | 178 | acpi_hw_low_level_read(8, &status, &ec->common.status_addr); |
115 | return status; | 179 | return status; |
116 | } | 180 | } |
117 | 181 | ||
118 | static int acpi_ec_wait(struct acpi_ec *ec, unsigned int event) | 182 | static int |
183 | acpi_ec_wait ( | ||
184 | union acpi_ec *ec, | ||
185 | u8 event) | ||
186 | { | ||
187 | if (acpi_ec_polling_mode) | ||
188 | return acpi_ec_polling_wait (ec, event); | ||
189 | else | ||
190 | return acpi_ec_burst_wait (ec, event); | ||
191 | } | ||
192 | |||
193 | static int | ||
194 | acpi_ec_polling_wait ( | ||
195 | union acpi_ec *ec, | ||
196 | u8 event) | ||
197 | { | ||
198 | u32 acpi_ec_status = 0; | ||
199 | u32 i = ACPI_EC_UDELAY_COUNT; | ||
200 | |||
201 | if (!ec) | ||
202 | return -EINVAL; | ||
203 | |||
204 | /* Poll the EC status register waiting for the event to occur. */ | ||
205 | switch (event) { | ||
206 | case ACPI_EC_EVENT_OBF: | ||
207 | do { | ||
208 | acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr); | ||
209 | if (acpi_ec_status & ACPI_EC_FLAG_OBF) | ||
210 | return 0; | ||
211 | udelay(ACPI_EC_UDELAY); | ||
212 | } while (--i>0); | ||
213 | break; | ||
214 | case ACPI_EC_EVENT_IBE: | ||
215 | do { | ||
216 | acpi_hw_low_level_read(8, &acpi_ec_status, &ec->common.status_addr); | ||
217 | if (!(acpi_ec_status & ACPI_EC_FLAG_IBF)) | ||
218 | return 0; | ||
219 | udelay(ACPI_EC_UDELAY); | ||
220 | } while (--i>0); | ||
221 | break; | ||
222 | default: | ||
223 | return -EINVAL; | ||
224 | } | ||
225 | |||
226 | return -ETIME; | ||
227 | } | ||
228 | static int acpi_ec_burst_wait(union acpi_ec *ec, unsigned int event) | ||
119 | { | 229 | { |
120 | int result = 0; | 230 | int result = 0; |
121 | 231 | ||
122 | ACPI_FUNCTION_TRACE("acpi_ec_wait"); | 232 | ACPI_FUNCTION_TRACE("acpi_ec_wait"); |
123 | 233 | ||
124 | ec->expect_event = event; | 234 | ec->burst.expect_event = event; |
125 | smp_mb(); | 235 | smp_mb(); |
126 | 236 | ||
127 | result = wait_event_interruptible_timeout(ec->wait, | 237 | result = wait_event_interruptible_timeout(ec->burst.wait, |
128 | !ec->expect_event, | 238 | !ec->burst.expect_event, |
129 | msecs_to_jiffies(ACPI_EC_DELAY)); | 239 | msecs_to_jiffies(ACPI_EC_DELAY)); |
130 | 240 | ||
131 | ec->expect_event = 0; | 241 | ec->burst.expect_event = 0; |
132 | smp_mb(); | 242 | smp_mb(); |
133 | 243 | ||
134 | if (result < 0){ | 244 | if (result < 0){ |
@@ -160,7 +270,7 @@ static int acpi_ec_wait(struct acpi_ec *ec, unsigned int event) | |||
160 | 270 | ||
161 | static int | 271 | static int |
162 | acpi_ec_enter_burst_mode ( | 272 | acpi_ec_enter_burst_mode ( |
163 | struct acpi_ec *ec) | 273 | union acpi_ec *ec) |
164 | { | 274 | { |
165 | u32 tmp = 0; | 275 | u32 tmp = 0; |
166 | int status = 0; | 276 | int status = 0; |
@@ -170,43 +280,43 @@ acpi_ec_enter_burst_mode ( | |||
170 | status = acpi_ec_read_status(ec); | 280 | status = acpi_ec_read_status(ec); |
171 | if (status != -EINVAL && | 281 | if (status != -EINVAL && |
172 | !(status & ACPI_EC_FLAG_BURST)){ | 282 | !(status & ACPI_EC_FLAG_BURST)){ |
173 | acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->command_addr); | 283 | acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr); |
174 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 284 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
175 | if (status){ | 285 | if (status){ |
176 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 286 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
177 | return_VALUE(-EINVAL); | 287 | return_VALUE(-EINVAL); |
178 | } | 288 | } |
179 | acpi_hw_low_level_read(8, &tmp, &ec->data_addr); | 289 | acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); |
180 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 290 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
181 | if(tmp != 0x90 ) {/* Burst ACK byte*/ | 291 | if(tmp != 0x90 ) {/* Burst ACK byte*/ |
182 | return_VALUE(-EINVAL); | 292 | return_VALUE(-EINVAL); |
183 | } | 293 | } |
184 | } | 294 | } |
185 | 295 | ||
186 | atomic_set(&ec->leaving_burst , 0); | 296 | atomic_set(&ec->burst.leaving_burst , 0); |
187 | return_VALUE(0); | 297 | return_VALUE(0); |
188 | } | 298 | } |
189 | 299 | ||
190 | static int | 300 | static int |
191 | acpi_ec_leave_burst_mode ( | 301 | acpi_ec_leave_burst_mode ( |
192 | struct acpi_ec *ec) | 302 | union acpi_ec *ec) |
193 | { | 303 | { |
194 | int status =0; | 304 | int status =0; |
195 | 305 | ||
196 | ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); | 306 | ACPI_FUNCTION_TRACE("acpi_ec_leave_burst_mode"); |
197 | 307 | ||
198 | atomic_set(&ec->leaving_burst , 1); | 308 | atomic_set(&ec->burst.leaving_burst , 1); |
199 | status = acpi_ec_read_status(ec); | 309 | status = acpi_ec_read_status(ec); |
200 | if (status != -EINVAL && | 310 | if (status != -EINVAL && |
201 | (status & ACPI_EC_FLAG_BURST)){ | 311 | (status & ACPI_EC_FLAG_BURST)){ |
202 | acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->command_addr); | 312 | acpi_hw_low_level_write(8, ACPI_EC_BURST_DISABLE, &ec->common.command_addr); |
203 | status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); | 313 | status = acpi_ec_wait(ec, ACPI_EC_FLAG_IBF); |
204 | if (status){ | 314 | if (status){ |
205 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 315 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
206 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->wait fail\n")); | 316 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR,"------->wait fail\n")); |
207 | return_VALUE(-EINVAL); | 317 | return_VALUE(-EINVAL); |
208 | } | 318 | } |
209 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 319 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
210 | status = acpi_ec_read_status(ec); | 320 | status = acpi_ec_read_status(ec); |
211 | } | 321 | } |
212 | 322 | ||
@@ -215,7 +325,131 @@ acpi_ec_leave_burst_mode ( | |||
215 | 325 | ||
216 | static int | 326 | static int |
217 | acpi_ec_read ( | 327 | acpi_ec_read ( |
218 | struct acpi_ec *ec, | 328 | union acpi_ec *ec, |
329 | u8 address, | ||
330 | u32 *data) | ||
331 | { | ||
332 | if (acpi_ec_polling_mode) | ||
333 | return acpi_ec_polling_read(ec, address, data); | ||
334 | else | ||
335 | return acpi_ec_burst_read(ec, address, data); | ||
336 | } | ||
337 | static int | ||
338 | acpi_ec_write ( | ||
339 | union acpi_ec *ec, | ||
340 | u8 address, | ||
341 | u8 data) | ||
342 | { | ||
343 | if (acpi_ec_polling_mode) | ||
344 | return acpi_ec_polling_write(ec, address, data); | ||
345 | else | ||
346 | return acpi_ec_burst_write(ec, address, data); | ||
347 | } | ||
348 | static int | ||
349 | acpi_ec_polling_read ( | ||
350 | union acpi_ec *ec, | ||
351 | u8 address, | ||
352 | u32 *data) | ||
353 | { | ||
354 | acpi_status status = AE_OK; | ||
355 | int result = 0; | ||
356 | unsigned long flags = 0; | ||
357 | u32 glk = 0; | ||
358 | |||
359 | ACPI_FUNCTION_TRACE("acpi_ec_read"); | ||
360 | |||
361 | if (!ec || !data) | ||
362 | return_VALUE(-EINVAL); | ||
363 | |||
364 | *data = 0; | ||
365 | |||
366 | if (ec->common.global_lock) { | ||
367 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | ||
368 | if (ACPI_FAILURE(status)) | ||
369 | return_VALUE(-ENODEV); | ||
370 | } | ||
371 | |||
372 | spin_lock_irqsave(&ec->polling.lock, flags); | ||
373 | |||
374 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr); | ||
375 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | ||
376 | if (result) | ||
377 | goto end; | ||
378 | |||
379 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); | ||
380 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | ||
381 | if (result) | ||
382 | goto end; | ||
383 | |||
384 | acpi_hw_low_level_read(8, data, &ec->common.data_addr); | ||
385 | |||
386 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", | ||
387 | *data, address)); | ||
388 | |||
389 | end: | ||
390 | spin_unlock_irqrestore(&ec->polling.lock, flags); | ||
391 | |||
392 | if (ec->common.global_lock) | ||
393 | acpi_release_global_lock(glk); | ||
394 | |||
395 | return_VALUE(result); | ||
396 | } | ||
397 | |||
398 | |||
399 | static int | ||
400 | acpi_ec_polling_write ( | ||
401 | union acpi_ec *ec, | ||
402 | u8 address, | ||
403 | u8 data) | ||
404 | { | ||
405 | int result = 0; | ||
406 | acpi_status status = AE_OK; | ||
407 | unsigned long flags = 0; | ||
408 | u32 glk = 0; | ||
409 | |||
410 | ACPI_FUNCTION_TRACE("acpi_ec_write"); | ||
411 | |||
412 | if (!ec) | ||
413 | return_VALUE(-EINVAL); | ||
414 | |||
415 | if (ec->common.global_lock) { | ||
416 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | ||
417 | if (ACPI_FAILURE(status)) | ||
418 | return_VALUE(-ENODEV); | ||
419 | } | ||
420 | |||
421 | spin_lock_irqsave(&ec->polling.lock, flags); | ||
422 | |||
423 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr); | ||
424 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | ||
425 | if (result) | ||
426 | goto end; | ||
427 | |||
428 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); | ||
429 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | ||
430 | if (result) | ||
431 | goto end; | ||
432 | |||
433 | acpi_hw_low_level_write(8, data, &ec->common.data_addr); | ||
434 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | ||
435 | if (result) | ||
436 | goto end; | ||
437 | |||
438 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Wrote [%02x] to address [%02x]\n", | ||
439 | data, address)); | ||
440 | |||
441 | end: | ||
442 | spin_unlock_irqrestore(&ec->polling.lock, flags); | ||
443 | |||
444 | if (ec->common.global_lock) | ||
445 | acpi_release_global_lock(glk); | ||
446 | |||
447 | return_VALUE(result); | ||
448 | } | ||
449 | |||
450 | static int | ||
451 | acpi_ec_burst_read ( | ||
452 | union acpi_ec *ec, | ||
219 | u8 address, | 453 | u8 address, |
220 | u32 *data) | 454 | u32 *data) |
221 | { | 455 | { |
@@ -230,51 +464,51 @@ acpi_ec_read ( | |||
230 | retry: | 464 | retry: |
231 | *data = 0; | 465 | *data = 0; |
232 | 466 | ||
233 | if (ec->global_lock) { | 467 | if (ec->common.global_lock) { |
234 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 468 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
235 | if (ACPI_FAILURE(status)) | 469 | if (ACPI_FAILURE(status)) |
236 | return_VALUE(-ENODEV); | 470 | return_VALUE(-ENODEV); |
237 | } | 471 | } |
238 | 472 | ||
239 | WARN_ON(in_interrupt()); | 473 | WARN_ON(in_interrupt()); |
240 | down(&ec->sem); | 474 | down(&ec->burst.sem); |
241 | 475 | ||
242 | if(acpi_ec_enter_burst_mode(ec)) | 476 | if(acpi_ec_enter_burst_mode(ec)) |
243 | goto end; | 477 | goto end; |
244 | 478 | ||
245 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->command_addr); | 479 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_READ, &ec->common.command_addr); |
246 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 480 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
247 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 481 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
248 | if (status) { | 482 | if (status) { |
249 | goto end; | 483 | goto end; |
250 | } | 484 | } |
251 | 485 | ||
252 | acpi_hw_low_level_write(8, address, &ec->data_addr); | 486 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); |
253 | status= acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 487 | status= acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
254 | if (status){ | 488 | if (status){ |
255 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 489 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
256 | goto end; | 490 | goto end; |
257 | } | 491 | } |
258 | 492 | ||
259 | acpi_hw_low_level_read(8, data, &ec->data_addr); | 493 | acpi_hw_low_level_read(8, data, &ec->common.data_addr); |
260 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 494 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
261 | 495 | ||
262 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", | 496 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Read [%02x] from address [%02x]\n", |
263 | *data, address)); | 497 | *data, address)); |
264 | 498 | ||
265 | end: | 499 | end: |
266 | acpi_ec_leave_burst_mode(ec); | 500 | acpi_ec_leave_burst_mode(ec); |
267 | up(&ec->sem); | 501 | up(&ec->burst.sem); |
268 | 502 | ||
269 | if (ec->global_lock) | 503 | if (ec->common.global_lock) |
270 | acpi_release_global_lock(glk); | 504 | acpi_release_global_lock(glk); |
271 | 505 | ||
272 | if(atomic_read(&ec->leaving_burst) == 2){ | 506 | if(atomic_read(&ec->burst.leaving_burst) == 2){ |
273 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); | 507 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); |
274 | while(atomic_read(&ec->pending_gpe)){ | 508 | while(atomic_read(&ec->burst.pending_gpe)){ |
275 | msleep(1); | 509 | msleep(1); |
276 | } | 510 | } |
277 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 511 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
278 | goto retry; | 512 | goto retry; |
279 | } | 513 | } |
280 | 514 | ||
@@ -283,8 +517,8 @@ end: | |||
283 | 517 | ||
284 | 518 | ||
285 | static int | 519 | static int |
286 | acpi_ec_write ( | 520 | acpi_ec_burst_write ( |
287 | struct acpi_ec *ec, | 521 | union acpi_ec *ec, |
288 | u8 address, | 522 | u8 address, |
289 | u8 data) | 523 | u8 data) |
290 | { | 524 | { |
@@ -297,14 +531,14 @@ acpi_ec_write ( | |||
297 | if (!ec) | 531 | if (!ec) |
298 | return_VALUE(-EINVAL); | 532 | return_VALUE(-EINVAL); |
299 | retry: | 533 | retry: |
300 | if (ec->global_lock) { | 534 | if (ec->common.global_lock) { |
301 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 535 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
302 | if (ACPI_FAILURE(status)) | 536 | if (ACPI_FAILURE(status)) |
303 | return_VALUE(-ENODEV); | 537 | return_VALUE(-ENODEV); |
304 | } | 538 | } |
305 | 539 | ||
306 | WARN_ON(in_interrupt()); | 540 | WARN_ON(in_interrupt()); |
307 | down(&ec->sem); | 541 | down(&ec->burst.sem); |
308 | 542 | ||
309 | if(acpi_ec_enter_burst_mode(ec)) | 543 | if(acpi_ec_enter_burst_mode(ec)) |
310 | goto end; | 544 | goto end; |
@@ -312,33 +546,33 @@ retry: | |||
312 | status = acpi_ec_read_status(ec); | 546 | status = acpi_ec_read_status(ec); |
313 | if (status != -EINVAL && | 547 | if (status != -EINVAL && |
314 | !(status & ACPI_EC_FLAG_BURST)){ | 548 | !(status & ACPI_EC_FLAG_BURST)){ |
315 | acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->command_addr); | 549 | acpi_hw_low_level_write(8, ACPI_EC_BURST_ENABLE, &ec->common.command_addr); |
316 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 550 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
317 | if (status) | 551 | if (status) |
318 | goto end; | 552 | goto end; |
319 | acpi_hw_low_level_read(8, &tmp, &ec->data_addr); | 553 | acpi_hw_low_level_read(8, &tmp, &ec->common.data_addr); |
320 | if(tmp != 0x90 ) /* Burst ACK byte*/ | 554 | if(tmp != 0x90 ) /* Burst ACK byte*/ |
321 | goto end; | 555 | goto end; |
322 | } | 556 | } |
323 | /*Now we are in burst mode*/ | 557 | /*Now we are in burst mode*/ |
324 | 558 | ||
325 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->command_addr); | 559 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_WRITE, &ec->common.command_addr); |
326 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 560 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
327 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 561 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
328 | if (status){ | 562 | if (status){ |
329 | goto end; | 563 | goto end; |
330 | } | 564 | } |
331 | 565 | ||
332 | acpi_hw_low_level_write(8, address, &ec->data_addr); | 566 | acpi_hw_low_level_write(8, address, &ec->common.data_addr); |
333 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 567 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
334 | if (status){ | 568 | if (status){ |
335 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 569 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
336 | goto end; | 570 | goto end; |
337 | } | 571 | } |
338 | 572 | ||
339 | acpi_hw_low_level_write(8, data, &ec->data_addr); | 573 | acpi_hw_low_level_write(8, data, &ec->common.data_addr); |
340 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); | 574 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBE); |
341 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 575 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
342 | if (status) | 576 | if (status) |
343 | goto end; | 577 | goto end; |
344 | 578 | ||
@@ -347,17 +581,17 @@ retry: | |||
347 | 581 | ||
348 | end: | 582 | end: |
349 | acpi_ec_leave_burst_mode(ec); | 583 | acpi_ec_leave_burst_mode(ec); |
350 | up(&ec->sem); | 584 | up(&ec->burst.sem); |
351 | 585 | ||
352 | if (ec->global_lock) | 586 | if (ec->common.global_lock) |
353 | acpi_release_global_lock(glk); | 587 | acpi_release_global_lock(glk); |
354 | 588 | ||
355 | if(atomic_read(&ec->leaving_burst) == 2){ | 589 | if(atomic_read(&ec->burst.leaving_burst) == 2){ |
356 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); | 590 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); |
357 | while(atomic_read(&ec->pending_gpe)){ | 591 | while(atomic_read(&ec->burst.pending_gpe)){ |
358 | msleep(1); | 592 | msleep(1); |
359 | } | 593 | } |
360 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 594 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
361 | goto retry; | 595 | goto retry; |
362 | } | 596 | } |
363 | 597 | ||
@@ -370,7 +604,7 @@ end: | |||
370 | int | 604 | int |
371 | ec_read(u8 addr, u8 *val) | 605 | ec_read(u8 addr, u8 *val) |
372 | { | 606 | { |
373 | struct acpi_ec *ec; | 607 | union acpi_ec *ec; |
374 | int err; | 608 | int err; |
375 | u32 temp_data; | 609 | u32 temp_data; |
376 | 610 | ||
@@ -393,7 +627,7 @@ EXPORT_SYMBOL(ec_read); | |||
393 | int | 627 | int |
394 | ec_write(u8 addr, u8 val) | 628 | ec_write(u8 addr, u8 val) |
395 | { | 629 | { |
396 | struct acpi_ec *ec; | 630 | union acpi_ec *ec; |
397 | int err; | 631 | int err; |
398 | 632 | ||
399 | if (!first_ec) | 633 | if (!first_ec) |
@@ -407,10 +641,66 @@ ec_write(u8 addr, u8 val) | |||
407 | } | 641 | } |
408 | EXPORT_SYMBOL(ec_write); | 642 | EXPORT_SYMBOL(ec_write); |
409 | 643 | ||
410 | |||
411 | static int | 644 | static int |
412 | acpi_ec_query ( | 645 | acpi_ec_query ( |
413 | struct acpi_ec *ec, | 646 | union acpi_ec *ec, |
647 | u32 *data) | ||
648 | { | ||
649 | if (acpi_ec_polling_mode) | ||
650 | return acpi_ec_polling_query(ec, data); | ||
651 | else | ||
652 | return acpi_ec_burst_query(ec, data); | ||
653 | } | ||
654 | static int | ||
655 | acpi_ec_polling_query ( | ||
656 | union acpi_ec *ec, | ||
657 | u32 *data) | ||
658 | { | ||
659 | int result = 0; | ||
660 | acpi_status status = AE_OK; | ||
661 | unsigned long flags = 0; | ||
662 | u32 glk = 0; | ||
663 | |||
664 | ACPI_FUNCTION_TRACE("acpi_ec_query"); | ||
665 | |||
666 | if (!ec || !data) | ||
667 | return_VALUE(-EINVAL); | ||
668 | |||
669 | *data = 0; | ||
670 | |||
671 | if (ec->common.global_lock) { | ||
672 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | ||
673 | if (ACPI_FAILURE(status)) | ||
674 | return_VALUE(-ENODEV); | ||
675 | } | ||
676 | |||
677 | /* | ||
678 | * Query the EC to find out which _Qxx method we need to evaluate. | ||
679 | * Note that successful completion of the query causes the ACPI_EC_SCI | ||
680 | * bit to be cleared (and thus clearing the interrupt source). | ||
681 | */ | ||
682 | spin_lock_irqsave(&ec->polling.lock, flags); | ||
683 | |||
684 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr); | ||
685 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | ||
686 | if (result) | ||
687 | goto end; | ||
688 | |||
689 | acpi_hw_low_level_read(8, data, &ec->common.data_addr); | ||
690 | if (!*data) | ||
691 | result = -ENODATA; | ||
692 | |||
693 | end: | ||
694 | spin_unlock_irqrestore(&ec->polling.lock, flags); | ||
695 | |||
696 | if (ec->common.global_lock) | ||
697 | acpi_release_global_lock(glk); | ||
698 | |||
699 | return_VALUE(result); | ||
700 | } | ||
701 | static int | ||
702 | acpi_ec_burst_query ( | ||
703 | union acpi_ec *ec, | ||
414 | u32 *data) | 704 | u32 *data) |
415 | { | 705 | { |
416 | int status = 0; | 706 | int status = 0; |
@@ -422,13 +712,13 @@ acpi_ec_query ( | |||
422 | return_VALUE(-EINVAL); | 712 | return_VALUE(-EINVAL); |
423 | *data = 0; | 713 | *data = 0; |
424 | 714 | ||
425 | if (ec->global_lock) { | 715 | if (ec->common.global_lock) { |
426 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); | 716 | status = acpi_acquire_global_lock(ACPI_EC_UDELAY_GLK, &glk); |
427 | if (ACPI_FAILURE(status)) | 717 | if (ACPI_FAILURE(status)) |
428 | return_VALUE(-ENODEV); | 718 | return_VALUE(-ENODEV); |
429 | } | 719 | } |
430 | 720 | ||
431 | down(&ec->sem); | 721 | down(&ec->burst.sem); |
432 | if(acpi_ec_enter_burst_mode(ec)) | 722 | if(acpi_ec_enter_burst_mode(ec)) |
433 | goto end; | 723 | goto end; |
434 | /* | 724 | /* |
@@ -436,28 +726,28 @@ acpi_ec_query ( | |||
436 | * Note that successful completion of the query causes the ACPI_EC_SCI | 726 | * Note that successful completion of the query causes the ACPI_EC_SCI |
437 | * bit to be cleared (and thus clearing the interrupt source). | 727 | * bit to be cleared (and thus clearing the interrupt source). |
438 | */ | 728 | */ |
439 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->command_addr); | 729 | acpi_hw_low_level_write(8, ACPI_EC_COMMAND_QUERY, &ec->common.command_addr); |
440 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); | 730 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF); |
441 | if (status){ | 731 | if (status){ |
442 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 732 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
443 | goto end; | 733 | goto end; |
444 | } | 734 | } |
445 | 735 | ||
446 | acpi_hw_low_level_read(8, data, &ec->data_addr); | 736 | acpi_hw_low_level_read(8, data, &ec->common.data_addr); |
447 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 737 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
448 | if (!*data) | 738 | if (!*data) |
449 | status = -ENODATA; | 739 | status = -ENODATA; |
450 | 740 | ||
451 | end: | 741 | end: |
452 | acpi_ec_leave_burst_mode(ec); | 742 | acpi_ec_leave_burst_mode(ec); |
453 | up(&ec->sem); | 743 | up(&ec->burst.sem); |
454 | 744 | ||
455 | if (ec->global_lock) | 745 | if (ec->common.global_lock) |
456 | acpi_release_global_lock(glk); | 746 | acpi_release_global_lock(glk); |
457 | 747 | ||
458 | if(atomic_read(&ec->leaving_burst) == 2){ | 748 | if(atomic_read(&ec->burst.leaving_burst) == 2){ |
459 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); | 749 | ACPI_DEBUG_PRINT((ACPI_DB_INFO,"aborted, retry ...\n")); |
460 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 750 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
461 | status = -ENODATA; | 751 | status = -ENODATA; |
462 | } | 752 | } |
463 | return_VALUE(status); | 753 | return_VALUE(status); |
@@ -468,7 +758,7 @@ end: | |||
468 | Event Management | 758 | Event Management |
469 | -------------------------------------------------------------------------- */ | 759 | -------------------------------------------------------------------------- */ |
470 | 760 | ||
471 | struct acpi_ec_query_data { | 761 | union acpi_ec_query_data { |
472 | acpi_handle handle; | 762 | acpi_handle handle; |
473 | u8 data; | 763 | u8 data; |
474 | }; | 764 | }; |
@@ -477,7 +767,59 @@ static void | |||
477 | acpi_ec_gpe_query ( | 767 | acpi_ec_gpe_query ( |
478 | void *ec_cxt) | 768 | void *ec_cxt) |
479 | { | 769 | { |
480 | struct acpi_ec *ec = (struct acpi_ec *) ec_cxt; | 770 | if (acpi_ec_polling_mode) |
771 | acpi_ec_gpe_polling_query(ec_cxt); | ||
772 | else | ||
773 | acpi_ec_gpe_burst_query(ec_cxt); | ||
774 | } | ||
775 | |||
776 | static void | ||
777 | acpi_ec_gpe_polling_query ( | ||
778 | void *ec_cxt) | ||
779 | { | ||
780 | union acpi_ec *ec = (union acpi_ec *) ec_cxt; | ||
781 | u32 value = 0; | ||
782 | unsigned long flags = 0; | ||
783 | static char object_name[5] = {'_','Q','0','0','\0'}; | ||
784 | const char hex[] = {'0','1','2','3','4','5','6','7', | ||
785 | '8','9','A','B','C','D','E','F'}; | ||
786 | |||
787 | ACPI_FUNCTION_TRACE("acpi_ec_gpe_query"); | ||
788 | |||
789 | if (!ec_cxt) | ||
790 | goto end; | ||
791 | |||
792 | spin_lock_irqsave(&ec->polling.lock, flags); | ||
793 | acpi_hw_low_level_read(8, &value, &ec->common.command_addr); | ||
794 | spin_unlock_irqrestore(&ec->polling.lock, flags); | ||
795 | |||
796 | /* TBD: Implement asynch events! | ||
797 | * NOTE: All we care about are EC-SCI's. Other EC events are | ||
798 | * handled via polling (yuck!). This is because some systems | ||
799 | * treat EC-SCIs as level (versus EDGE!) triggered, preventing | ||
800 | * a purely interrupt-driven approach (grumble, grumble). | ||
801 | */ | ||
802 | if (!(value & ACPI_EC_FLAG_SCI)) | ||
803 | goto end; | ||
804 | |||
805 | if (acpi_ec_query(ec, &value)) | ||
806 | goto end; | ||
807 | |||
808 | object_name[2] = hex[((value >> 4) & 0x0F)]; | ||
809 | object_name[3] = hex[(value & 0x0F)]; | ||
810 | |||
811 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); | ||
812 | |||
813 | acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); | ||
814 | |||
815 | end: | ||
816 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); | ||
817 | } | ||
818 | static void | ||
819 | acpi_ec_gpe_burst_query ( | ||
820 | void *ec_cxt) | ||
821 | { | ||
822 | union acpi_ec *ec = (union acpi_ec *) ec_cxt; | ||
481 | u32 value; | 823 | u32 value; |
482 | int result = -ENODATA; | 824 | int result = -ENODATA; |
483 | static char object_name[5] = {'_','Q','0','0','\0'}; | 825 | static char object_name[5] = {'_','Q','0','0','\0'}; |
@@ -497,9 +839,9 @@ acpi_ec_gpe_query ( | |||
497 | 839 | ||
498 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); | 840 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Evaluating %s\n", object_name)); |
499 | 841 | ||
500 | acpi_evaluate_object(ec->handle, object_name, NULL, NULL); | 842 | acpi_evaluate_object(ec->common.handle, object_name, NULL, NULL); |
501 | end: | 843 | end: |
502 | atomic_dec(&ec->pending_gpe); | 844 | atomic_dec(&ec->burst.pending_gpe); |
503 | return; | 845 | return; |
504 | } | 846 | } |
505 | 847 | ||
@@ -507,48 +849,77 @@ static u32 | |||
507 | acpi_ec_gpe_handler ( | 849 | acpi_ec_gpe_handler ( |
508 | void *data) | 850 | void *data) |
509 | { | 851 | { |
852 | if (acpi_ec_polling_mode) | ||
853 | return acpi_ec_gpe_polling_handler(data); | ||
854 | else | ||
855 | return acpi_ec_gpe_burst_handler(data); | ||
856 | } | ||
857 | static u32 | ||
858 | acpi_ec_gpe_polling_handler ( | ||
859 | void *data) | ||
860 | { | ||
861 | acpi_status status = AE_OK; | ||
862 | union acpi_ec *ec = (union acpi_ec *) data; | ||
863 | |||
864 | if (!ec) | ||
865 | return ACPI_INTERRUPT_NOT_HANDLED; | ||
866 | |||
867 | acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); | ||
868 | |||
869 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | ||
870 | acpi_ec_gpe_query, ec); | ||
871 | |||
872 | if (status == AE_OK) | ||
873 | return ACPI_INTERRUPT_HANDLED; | ||
874 | else | ||
875 | return ACPI_INTERRUPT_NOT_HANDLED; | ||
876 | } | ||
877 | static u32 | ||
878 | acpi_ec_gpe_burst_handler ( | ||
879 | void *data) | ||
880 | { | ||
510 | acpi_status status = AE_OK; | 881 | acpi_status status = AE_OK; |
511 | u32 value; | 882 | u32 value; |
512 | struct acpi_ec *ec = (struct acpi_ec *) data; | 883 | union acpi_ec *ec = (union acpi_ec *) data; |
513 | 884 | ||
514 | if (!ec) | 885 | if (!ec) |
515 | return ACPI_INTERRUPT_NOT_HANDLED; | 886 | return ACPI_INTERRUPT_NOT_HANDLED; |
516 | 887 | ||
517 | acpi_disable_gpe(NULL, ec->gpe_bit, ACPI_ISR); | 888 | acpi_disable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); |
518 | 889 | ||
519 | value = acpi_ec_read_status(ec); | 890 | value = acpi_ec_read_status(ec); |
520 | 891 | ||
521 | if((value & ACPI_EC_FLAG_IBF) && | 892 | if((value & ACPI_EC_FLAG_IBF) && |
522 | !(value & ACPI_EC_FLAG_BURST) && | 893 | !(value & ACPI_EC_FLAG_BURST) && |
523 | (atomic_read(&ec->leaving_burst) == 0)) { | 894 | (atomic_read(&ec->burst.leaving_burst) == 0)) { |
524 | /* | 895 | /* |
525 | * the embedded controller disables | 896 | * the embedded controller disables |
526 | * burst mode for any reason other | 897 | * burst mode for any reason other |
527 | * than the burst disable command | 898 | * than the burst disable command |
528 | * to process critical event. | 899 | * to process critical event. |
529 | */ | 900 | */ |
530 | atomic_set(&ec->leaving_burst , 2); /* block current pending transaction | 901 | atomic_set(&ec->burst.leaving_burst , 2); /* block current pending transaction |
531 | and retry */ | 902 | and retry */ |
532 | wake_up(&ec->wait); | 903 | wake_up(&ec->burst.wait); |
533 | }else { | 904 | }else { |
534 | if ((ec->expect_event == ACPI_EC_EVENT_OBF && | 905 | if ((ec->burst.expect_event == ACPI_EC_EVENT_OBF && |
535 | (value & ACPI_EC_FLAG_OBF)) || | 906 | (value & ACPI_EC_FLAG_OBF)) || |
536 | (ec->expect_event == ACPI_EC_EVENT_IBE && | 907 | (ec->burst.expect_event == ACPI_EC_EVENT_IBE && |
537 | !(value & ACPI_EC_FLAG_IBF))) { | 908 | !(value & ACPI_EC_FLAG_IBF))) { |
538 | ec->expect_event = 0; | 909 | ec->burst.expect_event = 0; |
539 | wake_up(&ec->wait); | 910 | wake_up(&ec->burst.wait); |
540 | return ACPI_INTERRUPT_HANDLED; | 911 | return ACPI_INTERRUPT_HANDLED; |
541 | } | 912 | } |
542 | } | 913 | } |
543 | 914 | ||
544 | if (value & ACPI_EC_FLAG_SCI){ | 915 | if (value & ACPI_EC_FLAG_SCI){ |
545 | atomic_add(1, &ec->pending_gpe) ; | 916 | atomic_add(1, &ec->burst.pending_gpe) ; |
546 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, | 917 | status = acpi_os_queue_for_execution(OSD_PRIORITY_GPE, |
547 | acpi_ec_gpe_query, ec); | 918 | acpi_ec_gpe_query, ec); |
548 | return status == AE_OK ? | 919 | return status == AE_OK ? |
549 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | 920 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; |
550 | } | 921 | } |
551 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_ISR); | 922 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_ISR); |
552 | return status == AE_OK ? | 923 | return status == AE_OK ? |
553 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; | 924 | ACPI_INTERRUPT_HANDLED : ACPI_INTERRUPT_NOT_HANDLED; |
554 | } | 925 | } |
@@ -585,7 +956,7 @@ acpi_ec_space_handler ( | |||
585 | void *region_context) | 956 | void *region_context) |
586 | { | 957 | { |
587 | int result = 0; | 958 | int result = 0; |
588 | struct acpi_ec *ec = NULL; | 959 | union acpi_ec *ec = NULL; |
589 | u64 temp = *value; | 960 | u64 temp = *value; |
590 | acpi_integer f_v = 0; | 961 | acpi_integer f_v = 0; |
591 | int i = 0; | 962 | int i = 0; |
@@ -600,7 +971,7 @@ acpi_ec_space_handler ( | |||
600 | return_VALUE(AE_BAD_PARAMETER); | 971 | return_VALUE(AE_BAD_PARAMETER); |
601 | } | 972 | } |
602 | 973 | ||
603 | ec = (struct acpi_ec *) handler_context; | 974 | ec = (union acpi_ec *) handler_context; |
604 | 975 | ||
605 | next_byte: | 976 | next_byte: |
606 | switch (function) { | 977 | switch (function) { |
@@ -661,7 +1032,7 @@ static struct proc_dir_entry *acpi_ec_dir; | |||
661 | static int | 1032 | static int |
662 | acpi_ec_read_info (struct seq_file *seq, void *offset) | 1033 | acpi_ec_read_info (struct seq_file *seq, void *offset) |
663 | { | 1034 | { |
664 | struct acpi_ec *ec = (struct acpi_ec *) seq->private; | 1035 | union acpi_ec *ec = (union acpi_ec *) seq->private; |
665 | 1036 | ||
666 | ACPI_FUNCTION_TRACE("acpi_ec_read_info"); | 1037 | ACPI_FUNCTION_TRACE("acpi_ec_read_info"); |
667 | 1038 | ||
@@ -669,12 +1040,12 @@ acpi_ec_read_info (struct seq_file *seq, void *offset) | |||
669 | goto end; | 1040 | goto end; |
670 | 1041 | ||
671 | seq_printf(seq, "gpe bit: 0x%02x\n", | 1042 | seq_printf(seq, "gpe bit: 0x%02x\n", |
672 | (u32) ec->gpe_bit); | 1043 | (u32) ec->common.gpe_bit); |
673 | seq_printf(seq, "ports: 0x%02x, 0x%02x\n", | 1044 | seq_printf(seq, "ports: 0x%02x, 0x%02x\n", |
674 | (u32) ec->status_addr.address, (u32) ec->data_addr.address); | 1045 | (u32) ec->common.status_addr.address, (u32) ec->common.data_addr.address); |
675 | seq_printf(seq, "use global lock: %s\n", | 1046 | seq_printf(seq, "use global lock: %s\n", |
676 | ec->global_lock?"yes":"no"); | 1047 | ec->common.global_lock?"yes":"no"); |
677 | acpi_enable_gpe(NULL, ec->gpe_bit, ACPI_NOT_ISR); | 1048 | acpi_enable_gpe(NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
678 | 1049 | ||
679 | end: | 1050 | end: |
680 | return_VALUE(0); | 1051 | return_VALUE(0); |
@@ -697,7 +1068,7 @@ static int | |||
697 | acpi_ec_add_fs ( | 1068 | acpi_ec_add_fs ( |
698 | struct acpi_device *device) | 1069 | struct acpi_device *device) |
699 | { | 1070 | { |
700 | struct proc_dir_entry *entry; | 1071 | struct proc_dir_entry *entry = NULL; |
701 | 1072 | ||
702 | ACPI_FUNCTION_TRACE("acpi_ec_add_fs"); | 1073 | ACPI_FUNCTION_TRACE("acpi_ec_add_fs"); |
703 | 1074 | ||
@@ -744,13 +1115,14 @@ acpi_ec_remove_fs ( | |||
744 | Driver Interface | 1115 | Driver Interface |
745 | -------------------------------------------------------------------------- */ | 1116 | -------------------------------------------------------------------------- */ |
746 | 1117 | ||
1118 | |||
747 | static int | 1119 | static int |
748 | acpi_ec_add ( | 1120 | acpi_ec_polling_add ( |
749 | struct acpi_device *device) | 1121 | struct acpi_device *device) |
750 | { | 1122 | { |
751 | int result; | 1123 | int result = 0; |
752 | acpi_status status; | 1124 | acpi_status status = AE_OK; |
753 | struct acpi_ec *ec; | 1125 | union acpi_ec *ec = NULL; |
754 | unsigned long uid; | 1126 | unsigned long uid; |
755 | 1127 | ||
756 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | 1128 | ACPI_FUNCTION_TRACE("acpi_ec_add"); |
@@ -758,39 +1130,107 @@ acpi_ec_add ( | |||
758 | if (!device) | 1130 | if (!device) |
759 | return_VALUE(-EINVAL); | 1131 | return_VALUE(-EINVAL); |
760 | 1132 | ||
761 | ec = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); | 1133 | ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); |
762 | if (!ec) | 1134 | if (!ec) |
763 | return_VALUE(-ENOMEM); | 1135 | return_VALUE(-ENOMEM); |
764 | memset(ec, 0, sizeof(struct acpi_ec)); | 1136 | memset(ec, 0, sizeof(union acpi_ec)); |
765 | 1137 | ||
766 | ec->handle = device->handle; | 1138 | ec->common.handle = device->handle; |
767 | ec->uid = -1; | 1139 | ec->common.uid = -1; |
768 | atomic_set(&ec->pending_gpe, 0); | 1140 | spin_lock_init(&ec->polling.lock); |
769 | atomic_set(&ec->leaving_burst , 1); | ||
770 | init_MUTEX(&ec->sem); | ||
771 | init_waitqueue_head(&ec->wait); | ||
772 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); | 1141 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); |
773 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | 1142 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); |
774 | acpi_driver_data(device) = ec; | 1143 | acpi_driver_data(device) = ec; |
775 | 1144 | ||
776 | /* Use the global lock for all EC transactions? */ | 1145 | /* Use the global lock for all EC transactions? */ |
777 | acpi_evaluate_integer(ec->handle, "_GLK", NULL, &ec->global_lock); | 1146 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); |
778 | 1147 | ||
779 | /* If our UID matches the UID for the ECDT-enumerated EC, | 1148 | /* If our UID matches the UID for the ECDT-enumerated EC, |
780 | we now have the *real* EC info, so kill the makeshift one.*/ | 1149 | we now have the *real* EC info, so kill the makeshift one.*/ |
781 | acpi_evaluate_integer(ec->handle, "_UID", NULL, &uid); | 1150 | acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); |
782 | if (ec_ecdt && ec_ecdt->uid == uid) { | 1151 | if (ec_ecdt && ec_ecdt->common.uid == uid) { |
783 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | 1152 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, |
784 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); | 1153 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); |
1154 | |||
1155 | acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler); | ||
1156 | |||
1157 | kfree(ec_ecdt); | ||
1158 | } | ||
1159 | |||
1160 | /* Get GPE bit assignment (EC events). */ | ||
1161 | /* TODO: Add support for _GPE returning a package */ | ||
1162 | status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); | ||
1163 | if (ACPI_FAILURE(status)) { | ||
1164 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | ||
1165 | "Error obtaining GPE bit assignment\n")); | ||
1166 | result = -ENODEV; | ||
1167 | goto end; | ||
1168 | } | ||
785 | 1169 | ||
786 | acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, &acpi_ec_gpe_handler); | 1170 | result = acpi_ec_add_fs(device); |
1171 | if (result) | ||
1172 | goto end; | ||
1173 | |||
1174 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", | ||
1175 | acpi_device_name(device), acpi_device_bid(device), | ||
1176 | (u32) ec->common.gpe_bit); | ||
1177 | |||
1178 | if (!first_ec) | ||
1179 | first_ec = device; | ||
1180 | |||
1181 | end: | ||
1182 | if (result) | ||
1183 | kfree(ec); | ||
1184 | |||
1185 | return_VALUE(result); | ||
1186 | } | ||
1187 | static int | ||
1188 | acpi_ec_burst_add ( | ||
1189 | struct acpi_device *device) | ||
1190 | { | ||
1191 | int result = 0; | ||
1192 | acpi_status status = AE_OK; | ||
1193 | union acpi_ec *ec = NULL; | ||
1194 | unsigned long uid; | ||
1195 | |||
1196 | ACPI_FUNCTION_TRACE("acpi_ec_add"); | ||
1197 | |||
1198 | if (!device) | ||
1199 | return_VALUE(-EINVAL); | ||
1200 | |||
1201 | ec = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); | ||
1202 | if (!ec) | ||
1203 | return_VALUE(-ENOMEM); | ||
1204 | memset(ec, 0, sizeof(union acpi_ec)); | ||
1205 | |||
1206 | ec->common.handle = device->handle; | ||
1207 | ec->common.uid = -1; | ||
1208 | atomic_set(&ec->burst.pending_gpe, 0); | ||
1209 | atomic_set(&ec->burst.leaving_burst , 1); | ||
1210 | init_MUTEX(&ec->burst.sem); | ||
1211 | init_waitqueue_head(&ec->burst.wait); | ||
1212 | strcpy(acpi_device_name(device), ACPI_EC_DEVICE_NAME); | ||
1213 | strcpy(acpi_device_class(device), ACPI_EC_CLASS); | ||
1214 | acpi_driver_data(device) = ec; | ||
1215 | |||
1216 | /* Use the global lock for all EC transactions? */ | ||
1217 | acpi_evaluate_integer(ec->common.handle, "_GLK", NULL, &ec->common.global_lock); | ||
1218 | |||
1219 | /* If our UID matches the UID for the ECDT-enumerated EC, | ||
1220 | we now have the *real* EC info, so kill the makeshift one.*/ | ||
1221 | acpi_evaluate_integer(ec->common.handle, "_UID", NULL, &uid); | ||
1222 | if (ec_ecdt && ec_ecdt->common.uid == uid) { | ||
1223 | acpi_remove_address_space_handler(ACPI_ROOT_OBJECT, | ||
1224 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); | ||
1225 | |||
1226 | acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, &acpi_ec_gpe_handler); | ||
787 | 1227 | ||
788 | kfree(ec_ecdt); | 1228 | kfree(ec_ecdt); |
789 | } | 1229 | } |
790 | 1230 | ||
791 | /* Get GPE bit assignment (EC events). */ | 1231 | /* Get GPE bit assignment (EC events). */ |
792 | /* TODO: Add support for _GPE returning a package */ | 1232 | /* TODO: Add support for _GPE returning a package */ |
793 | status = acpi_evaluate_integer(ec->handle, "_GPE", NULL, &ec->gpe_bit); | 1233 | status = acpi_evaluate_integer(ec->common.handle, "_GPE", NULL, &ec->common.gpe_bit); |
794 | if (ACPI_FAILURE(status)) { | 1234 | if (ACPI_FAILURE(status)) { |
795 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1235 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
796 | "Error obtaining GPE bit assignment\n")); | 1236 | "Error obtaining GPE bit assignment\n")); |
@@ -804,7 +1244,7 @@ acpi_ec_add ( | |||
804 | 1244 | ||
805 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", | 1245 | printk(KERN_INFO PREFIX "%s [%s] (gpe %d)\n", |
806 | acpi_device_name(device), acpi_device_bid(device), | 1246 | acpi_device_name(device), acpi_device_bid(device), |
807 | (u32) ec->gpe_bit); | 1247 | (u32) ec->common.gpe_bit); |
808 | 1248 | ||
809 | if (!first_ec) | 1249 | if (!first_ec) |
810 | first_ec = device; | 1250 | first_ec = device; |
@@ -822,7 +1262,7 @@ acpi_ec_remove ( | |||
822 | struct acpi_device *device, | 1262 | struct acpi_device *device, |
823 | int type) | 1263 | int type) |
824 | { | 1264 | { |
825 | struct acpi_ec *ec; | 1265 | union acpi_ec *ec = NULL; |
826 | 1266 | ||
827 | ACPI_FUNCTION_TRACE("acpi_ec_remove"); | 1267 | ACPI_FUNCTION_TRACE("acpi_ec_remove"); |
828 | 1268 | ||
@@ -844,7 +1284,7 @@ acpi_ec_io_ports ( | |||
844 | struct acpi_resource *resource, | 1284 | struct acpi_resource *resource, |
845 | void *context) | 1285 | void *context) |
846 | { | 1286 | { |
847 | struct acpi_ec *ec = (struct acpi_ec *) context; | 1287 | union acpi_ec *ec = (union acpi_ec *) context; |
848 | struct acpi_generic_address *addr; | 1288 | struct acpi_generic_address *addr; |
849 | 1289 | ||
850 | if (resource->id != ACPI_RSTYPE_IO) { | 1290 | if (resource->id != ACPI_RSTYPE_IO) { |
@@ -856,10 +1296,10 @@ acpi_ec_io_ports ( | |||
856 | * the second address region returned is the status/command | 1296 | * the second address region returned is the status/command |
857 | * port. | 1297 | * port. |
858 | */ | 1298 | */ |
859 | if (ec->data_addr.register_bit_width == 0) { | 1299 | if (ec->common.data_addr.register_bit_width == 0) { |
860 | addr = &ec->data_addr; | 1300 | addr = &ec->common.data_addr; |
861 | } else if (ec->command_addr.register_bit_width == 0) { | 1301 | } else if (ec->common.command_addr.register_bit_width == 0) { |
862 | addr = &ec->command_addr; | 1302 | addr = &ec->common.command_addr; |
863 | } else { | 1303 | } else { |
864 | return AE_CTRL_TERMINATE; | 1304 | return AE_CTRL_TERMINATE; |
865 | } | 1305 | } |
@@ -877,8 +1317,8 @@ static int | |||
877 | acpi_ec_start ( | 1317 | acpi_ec_start ( |
878 | struct acpi_device *device) | 1318 | struct acpi_device *device) |
879 | { | 1319 | { |
880 | acpi_status status; | 1320 | acpi_status status = AE_OK; |
881 | struct acpi_ec *ec; | 1321 | union acpi_ec *ec = NULL; |
882 | 1322 | ||
883 | ACPI_FUNCTION_TRACE("acpi_ec_start"); | 1323 | ACPI_FUNCTION_TRACE("acpi_ec_start"); |
884 | 1324 | ||
@@ -893,35 +1333,36 @@ acpi_ec_start ( | |||
893 | /* | 1333 | /* |
894 | * Get I/O port addresses. Convert to GAS format. | 1334 | * Get I/O port addresses. Convert to GAS format. |
895 | */ | 1335 | */ |
896 | status = acpi_walk_resources(ec->handle, METHOD_NAME__CRS, | 1336 | status = acpi_walk_resources(ec->common.handle, METHOD_NAME__CRS, |
897 | acpi_ec_io_ports, ec); | 1337 | acpi_ec_io_ports, ec); |
898 | if (ACPI_FAILURE(status) || ec->command_addr.register_bit_width == 0) { | 1338 | if (ACPI_FAILURE(status) || ec->common.command_addr.register_bit_width == 0) { |
899 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error getting I/O port addresses")); | 1339 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Error getting I/O port addresses")); |
900 | return_VALUE(-ENODEV); | 1340 | return_VALUE(-ENODEV); |
901 | } | 1341 | } |
902 | 1342 | ||
903 | ec->status_addr = ec->command_addr; | 1343 | ec->common.status_addr = ec->common.command_addr; |
904 | 1344 | ||
905 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n", | 1345 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "gpe=0x%02x, ports=0x%2x,0x%2x\n", |
906 | (u32) ec->gpe_bit, (u32) ec->command_addr.address, | 1346 | (u32) ec->common.gpe_bit, (u32) ec->common.command_addr.address, |
907 | (u32) ec->data_addr.address)); | 1347 | (u32) ec->common.data_addr.address)); |
1348 | |||
908 | 1349 | ||
909 | /* | 1350 | /* |
910 | * Install GPE handler | 1351 | * Install GPE handler |
911 | */ | 1352 | */ |
912 | status = acpi_install_gpe_handler(NULL, ec->gpe_bit, | 1353 | status = acpi_install_gpe_handler(NULL, ec->common.gpe_bit, |
913 | ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec); | 1354 | ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, ec); |
914 | if (ACPI_FAILURE(status)) { | 1355 | if (ACPI_FAILURE(status)) { |
915 | return_VALUE(-ENODEV); | 1356 | return_VALUE(-ENODEV); |
916 | } | 1357 | } |
917 | acpi_set_gpe_type (NULL, ec->gpe_bit, ACPI_GPE_TYPE_RUNTIME); | 1358 | acpi_set_gpe_type (NULL, ec->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); |
918 | acpi_enable_gpe (NULL, ec->gpe_bit, ACPI_NOT_ISR); | 1359 | acpi_enable_gpe (NULL, ec->common.gpe_bit, ACPI_NOT_ISR); |
919 | 1360 | ||
920 | status = acpi_install_address_space_handler (ec->handle, | 1361 | status = acpi_install_address_space_handler (ec->common.handle, |
921 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, | 1362 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, |
922 | &acpi_ec_space_setup, ec); | 1363 | &acpi_ec_space_setup, ec); |
923 | if (ACPI_FAILURE(status)) { | 1364 | if (ACPI_FAILURE(status)) { |
924 | acpi_remove_gpe_handler(NULL, ec->gpe_bit, &acpi_ec_gpe_handler); | 1365 | acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); |
925 | return_VALUE(-ENODEV); | 1366 | return_VALUE(-ENODEV); |
926 | } | 1367 | } |
927 | 1368 | ||
@@ -934,8 +1375,8 @@ acpi_ec_stop ( | |||
934 | struct acpi_device *device, | 1375 | struct acpi_device *device, |
935 | int type) | 1376 | int type) |
936 | { | 1377 | { |
937 | acpi_status status; | 1378 | acpi_status status = AE_OK; |
938 | struct acpi_ec *ec; | 1379 | union acpi_ec *ec = NULL; |
939 | 1380 | ||
940 | ACPI_FUNCTION_TRACE("acpi_ec_stop"); | 1381 | ACPI_FUNCTION_TRACE("acpi_ec_stop"); |
941 | 1382 | ||
@@ -944,12 +1385,12 @@ acpi_ec_stop ( | |||
944 | 1385 | ||
945 | ec = acpi_driver_data(device); | 1386 | ec = acpi_driver_data(device); |
946 | 1387 | ||
947 | status = acpi_remove_address_space_handler(ec->handle, | 1388 | status = acpi_remove_address_space_handler(ec->common.handle, |
948 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); | 1389 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler); |
949 | if (ACPI_FAILURE(status)) | 1390 | if (ACPI_FAILURE(status)) |
950 | return_VALUE(-ENODEV); | 1391 | return_VALUE(-ENODEV); |
951 | 1392 | ||
952 | status = acpi_remove_gpe_handler(NULL, ec->gpe_bit, &acpi_ec_gpe_handler); | 1393 | status = acpi_remove_gpe_handler(NULL, ec->common.gpe_bit, &acpi_ec_gpe_handler); |
953 | if (ACPI_FAILURE(status)) | 1394 | if (ACPI_FAILURE(status)) |
954 | return_VALUE(-ENODEV); | 1395 | return_VALUE(-ENODEV); |
955 | 1396 | ||
@@ -963,26 +1404,76 @@ acpi_fake_ecdt_callback ( | |||
963 | void *context, | 1404 | void *context, |
964 | void **retval) | 1405 | void **retval) |
965 | { | 1406 | { |
1407 | |||
1408 | if (acpi_ec_polling_mode) | ||
1409 | return acpi_fake_ecdt_polling_callback(handle, | ||
1410 | Level, context, retval); | ||
1411 | else | ||
1412 | return acpi_fake_ecdt_burst_callback(handle, | ||
1413 | Level, context, retval); | ||
1414 | } | ||
1415 | |||
1416 | static acpi_status __init | ||
1417 | acpi_fake_ecdt_polling_callback ( | ||
1418 | acpi_handle handle, | ||
1419 | u32 Level, | ||
1420 | void *context, | ||
1421 | void **retval) | ||
1422 | { | ||
966 | acpi_status status; | 1423 | acpi_status status; |
967 | 1424 | ||
968 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | 1425 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, |
969 | acpi_ec_io_ports, ec_ecdt); | 1426 | acpi_ec_io_ports, ec_ecdt); |
970 | if (ACPI_FAILURE(status)) | 1427 | if (ACPI_FAILURE(status)) |
971 | return status; | 1428 | return status; |
972 | ec_ecdt->status_addr = ec_ecdt->command_addr; | 1429 | ec_ecdt->common.status_addr = ec_ecdt->common.command_addr; |
973 | 1430 | ||
974 | ec_ecdt->uid = -1; | 1431 | ec_ecdt->common.uid = -1; |
975 | acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->uid); | 1432 | acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid); |
976 | 1433 | ||
977 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->gpe_bit); | 1434 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit); |
978 | if (ACPI_FAILURE(status)) | 1435 | if (ACPI_FAILURE(status)) |
979 | return status; | 1436 | return status; |
980 | ec_ecdt->global_lock = TRUE; | 1437 | spin_lock_init(&ec_ecdt->polling.lock); |
981 | ec_ecdt->handle = handle; | 1438 | ec_ecdt->common.global_lock = TRUE; |
1439 | ec_ecdt->common.handle = handle; | ||
982 | 1440 | ||
983 | printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", | 1441 | printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", |
984 | (u32) ec_ecdt->gpe_bit, (u32) ec_ecdt->command_addr.address, | 1442 | (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address, |
985 | (u32) ec_ecdt->data_addr.address); | 1443 | (u32) ec_ecdt->common.data_addr.address); |
1444 | |||
1445 | return AE_CTRL_TERMINATE; | ||
1446 | } | ||
1447 | |||
1448 | static acpi_status __init | ||
1449 | acpi_fake_ecdt_burst_callback ( | ||
1450 | acpi_handle handle, | ||
1451 | u32 Level, | ||
1452 | void *context, | ||
1453 | void **retval) | ||
1454 | { | ||
1455 | acpi_status status; | ||
1456 | |||
1457 | init_MUTEX(&ec_ecdt->burst.sem); | ||
1458 | init_waitqueue_head(&ec_ecdt->burst.wait); | ||
1459 | status = acpi_walk_resources(handle, METHOD_NAME__CRS, | ||
1460 | acpi_ec_io_ports, ec_ecdt); | ||
1461 | if (ACPI_FAILURE(status)) | ||
1462 | return status; | ||
1463 | ec_ecdt->common.status_addr = ec_ecdt->common.command_addr; | ||
1464 | |||
1465 | ec_ecdt->common.uid = -1; | ||
1466 | acpi_evaluate_integer(handle, "_UID", NULL, &ec_ecdt->common.uid); | ||
1467 | |||
1468 | status = acpi_evaluate_integer(handle, "_GPE", NULL, &ec_ecdt->common.gpe_bit); | ||
1469 | if (ACPI_FAILURE(status)) | ||
1470 | return status; | ||
1471 | ec_ecdt->common.global_lock = TRUE; | ||
1472 | ec_ecdt->common.handle = handle; | ||
1473 | |||
1474 | printk(KERN_INFO PREFIX "GPE=0x%02x, ports=0x%2x, 0x%2x\n", | ||
1475 | (u32) ec_ecdt->common.gpe_bit, (u32) ec_ecdt->common.command_addr.address, | ||
1476 | (u32) ec_ecdt->common.data_addr.address); | ||
986 | 1477 | ||
987 | return AE_CTRL_TERMINATE; | 1478 | return AE_CTRL_TERMINATE; |
988 | } | 1479 | } |
@@ -1005,12 +1496,12 @@ acpi_ec_fake_ecdt(void) | |||
1005 | 1496 | ||
1006 | printk(KERN_INFO PREFIX "Try to make an fake ECDT\n"); | 1497 | printk(KERN_INFO PREFIX "Try to make an fake ECDT\n"); |
1007 | 1498 | ||
1008 | ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); | 1499 | ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); |
1009 | if (!ec_ecdt) { | 1500 | if (!ec_ecdt) { |
1010 | ret = -ENOMEM; | 1501 | ret = -ENOMEM; |
1011 | goto error; | 1502 | goto error; |
1012 | } | 1503 | } |
1013 | memset(ec_ecdt, 0, sizeof(struct acpi_ec)); | 1504 | memset(ec_ecdt, 0, sizeof(union acpi_ec)); |
1014 | 1505 | ||
1015 | status = acpi_get_devices (ACPI_EC_HID, | 1506 | status = acpi_get_devices (ACPI_EC_HID, |
1016 | acpi_fake_ecdt_callback, | 1507 | acpi_fake_ecdt_callback, |
@@ -1031,6 +1522,60 @@ error: | |||
1031 | static int __init | 1522 | static int __init |
1032 | acpi_ec_get_real_ecdt(void) | 1523 | acpi_ec_get_real_ecdt(void) |
1033 | { | 1524 | { |
1525 | if (acpi_ec_polling_mode) | ||
1526 | return acpi_ec_polling_get_real_ecdt(); | ||
1527 | else | ||
1528 | return acpi_ec_burst_get_real_ecdt(); | ||
1529 | } | ||
1530 | |||
1531 | static int __init | ||
1532 | acpi_ec_polling_get_real_ecdt(void) | ||
1533 | { | ||
1534 | acpi_status status; | ||
1535 | struct acpi_table_ecdt *ecdt_ptr; | ||
1536 | |||
1537 | status = acpi_get_firmware_table("ECDT", 1, ACPI_LOGICAL_ADDRESSING, | ||
1538 | (struct acpi_table_header **) &ecdt_ptr); | ||
1539 | if (ACPI_FAILURE(status)) | ||
1540 | return -ENODEV; | ||
1541 | |||
1542 | printk(KERN_INFO PREFIX "Found ECDT\n"); | ||
1543 | |||
1544 | /* | ||
1545 | * Generate a temporary ec context to use until the namespace is scanned | ||
1546 | */ | ||
1547 | ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); | ||
1548 | if (!ec_ecdt) | ||
1549 | return -ENOMEM; | ||
1550 | memset(ec_ecdt, 0, sizeof(union acpi_ec)); | ||
1551 | |||
1552 | ec_ecdt->common.command_addr = ecdt_ptr->ec_control; | ||
1553 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; | ||
1554 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; | ||
1555 | ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; | ||
1556 | spin_lock_init(&ec_ecdt->polling.lock); | ||
1557 | /* use the GL just to be safe */ | ||
1558 | ec_ecdt->common.global_lock = TRUE; | ||
1559 | ec_ecdt->common.uid = ecdt_ptr->uid; | ||
1560 | |||
1561 | status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); | ||
1562 | if (ACPI_FAILURE(status)) { | ||
1563 | goto error; | ||
1564 | } | ||
1565 | |||
1566 | return 0; | ||
1567 | error: | ||
1568 | printk(KERN_ERR PREFIX "Could not use ECDT\n"); | ||
1569 | kfree(ec_ecdt); | ||
1570 | ec_ecdt = NULL; | ||
1571 | |||
1572 | return -ENODEV; | ||
1573 | } | ||
1574 | |||
1575 | |||
1576 | static int __init | ||
1577 | acpi_ec_burst_get_real_ecdt(void) | ||
1578 | { | ||
1034 | acpi_status status; | 1579 | acpi_status status; |
1035 | struct acpi_table_ecdt *ecdt_ptr; | 1580 | struct acpi_table_ecdt *ecdt_ptr; |
1036 | 1581 | ||
@@ -1044,22 +1589,22 @@ acpi_ec_get_real_ecdt(void) | |||
1044 | /* | 1589 | /* |
1045 | * Generate a temporary ec context to use until the namespace is scanned | 1590 | * Generate a temporary ec context to use until the namespace is scanned |
1046 | */ | 1591 | */ |
1047 | ec_ecdt = kmalloc(sizeof(struct acpi_ec), GFP_KERNEL); | 1592 | ec_ecdt = kmalloc(sizeof(union acpi_ec), GFP_KERNEL); |
1048 | if (!ec_ecdt) | 1593 | if (!ec_ecdt) |
1049 | return -ENOMEM; | 1594 | return -ENOMEM; |
1050 | memset(ec_ecdt, 0, sizeof(struct acpi_ec)); | 1595 | memset(ec_ecdt, 0, sizeof(union acpi_ec)); |
1051 | 1596 | ||
1052 | init_MUTEX(&ec_ecdt->sem); | 1597 | init_MUTEX(&ec_ecdt->burst.sem); |
1053 | init_waitqueue_head(&ec_ecdt->wait); | 1598 | init_waitqueue_head(&ec_ecdt->burst.wait); |
1054 | ec_ecdt->command_addr = ecdt_ptr->ec_control; | 1599 | ec_ecdt->common.command_addr = ecdt_ptr->ec_control; |
1055 | ec_ecdt->status_addr = ecdt_ptr->ec_control; | 1600 | ec_ecdt->common.status_addr = ecdt_ptr->ec_control; |
1056 | ec_ecdt->data_addr = ecdt_ptr->ec_data; | 1601 | ec_ecdt->common.data_addr = ecdt_ptr->ec_data; |
1057 | ec_ecdt->gpe_bit = ecdt_ptr->gpe_bit; | 1602 | ec_ecdt->common.gpe_bit = ecdt_ptr->gpe_bit; |
1058 | /* use the GL just to be safe */ | 1603 | /* use the GL just to be safe */ |
1059 | ec_ecdt->global_lock = TRUE; | 1604 | ec_ecdt->common.global_lock = TRUE; |
1060 | ec_ecdt->uid = ecdt_ptr->uid; | 1605 | ec_ecdt->common.uid = ecdt_ptr->uid; |
1061 | 1606 | ||
1062 | status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->handle); | 1607 | status = acpi_get_handle(NULL, ecdt_ptr->ec_id, &ec_ecdt->common.handle); |
1063 | if (ACPI_FAILURE(status)) { | 1608 | if (ACPI_FAILURE(status)) { |
1064 | goto error; | 1609 | goto error; |
1065 | } | 1610 | } |
@@ -1092,20 +1637,20 @@ acpi_ec_ecdt_probe (void) | |||
1092 | /* | 1637 | /* |
1093 | * Install GPE handler | 1638 | * Install GPE handler |
1094 | */ | 1639 | */ |
1095 | status = acpi_install_gpe_handler(NULL, ec_ecdt->gpe_bit, | 1640 | status = acpi_install_gpe_handler(NULL, ec_ecdt->common.gpe_bit, |
1096 | ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, | 1641 | ACPI_GPE_EDGE_TRIGGERED, &acpi_ec_gpe_handler, |
1097 | ec_ecdt); | 1642 | ec_ecdt); |
1098 | if (ACPI_FAILURE(status)) { | 1643 | if (ACPI_FAILURE(status)) { |
1099 | goto error; | 1644 | goto error; |
1100 | } | 1645 | } |
1101 | acpi_set_gpe_type (NULL, ec_ecdt->gpe_bit, ACPI_GPE_TYPE_RUNTIME); | 1646 | acpi_set_gpe_type (NULL, ec_ecdt->common.gpe_bit, ACPI_GPE_TYPE_RUNTIME); |
1102 | acpi_enable_gpe (NULL, ec_ecdt->gpe_bit, ACPI_NOT_ISR); | 1647 | acpi_enable_gpe (NULL, ec_ecdt->common.gpe_bit, ACPI_NOT_ISR); |
1103 | 1648 | ||
1104 | status = acpi_install_address_space_handler (ACPI_ROOT_OBJECT, | 1649 | status = acpi_install_address_space_handler (ACPI_ROOT_OBJECT, |
1105 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, | 1650 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler, |
1106 | &acpi_ec_space_setup, ec_ecdt); | 1651 | &acpi_ec_space_setup, ec_ecdt); |
1107 | if (ACPI_FAILURE(status)) { | 1652 | if (ACPI_FAILURE(status)) { |
1108 | acpi_remove_gpe_handler(NULL, ec_ecdt->gpe_bit, | 1653 | acpi_remove_gpe_handler(NULL, ec_ecdt->common.gpe_bit, |
1109 | &acpi_ec_gpe_handler); | 1654 | &acpi_ec_gpe_handler); |
1110 | goto error; | 1655 | goto error; |
1111 | } | 1656 | } |
@@ -1123,7 +1668,7 @@ error: | |||
1123 | 1668 | ||
1124 | static int __init acpi_ec_init (void) | 1669 | static int __init acpi_ec_init (void) |
1125 | { | 1670 | { |
1126 | int result; | 1671 | int result = 0; |
1127 | 1672 | ||
1128 | ACPI_FUNCTION_TRACE("acpi_ec_init"); | 1673 | ACPI_FUNCTION_TRACE("acpi_ec_init"); |
1129 | 1674 | ||
@@ -1166,4 +1711,24 @@ static int __init acpi_fake_ecdt_setup(char *str) | |||
1166 | acpi_fake_ecdt_enabled = 1; | 1711 | acpi_fake_ecdt_enabled = 1; |
1167 | return 0; | 1712 | return 0; |
1168 | } | 1713 | } |
1714 | |||
1169 | __setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); | 1715 | __setup("acpi_fake_ecdt", acpi_fake_ecdt_setup); |
1716 | static int __init acpi_ec_set_polling_mode(char *str) | ||
1717 | { | ||
1718 | int burst; | ||
1719 | |||
1720 | if (!get_option(&str, &burst)) | ||
1721 | return 0; | ||
1722 | |||
1723 | if (burst) { | ||
1724 | acpi_ec_polling_mode = EC_BURST; | ||
1725 | acpi_ec_driver.ops.add = acpi_ec_burst_add; | ||
1726 | } else { | ||
1727 | acpi_ec_polling_mode = EC_POLLING; | ||
1728 | acpi_ec_driver.ops.add = acpi_ec_polling_add; | ||
1729 | } | ||
1730 | printk(KERN_INFO PREFIX "EC %s mode.\n", | ||
1731 | burst ? "burst": "polling"); | ||
1732 | return 0; | ||
1733 | } | ||
1734 | __setup("ec_burst=", acpi_ec_set_polling_mode); | ||
diff --git a/drivers/acpi/hotkey.c b/drivers/acpi/hotkey.c index babdf762eadb..1f76a40badec 100644 --- a/drivers/acpi/hotkey.c +++ b/drivers/acpi/hotkey.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * hotkey.c - ACPI Hotkey Driver ($Revision:$) | 2 | * hotkey.c - ACPI Hotkey Driver ($Revision: 0.2 $) |
3 | * | 3 | * |
4 | * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> | 4 | * Copyright (C) 2004 Luming Yu <luming.yu@intel.com> |
5 | * | 5 | * |
@@ -51,17 +51,18 @@ | |||
51 | #define ACPI_HOTKEY_POLLING 0x2 | 51 | #define ACPI_HOTKEY_POLLING 0x2 |
52 | #define ACPI_UNDEFINED_EVENT 0xf | 52 | #define ACPI_UNDEFINED_EVENT 0xf |
53 | 53 | ||
54 | #define MAX_CONFIG_RECORD_LEN 80 | 54 | #define RESULT_STR_LEN 80 |
55 | #define MAX_NAME_PATH_LEN 80 | ||
56 | #define MAX_CALL_PARM 80 | ||
57 | 55 | ||
58 | #define IS_EVENT(e) 0xff /* ((e) & 0x40000000) */ | 56 | #define ACTION_METHOD 0 |
59 | #define IS_POLL(e) 0xff /* (~((e) & 0x40000000)) */ | 57 | #define POLL_METHOD 1 |
60 | 58 | ||
59 | #define IS_EVENT(e) ((e) <= 10000 && (e) >0) | ||
60 | #define IS_POLL(e) ((e) > 10000) | ||
61 | #define IS_OTHERS(e) ((e)<=0 || (e)>=20000) | ||
61 | #define _COMPONENT ACPI_HOTKEY_COMPONENT | 62 | #define _COMPONENT ACPI_HOTKEY_COMPONENT |
62 | ACPI_MODULE_NAME("acpi_hotkey") | 63 | ACPI_MODULE_NAME("acpi_hotkey") |
63 | 64 | ||
64 | MODULE_AUTHOR("luming.yu@intel.com"); | 65 | MODULE_AUTHOR("luming.yu@intel.com"); |
65 | MODULE_DESCRIPTION(ACPI_HOTK_NAME); | 66 | MODULE_DESCRIPTION(ACPI_HOTK_NAME); |
66 | MODULE_LICENSE("GPL"); | 67 | MODULE_LICENSE("GPL"); |
67 | 68 | ||
@@ -114,7 +115,7 @@ struct acpi_event_hotkey { | |||
114 | char *action_method; /* action method */ | 115 | char *action_method; /* action method */ |
115 | }; | 116 | }; |
116 | 117 | ||
117 | /* | 118 | /* |
118 | * There are two ways to poll status | 119 | * There are two ways to poll status |
119 | * 1. directy call read_xxx method, without any arguments passed in | 120 | * 1. directy call read_xxx method, without any arguments passed in |
120 | * 2. call write_xxx method, with arguments passed in, you need | 121 | * 2. call write_xxx method, with arguments passed in, you need |
@@ -131,7 +132,7 @@ struct acpi_polling_hotkey { | |||
131 | char *poll_method; /* poll method */ | 132 | char *poll_method; /* poll method */ |
132 | acpi_handle action_handle; /* acpi handle attached action method */ | 133 | acpi_handle action_handle; /* acpi handle attached action method */ |
133 | char *action_method; /* action method */ | 134 | char *action_method; /* action method */ |
134 | void *poll_result; /* polling_result */ | 135 | union acpi_object *poll_result; /* polling_result */ |
135 | struct proc_dir_entry *proc; | 136 | struct proc_dir_entry *proc; |
136 | }; | 137 | }; |
137 | 138 | ||
@@ -162,20 +163,25 @@ static struct acpi_driver hotkey_driver = { | |||
162 | }, | 163 | }, |
163 | }; | 164 | }; |
164 | 165 | ||
166 | static void free_hotkey_device(union acpi_hotkey *key); | ||
167 | static void free_hotkey_buffer(union acpi_hotkey *key); | ||
168 | static void free_poll_hotkey_buffer(union acpi_hotkey *key); | ||
165 | static int hotkey_open_config(struct inode *inode, struct file *file); | 169 | static int hotkey_open_config(struct inode *inode, struct file *file); |
170 | static int hotkey_poll_open_config(struct inode *inode, struct file *file); | ||
166 | static ssize_t hotkey_write_config(struct file *file, | 171 | static ssize_t hotkey_write_config(struct file *file, |
167 | const char __user * buffer, | 172 | const char __user * buffer, |
168 | size_t count, loff_t * data); | 173 | size_t count, loff_t * data); |
169 | static ssize_t hotkey_write_poll_config(struct file *file, | ||
170 | const char __user * buffer, | ||
171 | size_t count, loff_t * data); | ||
172 | static int hotkey_info_open_fs(struct inode *inode, struct file *file); | 174 | static int hotkey_info_open_fs(struct inode *inode, struct file *file); |
173 | static int hotkey_action_open_fs(struct inode *inode, struct file *file); | 175 | static int hotkey_action_open_fs(struct inode *inode, struct file *file); |
174 | static ssize_t hotkey_execute_aml_method(struct file *file, | 176 | static ssize_t hotkey_execute_aml_method(struct file *file, |
175 | const char __user * buffer, | 177 | const char __user * buffer, |
176 | size_t count, loff_t * data); | 178 | size_t count, loff_t * data); |
177 | static int hotkey_config_seq_show(struct seq_file *seq, void *offset); | 179 | static int hotkey_config_seq_show(struct seq_file *seq, void *offset); |
180 | static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset); | ||
178 | static int hotkey_polling_open_fs(struct inode *inode, struct file *file); | 181 | static int hotkey_polling_open_fs(struct inode *inode, struct file *file); |
182 | static union acpi_hotkey *get_hotkey_by_event(struct | ||
183 | acpi_hotkey_list | ||
184 | *hotkey_list, int event); | ||
179 | 185 | ||
180 | /* event based config */ | 186 | /* event based config */ |
181 | static struct file_operations hotkey_config_fops = { | 187 | static struct file_operations hotkey_config_fops = { |
@@ -188,9 +194,9 @@ static struct file_operations hotkey_config_fops = { | |||
188 | 194 | ||
189 | /* polling based config */ | 195 | /* polling based config */ |
190 | static struct file_operations hotkey_poll_config_fops = { | 196 | static struct file_operations hotkey_poll_config_fops = { |
191 | .open = hotkey_open_config, | 197 | .open = hotkey_poll_open_config, |
192 | .read = seq_read, | 198 | .read = seq_read, |
193 | .write = hotkey_write_poll_config, | 199 | .write = hotkey_write_config, |
194 | .llseek = seq_lseek, | 200 | .llseek = seq_lseek, |
195 | .release = single_release, | 201 | .release = single_release, |
196 | }; | 202 | }; |
@@ -227,7 +233,7 @@ static int hotkey_info_seq_show(struct seq_file *seq, void *offset) | |||
227 | { | 233 | { |
228 | ACPI_FUNCTION_TRACE("hotkey_info_seq_show"); | 234 | ACPI_FUNCTION_TRACE("hotkey_info_seq_show"); |
229 | 235 | ||
230 | seq_printf(seq, "Hotkey generic driver ver: %s", HOTKEY_ACPI_VERSION); | 236 | seq_printf(seq, "Hotkey generic driver ver: %s\n", HOTKEY_ACPI_VERSION); |
231 | 237 | ||
232 | return_VALUE(0); | 238 | return_VALUE(0); |
233 | } | 239 | } |
@@ -239,27 +245,35 @@ static int hotkey_info_open_fs(struct inode *inode, struct file *file) | |||
239 | 245 | ||
240 | static char *format_result(union acpi_object *object) | 246 | static char *format_result(union acpi_object *object) |
241 | { | 247 | { |
242 | char *buf = (char *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); | 248 | char *buf = NULL; |
243 | 249 | ||
244 | memset(buf, 0, sizeof(union acpi_object)); | 250 | buf = (char *)kmalloc(RESULT_STR_LEN, GFP_KERNEL); |
251 | if (buf) | ||
252 | memset(buf, 0, RESULT_STR_LEN); | ||
253 | else | ||
254 | goto do_fail; | ||
245 | 255 | ||
246 | /* Now, just support integer type */ | 256 | /* Now, just support integer type */ |
247 | if (object->type == ACPI_TYPE_INTEGER) | 257 | if (object->type == ACPI_TYPE_INTEGER) |
248 | sprintf(buf, "%d", (u32) object->integer.value); | 258 | sprintf(buf, "%d\n", (u32) object->integer.value); |
249 | 259 | do_fail: | |
250 | return buf; | 260 | return (buf); |
251 | } | 261 | } |
252 | 262 | ||
253 | static int hotkey_polling_seq_show(struct seq_file *seq, void *offset) | 263 | static int hotkey_polling_seq_show(struct seq_file *seq, void *offset) |
254 | { | 264 | { |
255 | struct acpi_polling_hotkey *poll_hotkey = | 265 | struct acpi_polling_hotkey *poll_hotkey = |
256 | (struct acpi_polling_hotkey *)seq->private; | 266 | (struct acpi_polling_hotkey *)seq->private; |
267 | char *buf; | ||
257 | 268 | ||
258 | ACPI_FUNCTION_TRACE("hotkey_polling_seq_show"); | 269 | ACPI_FUNCTION_TRACE("hotkey_polling_seq_show"); |
259 | 270 | ||
260 | if (poll_hotkey->poll_result) | 271 | if (poll_hotkey->poll_result){ |
261 | seq_printf(seq, "%s", format_result(poll_hotkey->poll_result)); | 272 | buf = format_result(poll_hotkey->poll_result); |
262 | 273 | if(buf) | |
274 | seq_printf(seq, "%s", buf); | ||
275 | kfree(buf); | ||
276 | } | ||
263 | return_VALUE(0); | 277 | return_VALUE(0); |
264 | } | 278 | } |
265 | 279 | ||
@@ -276,19 +290,19 @@ static int hotkey_action_open_fs(struct inode *inode, struct file *file) | |||
276 | /* Mapping external hotkey number to standardized hotkey event num */ | 290 | /* Mapping external hotkey number to standardized hotkey event num */ |
277 | static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list) | 291 | static int hotkey_get_internal_event(int event, struct acpi_hotkey_list *list) |
278 | { | 292 | { |
279 | struct list_head *entries, *next; | 293 | struct list_head *entries; |
280 | int val = 0; | 294 | int val = -1; |
281 | 295 | ||
282 | ACPI_FUNCTION_TRACE("hotkey_get_internal_event"); | 296 | ACPI_FUNCTION_TRACE("hotkey_get_internal_event"); |
283 | 297 | ||
284 | list_for_each_safe(entries, next, list->entries) { | 298 | list_for_each(entries, list->entries) { |
285 | union acpi_hotkey *key = | 299 | union acpi_hotkey *key = |
286 | container_of(entries, union acpi_hotkey, entries); | 300 | container_of(entries, union acpi_hotkey, entries); |
287 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT | 301 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT |
288 | && key->event_hotkey.external_hotkey_num == event) | 302 | && key->event_hotkey.external_hotkey_num == event){ |
289 | val = key->link.hotkey_standard_num; | 303 | val = key->link.hotkey_standard_num; |
290 | else | 304 | break; |
291 | val = -1; | 305 | } |
292 | } | 306 | } |
293 | 307 | ||
294 | return_VALUE(val); | 308 | return_VALUE(val); |
@@ -306,7 +320,7 @@ acpi_hotkey_notify_handler(acpi_handle handle, u32 event, void *data) | |||
306 | return_VOID; | 320 | return_VOID; |
307 | 321 | ||
308 | internal_event = hotkey_get_internal_event(event, &global_hotkey_list); | 322 | internal_event = hotkey_get_internal_event(event, &global_hotkey_list); |
309 | acpi_bus_generate_event(device, event, 0); | 323 | acpi_bus_generate_event(device, internal_event, 0); |
310 | 324 | ||
311 | return_VOID; | 325 | return_VOID; |
312 | } | 326 | } |
@@ -329,13 +343,17 @@ static int auto_hotkey_remove(struct acpi_device *device, int type) | |||
329 | static int create_polling_proc(union acpi_hotkey *device) | 343 | static int create_polling_proc(union acpi_hotkey *device) |
330 | { | 344 | { |
331 | struct proc_dir_entry *proc; | 345 | struct proc_dir_entry *proc; |
346 | char proc_name[80]; | ||
332 | mode_t mode; | 347 | mode_t mode; |
333 | 348 | ||
334 | ACPI_FUNCTION_TRACE("create_polling_proc"); | 349 | ACPI_FUNCTION_TRACE("create_polling_proc"); |
335 | mode = S_IFREG | S_IRUGO | S_IWUGO; | 350 | mode = S_IFREG | S_IRUGO | S_IWUGO; |
336 | 351 | ||
337 | proc = create_proc_entry(device->poll_hotkey.action_method, | 352 | sprintf(proc_name, "%d", device->link.hotkey_standard_num); |
338 | mode, hotkey_proc_dir); | 353 | /* |
354 | strcat(proc_name, device->poll_hotkey.poll_method); | ||
355 | */ | ||
356 | proc = create_proc_entry(proc_name, mode, hotkey_proc_dir); | ||
339 | 357 | ||
340 | if (!proc) { | 358 | if (!proc) { |
341 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 359 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
@@ -353,23 +371,6 @@ static int create_polling_proc(union acpi_hotkey *device) | |||
353 | return_VALUE(0); | 371 | return_VALUE(0); |
354 | } | 372 | } |
355 | 373 | ||
356 | static int is_valid_acpi_path(const char *pathname) | ||
357 | { | ||
358 | acpi_handle handle; | ||
359 | acpi_status status; | ||
360 | ACPI_FUNCTION_TRACE("is_valid_acpi_path"); | ||
361 | |||
362 | status = acpi_get_handle(NULL, (char *)pathname, &handle); | ||
363 | return_VALUE(!ACPI_FAILURE(status)); | ||
364 | } | ||
365 | |||
366 | static int is_valid_hotkey(union acpi_hotkey *device) | ||
367 | { | ||
368 | ACPI_FUNCTION_TRACE("is_valid_hotkey"); | ||
369 | /* Implement valid check */ | ||
370 | return_VALUE(1); | ||
371 | } | ||
372 | |||
373 | static int hotkey_add(union acpi_hotkey *device) | 374 | static int hotkey_add(union acpi_hotkey *device) |
374 | { | 375 | { |
375 | int status = 0; | 376 | int status = 0; |
@@ -378,15 +379,11 @@ static int hotkey_add(union acpi_hotkey *device) | |||
378 | ACPI_FUNCTION_TRACE("hotkey_add"); | 379 | ACPI_FUNCTION_TRACE("hotkey_add"); |
379 | 380 | ||
380 | if (device->link.hotkey_type == ACPI_HOTKEY_EVENT) { | 381 | if (device->link.hotkey_type == ACPI_HOTKEY_EVENT) { |
381 | status = | 382 | acpi_bus_get_device(device->event_hotkey.bus_handle, &dev); |
382 | acpi_bus_get_device(device->event_hotkey.bus_handle, &dev); | ||
383 | if (status) | ||
384 | return_VALUE(status); | ||
385 | |||
386 | status = acpi_install_notify_handler(dev->handle, | 383 | status = acpi_install_notify_handler(dev->handle, |
387 | ACPI_SYSTEM_NOTIFY, | 384 | ACPI_DEVICE_NOTIFY, |
388 | acpi_hotkey_notify_handler, | 385 | acpi_hotkey_notify_handler, |
389 | device); | 386 | dev); |
390 | } else /* Add polling hotkey */ | 387 | } else /* Add polling hotkey */ |
391 | create_polling_proc(device); | 388 | create_polling_proc(device); |
392 | 389 | ||
@@ -409,84 +406,143 @@ static int hotkey_remove(union acpi_hotkey *device) | |||
409 | if (key->link.hotkey_standard_num == | 406 | if (key->link.hotkey_standard_num == |
410 | device->link.hotkey_standard_num) { | 407 | device->link.hotkey_standard_num) { |
411 | list_del(&key->link.entries); | 408 | list_del(&key->link.entries); |
412 | remove_proc_entry(key->poll_hotkey.action_method, | 409 | free_hotkey_device(key); |
413 | hotkey_proc_dir); | ||
414 | global_hotkey_list.count--; | 410 | global_hotkey_list.count--; |
415 | break; | 411 | break; |
416 | } | 412 | } |
417 | } | 413 | } |
414 | kfree(device); | ||
418 | return_VALUE(0); | 415 | return_VALUE(0); |
419 | } | 416 | } |
420 | 417 | ||
421 | static void hotkey_update(union acpi_hotkey *key) | 418 | static int hotkey_update(union acpi_hotkey *key) |
422 | { | 419 | { |
423 | struct list_head *entries, *next; | 420 | struct list_head *entries; |
424 | 421 | ||
425 | ACPI_FUNCTION_TRACE("hotkey_update"); | 422 | ACPI_FUNCTION_TRACE("hotkey_update"); |
426 | 423 | ||
427 | list_for_each_safe(entries, next, global_hotkey_list.entries) { | 424 | list_for_each(entries, global_hotkey_list.entries) { |
428 | union acpi_hotkey *key = | 425 | union acpi_hotkey *tmp= |
429 | container_of(entries, union acpi_hotkey, entries); | 426 | container_of(entries, union acpi_hotkey, entries); |
430 | if (key->link.hotkey_standard_num == | 427 | if (tmp->link.hotkey_standard_num == |
431 | key->link.hotkey_standard_num) { | 428 | key->link.hotkey_standard_num) { |
432 | key->event_hotkey.bus_handle = | 429 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { |
433 | key->event_hotkey.bus_handle; | 430 | free_hotkey_buffer(tmp); |
434 | key->event_hotkey.external_hotkey_num = | 431 | tmp->event_hotkey.bus_handle = |
435 | key->event_hotkey.external_hotkey_num; | 432 | key->event_hotkey.bus_handle; |
436 | key->event_hotkey.action_handle = | 433 | tmp->event_hotkey.external_hotkey_num = |
437 | key->event_hotkey.action_handle; | 434 | key->event_hotkey.external_hotkey_num; |
438 | key->event_hotkey.action_method = | 435 | tmp->event_hotkey.action_handle = |
439 | key->event_hotkey.action_method; | 436 | key->event_hotkey.action_handle; |
437 | tmp->event_hotkey.action_method = | ||
438 | key->event_hotkey.action_method; | ||
439 | kfree(key); | ||
440 | } else { | ||
441 | /* | ||
442 | char proc_name[80]; | ||
443 | |||
444 | sprintf(proc_name, "%d", tmp->link.hotkey_standard_num); | ||
445 | strcat(proc_name, tmp->poll_hotkey.poll_method); | ||
446 | remove_proc_entry(proc_name,hotkey_proc_dir); | ||
447 | */ | ||
448 | free_poll_hotkey_buffer(tmp); | ||
449 | tmp->poll_hotkey.poll_handle = | ||
450 | key->poll_hotkey.poll_handle; | ||
451 | tmp->poll_hotkey.poll_method = | ||
452 | key->poll_hotkey.poll_method; | ||
453 | tmp->poll_hotkey.action_handle = | ||
454 | key->poll_hotkey.action_handle; | ||
455 | tmp->poll_hotkey.action_method = | ||
456 | key->poll_hotkey.action_method; | ||
457 | tmp->poll_hotkey.poll_result = | ||
458 | key->poll_hotkey.poll_result; | ||
459 | /* | ||
460 | create_polling_proc(tmp); | ||
461 | */ | ||
462 | kfree(key); | ||
463 | } | ||
464 | return_VALUE(0); | ||
440 | break; | 465 | break; |
441 | } | 466 | } |
442 | } | 467 | } |
443 | 468 | ||
444 | return_VOID; | 469 | return_VALUE(-ENODEV); |
445 | } | 470 | } |
446 | 471 | ||
447 | static void free_hotkey_device(union acpi_hotkey *key) | 472 | static void free_hotkey_device(union acpi_hotkey *key) |
448 | { | 473 | { |
449 | struct acpi_device *dev; | 474 | struct acpi_device *dev; |
450 | int status; | ||
451 | 475 | ||
452 | ACPI_FUNCTION_TRACE("free_hotkey_device"); | 476 | ACPI_FUNCTION_TRACE("free_hotkey_device"); |
453 | 477 | ||
454 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { | 478 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { |
455 | status = | 479 | acpi_bus_get_device(key->event_hotkey.bus_handle, &dev); |
456 | acpi_bus_get_device(key->event_hotkey.bus_handle, &dev); | ||
457 | if (dev->handle) | 480 | if (dev->handle) |
458 | acpi_remove_notify_handler(dev->handle, | 481 | acpi_remove_notify_handler(dev->handle, |
459 | ACPI_SYSTEM_NOTIFY, | 482 | ACPI_DEVICE_NOTIFY, |
460 | acpi_hotkey_notify_handler); | 483 | acpi_hotkey_notify_handler); |
461 | } else | 484 | free_hotkey_buffer(key); |
462 | remove_proc_entry(key->poll_hotkey.action_method, | 485 | } else { |
463 | hotkey_proc_dir); | 486 | char proc_name[80]; |
487 | |||
488 | sprintf(proc_name, "%d", key->link.hotkey_standard_num); | ||
489 | /* | ||
490 | strcat(proc_name, key->poll_hotkey.poll_method); | ||
491 | */ | ||
492 | remove_proc_entry(proc_name,hotkey_proc_dir); | ||
493 | free_poll_hotkey_buffer(key); | ||
494 | } | ||
464 | kfree(key); | 495 | kfree(key); |
465 | return_VOID; | 496 | return_VOID; |
466 | } | 497 | } |
467 | 498 | ||
499 | static void | ||
500 | free_hotkey_buffer(union acpi_hotkey *key) | ||
501 | { | ||
502 | kfree(key->event_hotkey.action_method); | ||
503 | } | ||
504 | |||
505 | static void | ||
506 | free_poll_hotkey_buffer(union acpi_hotkey *key) | ||
507 | { | ||
508 | kfree(key->poll_hotkey.action_method); | ||
509 | kfree(key->poll_hotkey.poll_method); | ||
510 | kfree(key->poll_hotkey.poll_result); | ||
511 | } | ||
468 | static int | 512 | static int |
469 | init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str, | 513 | init_hotkey_device(union acpi_hotkey *key, char *bus_str, char *action_str, |
470 | char *method, int std_num, int external_num) | 514 | char *method, int std_num, int external_num) |
471 | { | 515 | { |
516 | acpi_handle tmp_handle; | ||
517 | acpi_status status = AE_OK; | ||
518 | |||
472 | ACPI_FUNCTION_TRACE("init_hotkey_device"); | 519 | ACPI_FUNCTION_TRACE("init_hotkey_device"); |
473 | 520 | ||
521 | if(std_num < 0 || IS_POLL(std_num) || !key ) | ||
522 | goto do_fail; | ||
523 | |||
524 | if(!bus_str || !action_str || !method) | ||
525 | goto do_fail; | ||
526 | |||
474 | key->link.hotkey_type = ACPI_HOTKEY_EVENT; | 527 | key->link.hotkey_type = ACPI_HOTKEY_EVENT; |
475 | key->link.hotkey_standard_num = std_num; | 528 | key->link.hotkey_standard_num = std_num; |
476 | key->event_hotkey.flag = 0; | 529 | key->event_hotkey.flag = 0; |
477 | if (is_valid_acpi_path(bus_str)) | 530 | key->event_hotkey.action_method = method; |
478 | acpi_get_handle((acpi_handle) 0, | ||
479 | bus_str, &(key->event_hotkey.bus_handle)); | ||
480 | else | ||
481 | return_VALUE(-ENODEV); | ||
482 | key->event_hotkey.external_hotkey_num = external_num; | ||
483 | if (is_valid_acpi_path(action_str)) | ||
484 | acpi_get_handle((acpi_handle) 0, | ||
485 | action_str, &(key->event_hotkey.action_handle)); | ||
486 | key->event_hotkey.action_method = kmalloc(sizeof(method), GFP_KERNEL); | ||
487 | strcpy(key->event_hotkey.action_method, method); | ||
488 | 531 | ||
489 | return_VALUE(!is_valid_hotkey(key)); | 532 | status = acpi_get_handle(NULL,bus_str, &(key->event_hotkey.bus_handle)); |
533 | if(ACPI_FAILURE(status)) | ||
534 | goto do_fail; | ||
535 | key->event_hotkey.external_hotkey_num = external_num; | ||
536 | status = acpi_get_handle(NULL,action_str, &(key->event_hotkey.action_handle)); | ||
537 | if(ACPI_FAILURE(status)) | ||
538 | goto do_fail; | ||
539 | status = acpi_get_handle(key->event_hotkey.action_handle, | ||
540 | method, &tmp_handle); | ||
541 | if (ACPI_FAILURE(status)) | ||
542 | goto do_fail; | ||
543 | return_VALUE(AE_OK); | ||
544 | do_fail: | ||
545 | return_VALUE(-ENODEV); | ||
490 | } | 546 | } |
491 | 547 | ||
492 | static int | 548 | static int |
@@ -495,34 +551,46 @@ init_poll_hotkey_device(union acpi_hotkey *key, | |||
495 | char *poll_method, | 551 | char *poll_method, |
496 | char *action_str, char *action_method, int std_num) | 552 | char *action_str, char *action_method, int std_num) |
497 | { | 553 | { |
554 | acpi_status status = AE_OK; | ||
555 | acpi_handle tmp_handle; | ||
556 | |||
498 | ACPI_FUNCTION_TRACE("init_poll_hotkey_device"); | 557 | ACPI_FUNCTION_TRACE("init_poll_hotkey_device"); |
499 | 558 | ||
559 | if(std_num < 0 || IS_EVENT(std_num) || !key) | ||
560 | goto do_fail; | ||
561 | |||
562 | if(!poll_str || !poll_method || !action_str || !action_method) | ||
563 | goto do_fail; | ||
564 | |||
500 | key->link.hotkey_type = ACPI_HOTKEY_POLLING; | 565 | key->link.hotkey_type = ACPI_HOTKEY_POLLING; |
501 | key->link.hotkey_standard_num = std_num; | 566 | key->link.hotkey_standard_num = std_num; |
502 | key->poll_hotkey.flag = 0; | 567 | key->poll_hotkey.flag = 0; |
503 | if (is_valid_acpi_path(poll_str)) | ||
504 | acpi_get_handle((acpi_handle) 0, | ||
505 | poll_str, &(key->poll_hotkey.poll_handle)); | ||
506 | else | ||
507 | return_VALUE(-ENODEV); | ||
508 | key->poll_hotkey.poll_method = poll_method; | 568 | key->poll_hotkey.poll_method = poll_method; |
509 | if (is_valid_acpi_path(action_str)) | 569 | key->poll_hotkey.action_method = action_method; |
510 | acpi_get_handle((acpi_handle) 0, | 570 | |
511 | action_str, &(key->poll_hotkey.action_handle)); | 571 | status = acpi_get_handle(NULL,poll_str, &(key->poll_hotkey.poll_handle)); |
512 | key->poll_hotkey.action_method = | 572 | if(ACPI_FAILURE(status)) |
513 | kmalloc(sizeof(action_method), GFP_KERNEL); | 573 | goto do_fail; |
514 | strcpy(key->poll_hotkey.action_method, action_method); | 574 | status = acpi_get_handle(key->poll_hotkey.poll_handle, |
575 | poll_method, &tmp_handle); | ||
576 | if (ACPI_FAILURE(status)) | ||
577 | goto do_fail; | ||
578 | status = acpi_get_handle(NULL,action_str, &(key->poll_hotkey.action_handle)); | ||
579 | if (ACPI_FAILURE(status)) | ||
580 | goto do_fail; | ||
581 | status = acpi_get_handle(key->poll_hotkey.action_handle, | ||
582 | action_method, &tmp_handle); | ||
583 | if (ACPI_FAILURE(status)) | ||
584 | goto do_fail; | ||
515 | key->poll_hotkey.poll_result = | 585 | key->poll_hotkey.poll_result = |
516 | (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); | 586 | (union acpi_object *)kmalloc(sizeof(union acpi_object), GFP_KERNEL); |
517 | return_VALUE(is_valid_hotkey(key)); | 587 | if(!key->poll_hotkey.poll_result) |
588 | goto do_fail; | ||
589 | return_VALUE(AE_OK); | ||
590 | do_fail: | ||
591 | return_VALUE(-ENODEV); | ||
518 | } | 592 | } |
519 | 593 | ||
520 | static int check_hotkey_valid(union acpi_hotkey *key, | ||
521 | struct acpi_hotkey_list *list) | ||
522 | { | ||
523 | ACPI_FUNCTION_TRACE("check_hotkey_valid"); | ||
524 | return_VALUE(0); | ||
525 | } | ||
526 | 594 | ||
527 | static int hotkey_open_config(struct inode *inode, struct file *file) | 595 | static int hotkey_open_config(struct inode *inode, struct file *file) |
528 | { | 596 | { |
@@ -531,10 +599,17 @@ static int hotkey_open_config(struct inode *inode, struct file *file) | |||
531 | (file, hotkey_config_seq_show, PDE(inode)->data)); | 599 | (file, hotkey_config_seq_show, PDE(inode)->data)); |
532 | } | 600 | } |
533 | 601 | ||
602 | static int hotkey_poll_open_config(struct inode *inode, struct file *file) | ||
603 | { | ||
604 | ACPI_FUNCTION_TRACE("hotkey_poll_open_config"); | ||
605 | return_VALUE(single_open | ||
606 | (file, hotkey_poll_config_seq_show, PDE(inode)->data)); | ||
607 | } | ||
608 | |||
534 | static int hotkey_config_seq_show(struct seq_file *seq, void *offset) | 609 | static int hotkey_config_seq_show(struct seq_file *seq, void *offset) |
535 | { | 610 | { |
536 | struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; | 611 | struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; |
537 | struct list_head *entries, *next; | 612 | struct list_head *entries; |
538 | char bus_name[ACPI_PATHNAME_MAX] = { 0 }; | 613 | char bus_name[ACPI_PATHNAME_MAX] = { 0 }; |
539 | char action_name[ACPI_PATHNAME_MAX] = { 0 }; | 614 | char action_name[ACPI_PATHNAME_MAX] = { 0 }; |
540 | struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; | 615 | struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; |
@@ -542,10 +617,7 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset) | |||
542 | 617 | ||
543 | ACPI_FUNCTION_TRACE(("hotkey_config_seq_show")); | 618 | ACPI_FUNCTION_TRACE(("hotkey_config_seq_show")); |
544 | 619 | ||
545 | if (!hotkey_list) | 620 | list_for_each(entries, hotkey_list->entries) { |
546 | goto end; | ||
547 | |||
548 | list_for_each_safe(entries, next, hotkey_list->entries) { | ||
549 | union acpi_hotkey *key = | 621 | union acpi_hotkey *key = |
550 | container_of(entries, union acpi_hotkey, entries); | 622 | container_of(entries, union acpi_hotkey, entries); |
551 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { | 623 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT) { |
@@ -553,18 +625,37 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset) | |||
553 | ACPI_NAME_TYPE_MAX, &bus); | 625 | ACPI_NAME_TYPE_MAX, &bus); |
554 | acpi_get_name(key->event_hotkey.action_handle, | 626 | acpi_get_name(key->event_hotkey.action_handle, |
555 | ACPI_NAME_TYPE_MAX, &act); | 627 | ACPI_NAME_TYPE_MAX, &act); |
556 | seq_printf(seq, "%s:%s:%s:%d:%d", bus_name, | 628 | seq_printf(seq, "%s:%s:%s:%d:%d\n", bus_name, |
557 | action_name, | 629 | action_name, |
558 | key->event_hotkey.action_method, | 630 | key->event_hotkey.action_method, |
559 | key->link.hotkey_standard_num, | 631 | key->link.hotkey_standard_num, |
560 | key->event_hotkey.external_hotkey_num); | 632 | key->event_hotkey.external_hotkey_num); |
561 | } /* ACPI_HOTKEY_POLLING */ | 633 | } |
562 | else { | 634 | } |
635 | seq_puts(seq, "\n"); | ||
636 | return_VALUE(0); | ||
637 | } | ||
638 | |||
639 | static int hotkey_poll_config_seq_show(struct seq_file *seq, void *offset) | ||
640 | { | ||
641 | struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; | ||
642 | struct list_head *entries; | ||
643 | char bus_name[ACPI_PATHNAME_MAX] = { 0 }; | ||
644 | char action_name[ACPI_PATHNAME_MAX] = { 0 }; | ||
645 | struct acpi_buffer bus = { ACPI_PATHNAME_MAX, bus_name }; | ||
646 | struct acpi_buffer act = { ACPI_PATHNAME_MAX, action_name }; | ||
647 | |||
648 | ACPI_FUNCTION_TRACE(("hotkey_config_seq_show")); | ||
649 | |||
650 | list_for_each(entries, hotkey_list->entries) { | ||
651 | union acpi_hotkey *key = | ||
652 | container_of(entries, union acpi_hotkey, entries); | ||
653 | if (key->link.hotkey_type == ACPI_HOTKEY_POLLING) { | ||
563 | acpi_get_name(key->poll_hotkey.poll_handle, | 654 | acpi_get_name(key->poll_hotkey.poll_handle, |
564 | ACPI_NAME_TYPE_MAX, &bus); | 655 | ACPI_NAME_TYPE_MAX, &bus); |
565 | acpi_get_name(key->poll_hotkey.action_handle, | 656 | acpi_get_name(key->poll_hotkey.action_handle, |
566 | ACPI_NAME_TYPE_MAX, &act); | 657 | ACPI_NAME_TYPE_MAX, &act); |
567 | seq_printf(seq, "%s:%s:%s:%s:%d", bus_name, | 658 | seq_printf(seq, "%s:%s:%s:%s:%d\n", bus_name, |
568 | key->poll_hotkey.poll_method, | 659 | key->poll_hotkey.poll_method, |
569 | action_name, | 660 | action_name, |
570 | key->poll_hotkey.action_method, | 661 | key->poll_hotkey.action_method, |
@@ -572,49 +663,83 @@ static int hotkey_config_seq_show(struct seq_file *seq, void *offset) | |||
572 | } | 663 | } |
573 | } | 664 | } |
574 | seq_puts(seq, "\n"); | 665 | seq_puts(seq, "\n"); |
575 | end: | ||
576 | return_VALUE(0); | 666 | return_VALUE(0); |
577 | } | 667 | } |
578 | 668 | ||
579 | static int | 669 | static int |
580 | get_parms(char *config_record, | 670 | get_parms(char *config_record, |
581 | int *cmd, | 671 | int *cmd, |
582 | char *bus_handle, | 672 | char **bus_handle, |
583 | char *bus_method, | 673 | char **bus_method, |
584 | char *action_handle, | 674 | char **action_handle, |
585 | char *method, int *internal_event_num, int *external_event_num) | 675 | char **method, int *internal_event_num, int *external_event_num) |
586 | { | 676 | { |
587 | char *tmp, *tmp1; | 677 | char *tmp, *tmp1, count; |
588 | ACPI_FUNCTION_TRACE(("get_parms")); | 678 | ACPI_FUNCTION_TRACE(("get_parms")); |
589 | 679 | ||
590 | sscanf(config_record, "%d", cmd); | 680 | sscanf(config_record, "%d", cmd); |
591 | 681 | ||
682 | if(*cmd == 1){ | ||
683 | if(sscanf(config_record, "%d:%d", cmd, internal_event_num)!=2) | ||
684 | goto do_fail; | ||
685 | else | ||
686 | return (6); | ||
687 | } | ||
592 | tmp = strchr(config_record, ':'); | 688 | tmp = strchr(config_record, ':'); |
689 | if (!tmp) | ||
690 | goto do_fail; | ||
593 | tmp++; | 691 | tmp++; |
594 | tmp1 = strchr(tmp, ':'); | 692 | tmp1 = strchr(tmp, ':'); |
595 | strncpy(bus_handle, tmp, tmp1 - tmp); | 693 | if (!tmp1) |
596 | bus_handle[tmp1 - tmp] = 0; | 694 | goto do_fail; |
695 | |||
696 | count = tmp1 - tmp; | ||
697 | *bus_handle = (char *) kmalloc(count+1, GFP_KERNEL); | ||
698 | if(!*bus_handle) | ||
699 | goto do_fail; | ||
700 | strncpy(*bus_handle, tmp, count); | ||
701 | *(*bus_handle + count) = 0; | ||
597 | 702 | ||
598 | tmp = tmp1; | 703 | tmp = tmp1; |
599 | tmp++; | 704 | tmp++; |
600 | tmp1 = strchr(tmp, ':'); | 705 | tmp1 = strchr(tmp, ':'); |
601 | strncpy(bus_method, tmp, tmp1 - tmp); | 706 | if (!tmp1) |
602 | bus_method[tmp1 - tmp] = 0; | 707 | goto do_fail; |
708 | count = tmp1 - tmp; | ||
709 | *bus_method = (char *) kmalloc(count+1, GFP_KERNEL); | ||
710 | if(!*bus_method) | ||
711 | goto do_fail; | ||
712 | strncpy(*bus_method, tmp, count); | ||
713 | *(*bus_method + count) = 0; | ||
603 | 714 | ||
604 | tmp = tmp1; | 715 | tmp = tmp1; |
605 | tmp++; | 716 | tmp++; |
606 | tmp1 = strchr(tmp, ':'); | 717 | tmp1 = strchr(tmp, ':'); |
607 | strncpy(action_handle, tmp, tmp1 - tmp); | 718 | if (!tmp1) |
608 | action_handle[tmp1 - tmp] = 0; | 719 | goto do_fail; |
720 | count = tmp1 - tmp; | ||
721 | *action_handle = (char *) kmalloc(count+1, GFP_KERNEL); | ||
722 | strncpy(*action_handle, tmp, count); | ||
723 | *(*action_handle + count) = 0; | ||
609 | 724 | ||
610 | tmp = tmp1; | 725 | tmp = tmp1; |
611 | tmp++; | 726 | tmp++; |
612 | tmp1 = strchr(tmp, ':'); | 727 | tmp1 = strchr(tmp, ':'); |
613 | strncpy(method, tmp, tmp1 - tmp); | 728 | if (!tmp1) |
614 | method[tmp1 - tmp] = 0; | 729 | goto do_fail; |
730 | count = tmp1 - tmp; | ||
731 | *method = (char *) kmalloc(count+1, GFP_KERNEL); | ||
732 | if(!*method) | ||
733 | goto do_fail; | ||
734 | strncpy(*method, tmp, count); | ||
735 | *(*method + count) = 0; | ||
736 | |||
737 | if(sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num)<=0) | ||
738 | goto do_fail; | ||
615 | 739 | ||
616 | sscanf(tmp1 + 1, "%d:%d", internal_event_num, external_event_num); | ||
617 | return_VALUE(6); | 740 | return_VALUE(6); |
741 | do_fail: | ||
742 | return_VALUE(-1); | ||
618 | } | 743 | } |
619 | 744 | ||
620 | /* count is length for one input record */ | 745 | /* count is length for one input record */ |
@@ -622,135 +747,117 @@ static ssize_t hotkey_write_config(struct file *file, | |||
622 | const char __user * buffer, | 747 | const char __user * buffer, |
623 | size_t count, loff_t * data) | 748 | size_t count, loff_t * data) |
624 | { | 749 | { |
625 | struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; | 750 | char *config_record = NULL; |
626 | char config_record[MAX_CONFIG_RECORD_LEN]; | 751 | char *bus_handle = NULL; |
627 | char bus_handle[MAX_NAME_PATH_LEN]; | 752 | char *bus_method = NULL; |
628 | char bus_method[MAX_NAME_PATH_LEN]; | 753 | char *action_handle = NULL; |
629 | char action_handle[MAX_NAME_PATH_LEN]; | 754 | char *method = NULL; |
630 | char method[20]; | ||
631 | int cmd, internal_event_num, external_event_num; | 755 | int cmd, internal_event_num, external_event_num; |
632 | int ret = 0; | 756 | int ret = 0; |
633 | union acpi_hotkey *key = NULL; | 757 | union acpi_hotkey *key = NULL; |
634 | 758 | ||
635 | ACPI_FUNCTION_TRACE(("hotkey_write_config")); | 759 | ACPI_FUNCTION_TRACE(("hotkey_write_config")); |
636 | 760 | ||
637 | if (!hotkey_list || count > MAX_CONFIG_RECORD_LEN) { | 761 | config_record = (char *) kmalloc(count+1, GFP_KERNEL); |
638 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid arguments\n")); | 762 | if(!config_record) |
639 | return_VALUE(-EINVAL); | 763 | return_VALUE(-ENOMEM); |
640 | } | ||
641 | 764 | ||
642 | if (copy_from_user(config_record, buffer, count)) { | 765 | if (copy_from_user(config_record, buffer, count)) { |
766 | kfree(config_record); | ||
643 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data \n")); | 767 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data \n")); |
644 | return_VALUE(-EINVAL); | 768 | return_VALUE(-EINVAL); |
645 | } | 769 | } |
646 | config_record[count] = '\0'; | 770 | config_record[count] = 0; |
647 | 771 | ||
648 | ret = get_parms(config_record, | 772 | ret = get_parms(config_record, |
649 | &cmd, | 773 | &cmd, |
650 | bus_handle, | 774 | &bus_handle, |
651 | bus_method, | 775 | &bus_method, |
652 | action_handle, | 776 | &action_handle, |
653 | method, &internal_event_num, &external_event_num); | 777 | &method, &internal_event_num, &external_event_num); |
778 | |||
779 | kfree(config_record); | ||
780 | if(IS_OTHERS(internal_event_num)) | ||
781 | goto do_fail; | ||
654 | if (ret != 6) { | 782 | if (ret != 6) { |
783 | do_fail: | ||
784 | kfree(bus_handle); | ||
785 | kfree(bus_method); | ||
786 | kfree(action_handle); | ||
787 | kfree(method); | ||
655 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 788 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
656 | "Invalid data format ret=%d\n", ret)); | 789 | "Invalid data format ret=%d\n", ret)); |
657 | return_VALUE(-EINVAL); | 790 | return_VALUE(-EINVAL); |
658 | } | 791 | } |
659 | 792 | ||
660 | key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL); | 793 | key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL); |
661 | ret = init_hotkey_device(key, bus_handle, action_handle, method, | 794 | if(!key) |
795 | goto do_fail; | ||
796 | memset(key, 0, sizeof(union acpi_hotkey)); | ||
797 | if(cmd == 1) { | ||
798 | union acpi_hotkey *tmp = NULL; | ||
799 | tmp = get_hotkey_by_event(&global_hotkey_list, | ||
800 | internal_event_num); | ||
801 | if(!tmp) | ||
802 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid key")); | ||
803 | else | ||
804 | memcpy(key, tmp, sizeof(union acpi_hotkey)); | ||
805 | goto cont_cmd; | ||
806 | } | ||
807 | if (IS_EVENT(internal_event_num)) { | ||
808 | kfree(bus_method); | ||
809 | ret = init_hotkey_device(key, bus_handle, action_handle, method, | ||
662 | internal_event_num, external_event_num); | 810 | internal_event_num, external_event_num); |
663 | 811 | } else | |
664 | if (ret || check_hotkey_valid(key, hotkey_list)) { | 812 | ret = init_poll_hotkey_device(key, bus_handle, bus_method, |
813 | action_handle, method, | ||
814 | internal_event_num); | ||
815 | if (ret) { | ||
816 | kfree(bus_handle); | ||
817 | kfree(action_handle); | ||
818 | if(IS_EVENT(internal_event_num)) | ||
819 | free_hotkey_buffer(key); | ||
820 | else | ||
821 | free_poll_hotkey_buffer(key); | ||
665 | kfree(key); | 822 | kfree(key); |
666 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid hotkey \n")); | 823 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid hotkey \n")); |
667 | return_VALUE(-EINVAL); | 824 | return_VALUE(-EINVAL); |
668 | } | 825 | } |
669 | switch (cmd) { | ||
670 | case 0: | ||
671 | hotkey_add(key); | ||
672 | break; | ||
673 | case 1: | ||
674 | hotkey_remove(key); | ||
675 | free_hotkey_device(key); | ||
676 | break; | ||
677 | case 2: | ||
678 | hotkey_update(key); | ||
679 | break; | ||
680 | default: | ||
681 | break; | ||
682 | } | ||
683 | return_VALUE(count); | ||
684 | } | ||
685 | |||
686 | /* count is length for one input record */ | ||
687 | static ssize_t hotkey_write_poll_config(struct file *file, | ||
688 | const char __user * buffer, | ||
689 | size_t count, loff_t * data) | ||
690 | { | ||
691 | struct seq_file *m = (struct seq_file *)file->private_data; | ||
692 | struct acpi_hotkey_list *hotkey_list = | ||
693 | (struct acpi_hotkey_list *)m->private; | ||
694 | |||
695 | char config_record[MAX_CONFIG_RECORD_LEN]; | ||
696 | char polling_handle[MAX_NAME_PATH_LEN]; | ||
697 | char action_handle[MAX_NAME_PATH_LEN]; | ||
698 | char poll_method[20], action_method[20]; | ||
699 | int ret, internal_event_num, cmd, external_event_num; | ||
700 | union acpi_hotkey *key = NULL; | ||
701 | |||
702 | ACPI_FUNCTION_TRACE("hotkey_write_poll_config"); | ||
703 | |||
704 | if (!hotkey_list || count > MAX_CONFIG_RECORD_LEN) { | ||
705 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid arguments\n")); | ||
706 | return_VALUE(-EINVAL); | ||
707 | } | ||
708 | |||
709 | if (copy_from_user(config_record, buffer, count)) { | ||
710 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data \n")); | ||
711 | return_VALUE(-EINVAL); | ||
712 | } | ||
713 | config_record[count] = '\0'; | ||
714 | 826 | ||
715 | ret = get_parms(config_record, | 827 | cont_cmd: |
716 | &cmd, | 828 | kfree(bus_handle); |
717 | polling_handle, | 829 | kfree(action_handle); |
718 | poll_method, | ||
719 | action_handle, | ||
720 | action_method, | ||
721 | &internal_event_num, &external_event_num); | ||
722 | |||
723 | if (ret != 6) { | ||
724 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid data format\n")); | ||
725 | return_VALUE(-EINVAL); | ||
726 | } | ||
727 | 830 | ||
728 | key = kmalloc(sizeof(union acpi_hotkey), GFP_KERNEL); | ||
729 | ret = init_poll_hotkey_device(key, polling_handle, poll_method, | ||
730 | action_handle, action_method, | ||
731 | internal_event_num); | ||
732 | if (ret || check_hotkey_valid(key, hotkey_list)) { | ||
733 | kfree(key); | ||
734 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid hotkey \n")); | ||
735 | return_VALUE(-EINVAL); | ||
736 | } | ||
737 | switch (cmd) { | 831 | switch (cmd) { |
738 | case 0: | 832 | case 0: |
739 | hotkey_add(key); | 833 | if(get_hotkey_by_event(&global_hotkey_list,key->link.hotkey_standard_num)) |
834 | goto fail_out; | ||
835 | else | ||
836 | hotkey_add(key); | ||
740 | break; | 837 | break; |
741 | case 1: | 838 | case 1: |
742 | hotkey_remove(key); | 839 | hotkey_remove(key); |
743 | break; | 840 | break; |
744 | case 2: | 841 | case 2: |
745 | hotkey_update(key); | 842 | if(hotkey_update(key)) |
843 | goto fail_out; | ||
746 | break; | 844 | break; |
747 | default: | 845 | default: |
846 | goto fail_out; | ||
748 | break; | 847 | break; |
749 | } | 848 | } |
750 | return_VALUE(count); | 849 | return_VALUE(count); |
850 | fail_out: | ||
851 | if(IS_EVENT(internal_event_num)) | ||
852 | free_hotkey_buffer(key); | ||
853 | else | ||
854 | free_poll_hotkey_buffer(key); | ||
855 | kfree(key); | ||
856 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "invalid key\n")); | ||
857 | return_VALUE(-EINVAL); | ||
751 | } | 858 | } |
752 | 859 | ||
753 | /* | 860 | /* |
754 | * This function evaluates an ACPI method, given an int as parameter, the | 861 | * This function evaluates an ACPI method, given an int as parameter, the |
755 | * method is searched within the scope of the handle, can be NULL. The output | 862 | * method is searched within the scope of the handle, can be NULL. The output |
756 | * of the method is written is output, which can also be NULL | 863 | * of the method is written is output, which can also be NULL |
@@ -775,7 +882,7 @@ static int write_acpi_int(acpi_handle handle, const char *method, int val, | |||
775 | return_VALUE(status == AE_OK); | 882 | return_VALUE(status == AE_OK); |
776 | } | 883 | } |
777 | 884 | ||
778 | static int read_acpi_int(acpi_handle handle, const char *method, int *val) | 885 | static int read_acpi_int(acpi_handle handle, const char *method, union acpi_object *val) |
779 | { | 886 | { |
780 | struct acpi_buffer output; | 887 | struct acpi_buffer output; |
781 | union acpi_object out_obj; | 888 | union acpi_object out_obj; |
@@ -786,62 +893,32 @@ static int read_acpi_int(acpi_handle handle, const char *method, int *val) | |||
786 | output.pointer = &out_obj; | 893 | output.pointer = &out_obj; |
787 | 894 | ||
788 | status = acpi_evaluate_object(handle, (char *)method, NULL, &output); | 895 | status = acpi_evaluate_object(handle, (char *)method, NULL, &output); |
789 | *val = out_obj.integer.value; | 896 | if(val){ |
897 | val->integer.value = out_obj.integer.value; | ||
898 | val->type = out_obj.type; | ||
899 | } else | ||
900 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "null val pointer")); | ||
790 | return_VALUE((status == AE_OK) | 901 | return_VALUE((status == AE_OK) |
791 | && (out_obj.type == ACPI_TYPE_INTEGER)); | 902 | && (out_obj.type == ACPI_TYPE_INTEGER)); |
792 | } | 903 | } |
793 | 904 | ||
794 | static acpi_handle | 905 | static union acpi_hotkey *get_hotkey_by_event(struct |
795 | get_handle_from_hotkeylist(struct acpi_hotkey_list *hotkey_list, int event_num) | 906 | acpi_hotkey_list |
907 | *hotkey_list, int event) | ||
796 | { | 908 | { |
797 | struct list_head *entries, *next; | 909 | struct list_head *entries; |
798 | |||
799 | list_for_each_safe(entries, next, hotkey_list->entries) { | ||
800 | union acpi_hotkey *key = | ||
801 | container_of(entries, union acpi_hotkey, entries); | ||
802 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT | ||
803 | && key->link.hotkey_standard_num == event_num) { | ||
804 | return (key->event_hotkey.action_handle); | ||
805 | } | ||
806 | } | ||
807 | return (NULL); | ||
808 | } | ||
809 | |||
810 | static | ||
811 | char *get_method_from_hotkeylist(struct acpi_hotkey_list *hotkey_list, | ||
812 | int event_num) | ||
813 | { | ||
814 | struct list_head *entries, *next; | ||
815 | |||
816 | list_for_each_safe(entries, next, hotkey_list->entries) { | ||
817 | union acpi_hotkey *key = | ||
818 | container_of(entries, union acpi_hotkey, entries); | ||
819 | |||
820 | if (key->link.hotkey_type == ACPI_HOTKEY_EVENT && | ||
821 | key->link.hotkey_standard_num == event_num) | ||
822 | return (key->event_hotkey.action_method); | ||
823 | } | ||
824 | return (NULL); | ||
825 | } | ||
826 | |||
827 | static struct acpi_polling_hotkey *get_hotkey_by_event(struct | ||
828 | acpi_hotkey_list | ||
829 | *hotkey_list, int event) | ||
830 | { | ||
831 | struct list_head *entries, *next; | ||
832 | 910 | ||
833 | list_for_each_safe(entries, next, hotkey_list->entries) { | 911 | list_for_each(entries, hotkey_list->entries) { |
834 | union acpi_hotkey *key = | 912 | union acpi_hotkey *key = |
835 | container_of(entries, union acpi_hotkey, entries); | 913 | container_of(entries, union acpi_hotkey, entries); |
836 | if (key->link.hotkey_type == ACPI_HOTKEY_POLLING | 914 | if (key->link.hotkey_standard_num == event) { |
837 | && key->link.hotkey_standard_num == event) { | 915 | return(key); |
838 | return (&key->poll_hotkey); | ||
839 | } | 916 | } |
840 | } | 917 | } |
841 | return (NULL); | 918 | return(NULL); |
842 | } | 919 | } |
843 | 920 | ||
844 | /* | 921 | /* |
845 | * user call AML method interface: | 922 | * user call AML method interface: |
846 | * Call convention: | 923 | * Call convention: |
847 | * echo "event_num: arg type : value" | 924 | * echo "event_num: arg type : value" |
@@ -854,48 +931,56 @@ static ssize_t hotkey_execute_aml_method(struct file *file, | |||
854 | size_t count, loff_t * data) | 931 | size_t count, loff_t * data) |
855 | { | 932 | { |
856 | struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; | 933 | struct acpi_hotkey_list *hotkey_list = &global_hotkey_list; |
857 | char arg[MAX_CALL_PARM]; | 934 | char *arg; |
858 | int event, type, value; | 935 | int event,method_type,type, value; |
859 | 936 | union acpi_hotkey *key; | |
860 | char *method; | ||
861 | acpi_handle handle; | ||
862 | 937 | ||
863 | ACPI_FUNCTION_TRACE("hotkey_execte_aml_method"); | 938 | ACPI_FUNCTION_TRACE("hotkey_execte_aml_method"); |
864 | 939 | ||
865 | if (!hotkey_list || count > MAX_CALL_PARM) { | 940 | arg = (char *) kmalloc(count+1, GFP_KERNEL); |
866 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 1")); | 941 | if(!arg) |
867 | return_VALUE(-EINVAL); | 942 | return_VALUE(-ENOMEM); |
868 | } | 943 | arg[count]=0; |
869 | 944 | ||
870 | if (copy_from_user(arg, buffer, count)) { | 945 | if (copy_from_user(arg, buffer, count)) { |
946 | kfree(arg); | ||
871 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 2")); | 947 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 2")); |
872 | return_VALUE(-EINVAL); | 948 | return_VALUE(-EINVAL); |
873 | } | 949 | } |
874 | 950 | ||
875 | arg[count] = '\0'; | 951 | if (sscanf(arg, "%d:%d:%d:%d", &event, &method_type, &type, &value) != 4) { |
876 | 952 | kfree(arg); | |
877 | if (sscanf(arg, "%d:%d:%d", &event, &type, &value) != 3) { | ||
878 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3")); | 953 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid argument 3")); |
879 | return_VALUE(-EINVAL); | 954 | return_VALUE(-EINVAL); |
880 | } | 955 | } |
881 | 956 | kfree(arg); | |
882 | if (type == ACPI_TYPE_INTEGER) { | 957 | if (type == ACPI_TYPE_INTEGER) { |
883 | handle = get_handle_from_hotkeylist(hotkey_list, event); | 958 | key = get_hotkey_by_event(hotkey_list, event); |
884 | method = (char *)get_method_from_hotkeylist(hotkey_list, event); | 959 | if(!key) |
960 | goto do_fail; | ||
885 | if (IS_EVENT(event)) | 961 | if (IS_EVENT(event)) |
886 | write_acpi_int(handle, method, value, NULL); | 962 | write_acpi_int(key->event_hotkey.action_handle, |
963 | key->event_hotkey.action_method, value, NULL); | ||
887 | else if (IS_POLL(event)) { | 964 | else if (IS_POLL(event)) { |
888 | struct acpi_polling_hotkey *key; | 965 | if ( method_type == POLL_METHOD ) |
889 | key = (struct acpi_polling_hotkey *) | 966 | read_acpi_int(key->poll_hotkey.poll_handle, |
890 | get_hotkey_by_event(hotkey_list, event); | 967 | key->poll_hotkey.poll_method, |
891 | read_acpi_int(handle, method, key->poll_result); | 968 | key->poll_hotkey.poll_result); |
969 | else if ( method_type == ACTION_METHOD ) | ||
970 | write_acpi_int(key->poll_hotkey.action_handle, | ||
971 | key->poll_hotkey.action_method, value, NULL); | ||
972 | else | ||
973 | goto do_fail; | ||
974 | |||
892 | } | 975 | } |
893 | } else { | 976 | } else { |
894 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Not supported")); | 977 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Not supported")); |
895 | return_VALUE(-EINVAL); | 978 | return_VALUE(-EINVAL); |
896 | } | 979 | } |
897 | |||
898 | return_VALUE(count); | 980 | return_VALUE(count); |
981 | do_fail: | ||
982 | return_VALUE(-EINVAL); | ||
983 | |||
899 | } | 984 | } |
900 | 985 | ||
901 | static int __init hotkey_init(void) | 986 | static int __init hotkey_init(void) |
@@ -928,7 +1013,7 @@ static int __init hotkey_init(void) | |||
928 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1013 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
929 | "Hotkey: Unable to create %s entry\n", | 1014 | "Hotkey: Unable to create %s entry\n", |
930 | HOTKEY_EV_CONFIG)); | 1015 | HOTKEY_EV_CONFIG)); |
931 | return (-ENODEV); | 1016 | goto do_fail1; |
932 | } else { | 1017 | } else { |
933 | hotkey_config->proc_fops = &hotkey_config_fops; | 1018 | hotkey_config->proc_fops = &hotkey_config_fops; |
934 | hotkey_config->data = &global_hotkey_list; | 1019 | hotkey_config->data = &global_hotkey_list; |
@@ -943,7 +1028,8 @@ static int __init hotkey_init(void) | |||
943 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1028 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
944 | "Hotkey: Unable to create %s entry\n", | 1029 | "Hotkey: Unable to create %s entry\n", |
945 | HOTKEY_EV_CONFIG)); | 1030 | HOTKEY_EV_CONFIG)); |
946 | return (-ENODEV); | 1031 | |
1032 | goto do_fail2; | ||
947 | } else { | 1033 | } else { |
948 | hotkey_poll_config->proc_fops = &hotkey_poll_config_fops; | 1034 | hotkey_poll_config->proc_fops = &hotkey_poll_config_fops; |
949 | hotkey_poll_config->data = &global_hotkey_list; | 1035 | hotkey_poll_config->data = &global_hotkey_list; |
@@ -957,7 +1043,7 @@ static int __init hotkey_init(void) | |||
957 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1043 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
958 | "Hotkey: Unable to create %s entry\n", | 1044 | "Hotkey: Unable to create %s entry\n", |
959 | HOTKEY_ACTION)); | 1045 | HOTKEY_ACTION)); |
960 | return (-ENODEV); | 1046 | goto do_fail3; |
961 | } else { | 1047 | } else { |
962 | hotkey_action->proc_fops = &hotkey_action_fops; | 1048 | hotkey_action->proc_fops = &hotkey_action_fops; |
963 | hotkey_action->owner = THIS_MODULE; | 1049 | hotkey_action->owner = THIS_MODULE; |
@@ -970,7 +1056,7 @@ static int __init hotkey_init(void) | |||
970 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1056 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
971 | "Hotkey: Unable to create %s entry\n", | 1057 | "Hotkey: Unable to create %s entry\n", |
972 | HOTKEY_INFO)); | 1058 | HOTKEY_INFO)); |
973 | return (-ENODEV); | 1059 | goto do_fail4; |
974 | } else { | 1060 | } else { |
975 | hotkey_info->proc_fops = &hotkey_info_fops; | 1061 | hotkey_info->proc_fops = &hotkey_info_fops; |
976 | hotkey_info->owner = THIS_MODULE; | 1062 | hotkey_info->owner = THIS_MODULE; |
@@ -979,23 +1065,33 @@ static int __init hotkey_init(void) | |||
979 | } | 1065 | } |
980 | 1066 | ||
981 | result = acpi_bus_register_driver(&hotkey_driver); | 1067 | result = acpi_bus_register_driver(&hotkey_driver); |
982 | if (result < 0) { | 1068 | if (result < 0) |
983 | remove_proc_entry(HOTKEY_PROC, acpi_root_dir); | 1069 | goto do_fail5; |
984 | return (-ENODEV); | ||
985 | } | ||
986 | global_hotkey_list.count = 0; | 1070 | global_hotkey_list.count = 0; |
987 | global_hotkey_list.entries = &hotkey_entries; | 1071 | global_hotkey_list.entries = &hotkey_entries; |
988 | 1072 | ||
989 | INIT_LIST_HEAD(&hotkey_entries); | 1073 | INIT_LIST_HEAD(&hotkey_entries); |
990 | 1074 | ||
991 | return (0); | 1075 | return (0); |
1076 | |||
1077 | do_fail5: | ||
1078 | remove_proc_entry(HOTKEY_INFO, hotkey_proc_dir); | ||
1079 | do_fail4: | ||
1080 | remove_proc_entry(HOTKEY_ACTION, hotkey_proc_dir); | ||
1081 | do_fail3: | ||
1082 | remove_proc_entry(HOTKEY_PL_CONFIG, hotkey_proc_dir); | ||
1083 | do_fail2: | ||
1084 | remove_proc_entry(HOTKEY_EV_CONFIG, hotkey_proc_dir); | ||
1085 | do_fail1: | ||
1086 | remove_proc_entry(HOTKEY_PROC, acpi_root_dir); | ||
1087 | return (-ENODEV); | ||
992 | } | 1088 | } |
993 | 1089 | ||
994 | static void __exit hotkey_exit(void) | 1090 | static void __exit hotkey_exit(void) |
995 | { | 1091 | { |
996 | struct list_head *entries, *next; | 1092 | struct list_head *entries, *next; |
997 | 1093 | ||
998 | ACPI_FUNCTION_TRACE("hotkey_remove"); | 1094 | ACPI_FUNCTION_TRACE("hotkey_exit"); |
999 | 1095 | ||
1000 | list_for_each_safe(entries, next, global_hotkey_list.entries) { | 1096 | list_for_each_safe(entries, next, global_hotkey_list.entries) { |
1001 | union acpi_hotkey *key = | 1097 | union acpi_hotkey *key = |
diff --git a/drivers/acpi/motherboard.c b/drivers/acpi/motherboard.c index 61ea70742d49..2934475d67d6 100644 --- a/drivers/acpi/motherboard.c +++ b/drivers/acpi/motherboard.c | |||
@@ -43,7 +43,7 @@ ACPI_MODULE_NAME ("acpi_motherboard") | |||
43 | */ | 43 | */ |
44 | #define IS_RESERVED_ADDR(base, len) \ | 44 | #define IS_RESERVED_ADDR(base, len) \ |
45 | (((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \ | 45 | (((len) > 0) && ((base) > 0) && ((base) + (len) < IO_SPACE_LIMIT) \ |
46 | && ((base) + (len) > PCIBIOS_MIN_IO)) | 46 | && ((base) + (len) > 0x1000)) |
47 | 47 | ||
48 | /* | 48 | /* |
49 | * Clearing the flag (IORESOURCE_BUSY) allows drivers to use | 49 | * Clearing the flag (IORESOURCE_BUSY) allows drivers to use |
diff --git a/drivers/acpi/pci_irq.c b/drivers/acpi/pci_irq.c index d1f42b972821..bb973d2109a1 100644 --- a/drivers/acpi/pci_irq.c +++ b/drivers/acpi/pci_irq.c | |||
@@ -269,7 +269,51 @@ acpi_pci_irq_del_prt (int segment, int bus) | |||
269 | /* -------------------------------------------------------------------------- | 269 | /* -------------------------------------------------------------------------- |
270 | PCI Interrupt Routing Support | 270 | PCI Interrupt Routing Support |
271 | -------------------------------------------------------------------------- */ | 271 | -------------------------------------------------------------------------- */ |
272 | typedef int (*irq_lookup_func)(struct acpi_prt_entry *, int *, int *, char **); | ||
272 | 273 | ||
274 | static int | ||
275 | acpi_pci_allocate_irq(struct acpi_prt_entry *entry, | ||
276 | int *edge_level, | ||
277 | int *active_high_low, | ||
278 | char **link) | ||
279 | { | ||
280 | int irq; | ||
281 | |||
282 | ACPI_FUNCTION_TRACE("acpi_pci_allocate_irq"); | ||
283 | |||
284 | if (entry->link.handle) { | ||
285 | irq = acpi_pci_link_allocate_irq(entry->link.handle, | ||
286 | entry->link.index, edge_level, active_high_low, link); | ||
287 | if (irq < 0) { | ||
288 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n")); | ||
289 | return_VALUE(-1); | ||
290 | } | ||
291 | } else { | ||
292 | irq = entry->link.index; | ||
293 | *edge_level = ACPI_LEVEL_SENSITIVE; | ||
294 | *active_high_low = ACPI_ACTIVE_LOW; | ||
295 | } | ||
296 | |||
297 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); | ||
298 | return_VALUE(irq); | ||
299 | } | ||
300 | |||
301 | static int | ||
302 | acpi_pci_free_irq(struct acpi_prt_entry *entry, | ||
303 | int *edge_level, | ||
304 | int *active_high_low, | ||
305 | char **link) | ||
306 | { | ||
307 | int irq; | ||
308 | |||
309 | ACPI_FUNCTION_TRACE("acpi_pci_free_irq"); | ||
310 | if (entry->link.handle) { | ||
311 | irq = acpi_pci_link_free_irq(entry->link.handle); | ||
312 | } else { | ||
313 | irq = entry->link.index; | ||
314 | } | ||
315 | return_VALUE(irq); | ||
316 | } | ||
273 | /* | 317 | /* |
274 | * acpi_pci_irq_lookup | 318 | * acpi_pci_irq_lookup |
275 | * success: return IRQ >= 0 | 319 | * success: return IRQ >= 0 |
@@ -282,12 +326,13 @@ acpi_pci_irq_lookup ( | |||
282 | int pin, | 326 | int pin, |
283 | int *edge_level, | 327 | int *edge_level, |
284 | int *active_high_low, | 328 | int *active_high_low, |
285 | char **link) | 329 | char **link, |
330 | irq_lookup_func func) | ||
286 | { | 331 | { |
287 | struct acpi_prt_entry *entry = NULL; | 332 | struct acpi_prt_entry *entry = NULL; |
288 | int segment = pci_domain_nr(bus); | 333 | int segment = pci_domain_nr(bus); |
289 | int bus_nr = bus->number; | 334 | int bus_nr = bus->number; |
290 | int irq; | 335 | int ret; |
291 | 336 | ||
292 | ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup"); | 337 | ACPI_FUNCTION_TRACE("acpi_pci_irq_lookup"); |
293 | 338 | ||
@@ -301,22 +346,8 @@ acpi_pci_irq_lookup ( | |||
301 | return_VALUE(-1); | 346 | return_VALUE(-1); |
302 | } | 347 | } |
303 | 348 | ||
304 | if (entry->link.handle) { | 349 | ret = func(entry, edge_level, active_high_low, link); |
305 | irq = acpi_pci_link_get_irq(entry->link.handle, | 350 | return_VALUE(ret); |
306 | entry->link.index, edge_level, active_high_low, link); | ||
307 | if (irq < 0) { | ||
308 | ACPI_DEBUG_PRINT((ACPI_DB_WARN, "Invalid IRQ link routing entry\n")); | ||
309 | return_VALUE(-1); | ||
310 | } | ||
311 | } else { | ||
312 | irq = entry->link.index; | ||
313 | *edge_level = ACPI_LEVEL_SENSITIVE; | ||
314 | *active_high_low = ACPI_ACTIVE_LOW; | ||
315 | } | ||
316 | |||
317 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found IRQ %d\n", irq)); | ||
318 | |||
319 | return_VALUE(irq); | ||
320 | } | 351 | } |
321 | 352 | ||
322 | /* | 353 | /* |
@@ -330,7 +361,8 @@ acpi_pci_irq_derive ( | |||
330 | int pin, | 361 | int pin, |
331 | int *edge_level, | 362 | int *edge_level, |
332 | int *active_high_low, | 363 | int *active_high_low, |
333 | char **link) | 364 | char **link, |
365 | irq_lookup_func func) | ||
334 | { | 366 | { |
335 | struct pci_dev *bridge = dev; | 367 | struct pci_dev *bridge = dev; |
336 | int irq = -1; | 368 | int irq = -1; |
@@ -363,7 +395,7 @@ acpi_pci_irq_derive ( | |||
363 | } | 395 | } |
364 | 396 | ||
365 | irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), | 397 | irq = acpi_pci_irq_lookup(bridge->bus, PCI_SLOT(bridge->devfn), |
366 | pin, edge_level, active_high_low, link); | 398 | pin, edge_level, active_high_low, link, func); |
367 | } | 399 | } |
368 | 400 | ||
369 | if (irq < 0) { | 401 | if (irq < 0) { |
@@ -415,7 +447,7 @@ acpi_pci_irq_enable ( | |||
415 | * values override any BIOS-assigned IRQs set during boot. | 447 | * values override any BIOS-assigned IRQs set during boot. |
416 | */ | 448 | */ |
417 | irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, | 449 | irq = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, |
418 | &edge_level, &active_high_low, &link); | 450 | &edge_level, &active_high_low, &link, acpi_pci_allocate_irq); |
419 | 451 | ||
420 | /* | 452 | /* |
421 | * If no PRT entry was found, we'll try to derive an IRQ from the | 453 | * If no PRT entry was found, we'll try to derive an IRQ from the |
@@ -423,7 +455,7 @@ acpi_pci_irq_enable ( | |||
423 | */ | 455 | */ |
424 | if (irq < 0) | 456 | if (irq < 0) |
425 | irq = acpi_pci_irq_derive(dev, pin, &edge_level, | 457 | irq = acpi_pci_irq_derive(dev, pin, &edge_level, |
426 | &active_high_low, &link); | 458 | &active_high_low, &link, acpi_pci_allocate_irq); |
427 | 459 | ||
428 | /* | 460 | /* |
429 | * No IRQ known to the ACPI subsystem - maybe the BIOS / | 461 | * No IRQ known to the ACPI subsystem - maybe the BIOS / |
@@ -462,7 +494,9 @@ acpi_pci_irq_enable ( | |||
462 | EXPORT_SYMBOL(acpi_pci_irq_enable); | 494 | EXPORT_SYMBOL(acpi_pci_irq_enable); |
463 | 495 | ||
464 | 496 | ||
465 | #ifdef CONFIG_ACPI_DEALLOCATE_IRQ | 497 | /* FIXME: implement x86/x86_64 version */ |
498 | void __attribute__((weak)) acpi_unregister_gsi(u32 i) {} | ||
499 | |||
466 | void | 500 | void |
467 | acpi_pci_irq_disable ( | 501 | acpi_pci_irq_disable ( |
468 | struct pci_dev *dev) | 502 | struct pci_dev *dev) |
@@ -489,14 +523,14 @@ acpi_pci_irq_disable ( | |||
489 | * First we check the PCI IRQ routing table (PRT) for an IRQ. | 523 | * First we check the PCI IRQ routing table (PRT) for an IRQ. |
490 | */ | 524 | */ |
491 | gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, | 525 | gsi = acpi_pci_irq_lookup(dev->bus, PCI_SLOT(dev->devfn), pin, |
492 | &edge_level, &active_high_low, NULL); | 526 | &edge_level, &active_high_low, NULL, acpi_pci_free_irq); |
493 | /* | 527 | /* |
494 | * If no PRT entry was found, we'll try to derive an IRQ from the | 528 | * If no PRT entry was found, we'll try to derive an IRQ from the |
495 | * device's parent bridge. | 529 | * device's parent bridge. |
496 | */ | 530 | */ |
497 | if (gsi < 0) | 531 | if (gsi < 0) |
498 | gsi = acpi_pci_irq_derive(dev, pin, | 532 | gsi = acpi_pci_irq_derive(dev, pin, |
499 | &edge_level, &active_high_low, NULL); | 533 | &edge_level, &active_high_low, NULL, acpi_pci_free_irq); |
500 | if (gsi < 0) | 534 | if (gsi < 0) |
501 | return_VOID; | 535 | return_VOID; |
502 | 536 | ||
@@ -512,4 +546,3 @@ acpi_pci_irq_disable ( | |||
512 | 546 | ||
513 | return_VOID; | 547 | return_VOID; |
514 | } | 548 | } |
515 | #endif /* CONFIG_ACPI_DEALLOCATE_IRQ */ | ||
diff --git a/drivers/acpi/pci_link.c b/drivers/acpi/pci_link.c index 6ad0e77df9b3..65cea07abbc3 100644 --- a/drivers/acpi/pci_link.c +++ b/drivers/acpi/pci_link.c | |||
@@ -68,6 +68,10 @@ static struct acpi_driver acpi_pci_link_driver = { | |||
68 | }, | 68 | }, |
69 | }; | 69 | }; |
70 | 70 | ||
71 | /* | ||
72 | * If a link is initialized, we never change its active and initialized | ||
73 | * later even the link is disable. Instead, we just repick the active irq | ||
74 | */ | ||
71 | struct acpi_pci_link_irq { | 75 | struct acpi_pci_link_irq { |
72 | u8 active; /* Current IRQ */ | 76 | u8 active; /* Current IRQ */ |
73 | u8 edge_level; /* All IRQs */ | 77 | u8 edge_level; /* All IRQs */ |
@@ -76,8 +80,7 @@ struct acpi_pci_link_irq { | |||
76 | u8 possible_count; | 80 | u8 possible_count; |
77 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; | 81 | u8 possible[ACPI_PCI_LINK_MAX_POSSIBLE]; |
78 | u8 initialized:1; | 82 | u8 initialized:1; |
79 | u8 suspend_resume:1; | 83 | u8 reserved:7; |
80 | u8 reserved:6; | ||
81 | }; | 84 | }; |
82 | 85 | ||
83 | struct acpi_pci_link { | 86 | struct acpi_pci_link { |
@@ -85,12 +88,14 @@ struct acpi_pci_link { | |||
85 | struct acpi_device *device; | 88 | struct acpi_device *device; |
86 | acpi_handle handle; | 89 | acpi_handle handle; |
87 | struct acpi_pci_link_irq irq; | 90 | struct acpi_pci_link_irq irq; |
91 | int refcnt; | ||
88 | }; | 92 | }; |
89 | 93 | ||
90 | static struct { | 94 | static struct { |
91 | int count; | 95 | int count; |
92 | struct list_head entries; | 96 | struct list_head entries; |
93 | } acpi_link; | 97 | } acpi_link; |
98 | DECLARE_MUTEX(acpi_link_lock); | ||
94 | 99 | ||
95 | 100 | ||
96 | /* -------------------------------------------------------------------------- | 101 | /* -------------------------------------------------------------------------- |
@@ -532,12 +537,12 @@ static int acpi_pci_link_allocate( | |||
532 | 537 | ||
533 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); | 538 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate"); |
534 | 539 | ||
535 | if (link->irq.suspend_resume) { | 540 | if (link->irq.initialized) { |
536 | acpi_pci_link_set(link, link->irq.active); | 541 | if (link->refcnt == 0) |
537 | link->irq.suspend_resume = 0; | 542 | /* This means the link is disabled but initialized */ |
538 | } | 543 | acpi_pci_link_set(link, link->irq.active); |
539 | if (link->irq.initialized) | ||
540 | return_VALUE(0); | 544 | return_VALUE(0); |
545 | } | ||
541 | 546 | ||
542 | /* | 547 | /* |
543 | * search for active IRQ in list of possible IRQs. | 548 | * search for active IRQ in list of possible IRQs. |
@@ -596,13 +601,13 @@ static int acpi_pci_link_allocate( | |||
596 | } | 601 | } |
597 | 602 | ||
598 | /* | 603 | /* |
599 | * acpi_pci_link_get_irq | 604 | * acpi_pci_link_allocate_irq |
600 | * success: return IRQ >= 0 | 605 | * success: return IRQ >= 0 |
601 | * failure: return -1 | 606 | * failure: return -1 |
602 | */ | 607 | */ |
603 | 608 | ||
604 | int | 609 | int |
605 | acpi_pci_link_get_irq ( | 610 | acpi_pci_link_allocate_irq ( |
606 | acpi_handle handle, | 611 | acpi_handle handle, |
607 | int index, | 612 | int index, |
608 | int *edge_level, | 613 | int *edge_level, |
@@ -613,7 +618,7 @@ acpi_pci_link_get_irq ( | |||
613 | struct acpi_device *device = NULL; | 618 | struct acpi_device *device = NULL; |
614 | struct acpi_pci_link *link = NULL; | 619 | struct acpi_pci_link *link = NULL; |
615 | 620 | ||
616 | ACPI_FUNCTION_TRACE("acpi_pci_link_get_irq"); | 621 | ACPI_FUNCTION_TRACE("acpi_pci_link_allocate_irq"); |
617 | 622 | ||
618 | result = acpi_bus_get_device(handle, &device); | 623 | result = acpi_bus_get_device(handle, &device); |
619 | if (result) { | 624 | if (result) { |
@@ -633,21 +638,81 @@ acpi_pci_link_get_irq ( | |||
633 | return_VALUE(-1); | 638 | return_VALUE(-1); |
634 | } | 639 | } |
635 | 640 | ||
636 | if (acpi_pci_link_allocate(link)) | 641 | down(&acpi_link_lock); |
642 | if (acpi_pci_link_allocate(link)) { | ||
643 | up(&acpi_link_lock); | ||
637 | return_VALUE(-1); | 644 | return_VALUE(-1); |
645 | } | ||
638 | 646 | ||
639 | if (!link->irq.active) { | 647 | if (!link->irq.active) { |
648 | up(&acpi_link_lock); | ||
640 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); | 649 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link active IRQ is 0!\n")); |
641 | return_VALUE(-1); | 650 | return_VALUE(-1); |
642 | } | 651 | } |
652 | link->refcnt ++; | ||
653 | up(&acpi_link_lock); | ||
643 | 654 | ||
644 | if (edge_level) *edge_level = link->irq.edge_level; | 655 | if (edge_level) *edge_level = link->irq.edge_level; |
645 | if (active_high_low) *active_high_low = link->irq.active_high_low; | 656 | if (active_high_low) *active_high_low = link->irq.active_high_low; |
646 | if (name) *name = acpi_device_bid(link->device); | 657 | if (name) *name = acpi_device_bid(link->device); |
658 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
659 | "Link %s is referenced\n", acpi_device_bid(link->device))); | ||
647 | return_VALUE(link->irq.active); | 660 | return_VALUE(link->irq.active); |
648 | } | 661 | } |
649 | 662 | ||
663 | /* | ||
664 | * We don't change link's irq information here. After it is reenabled, we | ||
665 | * continue use the info | ||
666 | */ | ||
667 | int | ||
668 | acpi_pci_link_free_irq(acpi_handle handle) | ||
669 | { | ||
670 | struct acpi_device *device = NULL; | ||
671 | struct acpi_pci_link *link = NULL; | ||
672 | acpi_status result; | ||
673 | |||
674 | ACPI_FUNCTION_TRACE("acpi_pci_link_free_irq"); | ||
675 | |||
676 | result = acpi_bus_get_device(handle, &device); | ||
677 | if (result) { | ||
678 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link device\n")); | ||
679 | return_VALUE(-1); | ||
680 | } | ||
681 | |||
682 | link = (struct acpi_pci_link *) acpi_driver_data(device); | ||
683 | if (!link) { | ||
684 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); | ||
685 | return_VALUE(-1); | ||
686 | } | ||
687 | |||
688 | down(&acpi_link_lock); | ||
689 | if (!link->irq.initialized) { | ||
690 | up(&acpi_link_lock); | ||
691 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Link isn't initialized\n")); | ||
692 | return_VALUE(-1); | ||
693 | } | ||
650 | 694 | ||
695 | #ifdef FUTURE_USE | ||
696 | /* | ||
697 | * The Link reference count allows us to _DISable an unused link | ||
698 | * and suspend time, and set it again on resume. | ||
699 | * However, 2.6.12 still has irq_router.resume | ||
700 | * which blindly restores the link state. | ||
701 | * So we disable the reference count method | ||
702 | * to prevent duplicate acpi_pci_link_set() | ||
703 | * which would harm some systems | ||
704 | */ | ||
705 | link->refcnt --; | ||
706 | #endif | ||
707 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | ||
708 | "Link %s is dereferenced\n", acpi_device_bid(link->device))); | ||
709 | |||
710 | if (link->refcnt == 0) { | ||
711 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); | ||
712 | } | ||
713 | up(&acpi_link_lock); | ||
714 | return_VALUE(link->irq.active); | ||
715 | } | ||
651 | /* -------------------------------------------------------------------------- | 716 | /* -------------------------------------------------------------------------- |
652 | Driver Interface | 717 | Driver Interface |
653 | -------------------------------------------------------------------------- */ | 718 | -------------------------------------------------------------------------- */ |
@@ -677,6 +742,7 @@ acpi_pci_link_add ( | |||
677 | strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); | 742 | strcpy(acpi_device_class(device), ACPI_PCI_LINK_CLASS); |
678 | acpi_driver_data(device) = link; | 743 | acpi_driver_data(device) = link; |
679 | 744 | ||
745 | down(&acpi_link_lock); | ||
680 | result = acpi_pci_link_get_possible(link); | 746 | result = acpi_pci_link_get_possible(link); |
681 | if (result) | 747 | if (result) |
682 | goto end; | 748 | goto end; |
@@ -712,6 +778,7 @@ acpi_pci_link_add ( | |||
712 | end: | 778 | end: |
713 | /* disable all links -- to be activated on use */ | 779 | /* disable all links -- to be activated on use */ |
714 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); | 780 | acpi_ut_evaluate_object(link->handle, "_DIS", 0, NULL); |
781 | up(&acpi_link_lock); | ||
715 | 782 | ||
716 | if (result) | 783 | if (result) |
717 | kfree(link); | 784 | kfree(link); |
@@ -720,23 +787,34 @@ end: | |||
720 | } | 787 | } |
721 | 788 | ||
722 | static int | 789 | static int |
723 | irqrouter_suspend( | 790 | acpi_pci_link_resume( |
724 | struct sys_device *dev, | 791 | struct acpi_pci_link *link) |
725 | u32 state) | 792 | { |
793 | ACPI_FUNCTION_TRACE("acpi_pci_link_resume"); | ||
794 | |||
795 | if (link->refcnt && link->irq.active && link->irq.initialized) | ||
796 | return_VALUE(acpi_pci_link_set(link, link->irq.active)); | ||
797 | else | ||
798 | return_VALUE(0); | ||
799 | } | ||
800 | |||
801 | static int | ||
802 | irqrouter_resume( | ||
803 | struct sys_device *dev) | ||
726 | { | 804 | { |
727 | struct list_head *node = NULL; | 805 | struct list_head *node = NULL; |
728 | struct acpi_pci_link *link = NULL; | 806 | struct acpi_pci_link *link = NULL; |
729 | 807 | ||
730 | ACPI_FUNCTION_TRACE("irqrouter_suspend"); | 808 | ACPI_FUNCTION_TRACE("irqrouter_resume"); |
731 | 809 | ||
732 | list_for_each(node, &acpi_link.entries) { | 810 | list_for_each(node, &acpi_link.entries) { |
733 | link = list_entry(node, struct acpi_pci_link, node); | 811 | link = list_entry(node, struct acpi_pci_link, node); |
734 | if (!link) { | 812 | if (!link) { |
735 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, "Invalid link context\n")); | 813 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
814 | "Invalid link context\n")); | ||
736 | continue; | 815 | continue; |
737 | } | 816 | } |
738 | if (link->irq.active && link->irq.initialized) | 817 | acpi_pci_link_resume(link); |
739 | link->irq.suspend_resume = 1; | ||
740 | } | 818 | } |
741 | return_VALUE(0); | 819 | return_VALUE(0); |
742 | } | 820 | } |
@@ -756,8 +834,9 @@ acpi_pci_link_remove ( | |||
756 | 834 | ||
757 | link = (struct acpi_pci_link *) acpi_driver_data(device); | 835 | link = (struct acpi_pci_link *) acpi_driver_data(device); |
758 | 836 | ||
759 | /* TBD: Acquire/release lock */ | 837 | down(&acpi_link_lock); |
760 | list_del(&link->node); | 838 | list_del(&link->node); |
839 | up(&acpi_link_lock); | ||
761 | 840 | ||
762 | kfree(link); | 841 | kfree(link); |
763 | 842 | ||
@@ -849,9 +928,10 @@ int __init acpi_irq_balance_set(char *str) | |||
849 | __setup("acpi_irq_balance", acpi_irq_balance_set); | 928 | __setup("acpi_irq_balance", acpi_irq_balance_set); |
850 | 929 | ||
851 | 930 | ||
931 | /* FIXME: we will remove this interface after all drivers call pci_disable_device */ | ||
852 | static struct sysdev_class irqrouter_sysdev_class = { | 932 | static struct sysdev_class irqrouter_sysdev_class = { |
853 | set_kset_name("irqrouter"), | 933 | set_kset_name("irqrouter"), |
854 | .suspend = irqrouter_suspend, | 934 | .resume = irqrouter_resume, |
855 | }; | 935 | }; |
856 | 936 | ||
857 | 937 | ||
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index 893b074e3d1a..2c04740c6543 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -81,30 +81,32 @@ module_param(bm_history, uint, 0644); | |||
81 | * | 81 | * |
82 | * To skip this limit, boot/load with a large max_cstate limit. | 82 | * To skip this limit, boot/load with a large max_cstate limit. |
83 | */ | 83 | */ |
84 | static int no_c2c3(struct dmi_system_id *id) | 84 | static int set_max_cstate(struct dmi_system_id *id) |
85 | { | 85 | { |
86 | if (max_cstate > ACPI_PROCESSOR_MAX_POWER) | 86 | if (max_cstate > ACPI_PROCESSOR_MAX_POWER) |
87 | return 0; | 87 | return 0; |
88 | 88 | ||
89 | printk(KERN_NOTICE PREFIX "%s detected - C2,C3 disabled." | 89 | printk(KERN_NOTICE PREFIX "%s detected - limiting to C%ld max_cstate." |
90 | " Override with \"processor.max_cstate=%d\"\n", id->ident, | 90 | " Override with \"processor.max_cstate=%d\"\n", id->ident, |
91 | ACPI_PROCESSOR_MAX_POWER + 1); | 91 | (long)id->driver_data, ACPI_PROCESSOR_MAX_POWER + 1); |
92 | 92 | ||
93 | max_cstate = 1; | 93 | max_cstate = (long)id->driver_data; |
94 | 94 | ||
95 | return 0; | 95 | return 0; |
96 | } | 96 | } |
97 | 97 | ||
98 | 98 | ||
99 | |||
100 | |||
101 | static struct dmi_system_id __initdata processor_power_dmi_table[] = { | 99 | static struct dmi_system_id __initdata processor_power_dmi_table[] = { |
102 | { no_c2c3, "IBM ThinkPad R40e", { | 100 | { set_max_cstate, "IBM ThinkPad R40e", { |
103 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), | 101 | DMI_MATCH(DMI_BIOS_VENDOR,"IBM"), |
104 | DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }}, | 102 | DMI_MATCH(DMI_BIOS_VERSION,"1SET60WW") }, (void*)1}, |
105 | { no_c2c3, "Medion 41700", { | 103 | { set_max_cstate, "Medion 41700", { |
104 | DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), | ||
105 | DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }, (void*)1}, | ||
106 | { set_max_cstate, "Clevo 5600D", { | ||
106 | DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), | 107 | DMI_MATCH(DMI_BIOS_VENDOR,"Phoenix Technologies LTD"), |
107 | DMI_MATCH(DMI_BIOS_VERSION,"R01-A1J") }}, | 108 | DMI_MATCH(DMI_BIOS_VERSION,"SHE845M0.86C.0013.D.0302131307") }, |
109 | (void*)2}, | ||
108 | {}, | 110 | {}, |
109 | }; | 111 | }; |
110 | 112 | ||
@@ -549,7 +551,8 @@ static int acpi_processor_get_power_info_default_c1 (struct acpi_processor *pr) | |||
549 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); | 551 | ACPI_FUNCTION_TRACE("acpi_processor_get_power_info_default_c1"); |
550 | 552 | ||
551 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) | 553 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) |
552 | memset(pr->power.states, 0, sizeof(struct acpi_processor_cx)); | 554 | memset(&(pr->power.states[i]), 0, |
555 | sizeof(struct acpi_processor_cx)); | ||
553 | 556 | ||
554 | /* if info is obtained from pblk/fadt, type equals state */ | 557 | /* if info is obtained from pblk/fadt, type equals state */ |
555 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; | 558 | pr->power.states[ACPI_STATE_C1].type = ACPI_STATE_C1; |
@@ -580,7 +583,8 @@ static int acpi_processor_get_power_info_cst (struct acpi_processor *pr) | |||
580 | 583 | ||
581 | pr->power.count = 0; | 584 | pr->power.count = 0; |
582 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) | 585 | for (i = 0; i < ACPI_PROCESSOR_MAX_POWER; i++) |
583 | memset(pr->power.states, 0, sizeof(struct acpi_processor_cx)); | 586 | memset(&(pr->power.states[i]), 0, |
587 | sizeof(struct acpi_processor_cx)); | ||
584 | 588 | ||
585 | status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); | 589 | status = acpi_evaluate_object(pr->handle, "_CST", NULL, &buffer); |
586 | if (ACPI_FAILURE(status)) { | 590 | if (ACPI_FAILURE(status)) { |
@@ -763,7 +767,6 @@ static void acpi_processor_power_verify_c3( | |||
763 | } | 767 | } |
764 | 768 | ||
765 | if (pr->flags.bm_check) { | 769 | if (pr->flags.bm_check) { |
766 | printk("Disabling BM access before entering C3\n"); | ||
767 | /* bus mastering control is necessary */ | 770 | /* bus mastering control is necessary */ |
768 | if (!pr->flags.bm_control) { | 771 | if (!pr->flags.bm_control) { |
769 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 772 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
@@ -771,7 +774,6 @@ static void acpi_processor_power_verify_c3( | |||
771 | return_VOID; | 774 | return_VOID; |
772 | } | 775 | } |
773 | } else { | 776 | } else { |
774 | printk("Invalidating cache before entering C3\n"); | ||
775 | /* | 777 | /* |
776 | * WBINVD should be set in fadt, for C3 state to be | 778 | * WBINVD should be set in fadt, for C3 state to be |
777 | * supported on when bm_check is not required. | 779 | * supported on when bm_check is not required. |
@@ -842,7 +844,7 @@ static int acpi_processor_get_power_info ( | |||
842 | result = acpi_processor_get_power_info_cst(pr); | 844 | result = acpi_processor_get_power_info_cst(pr); |
843 | if ((result) || (acpi_processor_power_verify(pr) < 2)) { | 845 | if ((result) || (acpi_processor_power_verify(pr) < 2)) { |
844 | result = acpi_processor_get_power_info_fadt(pr); | 846 | result = acpi_processor_get_power_info_fadt(pr); |
845 | if (result) | 847 | if ((result) || (acpi_processor_power_verify(pr) < 2)) |
846 | result = acpi_processor_get_power_info_default_c1(pr); | 848 | result = acpi_processor_get_power_info_default_c1(pr); |
847 | } | 849 | } |
848 | 850 | ||
diff --git a/drivers/block/cfq-iosched.c b/drivers/block/cfq-iosched.c index de5746e38af9..2435a7c99b2b 100644 --- a/drivers/block/cfq-iosched.c +++ b/drivers/block/cfq-iosched.c | |||
@@ -1281,6 +1281,7 @@ dispatch: | |||
1281 | */ | 1281 | */ |
1282 | if (!cfq_crq_in_driver(crq) && | 1282 | if (!cfq_crq_in_driver(crq) && |
1283 | !cfq_cfqq_idle_window(cfqq) && | 1283 | !cfq_cfqq_idle_window(cfqq) && |
1284 | !blk_barrier_rq(rq) && | ||
1284 | cfqd->rq_in_driver >= cfqd->cfq_max_depth) | 1285 | cfqd->rq_in_driver >= cfqd->cfq_max_depth) |
1285 | return NULL; | 1286 | return NULL; |
1286 | 1287 | ||
diff --git a/drivers/char/agp/agp.h b/drivers/char/agp/agp.h index c1fe013c64f3..b4af87c6f9c8 100644 --- a/drivers/char/agp/agp.h +++ b/drivers/char/agp/agp.h | |||
@@ -143,6 +143,7 @@ struct agp_bridge_data { | |||
143 | char major_version; | 143 | char major_version; |
144 | char minor_version; | 144 | char minor_version; |
145 | struct list_head list; | 145 | struct list_head list; |
146 | u32 apbase_config; | ||
146 | }; | 147 | }; |
147 | 148 | ||
148 | #define KB(x) ((x) * 1024) | 149 | #define KB(x) ((x) * 1024) |
diff --git a/drivers/char/agp/intel-agp.c b/drivers/char/agp/intel-agp.c index 51266d6b4d78..1f7d415f432c 100644 --- a/drivers/char/agp/intel-agp.c +++ b/drivers/char/agp/intel-agp.c | |||
@@ -1047,9 +1047,15 @@ static int intel_845_configure(void) | |||
1047 | /* aperture size */ | 1047 | /* aperture size */ |
1048 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); | 1048 | pci_write_config_byte(agp_bridge->dev, INTEL_APSIZE, current_size->size_value); |
1049 | 1049 | ||
1050 | /* address to map to */ | 1050 | if (agp_bridge->apbase_config != 0) { |
1051 | pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); | 1051 | pci_write_config_dword(agp_bridge->dev, AGP_APBASE, |
1052 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); | 1052 | agp_bridge->apbase_config); |
1053 | } else { | ||
1054 | /* address to map to */ | ||
1055 | pci_read_config_dword(agp_bridge->dev, AGP_APBASE, &temp); | ||
1056 | agp_bridge->gart_bus_addr = (temp & PCI_BASE_ADDRESS_MEM_MASK); | ||
1057 | agp_bridge->apbase_config = temp; | ||
1058 | } | ||
1053 | 1059 | ||
1054 | /* attbase - aperture base */ | 1060 | /* attbase - aperture base */ |
1055 | pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); | 1061 | pci_write_config_dword(agp_bridge->dev, INTEL_ATTBASE, agp_bridge->gatt_bus_addr); |
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index 7b19e02f112f..523fd3c8bbaa 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
@@ -198,10 +198,10 @@ int setkeycode(unsigned int scancode, unsigned int keycode) | |||
198 | 198 | ||
199 | if (scancode >= dev->keycodemax) | 199 | if (scancode >= dev->keycodemax) |
200 | return -EINVAL; | 200 | return -EINVAL; |
201 | if (keycode > KEY_MAX) | ||
202 | return -EINVAL; | ||
203 | if (keycode < 0 || keycode > KEY_MAX) | 201 | if (keycode < 0 || keycode > KEY_MAX) |
204 | return -EINVAL; | 202 | return -EINVAL; |
203 | if (keycode >> (dev->keycodesize * 8)) | ||
204 | return -EINVAL; | ||
205 | 205 | ||
206 | oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode); | 206 | oldkey = SET_INPUT_KEYCODE(dev, scancode, keycode); |
207 | 207 | ||
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index fd042060809a..cefbe985e55c 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -439,6 +439,11 @@ static struct { | |||
439 | { 0, 0 }, | 439 | { 0, 0 }, |
440 | }; | 440 | }; |
441 | 441 | ||
442 | struct sonypi_keypress { | ||
443 | struct input_dev *dev; | ||
444 | int key; | ||
445 | }; | ||
446 | |||
442 | static struct sonypi_device { | 447 | static struct sonypi_device { |
443 | struct pci_dev *dev; | 448 | struct pci_dev *dev; |
444 | struct platform_device *pdev; | 449 | struct platform_device *pdev; |
@@ -710,22 +715,61 @@ static void sonypi_setbluetoothpower(u8 state) | |||
710 | 715 | ||
711 | static void input_keyrelease(void *data) | 716 | static void input_keyrelease(void *data) |
712 | { | 717 | { |
713 | struct input_dev *input_dev; | 718 | struct sonypi_keypress kp; |
714 | int key; | ||
715 | |||
716 | while (1) { | ||
717 | if (kfifo_get(sonypi_device.input_fifo, | ||
718 | (unsigned char *)&input_dev, | ||
719 | sizeof(input_dev)) != sizeof(input_dev)) | ||
720 | return; | ||
721 | if (kfifo_get(sonypi_device.input_fifo, | ||
722 | (unsigned char *)&key, | ||
723 | sizeof(key)) != sizeof(key)) | ||
724 | return; | ||
725 | 719 | ||
720 | while (kfifo_get(sonypi_device.input_fifo, (unsigned char *)&kp, | ||
721 | sizeof(kp)) == sizeof(kp)) { | ||
726 | msleep(10); | 722 | msleep(10); |
727 | input_report_key(input_dev, key, 0); | 723 | input_report_key(kp.dev, kp.key, 0); |
728 | input_sync(input_dev); | 724 | input_sync(kp.dev); |
725 | } | ||
726 | } | ||
727 | |||
728 | static void sonypi_report_input_event(u8 event) | ||
729 | { | ||
730 | struct input_dev *jog_dev = &sonypi_device.input_jog_dev; | ||
731 | struct input_dev *key_dev = &sonypi_device.input_key_dev; | ||
732 | struct sonypi_keypress kp = { NULL }; | ||
733 | int i; | ||
734 | |||
735 | switch (event) { | ||
736 | case SONYPI_EVENT_JOGDIAL_UP: | ||
737 | case SONYPI_EVENT_JOGDIAL_UP_PRESSED: | ||
738 | input_report_rel(jog_dev, REL_WHEEL, 1); | ||
739 | input_sync(jog_dev); | ||
740 | break; | ||
741 | |||
742 | case SONYPI_EVENT_JOGDIAL_DOWN: | ||
743 | case SONYPI_EVENT_JOGDIAL_DOWN_PRESSED: | ||
744 | input_report_rel(jog_dev, REL_WHEEL, -1); | ||
745 | input_sync(jog_dev); | ||
746 | break; | ||
747 | |||
748 | case SONYPI_EVENT_JOGDIAL_PRESSED: | ||
749 | kp.key = BTN_MIDDLE; | ||
750 | kp.dev = jog_dev; | ||
751 | break; | ||
752 | |||
753 | case SONYPI_EVENT_FNKEY_RELEASED: | ||
754 | /* Nothing, not all VAIOs generate this event */ | ||
755 | break; | ||
756 | |||
757 | default: | ||
758 | for (i = 0; sonypi_inputkeys[i].sonypiev; i++) | ||
759 | if (event == sonypi_inputkeys[i].sonypiev) { | ||
760 | kp.dev = key_dev; | ||
761 | kp.key = sonypi_inputkeys[i].inputev; | ||
762 | break; | ||
763 | } | ||
764 | break; | ||
765 | } | ||
766 | |||
767 | if (kp.dev) { | ||
768 | input_report_key(kp.dev, kp.key, 1); | ||
769 | input_sync(kp.dev); | ||
770 | kfifo_put(sonypi_device.input_fifo, | ||
771 | (unsigned char *)&kp, sizeof(kp)); | ||
772 | schedule_work(&sonypi_device.input_work); | ||
729 | } | 773 | } |
730 | } | 774 | } |
731 | 775 | ||
@@ -768,51 +812,8 @@ found: | |||
768 | printk(KERN_INFO | 812 | printk(KERN_INFO |
769 | "sonypi: event port1=0x%02x,port2=0x%02x\n", v1, v2); | 813 | "sonypi: event port1=0x%02x,port2=0x%02x\n", v1, v2); |
770 | 814 | ||
771 | if (useinput) { | 815 | if (useinput) |
772 | struct input_dev *input_jog_dev = &sonypi_device.input_jog_dev; | 816 | sonypi_report_input_event(event); |
773 | struct input_dev *input_key_dev = &sonypi_device.input_key_dev; | ||
774 | switch (event) { | ||
775 | case SONYPI_EVENT_JOGDIAL_UP: | ||
776 | case SONYPI_EVENT_JOGDIAL_UP_PRESSED: | ||
777 | input_report_rel(input_jog_dev, REL_WHEEL, 1); | ||
778 | break; | ||
779 | case SONYPI_EVENT_JOGDIAL_DOWN: | ||
780 | case SONYPI_EVENT_JOGDIAL_DOWN_PRESSED: | ||
781 | input_report_rel(input_jog_dev, REL_WHEEL, -1); | ||
782 | break; | ||
783 | case SONYPI_EVENT_JOGDIAL_PRESSED: { | ||
784 | int key = BTN_MIDDLE; | ||
785 | input_report_key(input_jog_dev, key, 1); | ||
786 | kfifo_put(sonypi_device.input_fifo, | ||
787 | (unsigned char *)&input_jog_dev, | ||
788 | sizeof(input_jog_dev)); | ||
789 | kfifo_put(sonypi_device.input_fifo, | ||
790 | (unsigned char *)&key, sizeof(key)); | ||
791 | break; | ||
792 | } | ||
793 | case SONYPI_EVENT_FNKEY_RELEASED: | ||
794 | /* Nothing, not all VAIOs generate this event */ | ||
795 | break; | ||
796 | } | ||
797 | input_sync(input_jog_dev); | ||
798 | |||
799 | for (i = 0; sonypi_inputkeys[i].sonypiev; i++) { | ||
800 | int key; | ||
801 | |||
802 | if (event != sonypi_inputkeys[i].sonypiev) | ||
803 | continue; | ||
804 | |||
805 | key = sonypi_inputkeys[i].inputev; | ||
806 | input_report_key(input_key_dev, key, 1); | ||
807 | kfifo_put(sonypi_device.input_fifo, | ||
808 | (unsigned char *)&input_key_dev, | ||
809 | sizeof(input_key_dev)); | ||
810 | kfifo_put(sonypi_device.input_fifo, | ||
811 | (unsigned char *)&key, sizeof(key)); | ||
812 | } | ||
813 | input_sync(input_key_dev); | ||
814 | schedule_work(&sonypi_device.input_work); | ||
815 | } | ||
816 | 817 | ||
817 | kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event)); | 818 | kfifo_put(sonypi_device.fifo, (unsigned char *)&event, sizeof(event)); |
818 | kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN); | 819 | kill_fasync(&sonypi_device.fifo_async, SIGIO, POLL_IN); |
@@ -1227,14 +1228,7 @@ static int __devinit sonypi_probe(void) | |||
1227 | sonypi_device.input_jog_dev.keybit[LONG(BTN_MOUSE)] = | 1228 | sonypi_device.input_jog_dev.keybit[LONG(BTN_MOUSE)] = |
1228 | BIT(BTN_MIDDLE); | 1229 | BIT(BTN_MIDDLE); |
1229 | sonypi_device.input_jog_dev.relbit[0] = BIT(REL_WHEEL); | 1230 | sonypi_device.input_jog_dev.relbit[0] = BIT(REL_WHEEL); |
1230 | sonypi_device.input_jog_dev.name = | 1231 | sonypi_device.input_jog_dev.name = SONYPI_JOG_INPUTNAME; |
1231 | kmalloc(sizeof(SONYPI_JOG_INPUTNAME), GFP_KERNEL); | ||
1232 | if (!sonypi_device.input_jog_dev.name) { | ||
1233 | printk(KERN_ERR "sonypi: kmalloc failed\n"); | ||
1234 | ret = -ENOMEM; | ||
1235 | goto out_inkmallocinput1; | ||
1236 | } | ||
1237 | sprintf(sonypi_device.input_jog_dev.name, SONYPI_JOG_INPUTNAME); | ||
1238 | sonypi_device.input_jog_dev.id.bustype = BUS_ISA; | 1232 | sonypi_device.input_jog_dev.id.bustype = BUS_ISA; |
1239 | sonypi_device.input_jog_dev.id.vendor = PCI_VENDOR_ID_SONY; | 1233 | sonypi_device.input_jog_dev.id.vendor = PCI_VENDOR_ID_SONY; |
1240 | 1234 | ||
@@ -1248,14 +1242,7 @@ static int __devinit sonypi_probe(void) | |||
1248 | if (sonypi_inputkeys[i].inputev) | 1242 | if (sonypi_inputkeys[i].inputev) |
1249 | set_bit(sonypi_inputkeys[i].inputev, | 1243 | set_bit(sonypi_inputkeys[i].inputev, |
1250 | sonypi_device.input_key_dev.keybit); | 1244 | sonypi_device.input_key_dev.keybit); |
1251 | sonypi_device.input_key_dev.name = | 1245 | sonypi_device.input_key_dev.name = SONYPI_KEY_INPUTNAME; |
1252 | kmalloc(sizeof(SONYPI_KEY_INPUTNAME), GFP_KERNEL); | ||
1253 | if (!sonypi_device.input_key_dev.name) { | ||
1254 | printk(KERN_ERR "sonypi: kmalloc failed\n"); | ||
1255 | ret = -ENOMEM; | ||
1256 | goto out_inkmallocinput2; | ||
1257 | } | ||
1258 | sprintf(sonypi_device.input_key_dev.name, SONYPI_KEY_INPUTNAME); | ||
1259 | sonypi_device.input_key_dev.id.bustype = BUS_ISA; | 1246 | sonypi_device.input_key_dev.id.bustype = BUS_ISA; |
1260 | sonypi_device.input_key_dev.id.vendor = PCI_VENDOR_ID_SONY; | 1247 | sonypi_device.input_key_dev.id.vendor = PCI_VENDOR_ID_SONY; |
1261 | 1248 | ||
@@ -1313,11 +1300,7 @@ out_platformdev: | |||
1313 | kfifo_free(sonypi_device.input_fifo); | 1300 | kfifo_free(sonypi_device.input_fifo); |
1314 | out_infifo: | 1301 | out_infifo: |
1315 | input_unregister_device(&sonypi_device.input_key_dev); | 1302 | input_unregister_device(&sonypi_device.input_key_dev); |
1316 | kfree(sonypi_device.input_key_dev.name); | ||
1317 | out_inkmallocinput2: | ||
1318 | input_unregister_device(&sonypi_device.input_jog_dev); | 1303 | input_unregister_device(&sonypi_device.input_jog_dev); |
1319 | kfree(sonypi_device.input_jog_dev.name); | ||
1320 | out_inkmallocinput1: | ||
1321 | free_irq(sonypi_device.irq, sonypi_irq); | 1304 | free_irq(sonypi_device.irq, sonypi_irq); |
1322 | out_reqirq: | 1305 | out_reqirq: |
1323 | release_region(sonypi_device.ioport1, sonypi_device.region_size); | 1306 | release_region(sonypi_device.ioport1, sonypi_device.region_size); |
@@ -1337,13 +1320,14 @@ static void __devexit sonypi_remove(void) | |||
1337 | { | 1320 | { |
1338 | sonypi_disable(); | 1321 | sonypi_disable(); |
1339 | 1322 | ||
1323 | synchronize_sched(); /* Allow sonypi interrupt to complete. */ | ||
1324 | flush_scheduled_work(); | ||
1325 | |||
1340 | platform_device_unregister(sonypi_device.pdev); | 1326 | platform_device_unregister(sonypi_device.pdev); |
1341 | 1327 | ||
1342 | if (useinput) { | 1328 | if (useinput) { |
1343 | input_unregister_device(&sonypi_device.input_key_dev); | 1329 | input_unregister_device(&sonypi_device.input_key_dev); |
1344 | kfree(sonypi_device.input_key_dev.name); | ||
1345 | input_unregister_device(&sonypi_device.input_jog_dev); | 1330 | input_unregister_device(&sonypi_device.input_jog_dev); |
1346 | kfree(sonypi_device.input_jog_dev.name); | ||
1347 | kfifo_free(sonypi_device.input_fifo); | 1331 | kfifo_free(sonypi_device.input_fifo); |
1348 | } | 1332 | } |
1349 | 1333 | ||
diff --git a/drivers/char/watchdog/sa1100_wdt.c b/drivers/char/watchdog/sa1100_wdt.c index 1b2132617dc3..fb88b4041dca 100644 --- a/drivers/char/watchdog/sa1100_wdt.c +++ b/drivers/char/watchdog/sa1100_wdt.c | |||
@@ -36,13 +36,10 @@ | |||
36 | #include <asm/uaccess.h> | 36 | #include <asm/uaccess.h> |
37 | 37 | ||
38 | #define OSCR_FREQ CLOCK_TICK_RATE | 38 | #define OSCR_FREQ CLOCK_TICK_RATE |
39 | #define SA1100_CLOSE_MAGIC (0x5afc4453) | ||
40 | 39 | ||
41 | static unsigned long sa1100wdt_users; | 40 | static unsigned long sa1100wdt_users; |
42 | static int expect_close; | ||
43 | static int pre_margin; | 41 | static int pre_margin; |
44 | static int boot_status; | 42 | static int boot_status; |
45 | static int nowayout = WATCHDOG_NOWAYOUT; | ||
46 | 43 | ||
47 | /* | 44 | /* |
48 | * Allow only one person to hold it open | 45 | * Allow only one person to hold it open |
@@ -62,55 +59,33 @@ static int sa1100dog_open(struct inode *inode, struct file *file) | |||
62 | } | 59 | } |
63 | 60 | ||
64 | /* | 61 | /* |
65 | * Shut off the timer. | 62 | * The watchdog cannot be disabled. |
66 | * Lock it in if it's a module and we defined ...NOWAYOUT | 63 | * |
67 | * Oddly, the watchdog can only be enabled, but we can turn off | 64 | * Previous comments suggested that turning off the interrupt by |
68 | * the interrupt, which appears to prevent the watchdog timing out. | 65 | * clearing OIER[E3] would prevent the watchdog timing out but this |
66 | * does not appear to be true (at least on the PXA255). | ||
69 | */ | 67 | */ |
70 | static int sa1100dog_release(struct inode *inode, struct file *file) | 68 | static int sa1100dog_release(struct inode *inode, struct file *file) |
71 | { | 69 | { |
72 | OSMR3 = OSCR + pre_margin; | 70 | printk(KERN_CRIT "WATCHDOG: Device closed - timer will not stop\n"); |
73 | |||
74 | if (expect_close == SA1100_CLOSE_MAGIC) { | ||
75 | OIER &= ~OIER_E3; | ||
76 | } else { | ||
77 | printk(KERN_CRIT "WATCHDOG: WDT device closed unexpectedly. WDT will not stop!\n"); | ||
78 | } | ||
79 | 71 | ||
80 | clear_bit(1, &sa1100wdt_users); | 72 | clear_bit(1, &sa1100wdt_users); |
81 | expect_close = 0; | ||
82 | 73 | ||
83 | return 0; | 74 | return 0; |
84 | } | 75 | } |
85 | 76 | ||
86 | static ssize_t sa1100dog_write(struct file *file, const char *data, size_t len, loff_t *ppos) | 77 | static ssize_t sa1100dog_write(struct file *file, const char *data, size_t len, loff_t *ppos) |
87 | { | 78 | { |
88 | if (len) { | 79 | if (len) |
89 | if (!nowayout) { | ||
90 | size_t i; | ||
91 | |||
92 | expect_close = 0; | ||
93 | |||
94 | for (i = 0; i != len; i++) { | ||
95 | char c; | ||
96 | |||
97 | if (get_user(c, data + i)) | ||
98 | return -EFAULT; | ||
99 | if (c == 'V') | ||
100 | expect_close = SA1100_CLOSE_MAGIC; | ||
101 | } | ||
102 | } | ||
103 | /* Refresh OSMR3 timer. */ | 80 | /* Refresh OSMR3 timer. */ |
104 | OSMR3 = OSCR + pre_margin; | 81 | OSMR3 = OSCR + pre_margin; |
105 | } | ||
106 | 82 | ||
107 | return len; | 83 | return len; |
108 | } | 84 | } |
109 | 85 | ||
110 | static struct watchdog_info ident = { | 86 | static struct watchdog_info ident = { |
111 | .options = WDIOF_CARDRESET | WDIOF_MAGICCLOSE | | 87 | .options = WDIOF_CARDRESET | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, |
112 | WDIOF_SETTIMEOUT | WDIOF_KEEPALIVEPING, | 88 | .identity = "SA1100/PXA255 Watchdog", |
113 | .identity = "SA1100 Watchdog", | ||
114 | }; | 89 | }; |
115 | 90 | ||
116 | static int sa1100dog_ioctl(struct inode *inode, struct file *file, | 91 | static int sa1100dog_ioctl(struct inode *inode, struct file *file, |
@@ -172,7 +147,7 @@ static struct file_operations sa1100dog_fops = | |||
172 | static struct miscdevice sa1100dog_miscdev = | 147 | static struct miscdevice sa1100dog_miscdev = |
173 | { | 148 | { |
174 | .minor = WATCHDOG_MINOR, | 149 | .minor = WATCHDOG_MINOR, |
175 | .name = "SA1100/PXA2xx watchdog", | 150 | .name = "watchdog", |
176 | .fops = &sa1100dog_fops, | 151 | .fops = &sa1100dog_fops, |
177 | }; | 152 | }; |
178 | 153 | ||
@@ -194,7 +169,6 @@ static int __init sa1100dog_init(void) | |||
194 | if (ret == 0) | 169 | if (ret == 0) |
195 | printk("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n", | 170 | printk("SA1100/PXA2xx Watchdog Timer: timer margin %d sec\n", |
196 | margin); | 171 | margin); |
197 | |||
198 | return ret; | 172 | return ret; |
199 | } | 173 | } |
200 | 174 | ||
@@ -212,8 +186,5 @@ MODULE_DESCRIPTION("SA1100/PXA2xx Watchdog"); | |||
212 | module_param(margin, int, 0); | 186 | module_param(margin, int, 0); |
213 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds (default 60s)"); | 187 | MODULE_PARM_DESC(margin, "Watchdog margin in seconds (default 60s)"); |
214 | 188 | ||
215 | module_param(nowayout, int, 0); | ||
216 | MODULE_PARM_DESC(nowayout, "Watchdog cannot be stopped once started"); | ||
217 | |||
218 | MODULE_LICENSE("GPL"); | 189 | MODULE_LICENSE("GPL"); |
219 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); | 190 | MODULE_ALIAS_MISCDEV(WATCHDOG_MINOR); |
diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index 7a7859dd0d98..10b014982381 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c | |||
@@ -1130,7 +1130,7 @@ int cpufreq_driver_target(struct cpufreq_policy *policy, | |||
1130 | unsigned int target_freq, | 1130 | unsigned int target_freq, |
1131 | unsigned int relation) | 1131 | unsigned int relation) |
1132 | { | 1132 | { |
1133 | unsigned int ret; | 1133 | int ret; |
1134 | 1134 | ||
1135 | policy = cpufreq_cpu_get(policy->cpu); | 1135 | policy = cpufreq_cpu_get(policy->cpu); |
1136 | if (!policy) | 1136 | if (!policy) |
@@ -1151,7 +1151,7 @@ EXPORT_SYMBOL_GPL(cpufreq_driver_target); | |||
1151 | 1151 | ||
1152 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) | 1152 | static int __cpufreq_governor(struct cpufreq_policy *policy, unsigned int event) |
1153 | { | 1153 | { |
1154 | int ret = -EINVAL; | 1154 | int ret; |
1155 | 1155 | ||
1156 | if (!try_module_get(policy->governor->owner)) | 1156 | if (!try_module_get(policy->governor->owner)) |
1157 | return -EINVAL; | 1157 | return -EINVAL; |
diff --git a/drivers/hwmon/adm1026.c b/drivers/hwmon/adm1026.c index 3c85fe150cd7..4fa17c76eea2 100644 --- a/drivers/hwmon/adm1026.c +++ b/drivers/hwmon/adm1026.c | |||
@@ -393,7 +393,7 @@ void adm1026_init_client(struct i2c_client *client) | |||
393 | 393 | ||
394 | value = data->config3; | 394 | value = data->config3; |
395 | if (data->config3 & CFG3_GPIO16_ENABLE) { | 395 | if (data->config3 & CFG3_GPIO16_ENABLE) { |
396 | dev_dbg(&client->dev, "GPIO16 enabled. THERM" | 396 | dev_dbg(&client->dev, "GPIO16 enabled. THERM " |
397 | "pin disabled.\n"); | 397 | "pin disabled.\n"); |
398 | } else { | 398 | } else { |
399 | dev_dbg(&client->dev, "THERM pin enabled. " | 399 | dev_dbg(&client->dev, "THERM pin enabled. " |
diff --git a/drivers/hwmon/atxp1.c b/drivers/hwmon/atxp1.c index 0bcf82b4c07b..fca3fc1cef72 100644 --- a/drivers/hwmon/atxp1.c +++ b/drivers/hwmon/atxp1.c | |||
@@ -21,6 +21,7 @@ | |||
21 | #include <linux/kernel.h> | 21 | #include <linux/kernel.h> |
22 | #include <linux/init.h> | 22 | #include <linux/init.h> |
23 | #include <linux/module.h> | 23 | #include <linux/module.h> |
24 | #include <linux/jiffies.h> | ||
24 | #include <linux/i2c.h> | 25 | #include <linux/i2c.h> |
25 | #include <linux/i2c-sensor.h> | 26 | #include <linux/i2c-sensor.h> |
26 | #include <linux/i2c-vid.h> | 27 | #include <linux/i2c-vid.h> |
@@ -80,9 +81,7 @@ static struct atxp1_data * atxp1_update_device(struct device *dev) | |||
80 | 81 | ||
81 | down(&data->update_lock); | 82 | down(&data->update_lock); |
82 | 83 | ||
83 | if ((jiffies - data->last_updated > HZ) || | 84 | if (time_after(jiffies, data->last_updated + HZ) || !data->valid) { |
84 | (jiffies < data->last_updated) || | ||
85 | !data->valid) { | ||
86 | 85 | ||
87 | /* Update local register data */ | 86 | /* Update local register data */ |
88 | data->reg.vid = i2c_smbus_read_byte_data(client, ATXP1_VID); | 87 | data->reg.vid = i2c_smbus_read_byte_data(client, ATXP1_VID); |
diff --git a/drivers/hwmon/fscpos.c b/drivers/hwmon/fscpos.c index 3beaa6191ef4..270015b626ad 100644 --- a/drivers/hwmon/fscpos.c +++ b/drivers/hwmon/fscpos.c | |||
@@ -32,6 +32,7 @@ | |||
32 | 32 | ||
33 | #include <linux/module.h> | 33 | #include <linux/module.h> |
34 | #include <linux/slab.h> | 34 | #include <linux/slab.h> |
35 | #include <linux/jiffies.h> | ||
35 | #include <linux/i2c.h> | 36 | #include <linux/i2c.h> |
36 | #include <linux/i2c-sensor.h> | 37 | #include <linux/i2c-sensor.h> |
37 | #include <linux/init.h> | 38 | #include <linux/init.h> |
@@ -572,8 +573,7 @@ static struct fscpos_data *fscpos_update_device(struct device *dev) | |||
572 | 573 | ||
573 | down(&data->update_lock); | 574 | down(&data->update_lock); |
574 | 575 | ||
575 | if ((jiffies - data->last_updated > 2 * HZ) || | 576 | if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) { |
576 | (jiffies < data->last_updated) || !data->valid) { | ||
577 | int i; | 577 | int i; |
578 | 578 | ||
579 | dev_dbg(&client->dev, "Starting fscpos update\n"); | 579 | dev_dbg(&client->dev, "Starting fscpos update\n"); |
diff --git a/drivers/hwmon/gl520sm.c b/drivers/hwmon/gl520sm.c index a13a504f5bfa..80ae8d30c2af 100644 --- a/drivers/hwmon/gl520sm.c +++ b/drivers/hwmon/gl520sm.c | |||
@@ -24,6 +24,7 @@ | |||
24 | #include <linux/module.h> | 24 | #include <linux/module.h> |
25 | #include <linux/init.h> | 25 | #include <linux/init.h> |
26 | #include <linux/slab.h> | 26 | #include <linux/slab.h> |
27 | #include <linux/jiffies.h> | ||
27 | #include <linux/i2c.h> | 28 | #include <linux/i2c.h> |
28 | #include <linux/i2c-sensor.h> | 29 | #include <linux/i2c-sensor.h> |
29 | #include <linux/i2c-vid.h> | 30 | #include <linux/i2c-vid.h> |
@@ -678,8 +679,7 @@ static struct gl520_data *gl520_update_device(struct device *dev) | |||
678 | 679 | ||
679 | down(&data->update_lock); | 680 | down(&data->update_lock); |
680 | 681 | ||
681 | if ((jiffies - data->last_updated > 2 * HZ) || | 682 | if (time_after(jiffies, data->last_updated + 2 * HZ) || !data->valid) { |
682 | (jiffies < data->last_updated) || !data->valid) { | ||
683 | 683 | ||
684 | dev_dbg(&client->dev, "Starting gl520sm update\n"); | 684 | dev_dbg(&client->dev, "Starting gl520sm update\n"); |
685 | 685 | ||
diff --git a/drivers/hwmon/max1619.c b/drivers/hwmon/max1619.c index bf553dcd97d6..3c159f1d49ee 100644 --- a/drivers/hwmon/max1619.c +++ b/drivers/hwmon/max1619.c | |||
@@ -363,7 +363,7 @@ static void __exit sensors_max1619_exit(void) | |||
363 | i2c_del_driver(&max1619_driver); | 363 | i2c_del_driver(&max1619_driver); |
364 | } | 364 | } |
365 | 365 | ||
366 | MODULE_AUTHOR("Alexey Fisher <fishor@mail.ru> and" | 366 | MODULE_AUTHOR("Alexey Fisher <fishor@mail.ru> and " |
367 | "Jean Delvare <khali@linux-fr.org>"); | 367 | "Jean Delvare <khali@linux-fr.org>"); |
368 | MODULE_DESCRIPTION("MAX1619 sensor driver"); | 368 | MODULE_DESCRIPTION("MAX1619 sensor driver"); |
369 | MODULE_LICENSE("GPL"); | 369 | MODULE_LICENSE("GPL"); |
diff --git a/drivers/hwmon/pc87360.c b/drivers/hwmon/pc87360.c index 876c68f3af31..fa4032d53b79 100644 --- a/drivers/hwmon/pc87360.c +++ b/drivers/hwmon/pc87360.c | |||
@@ -1043,7 +1043,7 @@ static void pc87360_init_client(struct i2c_client *client, int use_thermistors) | |||
1043 | if (init >= 2 && data->innr) { | 1043 | if (init >= 2 && data->innr) { |
1044 | reg = pc87360_read_value(data, LD_IN, NO_BANK, | 1044 | reg = pc87360_read_value(data, LD_IN, NO_BANK, |
1045 | PC87365_REG_IN_CONVRATE); | 1045 | PC87365_REG_IN_CONVRATE); |
1046 | dev_info(&client->dev, "VLM conversion set to" | 1046 | dev_info(&client->dev, "VLM conversion set to " |
1047 | "1s period, 160us delay\n"); | 1047 | "1s period, 160us delay\n"); |
1048 | pc87360_write_value(data, LD_IN, NO_BANK, | 1048 | pc87360_write_value(data, LD_IN, NO_BANK, |
1049 | PC87365_REG_IN_CONVRATE, | 1049 | PC87365_REG_IN_CONVRATE, |
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c index 0ab7e37f5b00..1ab41313ce51 100644 --- a/drivers/i2c/busses/i2c-i801.c +++ b/drivers/i2c/busses/i2c-i801.c | |||
@@ -137,7 +137,7 @@ static int i801_setup(struct pci_dev *dev) | |||
137 | pci_read_config_word(I801_dev, SMBBA, &i801_smba); | 137 | pci_read_config_word(I801_dev, SMBBA, &i801_smba); |
138 | i801_smba &= 0xfff0; | 138 | i801_smba &= 0xfff0; |
139 | if(i801_smba == 0) { | 139 | if(i801_smba == 0) { |
140 | dev_err(&dev->dev, "SMB base address uninitialized" | 140 | dev_err(&dev->dev, "SMB base address uninitialized " |
141 | "- upgrade BIOS or use force_addr=0xaddr\n"); | 141 | "- upgrade BIOS or use force_addr=0xaddr\n"); |
142 | return -ENODEV; | 142 | return -ENODEV; |
143 | } | 143 | } |
@@ -186,7 +186,7 @@ static int i801_transaction(void) | |||
186 | int result = 0; | 186 | int result = 0; |
187 | int timeout = 0; | 187 | int timeout = 0; |
188 | 188 | ||
189 | dev_dbg(&I801_dev->dev, "Transaction (pre): CNT=%02x, CMD=%02x," | 189 | dev_dbg(&I801_dev->dev, "Transaction (pre): CNT=%02x, CMD=%02x, " |
190 | "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), | 190 | "ADD=%02x, DAT0=%02x, DAT1=%02x\n", inb_p(SMBHSTCNT), |
191 | inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), | 191 | inb_p(SMBHSTCMD), inb_p(SMBHSTADD), inb_p(SMBHSTDAT0), |
192 | inb_p(SMBHSTDAT1)); | 192 | inb_p(SMBHSTDAT1)); |
@@ -240,7 +240,7 @@ static int i801_transaction(void) | |||
240 | outb_p(inb(SMBHSTSTS), SMBHSTSTS); | 240 | outb_p(inb(SMBHSTSTS), SMBHSTSTS); |
241 | 241 | ||
242 | if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { | 242 | if ((temp = (0x1f & inb_p(SMBHSTSTS))) != 0x00) { |
243 | dev_dbg(&I801_dev->dev, "Failed reset at end of transaction" | 243 | dev_dbg(&I801_dev->dev, "Failed reset at end of transaction " |
244 | "(%02x)\n", temp); | 244 | "(%02x)\n", temp); |
245 | } | 245 | } |
246 | dev_dbg(&I801_dev->dev, "Transaction (post): CNT=%02x, CMD=%02x, " | 246 | dev_dbg(&I801_dev->dev, "Transaction (post): CNT=%02x, CMD=%02x, " |
diff --git a/drivers/i2c/chips/ds1337.c b/drivers/i2c/chips/ds1337.c index 74ece8ac1c23..82cf959989fd 100644 --- a/drivers/i2c/chips/ds1337.c +++ b/drivers/i2c/chips/ds1337.c | |||
@@ -165,7 +165,7 @@ static int ds1337_set_datetime(struct i2c_client *client, struct rtc_time *dt) | |||
165 | buf[0] = 0; /* reg offset */ | 165 | buf[0] = 0; /* reg offset */ |
166 | buf[1] = BIN2BCD(dt->tm_sec); | 166 | buf[1] = BIN2BCD(dt->tm_sec); |
167 | buf[2] = BIN2BCD(dt->tm_min); | 167 | buf[2] = BIN2BCD(dt->tm_min); |
168 | buf[3] = BIN2BCD(dt->tm_hour) | (1 << 6); | 168 | buf[3] = BIN2BCD(dt->tm_hour); |
169 | buf[4] = BIN2BCD(dt->tm_wday) + 1; | 169 | buf[4] = BIN2BCD(dt->tm_wday) + 1; |
170 | buf[5] = BIN2BCD(dt->tm_mday); | 170 | buf[5] = BIN2BCD(dt->tm_mday); |
171 | buf[6] = BIN2BCD(dt->tm_mon) + 1; | 171 | buf[6] = BIN2BCD(dt->tm_mon) + 1; |
@@ -344,9 +344,9 @@ static void ds1337_init_client(struct i2c_client *client) | |||
344 | 344 | ||
345 | /* Ensure that device is set in 24-hour mode */ | 345 | /* Ensure that device is set in 24-hour mode */ |
346 | val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR); | 346 | val = i2c_smbus_read_byte_data(client, DS1337_REG_HOUR); |
347 | if ((val >= 0) && (val & (1 << 6)) == 0) | 347 | if ((val >= 0) && (val & (1 << 6))) |
348 | i2c_smbus_write_byte_data(client, DS1337_REG_HOUR, | 348 | i2c_smbus_write_byte_data(client, DS1337_REG_HOUR, |
349 | val | (1 << 6)); | 349 | val & 0x3f); |
350 | } | 350 | } |
351 | 351 | ||
352 | static int ds1337_detach_client(struct i2c_client *client) | 352 | static int ds1337_detach_client(struct i2c_client *client) |
diff --git a/drivers/i2c/chips/eeprom.c b/drivers/i2c/chips/eeprom.c index 6ea413f6d5e5..a2da31b0dd7b 100644 --- a/drivers/i2c/chips/eeprom.c +++ b/drivers/i2c/chips/eeprom.c | |||
@@ -163,6 +163,11 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) | |||
163 | struct eeprom_data *data; | 163 | struct eeprom_data *data; |
164 | int err = 0; | 164 | int err = 0; |
165 | 165 | ||
166 | /* prevent 24RF08 corruption */ | ||
167 | if (kind < 0) | ||
168 | i2c_smbus_xfer(adapter, address, 0, 0, 0, | ||
169 | I2C_SMBUS_QUICK, NULL); | ||
170 | |||
166 | /* There are three ways we can read the EEPROM data: | 171 | /* There are three ways we can read the EEPROM data: |
167 | (1) I2C block reads (faster, but unsupported by most adapters) | 172 | (1) I2C block reads (faster, but unsupported by most adapters) |
168 | (2) Consecutive byte reads (100% overhead) | 173 | (2) Consecutive byte reads (100% overhead) |
@@ -187,9 +192,6 @@ int eeprom_detect(struct i2c_adapter *adapter, int address, int kind) | |||
187 | new_client->driver = &eeprom_driver; | 192 | new_client->driver = &eeprom_driver; |
188 | new_client->flags = 0; | 193 | new_client->flags = 0; |
189 | 194 | ||
190 | /* prevent 24RF08 corruption */ | ||
191 | i2c_smbus_write_quick(new_client, 0); | ||
192 | |||
193 | /* Fill in the remaining client fields */ | 195 | /* Fill in the remaining client fields */ |
194 | strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE); | 196 | strlcpy(new_client->name, "eeprom", I2C_NAME_SIZE); |
195 | data->valid = 0; | 197 | data->valid = 0; |
diff --git a/drivers/i2c/chips/max6875.c b/drivers/i2c/chips/max6875.c index c4f14d9623c4..0230375f72e5 100644 --- a/drivers/i2c/chips/max6875.c +++ b/drivers/i2c/chips/max6875.c | |||
@@ -343,6 +343,11 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind) | |||
343 | struct max6875_data *data; | 343 | struct max6875_data *data; |
344 | int err = 0; | 344 | int err = 0; |
345 | 345 | ||
346 | /* Prevent 24RF08 corruption (in case of user error) */ | ||
347 | if (kind < 0) | ||
348 | i2c_smbus_xfer(adapter, address, 0, 0, 0, | ||
349 | I2C_SMBUS_QUICK, NULL); | ||
350 | |||
346 | /* There are three ways we can read the EEPROM data: | 351 | /* There are three ways we can read the EEPROM data: |
347 | (1) I2C block reads (faster, but unsupported by most adapters) | 352 | (1) I2C block reads (faster, but unsupported by most adapters) |
348 | (2) Consecutive byte reads (100% overhead) | 353 | (2) Consecutive byte reads (100% overhead) |
@@ -370,9 +375,6 @@ static int max6875_detect(struct i2c_adapter *adapter, int address, int kind) | |||
370 | new_client->driver = &max6875_driver; | 375 | new_client->driver = &max6875_driver; |
371 | new_client->flags = 0; | 376 | new_client->flags = 0; |
372 | 377 | ||
373 | /* Prevent 24RF08 corruption */ | ||
374 | i2c_smbus_write_quick(new_client, 0); | ||
375 | |||
376 | /* Setup the user section */ | 378 | /* Setup the user section */ |
377 | data->blocks[max6875_eeprom_user].type = max6875_eeprom_user; | 379 | data->blocks[max6875_eeprom_user].type = max6875_eeprom_user; |
378 | data->blocks[max6875_eeprom_user].slices = USER_EEPROM_SLICES; | 380 | data->blocks[max6875_eeprom_user].slices = USER_EEPROM_SLICES; |
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c index 4fd4f52c8e9b..4a9ead277596 100644 --- a/drivers/i2c/i2c-core.c +++ b/drivers/i2c/i2c-core.c | |||
@@ -231,8 +231,8 @@ int i2c_del_adapter(struct i2c_adapter *adap) | |||
231 | if (driver->detach_adapter) | 231 | if (driver->detach_adapter) |
232 | if ((res = driver->detach_adapter(adap))) { | 232 | if ((res = driver->detach_adapter(adap))) { |
233 | dev_warn(&adap->dev, "can't detach adapter " | 233 | dev_warn(&adap->dev, "can't detach adapter " |
234 | "while detaching driver %s: driver not " | 234 | "while detaching driver %s: driver " |
235 | "detached!", driver->name); | 235 | "not detached!\n", driver->name); |
236 | goto out_unlock; | 236 | goto out_unlock; |
237 | } | 237 | } |
238 | } | 238 | } |
@@ -456,8 +456,8 @@ int i2c_detach_client(struct i2c_client *client) | |||
456 | res = adapter->client_unregister(client); | 456 | res = adapter->client_unregister(client); |
457 | if (res) { | 457 | if (res) { |
458 | dev_err(&client->dev, | 458 | dev_err(&client->dev, |
459 | "client_unregister [%s] failed, " | 459 | "client_unregister [%s] failed, " |
460 | "client not detached", client->name); | 460 | "client not detached\n", client->name); |
461 | goto out; | 461 | goto out; |
462 | } | 462 | } |
463 | } | 463 | } |
diff --git a/drivers/ide/legacy/ide-cs.c b/drivers/ide/legacy/ide-cs.c index 03747439ac9c..f1d1ec4e9677 100644 --- a/drivers/ide/legacy/ide-cs.c +++ b/drivers/ide/legacy/ide-cs.c | |||
@@ -508,5 +508,5 @@ static void __exit exit_ide_cs(void) | |||
508 | BUG_ON(dev_list != NULL); | 508 | BUG_ON(dev_list != NULL); |
509 | } | 509 | } |
510 | 510 | ||
511 | module_init(init_ide_cs); | 511 | late_initcall(init_ide_cs); |
512 | module_exit(exit_ide_cs); | 512 | module_exit(exit_ide_cs); |
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c index 374f404e81da..20e3a165989f 100644 --- a/drivers/input/evdev.c +++ b/drivers/input/evdev.c | |||
@@ -320,6 +320,7 @@ static long evdev_ioctl(struct file *file, unsigned int cmd, unsigned long arg) | |||
320 | if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL; | 320 | if (t < 0 || t >= dev->keycodemax || !dev->keycodesize) return -EINVAL; |
321 | if (get_user(v, ip + 1)) return -EFAULT; | 321 | if (get_user(v, ip + 1)) return -EFAULT; |
322 | if (v < 0 || v > KEY_MAX) return -EINVAL; | 322 | if (v < 0 || v > KEY_MAX) return -EINVAL; |
323 | if (v >> (dev->keycodesize * 8)) return -EINVAL; | ||
323 | u = SET_INPUT_KEYCODE(dev, t, v); | 324 | u = SET_INPUT_KEYCODE(dev, t, v); |
324 | clear_bit(u, dev->keybit); | 325 | clear_bit(u, dev->keybit); |
325 | set_bit(v, dev->keybit); | 326 | set_bit(v, dev->keybit); |
diff --git a/drivers/input/input.c b/drivers/input/input.c index 7c4b4d37b3e6..a275211c8e1e 100644 --- a/drivers/input/input.c +++ b/drivers/input/input.c | |||
@@ -48,12 +48,6 @@ static LIST_HEAD(input_handler_list); | |||
48 | 48 | ||
49 | static struct input_handler *input_table[8]; | 49 | static struct input_handler *input_table[8]; |
50 | 50 | ||
51 | #ifdef CONFIG_PROC_FS | ||
52 | static struct proc_dir_entry *proc_bus_input_dir; | ||
53 | static DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait); | ||
54 | static int input_devices_state; | ||
55 | #endif | ||
56 | |||
57 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 51 | void input_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
58 | { | 52 | { |
59 | struct input_handle *handle; | 53 | struct input_handle *handle; |
@@ -312,6 +306,7 @@ static struct input_device_id *input_match_device(struct input_device_id *id, st | |||
312 | return NULL; | 306 | return NULL; |
313 | } | 307 | } |
314 | 308 | ||
309 | |||
315 | /* | 310 | /* |
316 | * Input hotplugging interface - loading event handlers based on | 311 | * Input hotplugging interface - loading event handlers based on |
317 | * device bitfields. | 312 | * device bitfields. |
@@ -428,6 +423,177 @@ static void input_call_hotplug(char *verb, struct input_dev *dev) | |||
428 | 423 | ||
429 | #endif | 424 | #endif |
430 | 425 | ||
426 | #ifdef CONFIG_PROC_FS | ||
427 | |||
428 | static struct proc_dir_entry *proc_bus_input_dir; | ||
429 | static DECLARE_WAIT_QUEUE_HEAD(input_devices_poll_wait); | ||
430 | static int input_devices_state; | ||
431 | |||
432 | static inline void input_wakeup_procfs_readers(void) | ||
433 | { | ||
434 | input_devices_state++; | ||
435 | wake_up(&input_devices_poll_wait); | ||
436 | } | ||
437 | |||
438 | static unsigned int input_devices_poll(struct file *file, poll_table *wait) | ||
439 | { | ||
440 | int state = input_devices_state; | ||
441 | poll_wait(file, &input_devices_poll_wait, wait); | ||
442 | if (state != input_devices_state) | ||
443 | return POLLIN | POLLRDNORM; | ||
444 | return 0; | ||
445 | } | ||
446 | |||
447 | #define SPRINTF_BIT_B(bit, name, max) \ | ||
448 | do { \ | ||
449 | len += sprintf(buf + len, "B: %s", name); \ | ||
450 | for (i = NBITS(max) - 1; i >= 0; i--) \ | ||
451 | if (dev->bit[i]) break; \ | ||
452 | for (; i >= 0; i--) \ | ||
453 | len += sprintf(buf + len, "%lx ", dev->bit[i]); \ | ||
454 | len += sprintf(buf + len, "\n"); \ | ||
455 | } while (0) | ||
456 | |||
457 | #define SPRINTF_BIT_B2(bit, name, max, ev) \ | ||
458 | do { \ | ||
459 | if (test_bit(ev, dev->evbit)) \ | ||
460 | SPRINTF_BIT_B(bit, name, max); \ | ||
461 | } while (0) | ||
462 | |||
463 | static int input_devices_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) | ||
464 | { | ||
465 | struct input_dev *dev; | ||
466 | struct input_handle *handle; | ||
467 | |||
468 | off_t at = 0; | ||
469 | int i, len, cnt = 0; | ||
470 | |||
471 | list_for_each_entry(dev, &input_dev_list, node) { | ||
472 | |||
473 | len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n", | ||
474 | dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version); | ||
475 | |||
476 | len += sprintf(buf + len, "N: Name=\"%s\"\n", dev->name ? dev->name : ""); | ||
477 | len += sprintf(buf + len, "P: Phys=%s\n", dev->phys ? dev->phys : ""); | ||
478 | len += sprintf(buf + len, "H: Handlers="); | ||
479 | |||
480 | list_for_each_entry(handle, &dev->h_list, d_node) | ||
481 | len += sprintf(buf + len, "%s ", handle->name); | ||
482 | |||
483 | len += sprintf(buf + len, "\n"); | ||
484 | |||
485 | SPRINTF_BIT_B(evbit, "EV=", EV_MAX); | ||
486 | SPRINTF_BIT_B2(keybit, "KEY=", KEY_MAX, EV_KEY); | ||
487 | SPRINTF_BIT_B2(relbit, "REL=", REL_MAX, EV_REL); | ||
488 | SPRINTF_BIT_B2(absbit, "ABS=", ABS_MAX, EV_ABS); | ||
489 | SPRINTF_BIT_B2(mscbit, "MSC=", MSC_MAX, EV_MSC); | ||
490 | SPRINTF_BIT_B2(ledbit, "LED=", LED_MAX, EV_LED); | ||
491 | SPRINTF_BIT_B2(sndbit, "SND=", SND_MAX, EV_SND); | ||
492 | SPRINTF_BIT_B2(ffbit, "FF=", FF_MAX, EV_FF); | ||
493 | |||
494 | len += sprintf(buf + len, "\n"); | ||
495 | |||
496 | at += len; | ||
497 | |||
498 | if (at >= pos) { | ||
499 | if (!*start) { | ||
500 | *start = buf + (pos - (at - len)); | ||
501 | cnt = at - pos; | ||
502 | } else cnt += len; | ||
503 | buf += len; | ||
504 | if (cnt >= count) | ||
505 | break; | ||
506 | } | ||
507 | } | ||
508 | |||
509 | if (&dev->node == &input_dev_list) | ||
510 | *eof = 1; | ||
511 | |||
512 | return (count > cnt) ? cnt : count; | ||
513 | } | ||
514 | |||
515 | static int input_handlers_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) | ||
516 | { | ||
517 | struct input_handler *handler; | ||
518 | |||
519 | off_t at = 0; | ||
520 | int len = 0, cnt = 0; | ||
521 | int i = 0; | ||
522 | |||
523 | list_for_each_entry(handler, &input_handler_list, node) { | ||
524 | |||
525 | if (handler->fops) | ||
526 | len = sprintf(buf, "N: Number=%d Name=%s Minor=%d\n", | ||
527 | i++, handler->name, handler->minor); | ||
528 | else | ||
529 | len = sprintf(buf, "N: Number=%d Name=%s\n", | ||
530 | i++, handler->name); | ||
531 | |||
532 | at += len; | ||
533 | |||
534 | if (at >= pos) { | ||
535 | if (!*start) { | ||
536 | *start = buf + (pos - (at - len)); | ||
537 | cnt = at - pos; | ||
538 | } else cnt += len; | ||
539 | buf += len; | ||
540 | if (cnt >= count) | ||
541 | break; | ||
542 | } | ||
543 | } | ||
544 | if (&handler->node == &input_handler_list) | ||
545 | *eof = 1; | ||
546 | |||
547 | return (count > cnt) ? cnt : count; | ||
548 | } | ||
549 | |||
550 | static struct file_operations input_fileops; | ||
551 | |||
552 | static int __init input_proc_init(void) | ||
553 | { | ||
554 | struct proc_dir_entry *entry; | ||
555 | |||
556 | proc_bus_input_dir = proc_mkdir("input", proc_bus); | ||
557 | if (!proc_bus_input_dir) | ||
558 | return -ENOMEM; | ||
559 | |||
560 | proc_bus_input_dir->owner = THIS_MODULE; | ||
561 | |||
562 | entry = create_proc_read_entry("devices", 0, proc_bus_input_dir, input_devices_read, NULL); | ||
563 | if (!entry) | ||
564 | goto fail1; | ||
565 | |||
566 | entry->owner = THIS_MODULE; | ||
567 | input_fileops = *entry->proc_fops; | ||
568 | entry->proc_fops = &input_fileops; | ||
569 | entry->proc_fops->poll = input_devices_poll; | ||
570 | |||
571 | entry = create_proc_read_entry("handlers", 0, proc_bus_input_dir, input_handlers_read, NULL); | ||
572 | if (!entry) | ||
573 | goto fail2; | ||
574 | |||
575 | entry->owner = THIS_MODULE; | ||
576 | |||
577 | return 0; | ||
578 | |||
579 | fail2: remove_proc_entry("devices", proc_bus_input_dir); | ||
580 | fail1: remove_proc_entry("input", proc_bus); | ||
581 | return -ENOMEM; | ||
582 | } | ||
583 | |||
584 | static void input_proc_exit(void) | ||
585 | { | ||
586 | remove_proc_entry("devices", proc_bus_input_dir); | ||
587 | remove_proc_entry("handlers", proc_bus_input_dir); | ||
588 | remove_proc_entry("input", proc_bus); | ||
589 | } | ||
590 | |||
591 | #else /* !CONFIG_PROC_FS */ | ||
592 | static inline void input_wakeup_procfs_readers(void) { } | ||
593 | static inline int input_proc_init(void) { return 0; } | ||
594 | static inline void input_proc_exit(void) { } | ||
595 | #endif | ||
596 | |||
431 | void input_register_device(struct input_dev *dev) | 597 | void input_register_device(struct input_dev *dev) |
432 | { | 598 | { |
433 | struct input_handle *handle; | 599 | struct input_handle *handle; |
@@ -464,10 +630,7 @@ void input_register_device(struct input_dev *dev) | |||
464 | input_call_hotplug("add", dev); | 630 | input_call_hotplug("add", dev); |
465 | #endif | 631 | #endif |
466 | 632 | ||
467 | #ifdef CONFIG_PROC_FS | 633 | input_wakeup_procfs_readers(); |
468 | input_devices_state++; | ||
469 | wake_up(&input_devices_poll_wait); | ||
470 | #endif | ||
471 | } | 634 | } |
472 | 635 | ||
473 | void input_unregister_device(struct input_dev *dev) | 636 | void input_unregister_device(struct input_dev *dev) |
@@ -491,10 +654,7 @@ void input_unregister_device(struct input_dev *dev) | |||
491 | 654 | ||
492 | list_del_init(&dev->node); | 655 | list_del_init(&dev->node); |
493 | 656 | ||
494 | #ifdef CONFIG_PROC_FS | 657 | input_wakeup_procfs_readers(); |
495 | input_devices_state++; | ||
496 | wake_up(&input_devices_poll_wait); | ||
497 | #endif | ||
498 | } | 658 | } |
499 | 659 | ||
500 | void input_register_handler(struct input_handler *handler) | 660 | void input_register_handler(struct input_handler *handler) |
@@ -518,10 +678,7 @@ void input_register_handler(struct input_handler *handler) | |||
518 | if ((handle = handler->connect(handler, dev, id))) | 678 | if ((handle = handler->connect(handler, dev, id))) |
519 | input_link_handle(handle); | 679 | input_link_handle(handle); |
520 | 680 | ||
521 | #ifdef CONFIG_PROC_FS | 681 | input_wakeup_procfs_readers(); |
522 | input_devices_state++; | ||
523 | wake_up(&input_devices_poll_wait); | ||
524 | #endif | ||
525 | } | 682 | } |
526 | 683 | ||
527 | void input_unregister_handler(struct input_handler *handler) | 684 | void input_unregister_handler(struct input_handler *handler) |
@@ -540,10 +697,7 @@ void input_unregister_handler(struct input_handler *handler) | |||
540 | if (handler->fops != NULL) | 697 | if (handler->fops != NULL) |
541 | input_table[handler->minor >> 5] = NULL; | 698 | input_table[handler->minor >> 5] = NULL; |
542 | 699 | ||
543 | #ifdef CONFIG_PROC_FS | 700 | input_wakeup_procfs_readers(); |
544 | input_devices_state++; | ||
545 | wake_up(&input_devices_poll_wait); | ||
546 | #endif | ||
547 | } | 701 | } |
548 | 702 | ||
549 | static int input_open_file(struct inode *inode, struct file *file) | 703 | static int input_open_file(struct inode *inode, struct file *file) |
@@ -582,190 +736,43 @@ static struct file_operations input_fops = { | |||
582 | .open = input_open_file, | 736 | .open = input_open_file, |
583 | }; | 737 | }; |
584 | 738 | ||
585 | #ifdef CONFIG_PROC_FS | 739 | struct class *input_class; |
586 | |||
587 | #define SPRINTF_BIT_B(bit, name, max) \ | ||
588 | do { \ | ||
589 | len += sprintf(buf + len, "B: %s", name); \ | ||
590 | for (i = NBITS(max) - 1; i >= 0; i--) \ | ||
591 | if (dev->bit[i]) break; \ | ||
592 | for (; i >= 0; i--) \ | ||
593 | len += sprintf(buf + len, "%lx ", dev->bit[i]); \ | ||
594 | len += sprintf(buf + len, "\n"); \ | ||
595 | } while (0) | ||
596 | |||
597 | #define SPRINTF_BIT_B2(bit, name, max, ev) \ | ||
598 | do { \ | ||
599 | if (test_bit(ev, dev->evbit)) \ | ||
600 | SPRINTF_BIT_B(bit, name, max); \ | ||
601 | } while (0) | ||
602 | |||
603 | |||
604 | static unsigned int input_devices_poll(struct file *file, poll_table *wait) | ||
605 | { | ||
606 | int state = input_devices_state; | ||
607 | poll_wait(file, &input_devices_poll_wait, wait); | ||
608 | if (state != input_devices_state) | ||
609 | return POLLIN | POLLRDNORM; | ||
610 | return 0; | ||
611 | } | ||
612 | 740 | ||
613 | static int input_devices_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) | 741 | static int __init input_init(void) |
614 | { | 742 | { |
615 | struct input_dev *dev; | 743 | int err; |
616 | struct input_handle *handle; | ||
617 | |||
618 | off_t at = 0; | ||
619 | int i, len, cnt = 0; | ||
620 | |||
621 | list_for_each_entry(dev, &input_dev_list, node) { | ||
622 | |||
623 | len = sprintf(buf, "I: Bus=%04x Vendor=%04x Product=%04x Version=%04x\n", | ||
624 | dev->id.bustype, dev->id.vendor, dev->id.product, dev->id.version); | ||
625 | |||
626 | len += sprintf(buf + len, "N: Name=\"%s\"\n", dev->name ? dev->name : ""); | ||
627 | len += sprintf(buf + len, "P: Phys=%s\n", dev->phys ? dev->phys : ""); | ||
628 | len += sprintf(buf + len, "H: Handlers="); | ||
629 | |||
630 | list_for_each_entry(handle, &dev->h_list, d_node) | ||
631 | len += sprintf(buf + len, "%s ", handle->name); | ||
632 | |||
633 | len += sprintf(buf + len, "\n"); | ||
634 | |||
635 | SPRINTF_BIT_B(evbit, "EV=", EV_MAX); | ||
636 | SPRINTF_BIT_B2(keybit, "KEY=", KEY_MAX, EV_KEY); | ||
637 | SPRINTF_BIT_B2(relbit, "REL=", REL_MAX, EV_REL); | ||
638 | SPRINTF_BIT_B2(absbit, "ABS=", ABS_MAX, EV_ABS); | ||
639 | SPRINTF_BIT_B2(mscbit, "MSC=", MSC_MAX, EV_MSC); | ||
640 | SPRINTF_BIT_B2(ledbit, "LED=", LED_MAX, EV_LED); | ||
641 | SPRINTF_BIT_B2(sndbit, "SND=", SND_MAX, EV_SND); | ||
642 | SPRINTF_BIT_B2(ffbit, "FF=", FF_MAX, EV_FF); | ||
643 | |||
644 | len += sprintf(buf + len, "\n"); | ||
645 | |||
646 | at += len; | ||
647 | 744 | ||
648 | if (at >= pos) { | 745 | input_class = class_create(THIS_MODULE, "input"); |
649 | if (!*start) { | 746 | if (IS_ERR(input_class)) { |
650 | *start = buf + (pos - (at - len)); | 747 | printk(KERN_ERR "input: unable to register input class\n"); |
651 | cnt = at - pos; | 748 | return PTR_ERR(input_class); |
652 | } else cnt += len; | ||
653 | buf += len; | ||
654 | if (cnt >= count) | ||
655 | break; | ||
656 | } | ||
657 | } | 749 | } |
658 | 750 | ||
659 | if (&dev->node == &input_dev_list) | 751 | err = input_proc_init(); |
660 | *eof = 1; | 752 | if (err) |
661 | 753 | goto fail1; | |
662 | return (count > cnt) ? cnt : count; | ||
663 | } | ||
664 | |||
665 | static int input_handlers_read(char *buf, char **start, off_t pos, int count, int *eof, void *data) | ||
666 | { | ||
667 | struct input_handler *handler; | ||
668 | |||
669 | off_t at = 0; | ||
670 | int len = 0, cnt = 0; | ||
671 | int i = 0; | ||
672 | |||
673 | list_for_each_entry(handler, &input_handler_list, node) { | ||
674 | |||
675 | if (handler->fops) | ||
676 | len = sprintf(buf, "N: Number=%d Name=%s Minor=%d\n", | ||
677 | i++, handler->name, handler->minor); | ||
678 | else | ||
679 | len = sprintf(buf, "N: Number=%d Name=%s\n", | ||
680 | i++, handler->name); | ||
681 | |||
682 | at += len; | ||
683 | 754 | ||
684 | if (at >= pos) { | 755 | err = register_chrdev(INPUT_MAJOR, "input", &input_fops); |
685 | if (!*start) { | 756 | if (err) { |
686 | *start = buf + (pos - (at - len)); | 757 | printk(KERN_ERR "input: unable to register char major %d", INPUT_MAJOR); |
687 | cnt = at - pos; | 758 | goto fail2; |
688 | } else cnt += len; | ||
689 | buf += len; | ||
690 | if (cnt >= count) | ||
691 | break; | ||
692 | } | ||
693 | } | 759 | } |
694 | if (&handler->node == &input_handler_list) | ||
695 | *eof = 1; | ||
696 | |||
697 | return (count > cnt) ? cnt : count; | ||
698 | } | ||
699 | |||
700 | static struct file_operations input_fileops; | ||
701 | 760 | ||
702 | static int __init input_proc_init(void) | 761 | err = devfs_mk_dir("input"); |
703 | { | 762 | if (err) |
704 | struct proc_dir_entry *entry; | 763 | goto fail3; |
705 | 764 | ||
706 | proc_bus_input_dir = proc_mkdir("input", proc_bus); | ||
707 | if (proc_bus_input_dir == NULL) | ||
708 | return -ENOMEM; | ||
709 | proc_bus_input_dir->owner = THIS_MODULE; | ||
710 | entry = create_proc_read_entry("devices", 0, proc_bus_input_dir, input_devices_read, NULL); | ||
711 | if (entry == NULL) { | ||
712 | remove_proc_entry("input", proc_bus); | ||
713 | return -ENOMEM; | ||
714 | } | ||
715 | entry->owner = THIS_MODULE; | ||
716 | input_fileops = *entry->proc_fops; | ||
717 | entry->proc_fops = &input_fileops; | ||
718 | entry->proc_fops->poll = input_devices_poll; | ||
719 | entry = create_proc_read_entry("handlers", 0, proc_bus_input_dir, input_handlers_read, NULL); | ||
720 | if (entry == NULL) { | ||
721 | remove_proc_entry("devices", proc_bus_input_dir); | ||
722 | remove_proc_entry("input", proc_bus); | ||
723 | return -ENOMEM; | ||
724 | } | ||
725 | entry->owner = THIS_MODULE; | ||
726 | return 0; | 765 | return 0; |
727 | } | ||
728 | #else /* !CONFIG_PROC_FS */ | ||
729 | static inline int input_proc_init(void) { return 0; } | ||
730 | #endif | ||
731 | 766 | ||
732 | struct class *input_class; | 767 | fail3: unregister_chrdev(INPUT_MAJOR, "input"); |
733 | 768 | fail2: input_proc_exit(); | |
734 | static int __init input_init(void) | 769 | fail1: class_destroy(input_class); |
735 | { | 770 | return err; |
736 | int retval = -ENOMEM; | ||
737 | |||
738 | input_class = class_create(THIS_MODULE, "input"); | ||
739 | if (IS_ERR(input_class)) | ||
740 | return PTR_ERR(input_class); | ||
741 | input_proc_init(); | ||
742 | retval = register_chrdev(INPUT_MAJOR, "input", &input_fops); | ||
743 | if (retval) { | ||
744 | printk(KERN_ERR "input: unable to register char major %d", INPUT_MAJOR); | ||
745 | remove_proc_entry("devices", proc_bus_input_dir); | ||
746 | remove_proc_entry("handlers", proc_bus_input_dir); | ||
747 | remove_proc_entry("input", proc_bus); | ||
748 | class_destroy(input_class); | ||
749 | return retval; | ||
750 | } | ||
751 | |||
752 | retval = devfs_mk_dir("input"); | ||
753 | if (retval) { | ||
754 | remove_proc_entry("devices", proc_bus_input_dir); | ||
755 | remove_proc_entry("handlers", proc_bus_input_dir); | ||
756 | remove_proc_entry("input", proc_bus); | ||
757 | unregister_chrdev(INPUT_MAJOR, "input"); | ||
758 | class_destroy(input_class); | ||
759 | } | ||
760 | return retval; | ||
761 | } | 771 | } |
762 | 772 | ||
763 | static void __exit input_exit(void) | 773 | static void __exit input_exit(void) |
764 | { | 774 | { |
765 | remove_proc_entry("devices", proc_bus_input_dir); | 775 | input_proc_exit(); |
766 | remove_proc_entry("handlers", proc_bus_input_dir); | ||
767 | remove_proc_entry("input", proc_bus); | ||
768 | |||
769 | devfs_remove("input"); | 776 | devfs_remove("input"); |
770 | unregister_chrdev(INPUT_MAJOR, "input"); | 777 | unregister_chrdev(INPUT_MAJOR, "input"); |
771 | class_destroy(input_class); | 778 | class_destroy(input_class); |
diff --git a/drivers/input/joydev.c b/drivers/input/joydev.c index ff8e1bbd0e13..e0938d1d3ad7 100644 --- a/drivers/input/joydev.c +++ b/drivers/input/joydev.c | |||
@@ -37,8 +37,6 @@ MODULE_LICENSE("GPL"); | |||
37 | #define JOYDEV_MINORS 16 | 37 | #define JOYDEV_MINORS 16 |
38 | #define JOYDEV_BUFFER_SIZE 64 | 38 | #define JOYDEV_BUFFER_SIZE 64 |
39 | 39 | ||
40 | #define MSECS(t) (1000 * ((t) / HZ) + 1000 * ((t) % HZ) / HZ) | ||
41 | |||
42 | struct joydev { | 40 | struct joydev { |
43 | int exist; | 41 | int exist; |
44 | int open; | 42 | int open; |
@@ -117,7 +115,7 @@ static void joydev_event(struct input_handle *handle, unsigned int type, unsigne | |||
117 | return; | 115 | return; |
118 | } | 116 | } |
119 | 117 | ||
120 | event.time = MSECS(jiffies); | 118 | event.time = jiffies_to_msecs(jiffies); |
121 | 119 | ||
122 | list_for_each_entry(list, &joydev->list, node) { | 120 | list_for_each_entry(list, &joydev->list, node) { |
123 | 121 | ||
@@ -245,7 +243,7 @@ static ssize_t joydev_read(struct file *file, char __user *buf, size_t count, lo | |||
245 | 243 | ||
246 | struct js_event event; | 244 | struct js_event event; |
247 | 245 | ||
248 | event.time = MSECS(jiffies); | 246 | event.time = jiffies_to_msecs(jiffies); |
249 | 247 | ||
250 | if (list->startup < joydev->nkey) { | 248 | if (list->startup < joydev->nkey) { |
251 | event.type = JS_EVENT_BUTTON | JS_EVENT_INIT; | 249 | event.type = JS_EVENT_BUTTON | JS_EVENT_INIT; |
diff --git a/drivers/input/misc/uinput.c b/drivers/input/misc/uinput.c index 98710997aaaa..d5c5b32045af 100644 --- a/drivers/input/misc/uinput.c +++ b/drivers/input/misc/uinput.c | |||
@@ -36,16 +36,6 @@ | |||
36 | #include <linux/miscdevice.h> | 36 | #include <linux/miscdevice.h> |
37 | #include <linux/uinput.h> | 37 | #include <linux/uinput.h> |
38 | 38 | ||
39 | static int uinput_dev_open(struct input_dev *dev) | ||
40 | { | ||
41 | return 0; | ||
42 | } | ||
43 | |||
44 | static void uinput_dev_close(struct input_dev *dev) | ||
45 | { | ||
46 | |||
47 | } | ||
48 | |||
49 | static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) | 39 | static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned int code, int value) |
50 | { | 40 | { |
51 | struct uinput_device *udev; | 41 | struct uinput_device *udev; |
@@ -63,22 +53,24 @@ static int uinput_dev_event(struct input_dev *dev, unsigned int type, unsigned i | |||
63 | return 0; | 53 | return 0; |
64 | } | 54 | } |
65 | 55 | ||
66 | static int uinput_request_alloc_id(struct input_dev *dev, struct uinput_request *request) | 56 | static int uinput_request_alloc_id(struct uinput_device *udev, struct uinput_request *request) |
67 | { | 57 | { |
68 | /* Atomically allocate an ID for the given request. Returns 0 on success. */ | 58 | /* Atomically allocate an ID for the given request. Returns 0 on success. */ |
69 | struct uinput_device *udev = dev->private; | ||
70 | int id; | 59 | int id; |
60 | int err = -1; | ||
61 | |||
62 | spin_lock(&udev->requests_lock); | ||
71 | 63 | ||
72 | down(&udev->requests_sem); | 64 | for (id = 0; id < UINPUT_NUM_REQUESTS; id++) |
73 | for (id=0; id<UINPUT_NUM_REQUESTS; id++) | ||
74 | if (!udev->requests[id]) { | 65 | if (!udev->requests[id]) { |
75 | udev->requests[id] = request; | ||
76 | request->id = id; | 66 | request->id = id; |
77 | up(&udev->requests_sem); | 67 | udev->requests[id] = request; |
78 | return 0; | 68 | err = 0; |
69 | break; | ||
79 | } | 70 | } |
80 | up(&udev->requests_sem); | 71 | |
81 | return -1; | 72 | spin_unlock(&udev->requests_lock); |
73 | return err; | ||
82 | } | 74 | } |
83 | 75 | ||
84 | static struct uinput_request* uinput_request_find(struct uinput_device *udev, int id) | 76 | static struct uinput_request* uinput_request_find(struct uinput_device *udev, int id) |
@@ -86,70 +78,78 @@ static struct uinput_request* uinput_request_find(struct uinput_device *udev, in | |||
86 | /* Find an input request, by ID. Returns NULL if the ID isn't valid. */ | 78 | /* Find an input request, by ID. Returns NULL if the ID isn't valid. */ |
87 | if (id >= UINPUT_NUM_REQUESTS || id < 0) | 79 | if (id >= UINPUT_NUM_REQUESTS || id < 0) |
88 | return NULL; | 80 | return NULL; |
89 | if (udev->requests[id]->completed) | ||
90 | return NULL; | ||
91 | return udev->requests[id]; | 81 | return udev->requests[id]; |
92 | } | 82 | } |
93 | 83 | ||
94 | static void uinput_request_init(struct input_dev *dev, struct uinput_request *request, int code) | 84 | static inline int uinput_request_reserve_slot(struct uinput_device *udev, struct uinput_request *request) |
95 | { | 85 | { |
96 | struct uinput_device *udev = dev->private; | 86 | /* Allocate slot. If none are available right away, wait. */ |
87 | return wait_event_interruptible(udev->requests_waitq, | ||
88 | !uinput_request_alloc_id(udev, request)); | ||
89 | } | ||
97 | 90 | ||
98 | memset(request, 0, sizeof(struct uinput_request)); | 91 | static void uinput_request_done(struct uinput_device *udev, struct uinput_request *request) |
99 | request->code = code; | 92 | { |
100 | init_waitqueue_head(&request->waitq); | 93 | complete(&request->done); |
101 | 94 | ||
102 | /* Allocate an ID. If none are available right away, wait. */ | 95 | /* Mark slot as available */ |
103 | request->retval = wait_event_interruptible(udev->requests_waitq, | 96 | udev->requests[request->id] = NULL; |
104 | !uinput_request_alloc_id(dev, request)); | 97 | wake_up_interruptible(&udev->requests_waitq); |
105 | } | 98 | } |
106 | 99 | ||
107 | static void uinput_request_submit(struct input_dev *dev, struct uinput_request *request) | 100 | static int uinput_request_submit(struct input_dev *dev, struct uinput_request *request) |
108 | { | 101 | { |
109 | struct uinput_device *udev = dev->private; | ||
110 | int retval; | 102 | int retval; |
111 | 103 | ||
112 | /* Tell our userspace app about this new request by queueing an input event */ | 104 | /* Tell our userspace app about this new request by queueing an input event */ |
113 | uinput_dev_event(dev, EV_UINPUT, request->code, request->id); | 105 | uinput_dev_event(dev, EV_UINPUT, request->code, request->id); |
114 | 106 | ||
115 | /* Wait for the request to complete */ | 107 | /* Wait for the request to complete */ |
116 | retval = wait_event_interruptible(request->waitq, request->completed); | 108 | retval = wait_for_completion_interruptible(&request->done); |
117 | if (retval) | 109 | if (!retval) |
118 | request->retval = retval; | 110 | retval = request->retval; |
119 | 111 | ||
120 | /* Release this request's ID, let others know it's available */ | 112 | return retval; |
121 | udev->requests[request->id] = NULL; | ||
122 | wake_up_interruptible(&udev->requests_waitq); | ||
123 | } | 113 | } |
124 | 114 | ||
125 | static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) | 115 | static int uinput_dev_upload_effect(struct input_dev *dev, struct ff_effect *effect) |
126 | { | 116 | { |
127 | struct uinput_request request; | 117 | struct uinput_request request; |
118 | int retval; | ||
128 | 119 | ||
129 | if (!test_bit(EV_FF, dev->evbit)) | 120 | if (!test_bit(EV_FF, dev->evbit)) |
130 | return -ENOSYS; | 121 | return -ENOSYS; |
131 | 122 | ||
132 | uinput_request_init(dev, &request, UI_FF_UPLOAD); | 123 | request.id = -1; |
133 | if (request.retval) | 124 | init_completion(&request.done); |
134 | return request.retval; | 125 | request.code = UI_FF_UPLOAD; |
135 | request.u.effect = effect; | 126 | request.u.effect = effect; |
136 | uinput_request_submit(dev, &request); | 127 | |
137 | return request.retval; | 128 | retval = uinput_request_reserve_slot(dev->private, &request); |
129 | if (!retval) | ||
130 | retval = uinput_request_submit(dev, &request); | ||
131 | |||
132 | return retval; | ||
138 | } | 133 | } |
139 | 134 | ||
140 | static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) | 135 | static int uinput_dev_erase_effect(struct input_dev *dev, int effect_id) |
141 | { | 136 | { |
142 | struct uinput_request request; | 137 | struct uinput_request request; |
138 | int retval; | ||
143 | 139 | ||
144 | if (!test_bit(EV_FF, dev->evbit)) | 140 | if (!test_bit(EV_FF, dev->evbit)) |
145 | return -ENOSYS; | 141 | return -ENOSYS; |
146 | 142 | ||
147 | uinput_request_init(dev, &request, UI_FF_ERASE); | 143 | request.id = -1; |
148 | if (request.retval) | 144 | init_completion(&request.done); |
149 | return request.retval; | 145 | request.code = UI_FF_ERASE; |
150 | request.u.effect_id = effect_id; | 146 | request.u.effect_id = effect_id; |
151 | uinput_request_submit(dev, &request); | 147 | |
152 | return request.retval; | 148 | retval = uinput_request_reserve_slot(dev->private, &request); |
149 | if (!retval) | ||
150 | retval = uinput_request_submit(dev, &request); | ||
151 | |||
152 | return retval; | ||
153 | } | 153 | } |
154 | 154 | ||
155 | static int uinput_create_device(struct uinput_device *udev) | 155 | static int uinput_create_device(struct uinput_device *udev) |
@@ -159,32 +159,30 @@ static int uinput_create_device(struct uinput_device *udev) | |||
159 | return -EINVAL; | 159 | return -EINVAL; |
160 | } | 160 | } |
161 | 161 | ||
162 | udev->dev->open = uinput_dev_open; | ||
163 | udev->dev->close = uinput_dev_close; | ||
164 | udev->dev->event = uinput_dev_event; | 162 | udev->dev->event = uinput_dev_event; |
165 | udev->dev->upload_effect = uinput_dev_upload_effect; | 163 | udev->dev->upload_effect = uinput_dev_upload_effect; |
166 | udev->dev->erase_effect = uinput_dev_erase_effect; | 164 | udev->dev->erase_effect = uinput_dev_erase_effect; |
167 | udev->dev->private = udev; | 165 | udev->dev->private = udev; |
168 | 166 | ||
169 | init_waitqueue_head(&(udev->waitq)); | 167 | init_waitqueue_head(&udev->waitq); |
170 | 168 | ||
171 | input_register_device(udev->dev); | 169 | input_register_device(udev->dev); |
172 | 170 | ||
173 | set_bit(UIST_CREATED, &(udev->state)); | 171 | set_bit(UIST_CREATED, &udev->state); |
174 | 172 | ||
175 | return 0; | 173 | return 0; |
176 | } | 174 | } |
177 | 175 | ||
178 | static int uinput_destroy_device(struct uinput_device *udev) | 176 | static int uinput_destroy_device(struct uinput_device *udev) |
179 | { | 177 | { |
180 | if (!test_bit(UIST_CREATED, &(udev->state))) { | 178 | if (!test_bit(UIST_CREATED, &udev->state)) { |
181 | printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME); | 179 | printk(KERN_WARNING "%s: create the device first\n", UINPUT_NAME); |
182 | return -EINVAL; | 180 | return -EINVAL; |
183 | } | 181 | } |
184 | 182 | ||
185 | input_unregister_device(udev->dev); | 183 | input_unregister_device(udev->dev); |
186 | 184 | ||
187 | clear_bit(UIST_CREATED, &(udev->state)); | 185 | clear_bit(UIST_CREATED, &udev->state); |
188 | 186 | ||
189 | return 0; | 187 | return 0; |
190 | } | 188 | } |
@@ -198,7 +196,7 @@ static int uinput_open(struct inode *inode, struct file *file) | |||
198 | if (!newdev) | 196 | if (!newdev) |
199 | goto error; | 197 | goto error; |
200 | memset(newdev, 0, sizeof(struct uinput_device)); | 198 | memset(newdev, 0, sizeof(struct uinput_device)); |
201 | init_MUTEX(&newdev->requests_sem); | 199 | spin_lock_init(&newdev->requests_lock); |
202 | init_waitqueue_head(&newdev->requests_waitq); | 200 | init_waitqueue_head(&newdev->requests_waitq); |
203 | 201 | ||
204 | newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL); | 202 | newinput = kmalloc(sizeof(struct input_dev), GFP_KERNEL); |
@@ -253,15 +251,16 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz | |||
253 | struct uinput_user_dev *user_dev; | 251 | struct uinput_user_dev *user_dev; |
254 | struct input_dev *dev; | 252 | struct input_dev *dev; |
255 | struct uinput_device *udev; | 253 | struct uinput_device *udev; |
256 | int size, | 254 | char *name; |
257 | retval; | 255 | int size; |
256 | int retval; | ||
258 | 257 | ||
259 | retval = count; | 258 | retval = count; |
260 | 259 | ||
261 | udev = file->private_data; | 260 | udev = file->private_data; |
262 | dev = udev->dev; | 261 | dev = udev->dev; |
263 | 262 | ||
264 | user_dev = kmalloc(sizeof(*user_dev), GFP_KERNEL); | 263 | user_dev = kmalloc(sizeof(struct uinput_user_dev), GFP_KERNEL); |
265 | if (!user_dev) { | 264 | if (!user_dev) { |
266 | retval = -ENOMEM; | 265 | retval = -ENOMEM; |
267 | goto exit; | 266 | goto exit; |
@@ -272,17 +271,17 @@ static int uinput_alloc_device(struct file *file, const char __user *buffer, siz | |||
272 | goto exit; | 271 | goto exit; |
273 | } | 272 | } |
274 | 273 | ||
275 | if (NULL != dev->name) | 274 | if (dev->name) |
276 | kfree(dev->name); | 275 | kfree(dev->name); |
277 | 276 | ||
278 | size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; | 277 | size = strnlen(user_dev->name, UINPUT_MAX_NAME_SIZE) + 1; |
279 | dev->name = kmalloc(size, GFP_KERNEL); | 278 | dev->name = name = kmalloc(size, GFP_KERNEL); |
280 | if (!dev->name) { | 279 | if (!name) { |
281 | retval = -ENOMEM; | 280 | retval = -ENOMEM; |
282 | goto exit; | 281 | goto exit; |
283 | } | 282 | } |
283 | strlcpy(name, user_dev->name, size); | ||
284 | 284 | ||
285 | strlcpy(dev->name, user_dev->name, size); | ||
286 | dev->id.bustype = user_dev->id.bustype; | 285 | dev->id.bustype = user_dev->id.bustype; |
287 | dev->id.vendor = user_dev->id.vendor; | 286 | dev->id.vendor = user_dev->id.vendor; |
288 | dev->id.product = user_dev->id.product; | 287 | dev->id.product = user_dev->id.product; |
@@ -314,14 +313,13 @@ static ssize_t uinput_write(struct file *file, const char __user *buffer, size_t | |||
314 | { | 313 | { |
315 | struct uinput_device *udev = file->private_data; | 314 | struct uinput_device *udev = file->private_data; |
316 | 315 | ||
317 | if (test_bit(UIST_CREATED, &(udev->state))) { | 316 | if (test_bit(UIST_CREATED, &udev->state)) { |
318 | struct input_event ev; | 317 | struct input_event ev; |
319 | 318 | ||
320 | if (copy_from_user(&ev, buffer, sizeof(struct input_event))) | 319 | if (copy_from_user(&ev, buffer, sizeof(struct input_event))) |
321 | return -EFAULT; | 320 | return -EFAULT; |
322 | input_event(udev->dev, ev.type, ev.code, ev.value); | 321 | input_event(udev->dev, ev.type, ev.code, ev.value); |
323 | } | 322 | } else |
324 | else | ||
325 | count = uinput_alloc_device(file, buffer, count); | 323 | count = uinput_alloc_device(file, buffer, count); |
326 | 324 | ||
327 | return count; | 325 | return count; |
@@ -332,26 +330,24 @@ static ssize_t uinput_read(struct file *file, char __user *buffer, size_t count, | |||
332 | struct uinput_device *udev = file->private_data; | 330 | struct uinput_device *udev = file->private_data; |
333 | int retval = 0; | 331 | int retval = 0; |
334 | 332 | ||
335 | if (!test_bit(UIST_CREATED, &(udev->state))) | 333 | if (!test_bit(UIST_CREATED, &udev->state)) |
336 | return -ENODEV; | 334 | return -ENODEV; |
337 | 335 | ||
338 | if ((udev->head == udev->tail) && (file->f_flags & O_NONBLOCK)) | 336 | if (udev->head == udev->tail && (file->f_flags & O_NONBLOCK)) |
339 | return -EAGAIN; | 337 | return -EAGAIN; |
340 | 338 | ||
341 | retval = wait_event_interruptible(udev->waitq, | 339 | retval = wait_event_interruptible(udev->waitq, |
342 | (udev->head != udev->tail) || | 340 | udev->head != udev->tail || !test_bit(UIST_CREATED, &udev->state)); |
343 | !test_bit(UIST_CREATED, &(udev->state))); | ||
344 | |||
345 | if (retval) | 341 | if (retval) |
346 | return retval; | 342 | return retval; |
347 | 343 | ||
348 | if (!test_bit(UIST_CREATED, &(udev->state))) | 344 | if (!test_bit(UIST_CREATED, &udev->state)) |
349 | return -ENODEV; | 345 | return -ENODEV; |
350 | 346 | ||
351 | while ((udev->head != udev->tail) && | 347 | while ((udev->head != udev->tail) && |
352 | (retval + sizeof(struct input_event) <= count)) { | 348 | (retval + sizeof(struct input_event) <= count)) { |
353 | if (copy_to_user(buffer + retval, &(udev->buff[udev->tail]), | 349 | if (copy_to_user(buffer + retval, &udev->buff[udev->tail], sizeof(struct input_event))) |
354 | sizeof(struct input_event))) return -EFAULT; | 350 | return -EFAULT; |
355 | udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; | 351 | udev->tail = (udev->tail + 1) % UINPUT_BUFFER_SIZE; |
356 | retval += sizeof(struct input_event); | 352 | retval += sizeof(struct input_event); |
357 | } | 353 | } |
@@ -373,12 +369,12 @@ static unsigned int uinput_poll(struct file *file, poll_table *wait) | |||
373 | 369 | ||
374 | static int uinput_burn_device(struct uinput_device *udev) | 370 | static int uinput_burn_device(struct uinput_device *udev) |
375 | { | 371 | { |
376 | if (test_bit(UIST_CREATED, &(udev->state))) | 372 | if (test_bit(UIST_CREATED, &udev->state)) |
377 | uinput_destroy_device(udev); | 373 | uinput_destroy_device(udev); |
378 | 374 | ||
379 | if (NULL != udev->dev->name) | 375 | if (udev->dev->name) |
380 | kfree(udev->dev->name); | 376 | kfree(udev->dev->name); |
381 | if (NULL != udev->dev->phys) | 377 | if (udev->dev->phys) |
382 | kfree(udev->dev->phys); | 378 | kfree(udev->dev->phys); |
383 | 379 | ||
384 | kfree(udev->dev); | 380 | kfree(udev->dev); |
@@ -389,7 +385,8 @@ static int uinput_burn_device(struct uinput_device *udev) | |||
389 | 385 | ||
390 | static int uinput_close(struct inode *inode, struct file *file) | 386 | static int uinput_close(struct inode *inode, struct file *file) |
391 | { | 387 | { |
392 | return uinput_burn_device(file->private_data); | 388 | uinput_burn_device(file->private_data); |
389 | return 0; | ||
393 | } | 390 | } |
394 | 391 | ||
395 | static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) | 392 | static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd, unsigned long arg) |
@@ -401,6 +398,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
401 | struct uinput_ff_erase ff_erase; | 398 | struct uinput_ff_erase ff_erase; |
402 | struct uinput_request *req; | 399 | struct uinput_request *req; |
403 | int length; | 400 | int length; |
401 | char *phys; | ||
404 | 402 | ||
405 | udev = file->private_data; | 403 | udev = file->private_data; |
406 | 404 | ||
@@ -415,7 +413,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
415 | case UI_SET_SNDBIT: | 413 | case UI_SET_SNDBIT: |
416 | case UI_SET_FFBIT: | 414 | case UI_SET_FFBIT: |
417 | case UI_SET_PHYS: | 415 | case UI_SET_PHYS: |
418 | if (test_bit(UIST_CREATED, &(udev->state))) | 416 | if (test_bit(UIST_CREATED, &udev->state)) |
419 | return -EINVAL; | 417 | return -EINVAL; |
420 | } | 418 | } |
421 | 419 | ||
@@ -498,20 +496,19 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
498 | retval = -EFAULT; | 496 | retval = -EFAULT; |
499 | break; | 497 | break; |
500 | } | 498 | } |
501 | if (NULL != udev->dev->phys) | 499 | kfree(udev->dev->phys); |
502 | kfree(udev->dev->phys); | 500 | udev->dev->phys = phys = kmalloc(length, GFP_KERNEL); |
503 | udev->dev->phys = kmalloc(length, GFP_KERNEL); | 501 | if (!phys) { |
504 | if (!udev->dev->phys) { | ||
505 | retval = -ENOMEM; | 502 | retval = -ENOMEM; |
506 | break; | 503 | break; |
507 | } | 504 | } |
508 | if (copy_from_user(udev->dev->phys, p, length)) { | 505 | if (copy_from_user(phys, p, length)) { |
509 | retval = -EFAULT; | ||
510 | kfree(udev->dev->phys); | ||
511 | udev->dev->phys = NULL; | 506 | udev->dev->phys = NULL; |
507 | kfree(phys); | ||
508 | retval = -EFAULT; | ||
512 | break; | 509 | break; |
513 | } | 510 | } |
514 | udev->dev->phys[length-1] = '\0'; | 511 | phys[length - 1] = '\0'; |
515 | break; | 512 | break; |
516 | 513 | ||
517 | case UI_BEGIN_FF_UPLOAD: | 514 | case UI_BEGIN_FF_UPLOAD: |
@@ -520,7 +517,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
520 | break; | 517 | break; |
521 | } | 518 | } |
522 | req = uinput_request_find(udev, ff_up.request_id); | 519 | req = uinput_request_find(udev, ff_up.request_id); |
523 | if (!(req && req->code==UI_FF_UPLOAD && req->u.effect)) { | 520 | if (!(req && req->code == UI_FF_UPLOAD && req->u.effect)) { |
524 | retval = -EINVAL; | 521 | retval = -EINVAL; |
525 | break; | 522 | break; |
526 | } | 523 | } |
@@ -538,7 +535,7 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
538 | break; | 535 | break; |
539 | } | 536 | } |
540 | req = uinput_request_find(udev, ff_erase.request_id); | 537 | req = uinput_request_find(udev, ff_erase.request_id); |
541 | if (!(req && req->code==UI_FF_ERASE)) { | 538 | if (!(req && req->code == UI_FF_ERASE)) { |
542 | retval = -EINVAL; | 539 | retval = -EINVAL; |
543 | break; | 540 | break; |
544 | } | 541 | } |
@@ -556,14 +553,13 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
556 | break; | 553 | break; |
557 | } | 554 | } |
558 | req = uinput_request_find(udev, ff_up.request_id); | 555 | req = uinput_request_find(udev, ff_up.request_id); |
559 | if (!(req && req->code==UI_FF_UPLOAD && req->u.effect)) { | 556 | if (!(req && req->code == UI_FF_UPLOAD && req->u.effect)) { |
560 | retval = -EINVAL; | 557 | retval = -EINVAL; |
561 | break; | 558 | break; |
562 | } | 559 | } |
563 | req->retval = ff_up.retval; | 560 | req->retval = ff_up.retval; |
564 | memcpy(req->u.effect, &ff_up.effect, sizeof(struct ff_effect)); | 561 | memcpy(req->u.effect, &ff_up.effect, sizeof(struct ff_effect)); |
565 | req->completed = 1; | 562 | uinput_request_done(udev, req); |
566 | wake_up_interruptible(&req->waitq); | ||
567 | break; | 563 | break; |
568 | 564 | ||
569 | case UI_END_FF_ERASE: | 565 | case UI_END_FF_ERASE: |
@@ -572,13 +568,12 @@ static int uinput_ioctl(struct inode *inode, struct file *file, unsigned int cmd | |||
572 | break; | 568 | break; |
573 | } | 569 | } |
574 | req = uinput_request_find(udev, ff_erase.request_id); | 570 | req = uinput_request_find(udev, ff_erase.request_id); |
575 | if (!(req && req->code==UI_FF_ERASE)) { | 571 | if (!(req && req->code == UI_FF_ERASE)) { |
576 | retval = -EINVAL; | 572 | retval = -EINVAL; |
577 | break; | 573 | break; |
578 | } | 574 | } |
579 | req->retval = ff_erase.retval; | 575 | req->retval = ff_erase.retval; |
580 | req->completed = 1; | 576 | uinput_request_done(udev, req); |
581 | wake_up_interruptible(&req->waitq); | ||
582 | break; | 577 | break; |
583 | 578 | ||
584 | default: | 579 | default: |
diff --git a/drivers/input/mouse/alps.c b/drivers/input/mouse/alps.c index a12e98158a75..0d68e5e0182a 100644 --- a/drivers/input/mouse/alps.c +++ b/drivers/input/mouse/alps.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * ALPS touchpad PS/2 mouse driver | 2 | * ALPS touchpad PS/2 mouse driver |
3 | * | 3 | * |
4 | * Copyright (c) 2003 Neil Brown <neilb@cse.unsw.edu.au> | 4 | * Copyright (c) 2003 Neil Brown <neilb@cse.unsw.edu.au> |
5 | * Copyright (c) 2003 Peter Osterlund <petero2@telia.com> | 5 | * Copyright (c) 2003-2005 Peter Osterlund <petero2@telia.com> |
6 | * Copyright (c) 2004 Dmitry Torokhov <dtor@mail.ru> | 6 | * Copyright (c) 2004 Dmitry Torokhov <dtor@mail.ru> |
7 | * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz> | 7 | * Copyright (c) 2005 Vojtech Pavlik <vojtech@suse.cz> |
8 | * | 8 | * |
@@ -350,7 +350,6 @@ static int alps_tap_mode(struct psmouse *psmouse, int enable) | |||
350 | static int alps_reconnect(struct psmouse *psmouse) | 350 | static int alps_reconnect(struct psmouse *psmouse) |
351 | { | 351 | { |
352 | struct alps_data *priv = psmouse->private; | 352 | struct alps_data *priv = psmouse->private; |
353 | unsigned char param[4]; | ||
354 | int version; | 353 | int version; |
355 | 354 | ||
356 | psmouse_reset(psmouse); | 355 | psmouse_reset(psmouse); |
@@ -358,21 +357,20 @@ static int alps_reconnect(struct psmouse *psmouse) | |||
358 | if (!(priv->i = alps_get_model(psmouse, &version))) | 357 | if (!(priv->i = alps_get_model(psmouse, &version))) |
359 | return -1; | 358 | return -1; |
360 | 359 | ||
361 | if (priv->i->flags & ALPS_PASS && alps_passthrough_mode(psmouse, 1)) | 360 | if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) |
362 | return -1; | 361 | return -1; |
363 | 362 | ||
364 | if (alps_get_status(psmouse, param)) | 363 | if (alps_tap_mode(psmouse, 1)) { |
364 | printk(KERN_WARNING "alps.c: Failed to reenable hardware tapping\n"); | ||
365 | return -1; | 365 | return -1; |
366 | 366 | } | |
367 | if (!(param[0] & 0x04)) | ||
368 | alps_tap_mode(psmouse, 1); | ||
369 | 367 | ||
370 | if (alps_absolute_mode(psmouse)) { | 368 | if (alps_absolute_mode(psmouse)) { |
371 | printk(KERN_ERR "alps.c: Failed to enable absolute mode\n"); | 369 | printk(KERN_ERR "alps.c: Failed to reenable absolute mode\n"); |
372 | return -1; | 370 | return -1; |
373 | } | 371 | } |
374 | 372 | ||
375 | if (priv->i->flags == ALPS_PASS && alps_passthrough_mode(psmouse, 0)) | 373 | if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 0)) |
376 | return -1; | 374 | return -1; |
377 | 375 | ||
378 | return 0; | 376 | return 0; |
@@ -389,7 +387,6 @@ static void alps_disconnect(struct psmouse *psmouse) | |||
389 | int alps_init(struct psmouse *psmouse) | 387 | int alps_init(struct psmouse *psmouse) |
390 | { | 388 | { |
391 | struct alps_data *priv; | 389 | struct alps_data *priv; |
392 | unsigned char param[4]; | ||
393 | int version; | 390 | int version; |
394 | 391 | ||
395 | psmouse->private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL); | 392 | psmouse->private = priv = kmalloc(sizeof(struct alps_data), GFP_KERNEL); |
@@ -403,16 +400,8 @@ int alps_init(struct psmouse *psmouse) | |||
403 | if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) | 400 | if ((priv->i->flags & ALPS_PASS) && alps_passthrough_mode(psmouse, 1)) |
404 | goto init_fail; | 401 | goto init_fail; |
405 | 402 | ||
406 | if (alps_get_status(psmouse, param)) { | 403 | if (alps_tap_mode(psmouse, 1)) |
407 | printk(KERN_ERR "alps.c: touchpad status report request failed\n"); | 404 | printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n"); |
408 | goto init_fail; | ||
409 | } | ||
410 | |||
411 | if (param[0] & 0x04) { | ||
412 | printk(KERN_INFO "alps.c: Enabling hardware tapping\n"); | ||
413 | if (alps_tap_mode(psmouse, 1)) | ||
414 | printk(KERN_WARNING "alps.c: Failed to enable hardware tapping\n"); | ||
415 | } | ||
416 | 405 | ||
417 | if (alps_absolute_mode(psmouse)) { | 406 | if (alps_absolute_mode(psmouse)) { |
418 | printk(KERN_ERR "alps.c: Failed to enable absolute mode\n"); | 407 | printk(KERN_ERR "alps.c: Failed to enable absolute mode\n"); |
diff --git a/drivers/input/mouse/logips2pp.c b/drivers/input/mouse/logips2pp.c index 5ab1bd7d529d..48d2b20d2642 100644 --- a/drivers/input/mouse/logips2pp.c +++ b/drivers/input/mouse/logips2pp.c | |||
@@ -385,8 +385,6 @@ int ps2pp_init(struct psmouse *psmouse, int set_properties) | |||
385 | 385 | ||
386 | if (buttons < 3) | 386 | if (buttons < 3) |
387 | clear_bit(BTN_MIDDLE, psmouse->dev.keybit); | 387 | clear_bit(BTN_MIDDLE, psmouse->dev.keybit); |
388 | if (buttons < 2) | ||
389 | clear_bit(BTN_RIGHT, psmouse->dev.keybit); | ||
390 | 388 | ||
391 | if (model_info) | 389 | if (model_info) |
392 | ps2pp_set_model_properties(psmouse, model_info, use_ps2pp); | 390 | ps2pp_set_model_properties(psmouse, model_info, use_ps2pp); |
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c index 19785a6c5abd..2bb2fe78bdca 100644 --- a/drivers/input/mouse/psmouse-base.c +++ b/drivers/input/mouse/psmouse-base.c | |||
@@ -344,6 +344,7 @@ static int intellimouse_detect(struct psmouse *psmouse, int set_properties) | |||
344 | return -1; | 344 | return -1; |
345 | 345 | ||
346 | if (set_properties) { | 346 | if (set_properties) { |
347 | set_bit(BTN_MIDDLE, psmouse->dev.keybit); | ||
347 | set_bit(REL_WHEEL, psmouse->dev.relbit); | 348 | set_bit(REL_WHEEL, psmouse->dev.relbit); |
348 | 349 | ||
349 | if (!psmouse->vendor) psmouse->vendor = "Generic"; | 350 | if (!psmouse->vendor) psmouse->vendor = "Generic"; |
@@ -376,6 +377,7 @@ static int im_explorer_detect(struct psmouse *psmouse, int set_properties) | |||
376 | return -1; | 377 | return -1; |
377 | 378 | ||
378 | if (set_properties) { | 379 | if (set_properties) { |
380 | set_bit(BTN_MIDDLE, psmouse->dev.keybit); | ||
379 | set_bit(REL_WHEEL, psmouse->dev.relbit); | 381 | set_bit(REL_WHEEL, psmouse->dev.relbit); |
380 | set_bit(BTN_SIDE, psmouse->dev.keybit); | 382 | set_bit(BTN_SIDE, psmouse->dev.keybit); |
381 | set_bit(BTN_EXTRA, psmouse->dev.keybit); | 383 | set_bit(BTN_EXTRA, psmouse->dev.keybit); |
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c index 36c721227b68..029309422409 100644 --- a/drivers/input/mouse/synaptics.c +++ b/drivers/input/mouse/synaptics.c | |||
@@ -219,7 +219,7 @@ static void synaptics_pass_pt_packet(struct serio *ptport, unsigned char *packet | |||
219 | serio_interrupt(ptport, packet[1], 0, NULL); | 219 | serio_interrupt(ptport, packet[1], 0, NULL); |
220 | serio_interrupt(ptport, packet[4], 0, NULL); | 220 | serio_interrupt(ptport, packet[4], 0, NULL); |
221 | serio_interrupt(ptport, packet[5], 0, NULL); | 221 | serio_interrupt(ptport, packet[5], 0, NULL); |
222 | if (child->type >= PSMOUSE_GENPS) | 222 | if (child->pktsize == 4) |
223 | serio_interrupt(ptport, packet[2], 0, NULL); | 223 | serio_interrupt(ptport, packet[2], 0, NULL); |
224 | } else | 224 | } else |
225 | serio_interrupt(ptport, packet[1], 0, NULL); | 225 | serio_interrupt(ptport, packet[1], 0, NULL); |
@@ -233,7 +233,7 @@ static void synaptics_pt_activate(struct psmouse *psmouse) | |||
233 | 233 | ||
234 | /* adjust the touchpad to child's choice of protocol */ | 234 | /* adjust the touchpad to child's choice of protocol */ |
235 | if (child) { | 235 | if (child) { |
236 | if (child->type >= PSMOUSE_GENPS) | 236 | if (child->pktsize == 4) |
237 | priv->mode |= SYN_BIT_FOUR_BYTE_CLIENT; | 237 | priv->mode |= SYN_BIT_FOUR_BYTE_CLIENT; |
238 | else | 238 | else |
239 | priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT; | 239 | priv->mode &= ~SYN_BIT_FOUR_BYTE_CLIENT; |
@@ -608,6 +608,13 @@ static struct dmi_system_id toshiba_dmi_table[] = { | |||
608 | DMI_MATCH(DMI_PRODUCT_NAME , "Satellite"), | 608 | DMI_MATCH(DMI_PRODUCT_NAME , "Satellite"), |
609 | }, | 609 | }, |
610 | }, | 610 | }, |
611 | { | ||
612 | .ident = "Toshiba Dynabook", | ||
613 | .matches = { | ||
614 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
615 | DMI_MATCH(DMI_PRODUCT_NAME , "dynabook"), | ||
616 | }, | ||
617 | }, | ||
611 | { } | 618 | { } |
612 | }; | 619 | }; |
613 | #endif | 620 | #endif |
@@ -656,7 +663,8 @@ int synaptics_init(struct psmouse *psmouse) | |||
656 | * thye same as rate of standard PS/2 mouse. | 663 | * thye same as rate of standard PS/2 mouse. |
657 | */ | 664 | */ |
658 | if (psmouse->rate >= 80 && dmi_check_system(toshiba_dmi_table)) { | 665 | if (psmouse->rate >= 80 && dmi_check_system(toshiba_dmi_table)) { |
659 | printk(KERN_INFO "synaptics: Toshiba Satellite detected, limiting rate to 40pps.\n"); | 666 | printk(KERN_INFO "synaptics: Toshiba %s detected, limiting rate to 40pps.\n", |
667 | dmi_get_system_info(DMI_PRODUCT_NAME)); | ||
660 | psmouse->rate = 40; | 668 | psmouse->rate = 40; |
661 | } | 669 | } |
662 | #endif | 670 | #endif |
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig index b3710733b36b..98acf170252c 100644 --- a/drivers/input/serio/Kconfig +++ b/drivers/input/serio/Kconfig | |||
@@ -175,7 +175,7 @@ config SERIO_RAW | |||
175 | allocating minor 1 (that historically corresponds to /dev/psaux) | 175 | allocating minor 1 (that historically corresponds to /dev/psaux) |
176 | first. To bind this driver to a serio port use sysfs interface: | 176 | first. To bind this driver to a serio port use sysfs interface: |
177 | 177 | ||
178 | echo -n "serio_raw" > /sys/bus/serio/devices/serioX/driver | 178 | echo -n "serio_raw" > /sys/bus/serio/devices/serioX/drvctl |
179 | 179 | ||
180 | To compile this driver as a module, choose M here: the | 180 | To compile this driver as a module, choose M here: the |
181 | module will be called serio_raw. | 181 | module will be called serio_raw. |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index 0487ecbb8a49..03877c84e6ff 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -131,12 +131,26 @@ static struct dmi_system_id __initdata i8042_dmi_nomux_table[] = { | |||
131 | }, | 131 | }, |
132 | }, | 132 | }, |
133 | { | 133 | { |
134 | .ident = "Fujitsu-Siemens Lifebook T3010", | ||
135 | .matches = { | ||
136 | DMI_MATCH(DMI_SYS_VENDOR, "FUJITSU SIEMENS"), | ||
137 | DMI_MATCH(DMI_PRODUCT_NAME, "LIFEBOOK T3010"), | ||
138 | }, | ||
139 | }, | ||
140 | { | ||
134 | .ident = "Toshiba P10", | 141 | .ident = "Toshiba P10", |
135 | .matches = { | 142 | .matches = { |
136 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 143 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
137 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"), | 144 | DMI_MATCH(DMI_PRODUCT_NAME, "Satellite P10"), |
138 | }, | 145 | }, |
139 | }, | 146 | }, |
147 | { | ||
148 | .ident = "Alienware Sentia", | ||
149 | .matches = { | ||
150 | DMI_MATCH(DMI_SYS_VENDOR, "ALIENWARE"), | ||
151 | DMI_MATCH(DMI_PRODUCT_NAME, "Sentia"), | ||
152 | }, | ||
153 | }, | ||
140 | { } | 154 | { } |
141 | }; | 155 | }; |
142 | 156 | ||
diff --git a/drivers/input/serio/i8042.c b/drivers/input/serio/i8042.c index a9bf549c8dc5..708a1d3beab9 100644 --- a/drivers/input/serio/i8042.c +++ b/drivers/input/serio/i8042.c | |||
@@ -100,7 +100,7 @@ struct i8042_port { | |||
100 | static struct i8042_port i8042_ports[I8042_NUM_PORTS] = { | 100 | static struct i8042_port i8042_ports[I8042_NUM_PORTS] = { |
101 | { | 101 | { |
102 | .disable = I8042_CTR_KBDDIS, | 102 | .disable = I8042_CTR_KBDDIS, |
103 | .irqen = I8042_CTR_KBDINT, | 103 | .irqen = I8042_CTR_KBDINT, |
104 | .mux = -1, | 104 | .mux = -1, |
105 | .name = "KBD", | 105 | .name = "KBD", |
106 | }, | 106 | }, |
@@ -191,41 +191,45 @@ static int i8042_flush(void) | |||
191 | static int i8042_command(unsigned char *param, int command) | 191 | static int i8042_command(unsigned char *param, int command) |
192 | { | 192 | { |
193 | unsigned long flags; | 193 | unsigned long flags; |
194 | int retval = 0, i = 0; | 194 | int i, retval, auxerr = 0; |
195 | 195 | ||
196 | if (i8042_noloop && command == I8042_CMD_AUX_LOOP) | 196 | if (i8042_noloop && command == I8042_CMD_AUX_LOOP) |
197 | return -1; | 197 | return -1; |
198 | 198 | ||
199 | spin_lock_irqsave(&i8042_lock, flags); | 199 | spin_lock_irqsave(&i8042_lock, flags); |
200 | 200 | ||
201 | retval = i8042_wait_write(); | 201 | if ((retval = i8042_wait_write())) |
202 | if (!retval) { | 202 | goto out; |
203 | dbg("%02x -> i8042 (command)", command & 0xff); | 203 | |
204 | i8042_write_command(command & 0xff); | 204 | dbg("%02x -> i8042 (command)", command & 0xff); |
205 | i8042_write_command(command & 0xff); | ||
206 | |||
207 | for (i = 0; i < ((command >> 12) & 0xf); i++) { | ||
208 | if ((retval = i8042_wait_write())) | ||
209 | goto out; | ||
210 | dbg("%02x -> i8042 (parameter)", param[i]); | ||
211 | i8042_write_data(param[i]); | ||
205 | } | 212 | } |
206 | 213 | ||
207 | if (!retval) | 214 | for (i = 0; i < ((command >> 8) & 0xf); i++) { |
208 | for (i = 0; i < ((command >> 12) & 0xf); i++) { | 215 | if ((retval = i8042_wait_read())) |
209 | if ((retval = i8042_wait_write())) break; | 216 | goto out; |
210 | dbg("%02x -> i8042 (parameter)", param[i]); | ||
211 | i8042_write_data(param[i]); | ||
212 | } | ||
213 | 217 | ||
214 | if (!retval) | 218 | if (command == I8042_CMD_AUX_LOOP && |
215 | for (i = 0; i < ((command >> 8) & 0xf); i++) { | 219 | !(i8042_read_status() & I8042_STR_AUXDATA)) { |
216 | if ((retval = i8042_wait_read())) break; | 220 | retval = auxerr = -1; |
217 | if (i8042_read_status() & I8042_STR_AUXDATA) | 221 | goto out; |
218 | param[i] = ~i8042_read_data(); | ||
219 | else | ||
220 | param[i] = i8042_read_data(); | ||
221 | dbg("%02x <- i8042 (return)", param[i]); | ||
222 | } | 222 | } |
223 | 223 | ||
224 | spin_unlock_irqrestore(&i8042_lock, flags); | 224 | param[i] = i8042_read_data(); |
225 | dbg("%02x <- i8042 (return)", param[i]); | ||
226 | } | ||
225 | 227 | ||
226 | if (retval) | 228 | if (retval) |
227 | dbg(" -- i8042 (timeout)"); | 229 | dbg(" -- i8042 (%s)", auxerr ? "auxerr" : "timeout"); |
228 | 230 | ||
231 | out: | ||
232 | spin_unlock_irqrestore(&i8042_lock, flags); | ||
229 | return retval; | 233 | return retval; |
230 | } | 234 | } |
231 | 235 | ||
@@ -507,17 +511,17 @@ static int i8042_set_mux_mode(unsigned int mode, unsigned char *mux_version) | |||
507 | */ | 511 | */ |
508 | 512 | ||
509 | param = 0xf0; | 513 | param = 0xf0; |
510 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0x0f) | 514 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0xf0) |
511 | return -1; | 515 | return -1; |
512 | param = mode ? 0x56 : 0xf6; | 516 | param = mode ? 0x56 : 0xf6; |
513 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != (mode ? 0xa9 : 0x09)) | 517 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != (mode ? 0x56 : 0xf6)) |
514 | return -1; | 518 | return -1; |
515 | param = mode ? 0xa4 : 0xa5; | 519 | param = mode ? 0xa4 : 0xa5; |
516 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == (mode ? 0x5b : 0x5a)) | 520 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param == (mode ? 0xa4 : 0xa5)) |
517 | return -1; | 521 | return -1; |
518 | 522 | ||
519 | if (mux_version) | 523 | if (mux_version) |
520 | *mux_version = ~param; | 524 | *mux_version = param; |
521 | 525 | ||
522 | return 0; | 526 | return 0; |
523 | } | 527 | } |
@@ -619,7 +623,7 @@ static int __init i8042_check_aux(void) | |||
619 | */ | 623 | */ |
620 | 624 | ||
621 | param = 0x5a; | 625 | param = 0x5a; |
622 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0xa5) { | 626 | if (i8042_command(¶m, I8042_CMD_AUX_LOOP) || param != 0x5a) { |
623 | 627 | ||
624 | /* | 628 | /* |
625 | * External connection test - filters out AT-soldered PS/2 i8042's | 629 | * External connection test - filters out AT-soldered PS/2 i8042's |
@@ -630,7 +634,7 @@ static int __init i8042_check_aux(void) | |||
630 | */ | 634 | */ |
631 | 635 | ||
632 | if (i8042_command(¶m, I8042_CMD_AUX_TEST) | 636 | if (i8042_command(¶m, I8042_CMD_AUX_TEST) |
633 | || (param && param != 0xfa && param != 0xff)) | 637 | || (param && param != 0xfa && param != 0xff)) |
634 | return -1; | 638 | return -1; |
635 | } | 639 | } |
636 | 640 | ||
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c index f367695e69b5..edd15db17715 100644 --- a/drivers/input/serio/serio.c +++ b/drivers/input/serio/serio.c | |||
@@ -389,6 +389,14 @@ static ssize_t serio_show_description(struct device *dev, struct device_attribut | |||
389 | return sprintf(buf, "%s\n", serio->name); | 389 | return sprintf(buf, "%s\n", serio->name); |
390 | } | 390 | } |
391 | 391 | ||
392 | static ssize_t serio_show_modalias(struct device *dev, struct device_attribute *attr, char *buf) | ||
393 | { | ||
394 | struct serio *serio = to_serio_port(dev); | ||
395 | |||
396 | return sprintf(buf, "serio:ty%02Xpr%02Xid%02Xex%02X\n", | ||
397 | serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); | ||
398 | } | ||
399 | |||
392 | static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf) | 400 | static ssize_t serio_show_id_type(struct device *dev, struct device_attribute *attr, char *buf) |
393 | { | 401 | { |
394 | struct serio *serio = to_serio_port(dev); | 402 | struct serio *serio = to_serio_port(dev); |
@@ -487,6 +495,7 @@ static ssize_t serio_set_bind_mode(struct device *dev, struct device_attribute * | |||
487 | 495 | ||
488 | static struct device_attribute serio_device_attrs[] = { | 496 | static struct device_attribute serio_device_attrs[] = { |
489 | __ATTR(description, S_IRUGO, serio_show_description, NULL), | 497 | __ATTR(description, S_IRUGO, serio_show_description, NULL), |
498 | __ATTR(modalias, S_IRUGO, serio_show_modalias, NULL), | ||
490 | __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), | 499 | __ATTR(drvctl, S_IWUSR, NULL, serio_rebind_driver), |
491 | __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), | 500 | __ATTR(bind_mode, S_IWUSR | S_IRUGO, serio_show_bind_mode, serio_set_bind_mode), |
492 | __ATTR_NULL | 501 | __ATTR_NULL |
@@ -785,36 +794,37 @@ static int serio_bus_match(struct device *dev, struct device_driver *drv) | |||
785 | 794 | ||
786 | #ifdef CONFIG_HOTPLUG | 795 | #ifdef CONFIG_HOTPLUG |
787 | 796 | ||
788 | #define PUT_ENVP(fmt, val) \ | 797 | #define SERIO_ADD_HOTPLUG_VAR(fmt, val...) \ |
789 | do { \ | 798 | do { \ |
790 | envp[i++] = buffer; \ | 799 | int err = add_hotplug_env_var(envp, num_envp, &i, \ |
791 | length += snprintf(buffer, buffer_size - length, fmt, val); \ | 800 | buffer, buffer_size, &len, \ |
792 | if (buffer_size - length <= 0 || i >= num_envp) \ | 801 | fmt, val); \ |
793 | return -ENOMEM; \ | 802 | if (err) \ |
794 | length++; \ | 803 | return err; \ |
795 | buffer += length; \ | 804 | } while (0) |
796 | } while (0) | 805 | |
797 | static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) | 806 | static int serio_hotplug(struct device *dev, char **envp, int num_envp, char *buffer, int buffer_size) |
798 | { | 807 | { |
799 | struct serio *serio; | 808 | struct serio *serio; |
800 | int i = 0; | 809 | int i = 0; |
801 | int length = 0; | 810 | int len = 0; |
802 | 811 | ||
803 | if (!dev) | 812 | if (!dev) |
804 | return -ENODEV; | 813 | return -ENODEV; |
805 | 814 | ||
806 | serio = to_serio_port(dev); | 815 | serio = to_serio_port(dev); |
807 | 816 | ||
808 | PUT_ENVP("SERIO_TYPE=%02x", serio->id.type); | 817 | SERIO_ADD_HOTPLUG_VAR("SERIO_TYPE=%02x", serio->id.type); |
809 | PUT_ENVP("SERIO_PROTO=%02x", serio->id.proto); | 818 | SERIO_ADD_HOTPLUG_VAR("SERIO_PROTO=%02x", serio->id.proto); |
810 | PUT_ENVP("SERIO_ID=%02x", serio->id.id); | 819 | SERIO_ADD_HOTPLUG_VAR("SERIO_ID=%02x", serio->id.id); |
811 | PUT_ENVP("SERIO_EXTRA=%02x", serio->id.extra); | 820 | SERIO_ADD_HOTPLUG_VAR("SERIO_EXTRA=%02x", serio->id.extra); |
812 | 821 | SERIO_ADD_HOTPLUG_VAR("MODALIAS=serio:ty%02Xpr%02Xid%02Xex%02X", | |
822 | serio->id.type, serio->id.proto, serio->id.id, serio->id.extra); | ||
813 | envp[i] = NULL; | 823 | envp[i] = NULL; |
814 | 824 | ||
815 | return 0; | 825 | return 0; |
816 | } | 826 | } |
817 | #undef PUT_ENVP | 827 | #undef SERIO_ADD_HOTPLUG_VAR |
818 | 828 | ||
819 | #else | 829 | #else |
820 | 830 | ||
diff --git a/drivers/input/serio/serio_raw.c b/drivers/input/serio/serio_raw.c index d914e7e93db4..47e08de18d07 100644 --- a/drivers/input/serio/serio_raw.c +++ b/drivers/input/serio/serio_raw.c | |||
@@ -299,6 +299,7 @@ static int serio_raw_connect(struct serio *serio, struct serio_driver *drv) | |||
299 | 299 | ||
300 | serio_raw->dev.minor = PSMOUSE_MINOR; | 300 | serio_raw->dev.minor = PSMOUSE_MINOR; |
301 | serio_raw->dev.name = serio_raw->name; | 301 | serio_raw->dev.name = serio_raw->name; |
302 | serio_raw->dev.dev = &serio->dev; | ||
302 | serio_raw->dev.fops = &serio_raw_fops; | 303 | serio_raw->dev.fops = &serio_raw_fops; |
303 | 304 | ||
304 | err = misc_register(&serio_raw->dev); | 305 | err = misc_register(&serio_raw->dev); |
diff --git a/drivers/input/touchscreen/Kconfig b/drivers/input/touchscreen/Kconfig index 7e991274ea40..0489af5a80c9 100644 --- a/drivers/input/touchscreen/Kconfig +++ b/drivers/input/touchscreen/Kconfig | |||
@@ -58,7 +58,7 @@ config TOUCHSCREEN_ELO | |||
58 | If unsure, say N. | 58 | If unsure, say N. |
59 | 59 | ||
60 | To compile this driver as a module, choose M here: the | 60 | To compile this driver as a module, choose M here: the |
61 | module will be called gunze. | 61 | module will be called elo. |
62 | 62 | ||
63 | config TOUCHSCREEN_MTOUCH | 63 | config TOUCHSCREEN_MTOUCH |
64 | tristate "MicroTouch serial touchscreens" | 64 | tristate "MicroTouch serial touchscreens" |
diff --git a/drivers/md/dm-table.c b/drivers/md/dm-table.c index a5a4c0ed8a14..a6d3baa46f61 100644 --- a/drivers/md/dm-table.c +++ b/drivers/md/dm-table.c | |||
@@ -869,11 +869,17 @@ static void suspend_targets(struct dm_table *t, unsigned postsuspend) | |||
869 | 869 | ||
870 | void dm_table_presuspend_targets(struct dm_table *t) | 870 | void dm_table_presuspend_targets(struct dm_table *t) |
871 | { | 871 | { |
872 | if (!t) | ||
873 | return; | ||
874 | |||
872 | return suspend_targets(t, 0); | 875 | return suspend_targets(t, 0); |
873 | } | 876 | } |
874 | 877 | ||
875 | void dm_table_postsuspend_targets(struct dm_table *t) | 878 | void dm_table_postsuspend_targets(struct dm_table *t) |
876 | { | 879 | { |
880 | if (!t) | ||
881 | return; | ||
882 | |||
877 | return suspend_targets(t, 1); | 883 | return suspend_targets(t, 1); |
878 | } | 884 | } |
879 | 885 | ||
diff --git a/drivers/md/dm.c b/drivers/md/dm.c index 54fabbf06678..d487d9deb98e 100644 --- a/drivers/md/dm.c +++ b/drivers/md/dm.c | |||
@@ -55,10 +55,10 @@ union map_info *dm_get_mapinfo(struct bio *bio) | |||
55 | */ | 55 | */ |
56 | #define DMF_BLOCK_IO 0 | 56 | #define DMF_BLOCK_IO 0 |
57 | #define DMF_SUSPENDED 1 | 57 | #define DMF_SUSPENDED 1 |
58 | #define DMF_FS_LOCKED 2 | ||
59 | 58 | ||
60 | struct mapped_device { | 59 | struct mapped_device { |
61 | struct rw_semaphore lock; | 60 | struct rw_semaphore io_lock; |
61 | struct semaphore suspend_lock; | ||
62 | rwlock_t map_lock; | 62 | rwlock_t map_lock; |
63 | atomic_t holders; | 63 | atomic_t holders; |
64 | 64 | ||
@@ -248,16 +248,16 @@ static inline void free_tio(struct mapped_device *md, struct target_io *tio) | |||
248 | */ | 248 | */ |
249 | static int queue_io(struct mapped_device *md, struct bio *bio) | 249 | static int queue_io(struct mapped_device *md, struct bio *bio) |
250 | { | 250 | { |
251 | down_write(&md->lock); | 251 | down_write(&md->io_lock); |
252 | 252 | ||
253 | if (!test_bit(DMF_BLOCK_IO, &md->flags)) { | 253 | if (!test_bit(DMF_BLOCK_IO, &md->flags)) { |
254 | up_write(&md->lock); | 254 | up_write(&md->io_lock); |
255 | return 1; | 255 | return 1; |
256 | } | 256 | } |
257 | 257 | ||
258 | bio_list_add(&md->deferred, bio); | 258 | bio_list_add(&md->deferred, bio); |
259 | 259 | ||
260 | up_write(&md->lock); | 260 | up_write(&md->io_lock); |
261 | return 0; /* deferred successfully */ | 261 | return 0; /* deferred successfully */ |
262 | } | 262 | } |
263 | 263 | ||
@@ -568,14 +568,14 @@ static int dm_request(request_queue_t *q, struct bio *bio) | |||
568 | int r; | 568 | int r; |
569 | struct mapped_device *md = q->queuedata; | 569 | struct mapped_device *md = q->queuedata; |
570 | 570 | ||
571 | down_read(&md->lock); | 571 | down_read(&md->io_lock); |
572 | 572 | ||
573 | /* | 573 | /* |
574 | * If we're suspended we have to queue | 574 | * If we're suspended we have to queue |
575 | * this io for later. | 575 | * this io for later. |
576 | */ | 576 | */ |
577 | while (test_bit(DMF_BLOCK_IO, &md->flags)) { | 577 | while (test_bit(DMF_BLOCK_IO, &md->flags)) { |
578 | up_read(&md->lock); | 578 | up_read(&md->io_lock); |
579 | 579 | ||
580 | if (bio_rw(bio) == READA) { | 580 | if (bio_rw(bio) == READA) { |
581 | bio_io_error(bio, bio->bi_size); | 581 | bio_io_error(bio, bio->bi_size); |
@@ -594,11 +594,11 @@ static int dm_request(request_queue_t *q, struct bio *bio) | |||
594 | * We're in a while loop, because someone could suspend | 594 | * We're in a while loop, because someone could suspend |
595 | * before we get to the following read lock. | 595 | * before we get to the following read lock. |
596 | */ | 596 | */ |
597 | down_read(&md->lock); | 597 | down_read(&md->io_lock); |
598 | } | 598 | } |
599 | 599 | ||
600 | __split_bio(md, bio); | 600 | __split_bio(md, bio); |
601 | up_read(&md->lock); | 601 | up_read(&md->io_lock); |
602 | return 0; | 602 | return 0; |
603 | } | 603 | } |
604 | 604 | ||
@@ -610,7 +610,7 @@ static int dm_flush_all(request_queue_t *q, struct gendisk *disk, | |||
610 | int ret = -ENXIO; | 610 | int ret = -ENXIO; |
611 | 611 | ||
612 | if (map) { | 612 | if (map) { |
613 | ret = dm_table_flush_all(md->map); | 613 | ret = dm_table_flush_all(map); |
614 | dm_table_put(map); | 614 | dm_table_put(map); |
615 | } | 615 | } |
616 | 616 | ||
@@ -747,7 +747,8 @@ static struct mapped_device *alloc_dev(unsigned int minor, int persistent) | |||
747 | goto bad1; | 747 | goto bad1; |
748 | 748 | ||
749 | memset(md, 0, sizeof(*md)); | 749 | memset(md, 0, sizeof(*md)); |
750 | init_rwsem(&md->lock); | 750 | init_rwsem(&md->io_lock); |
751 | init_MUTEX(&md->suspend_lock); | ||
751 | rwlock_init(&md->map_lock); | 752 | rwlock_init(&md->map_lock); |
752 | atomic_set(&md->holders, 1); | 753 | atomic_set(&md->holders, 1); |
753 | atomic_set(&md->event_nr, 0); | 754 | atomic_set(&md->event_nr, 0); |
@@ -825,18 +826,13 @@ static void event_callback(void *context) | |||
825 | wake_up(&md->eventq); | 826 | wake_up(&md->eventq); |
826 | } | 827 | } |
827 | 828 | ||
828 | static void __set_size(struct gendisk *disk, sector_t size) | 829 | static void __set_size(struct mapped_device *md, sector_t size) |
829 | { | 830 | { |
830 | struct block_device *bdev; | 831 | set_capacity(md->disk, size); |
831 | 832 | ||
832 | set_capacity(disk, size); | 833 | down(&md->frozen_bdev->bd_inode->i_sem); |
833 | bdev = bdget_disk(disk, 0); | 834 | i_size_write(md->frozen_bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); |
834 | if (bdev) { | 835 | up(&md->frozen_bdev->bd_inode->i_sem); |
835 | down(&bdev->bd_inode->i_sem); | ||
836 | i_size_write(bdev->bd_inode, (loff_t)size << SECTOR_SHIFT); | ||
837 | up(&bdev->bd_inode->i_sem); | ||
838 | bdput(bdev); | ||
839 | } | ||
840 | } | 836 | } |
841 | 837 | ||
842 | static int __bind(struct mapped_device *md, struct dm_table *t) | 838 | static int __bind(struct mapped_device *md, struct dm_table *t) |
@@ -845,17 +841,18 @@ static int __bind(struct mapped_device *md, struct dm_table *t) | |||
845 | sector_t size; | 841 | sector_t size; |
846 | 842 | ||
847 | size = dm_table_get_size(t); | 843 | size = dm_table_get_size(t); |
848 | __set_size(md->disk, size); | 844 | __set_size(md, size); |
849 | if (size == 0) | 845 | if (size == 0) |
850 | return 0; | 846 | return 0; |
851 | 847 | ||
848 | dm_table_get(t); | ||
849 | dm_table_event_callback(t, event_callback, md); | ||
850 | |||
852 | write_lock(&md->map_lock); | 851 | write_lock(&md->map_lock); |
853 | md->map = t; | 852 | md->map = t; |
853 | dm_table_set_restrictions(t, q); | ||
854 | write_unlock(&md->map_lock); | 854 | write_unlock(&md->map_lock); |
855 | 855 | ||
856 | dm_table_get(t); | ||
857 | dm_table_event_callback(md->map, event_callback, md); | ||
858 | dm_table_set_restrictions(t, q); | ||
859 | return 0; | 856 | return 0; |
860 | } | 857 | } |
861 | 858 | ||
@@ -935,7 +932,7 @@ void dm_put(struct mapped_device *md) | |||
935 | struct dm_table *map = dm_get_table(md); | 932 | struct dm_table *map = dm_get_table(md); |
936 | 933 | ||
937 | if (atomic_dec_and_test(&md->holders)) { | 934 | if (atomic_dec_and_test(&md->holders)) { |
938 | if (!test_bit(DMF_SUSPENDED, &md->flags) && map) { | 935 | if (!dm_suspended(md)) { |
939 | dm_table_presuspend_targets(map); | 936 | dm_table_presuspend_targets(map); |
940 | dm_table_postsuspend_targets(map); | 937 | dm_table_postsuspend_targets(map); |
941 | } | 938 | } |
@@ -968,17 +965,17 @@ int dm_swap_table(struct mapped_device *md, struct dm_table *table) | |||
968 | { | 965 | { |
969 | int r = -EINVAL; | 966 | int r = -EINVAL; |
970 | 967 | ||
971 | down_write(&md->lock); | 968 | down(&md->suspend_lock); |
972 | 969 | ||
973 | /* device must be suspended */ | 970 | /* device must be suspended */ |
974 | if (!test_bit(DMF_SUSPENDED, &md->flags)) | 971 | if (!dm_suspended(md)) |
975 | goto out; | 972 | goto out; |
976 | 973 | ||
977 | __unbind(md); | 974 | __unbind(md); |
978 | r = __bind(md, table); | 975 | r = __bind(md, table); |
979 | 976 | ||
980 | out: | 977 | out: |
981 | up_write(&md->lock); | 978 | up(&md->suspend_lock); |
982 | return r; | 979 | return r; |
983 | } | 980 | } |
984 | 981 | ||
@@ -986,16 +983,13 @@ out: | |||
986 | * Functions to lock and unlock any filesystem running on the | 983 | * Functions to lock and unlock any filesystem running on the |
987 | * device. | 984 | * device. |
988 | */ | 985 | */ |
989 | static int __lock_fs(struct mapped_device *md) | 986 | static int lock_fs(struct mapped_device *md) |
990 | { | 987 | { |
991 | int error = -ENOMEM; | 988 | int r = -ENOMEM; |
992 | |||
993 | if (test_and_set_bit(DMF_FS_LOCKED, &md->flags)) | ||
994 | return 0; | ||
995 | 989 | ||
996 | md->frozen_bdev = bdget_disk(md->disk, 0); | 990 | md->frozen_bdev = bdget_disk(md->disk, 0); |
997 | if (!md->frozen_bdev) { | 991 | if (!md->frozen_bdev) { |
998 | DMWARN("bdget failed in __lock_fs"); | 992 | DMWARN("bdget failed in lock_fs"); |
999 | goto out; | 993 | goto out; |
1000 | } | 994 | } |
1001 | 995 | ||
@@ -1003,13 +997,13 @@ static int __lock_fs(struct mapped_device *md) | |||
1003 | 997 | ||
1004 | md->frozen_sb = freeze_bdev(md->frozen_bdev); | 998 | md->frozen_sb = freeze_bdev(md->frozen_bdev); |
1005 | if (IS_ERR(md->frozen_sb)) { | 999 | if (IS_ERR(md->frozen_sb)) { |
1006 | error = PTR_ERR(md->frozen_sb); | 1000 | r = PTR_ERR(md->frozen_sb); |
1007 | goto out_bdput; | 1001 | goto out_bdput; |
1008 | } | 1002 | } |
1009 | 1003 | ||
1010 | /* don't bdput right now, we don't want the bdev | 1004 | /* don't bdput right now, we don't want the bdev |
1011 | * to go away while it is locked. We'll bdput | 1005 | * to go away while it is locked. We'll bdput |
1012 | * in __unlock_fs | 1006 | * in unlock_fs |
1013 | */ | 1007 | */ |
1014 | return 0; | 1008 | return 0; |
1015 | 1009 | ||
@@ -1018,15 +1012,11 @@ out_bdput: | |||
1018 | md->frozen_sb = NULL; | 1012 | md->frozen_sb = NULL; |
1019 | md->frozen_bdev = NULL; | 1013 | md->frozen_bdev = NULL; |
1020 | out: | 1014 | out: |
1021 | clear_bit(DMF_FS_LOCKED, &md->flags); | 1015 | return r; |
1022 | return error; | ||
1023 | } | 1016 | } |
1024 | 1017 | ||
1025 | static void __unlock_fs(struct mapped_device *md) | 1018 | static void unlock_fs(struct mapped_device *md) |
1026 | { | 1019 | { |
1027 | if (!test_and_clear_bit(DMF_FS_LOCKED, &md->flags)) | ||
1028 | return; | ||
1029 | |||
1030 | thaw_bdev(md->frozen_bdev, md->frozen_sb); | 1020 | thaw_bdev(md->frozen_bdev, md->frozen_sb); |
1031 | bdput(md->frozen_bdev); | 1021 | bdput(md->frozen_bdev); |
1032 | 1022 | ||
@@ -1043,50 +1033,37 @@ static void __unlock_fs(struct mapped_device *md) | |||
1043 | */ | 1033 | */ |
1044 | int dm_suspend(struct mapped_device *md) | 1034 | int dm_suspend(struct mapped_device *md) |
1045 | { | 1035 | { |
1046 | struct dm_table *map; | 1036 | struct dm_table *map = NULL; |
1047 | DECLARE_WAITQUEUE(wait, current); | 1037 | DECLARE_WAITQUEUE(wait, current); |
1048 | int error = -EINVAL; | 1038 | int r = -EINVAL; |
1049 | 1039 | ||
1050 | /* Flush I/O to the device. */ | 1040 | down(&md->suspend_lock); |
1051 | down_read(&md->lock); | 1041 | |
1052 | if (test_bit(DMF_BLOCK_IO, &md->flags)) | 1042 | if (dm_suspended(md)) |
1053 | goto out_read_unlock; | 1043 | goto out; |
1054 | 1044 | ||
1055 | map = dm_get_table(md); | 1045 | map = dm_get_table(md); |
1056 | if (map) | ||
1057 | /* This does not get reverted if there's an error later. */ | ||
1058 | dm_table_presuspend_targets(map); | ||
1059 | 1046 | ||
1060 | error = __lock_fs(md); | 1047 | /* This does not get reverted if there's an error later. */ |
1061 | if (error) { | 1048 | dm_table_presuspend_targets(map); |
1062 | dm_table_put(map); | ||
1063 | goto out_read_unlock; | ||
1064 | } | ||
1065 | 1049 | ||
1066 | up_read(&md->lock); | 1050 | /* Flush I/O to the device. */ |
1051 | r = lock_fs(md); | ||
1052 | if (r) | ||
1053 | goto out; | ||
1067 | 1054 | ||
1068 | /* | 1055 | /* |
1069 | * First we set the BLOCK_IO flag so no more ios will be mapped. | 1056 | * First we set the BLOCK_IO flag so no more ios will be mapped. |
1070 | * | ||
1071 | * If the flag is already set we know another thread is trying to | ||
1072 | * suspend as well, so we leave the fs locked for this thread. | ||
1073 | */ | 1057 | */ |
1074 | error = -EINVAL; | 1058 | down_write(&md->io_lock); |
1075 | down_write(&md->lock); | 1059 | set_bit(DMF_BLOCK_IO, &md->flags); |
1076 | if (test_and_set_bit(DMF_BLOCK_IO, &md->flags)) { | ||
1077 | if (map) | ||
1078 | dm_table_put(map); | ||
1079 | goto out_write_unlock; | ||
1080 | } | ||
1081 | 1060 | ||
1082 | add_wait_queue(&md->wait, &wait); | 1061 | add_wait_queue(&md->wait, &wait); |
1083 | up_write(&md->lock); | 1062 | up_write(&md->io_lock); |
1084 | 1063 | ||
1085 | /* unplug */ | 1064 | /* unplug */ |
1086 | if (map) { | 1065 | if (map) |
1087 | dm_table_unplug_all(map); | 1066 | dm_table_unplug_all(map); |
1088 | dm_table_put(map); | ||
1089 | } | ||
1090 | 1067 | ||
1091 | /* | 1068 | /* |
1092 | * Then we wait for the already mapped ios to | 1069 | * Then we wait for the already mapped ios to |
@@ -1102,62 +1079,67 @@ int dm_suspend(struct mapped_device *md) | |||
1102 | } | 1079 | } |
1103 | set_current_state(TASK_RUNNING); | 1080 | set_current_state(TASK_RUNNING); |
1104 | 1081 | ||
1105 | down_write(&md->lock); | 1082 | down_write(&md->io_lock); |
1106 | remove_wait_queue(&md->wait, &wait); | 1083 | remove_wait_queue(&md->wait, &wait); |
1107 | 1084 | ||
1108 | /* were we interrupted ? */ | 1085 | /* were we interrupted ? */ |
1109 | error = -EINTR; | 1086 | r = -EINTR; |
1110 | if (atomic_read(&md->pending)) | 1087 | if (atomic_read(&md->pending)) { |
1111 | goto out_unfreeze; | 1088 | up_write(&md->io_lock); |
1112 | 1089 | unlock_fs(md); | |
1113 | set_bit(DMF_SUSPENDED, &md->flags); | 1090 | clear_bit(DMF_BLOCK_IO, &md->flags); |
1091 | goto out; | ||
1092 | } | ||
1093 | up_write(&md->io_lock); | ||
1114 | 1094 | ||
1115 | map = dm_get_table(md); | 1095 | dm_table_postsuspend_targets(map); |
1116 | if (map) | ||
1117 | dm_table_postsuspend_targets(map); | ||
1118 | dm_table_put(map); | ||
1119 | up_write(&md->lock); | ||
1120 | 1096 | ||
1121 | return 0; | 1097 | set_bit(DMF_SUSPENDED, &md->flags); |
1122 | 1098 | ||
1123 | out_unfreeze: | 1099 | r = 0; |
1124 | __unlock_fs(md); | ||
1125 | clear_bit(DMF_BLOCK_IO, &md->flags); | ||
1126 | out_write_unlock: | ||
1127 | up_write(&md->lock); | ||
1128 | return error; | ||
1129 | 1100 | ||
1130 | out_read_unlock: | 1101 | out: |
1131 | up_read(&md->lock); | 1102 | dm_table_put(map); |
1132 | return error; | 1103 | up(&md->suspend_lock); |
1104 | return r; | ||
1133 | } | 1105 | } |
1134 | 1106 | ||
1135 | int dm_resume(struct mapped_device *md) | 1107 | int dm_resume(struct mapped_device *md) |
1136 | { | 1108 | { |
1109 | int r = -EINVAL; | ||
1137 | struct bio *def; | 1110 | struct bio *def; |
1138 | struct dm_table *map = dm_get_table(md); | 1111 | struct dm_table *map = NULL; |
1139 | 1112 | ||
1140 | down_write(&md->lock); | 1113 | down(&md->suspend_lock); |
1141 | if (!map || | 1114 | if (!dm_suspended(md)) |
1142 | !test_bit(DMF_SUSPENDED, &md->flags) || | 1115 | goto out; |
1143 | !dm_table_get_size(map)) { | 1116 | |
1144 | up_write(&md->lock); | 1117 | map = dm_get_table(md); |
1145 | dm_table_put(map); | 1118 | if (!map || !dm_table_get_size(map)) |
1146 | return -EINVAL; | 1119 | goto out; |
1147 | } | ||
1148 | 1120 | ||
1149 | dm_table_resume_targets(map); | 1121 | dm_table_resume_targets(map); |
1150 | clear_bit(DMF_SUSPENDED, &md->flags); | 1122 | |
1123 | down_write(&md->io_lock); | ||
1151 | clear_bit(DMF_BLOCK_IO, &md->flags); | 1124 | clear_bit(DMF_BLOCK_IO, &md->flags); |
1152 | 1125 | ||
1153 | def = bio_list_get(&md->deferred); | 1126 | def = bio_list_get(&md->deferred); |
1154 | __flush_deferred_io(md, def); | 1127 | __flush_deferred_io(md, def); |
1155 | up_write(&md->lock); | 1128 | up_write(&md->io_lock); |
1156 | __unlock_fs(md); | 1129 | |
1130 | unlock_fs(md); | ||
1131 | |||
1132 | clear_bit(DMF_SUSPENDED, &md->flags); | ||
1133 | |||
1157 | dm_table_unplug_all(map); | 1134 | dm_table_unplug_all(map); |
1135 | |||
1136 | r = 0; | ||
1137 | |||
1138 | out: | ||
1158 | dm_table_put(map); | 1139 | dm_table_put(map); |
1140 | up(&md->suspend_lock); | ||
1159 | 1141 | ||
1160 | return 0; | 1142 | return r; |
1161 | } | 1143 | } |
1162 | 1144 | ||
1163 | /*----------------------------------------------------------------- | 1145 | /*----------------------------------------------------------------- |
diff --git a/drivers/md/raid5.c b/drivers/md/raid5.c index 4698d5f79575..43f231a467d5 100644 --- a/drivers/md/raid5.c +++ b/drivers/md/raid5.c | |||
@@ -1653,6 +1653,7 @@ static int run (mddev_t *mddev) | |||
1653 | 1653 | ||
1654 | /* device size must be a multiple of chunk size */ | 1654 | /* device size must be a multiple of chunk size */ |
1655 | mddev->size &= ~(mddev->chunk_size/1024 -1); | 1655 | mddev->size &= ~(mddev->chunk_size/1024 -1); |
1656 | mddev->resync_max_sectors = mddev->size << 1; | ||
1656 | 1657 | ||
1657 | if (!conf->chunk_size || conf->chunk_size % 4) { | 1658 | if (!conf->chunk_size || conf->chunk_size % 4) { |
1658 | printk(KERN_ERR "raid5: invalid chunk size %d for %s\n", | 1659 | printk(KERN_ERR "raid5: invalid chunk size %d for %s\n", |
diff --git a/drivers/md/raid6main.c b/drivers/md/raid6main.c index f5ee16805111..495dee1d1e83 100644 --- a/drivers/md/raid6main.c +++ b/drivers/md/raid6main.c | |||
@@ -1813,6 +1813,7 @@ static int run (mddev_t *mddev) | |||
1813 | 1813 | ||
1814 | /* device size must be a multiple of chunk size */ | 1814 | /* device size must be a multiple of chunk size */ |
1815 | mddev->size &= ~(mddev->chunk_size/1024 -1); | 1815 | mddev->size &= ~(mddev->chunk_size/1024 -1); |
1816 | mddev->resync_max_sectors = mddev->size << 1; | ||
1816 | 1817 | ||
1817 | if (conf->raid_disks < 4) { | 1818 | if (conf->raid_disks < 4) { |
1818 | printk(KERN_ERR "raid6: not enough configured devices for %s (%d, minimum 4)\n", | 1819 | printk(KERN_ERR "raid6: not enough configured devices for %s (%d, minimum 4)\n", |
diff --git a/drivers/media/video/bttv-driver.c b/drivers/media/video/bttv-driver.c index 51a0f6d68e73..67f331eeeb19 100644 --- a/drivers/media/video/bttv-driver.c +++ b/drivers/media/video/bttv-driver.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttv-driver.c,v 1.42 2005/07/05 17:37:35 nsh Exp $ | 2 | $Id: bttv-driver.c,v 1.45 2005/07/20 19:43:24 mkrufky Exp $ |
3 | 3 | ||
4 | bttv - Bt848 frame grabber driver | 4 | bttv - Bt848 frame grabber driver |
5 | 5 | ||
@@ -3869,11 +3869,6 @@ static int __devinit bttv_probe(struct pci_dev *dev, | |||
3869 | pci_set_master(dev); | 3869 | pci_set_master(dev); |
3870 | pci_set_command(dev); | 3870 | pci_set_command(dev); |
3871 | pci_set_drvdata(dev,btv); | 3871 | pci_set_drvdata(dev,btv); |
3872 | if (!pci_dma_supported(dev,0xffffffff)) { | ||
3873 | printk("bttv%d: Oops: no 32bit PCI DMA ???\n", btv->c.nr); | ||
3874 | result = -EIO; | ||
3875 | goto fail1; | ||
3876 | } | ||
3877 | 3872 | ||
3878 | pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision); | 3873 | pci_read_config_byte(dev, PCI_CLASS_REVISION, &btv->revision); |
3879 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); | 3874 | pci_read_config_byte(dev, PCI_LATENCY_TIMER, &lat); |
diff --git a/drivers/media/video/bttv.h b/drivers/media/video/bttv.h index 191eaf1714ba..f2af9e1454f0 100644 --- a/drivers/media/video/bttv.h +++ b/drivers/media/video/bttv.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: bttv.h,v 1.18 2005/05/24 23:41:42 nsh Exp $ | 2 | * $Id: bttv.h,v 1.22 2005/07/28 18:41:21 mchehab Exp $ |
3 | * | 3 | * |
4 | * bttv - Bt848 frame grabber driver | 4 | * bttv - Bt848 frame grabber driver |
5 | * | 5 | * |
@@ -135,7 +135,9 @@ | |||
135 | #define BTTV_DVICO_DVBT_LITE 0x80 | 135 | #define BTTV_DVICO_DVBT_LITE 0x80 |
136 | #define BTTV_TIBET_CS16 0x83 | 136 | #define BTTV_TIBET_CS16 0x83 |
137 | #define BTTV_KODICOM_4400R 0x84 | 137 | #define BTTV_KODICOM_4400R 0x84 |
138 | #define BTTV_ADLINK_RTV24 0x85 | 138 | #define BTTV_ADLINK_RTV24 0x86 |
139 | #define BTTV_DVICO_FUSIONHDTV_5_LITE 0x87 | ||
140 | #define BTTV_ACORP_Y878F 0x88 | ||
139 | 141 | ||
140 | /* i2c address list */ | 142 | /* i2c address list */ |
141 | #define I2C_TSA5522 0xc2 | 143 | #define I2C_TSA5522 0xc2 |
diff --git a/drivers/media/video/bttvp.h b/drivers/media/video/bttvp.h index f3293e4a15ad..aab094bc243d 100644 --- a/drivers/media/video/bttvp.h +++ b/drivers/media/video/bttvp.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | $Id: bttvp.h,v 1.19 2005/06/16 21:38:45 nsh Exp $ | 2 | $Id: bttvp.h,v 1.21 2005/07/15 21:44:14 mchehab Exp $ |
3 | 3 | ||
4 | bttv - Bt848 frame grabber driver | 4 | bttv - Bt848 frame grabber driver |
5 | 5 | ||
@@ -27,7 +27,7 @@ | |||
27 | #define _BTTVP_H_ | 27 | #define _BTTVP_H_ |
28 | 28 | ||
29 | #include <linux/version.h> | 29 | #include <linux/version.h> |
30 | #define BTTV_VERSION_CODE KERNEL_VERSION(0,9,15) | 30 | #define BTTV_VERSION_CODE KERNEL_VERSION(0,9,16) |
31 | 31 | ||
32 | #include <linux/types.h> | 32 | #include <linux/types.h> |
33 | #include <linux/wait.h> | 33 | #include <linux/wait.h> |
diff --git a/drivers/media/video/cx88/cx88-cards.c b/drivers/media/video/cx88/cx88-cards.c index 3d0c784b376f..ebf02a7f81e8 100644 --- a/drivers/media/video/cx88/cx88-cards.c +++ b/drivers/media/video/cx88/cx88-cards.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-cards.c,v 1.86 2005/07/14 03:06:43 mchehab Exp $ | 2 | * $Id: cx88-cards.c,v 1.90 2005/07/28 02:47:42 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * card-specific stuff. | 5 | * card-specific stuff. |
@@ -90,6 +90,9 @@ struct cx88_board cx88_boards[] = { | |||
90 | .input = {{ | 90 | .input = {{ |
91 | .type = CX88_VMUX_TELEVISION, | 91 | .type = CX88_VMUX_TELEVISION, |
92 | .vmux = 0, | 92 | .vmux = 0, |
93 | },{ | ||
94 | .type = CX88_VMUX_SVIDEO, | ||
95 | .vmux = 2, | ||
93 | }}, | 96 | }}, |
94 | }, | 97 | }, |
95 | [CX88_BOARD_PIXELVIEW] = { | 98 | [CX88_BOARD_PIXELVIEW] = { |
@@ -496,6 +499,9 @@ struct cx88_board cx88_boards[] = { | |||
496 | .input = {{ | 499 | .input = {{ |
497 | .type = CX88_VMUX_DVB, | 500 | .type = CX88_VMUX_DVB, |
498 | .vmux = 0, | 501 | .vmux = 0, |
502 | },{ | ||
503 | .type = CX88_VMUX_SVIDEO, | ||
504 | .vmux = 2, | ||
499 | }}, | 505 | }}, |
500 | .dvb = 1, | 506 | .dvb = 1, |
501 | }, | 507 | }, |
@@ -753,6 +759,27 @@ struct cx88_board cx88_boards[] = { | |||
753 | }}, | 759 | }}, |
754 | .dvb = 1, | 760 | .dvb = 1, |
755 | }, | 761 | }, |
762 | [CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD] = { | ||
763 | .name = "DViCO FusionHDTV 5 Gold", | ||
764 | .tuner_type = TUNER_LG_TDVS_H062F, | ||
765 | .radio_type = UNSET, | ||
766 | .tuner_addr = ADDR_UNSET, | ||
767 | .radio_addr = ADDR_UNSET, | ||
768 | /* See DViCO FusionHDTV 3 Gold-Q for GPIO documentation. */ | ||
769 | .input = {{ | ||
770 | .type = CX88_VMUX_TELEVISION, | ||
771 | .vmux = 0, | ||
772 | .gpio0 = 0x0f0d, | ||
773 | },{ | ||
774 | .type = CX88_VMUX_COMPOSITE1, | ||
775 | .vmux = 1, | ||
776 | .gpio0 = 0x0f00, | ||
777 | },{ | ||
778 | .type = CX88_VMUX_SVIDEO, | ||
779 | .vmux = 2, | ||
780 | .gpio0 = 0x0f00, | ||
781 | }}, | ||
782 | }, | ||
756 | }; | 783 | }; |
757 | const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); | 784 | const unsigned int cx88_bcount = ARRAY_SIZE(cx88_boards); |
758 | 785 | ||
@@ -880,6 +907,10 @@ struct cx88_subid cx88_subids[] = { | |||
880 | .subvendor = 0x153b, | 907 | .subvendor = 0x153b, |
881 | .subdevice = 0x1166, | 908 | .subdevice = 0x1166, |
882 | .card = CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1, | 909 | .card = CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1, |
910 | },{ | ||
911 | .subvendor = 0x18ac, | ||
912 | .subdevice = 0xd500, | ||
913 | .card = CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD, | ||
883 | }, | 914 | }, |
884 | }; | 915 | }; |
885 | const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); | 916 | const unsigned int cx88_idcount = ARRAY_SIZE(cx88_subids); |
diff --git a/drivers/media/video/cx88/cx88-video.c b/drivers/media/video/cx88/cx88-video.c index 5588a3aeecb4..5f58c103198a 100644 --- a/drivers/media/video/cx88/cx88-video.c +++ b/drivers/media/video/cx88/cx88-video.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88-video.c,v 1.80 2005/07/13 08:49:08 mchehab Exp $ | 2 | * $Id: cx88-video.c,v 1.82 2005/07/22 05:13:34 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for Conexant 2388x based TV cards | 4 | * device driver for Conexant 2388x based TV cards |
5 | * video4linux video interface | 5 | * video4linux video interface |
@@ -758,10 +758,10 @@ static int video_open(struct inode *inode, struct file *file) | |||
758 | struct cx88_core *core = dev->core; | 758 | struct cx88_core *core = dev->core; |
759 | int board = core->board; | 759 | int board = core->board; |
760 | dprintk(1,"video_open: setting radio device\n"); | 760 | dprintk(1,"video_open: setting radio device\n"); |
761 | cx_write(MO_GP3_IO, cx88_boards[board].radio.gpio3); | ||
761 | cx_write(MO_GP0_IO, cx88_boards[board].radio.gpio0); | 762 | cx_write(MO_GP0_IO, cx88_boards[board].radio.gpio0); |
762 | cx_write(MO_GP1_IO, cx88_boards[board].radio.gpio1); | 763 | cx_write(MO_GP1_IO, cx88_boards[board].radio.gpio1); |
763 | cx_write(MO_GP2_IO, cx88_boards[board].radio.gpio2); | 764 | cx_write(MO_GP2_IO, cx88_boards[board].radio.gpio2); |
764 | cx_write(MO_GP3_IO, cx88_boards[board].radio.gpio3); | ||
765 | dev->core->tvaudio = WW_FM; | 765 | dev->core->tvaudio = WW_FM; |
766 | cx88_set_tvaudio(core); | 766 | cx88_set_tvaudio(core); |
767 | cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); | 767 | cx88_set_stereo(core,V4L2_TUNER_MODE_STEREO,1); |
diff --git a/drivers/media/video/cx88/cx88.h b/drivers/media/video/cx88/cx88.h index b008f7db6dfd..da65dc92787c 100644 --- a/drivers/media/video/cx88/cx88.h +++ b/drivers/media/video/cx88/cx88.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: cx88.h,v 1.69 2005/07/13 17:25:25 mchehab Exp $ | 2 | * $Id: cx88.h,v 1.70 2005/07/24 17:44:09 mkrufky Exp $ |
3 | * | 3 | * |
4 | * v4l2 device driver for cx2388x based TV cards | 4 | * v4l2 device driver for cx2388x based TV cards |
5 | * | 5 | * |
@@ -171,6 +171,7 @@ extern struct sram_channel cx88_sram_channels[]; | |||
171 | #define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T 28 | 171 | #define CX88_BOARD_DVICO_FUSIONHDTV_3_GOLD_T 28 |
172 | #define CX88_BOARD_ADSTECH_DVB_T_PCI 29 | 172 | #define CX88_BOARD_ADSTECH_DVB_T_PCI 29 |
173 | #define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1 30 | 173 | #define CX88_BOARD_TERRATEC_CINERGY_1400_DVB_T1 30 |
174 | #define CX88_BOARD_DVICO_FUSIONHDTV_5_GOLD 31 | ||
174 | 175 | ||
175 | enum cx88_itype { | 176 | enum cx88_itype { |
176 | CX88_VMUX_COMPOSITE1 = 1, | 177 | CX88_VMUX_COMPOSITE1 = 1, |
diff --git a/drivers/media/video/msp3400.c b/drivers/media/video/msp3400.c index 6239254db27e..62f1b8ddb98b 100644 --- a/drivers/media/video/msp3400.c +++ b/drivers/media/video/msp3400.c | |||
@@ -741,11 +741,9 @@ static int msp34xx_sleep(struct msp3400c *msp, int timeout) | |||
741 | schedule_timeout(msecs_to_jiffies(timeout)); | 741 | schedule_timeout(msecs_to_jiffies(timeout)); |
742 | } | 742 | } |
743 | } | 743 | } |
744 | if (current->flags & PF_FREEZE) { | ||
745 | refrigerator (); | ||
746 | } | ||
747 | 744 | ||
748 | remove_wait_queue(&msp->wq, &wait); | 745 | remove_wait_queue(&msp->wq, &wait); |
746 | try_to_freeze(); | ||
749 | return msp->restart; | 747 | return msp->restart; |
750 | } | 748 | } |
751 | 749 | ||
diff --git a/drivers/media/video/saa7134/saa7134-i2c.c b/drivers/media/video/saa7134/saa7134-i2c.c index 93dd61978541..1203b93a572c 100644 --- a/drivers/media/video/saa7134/saa7134-i2c.c +++ b/drivers/media/video/saa7134/saa7134-i2c.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134-i2c.c,v 1.19 2005/07/07 01:49:30 mkrufky Exp $ | 2 | * $Id: saa7134-i2c.c,v 1.22 2005/07/22 04:09:41 mkrufky Exp $ |
3 | * | 3 | * |
4 | * device driver for philips saa7134 based TV cards | 4 | * device driver for philips saa7134 based TV cards |
5 | * i2c interface support | 5 | * i2c interface support |
@@ -300,6 +300,8 @@ static int saa7134_i2c_xfer(struct i2c_adapter *i2c_adap, | |||
300 | status = i2c_get_status(dev); | 300 | status = i2c_get_status(dev); |
301 | if (i2c_is_error(status)) | 301 | if (i2c_is_error(status)) |
302 | goto err; | 302 | goto err; |
303 | /* ensure that the bus is idle for at least one bit slot */ | ||
304 | msleep(1); | ||
303 | 305 | ||
304 | d1printk("\n"); | 306 | d1printk("\n"); |
305 | return num; | 307 | return num; |
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h index 6836c07794fc..2af0cb2a731b 100644 --- a/drivers/media/video/saa7134/saa7134.h +++ b/drivers/media/video/saa7134/saa7134.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: saa7134.h,v 1.48 2005/07/01 08:22:24 nsh Exp $ | 2 | * $Id: saa7134.h,v 1.49 2005/07/13 17:25:25 mchehab Exp $ |
3 | * | 3 | * |
4 | * v4l2 device driver for philips saa7134 based TV cards | 4 | * v4l2 device driver for philips saa7134 based TV cards |
5 | * | 5 | * |
@@ -21,7 +21,7 @@ | |||
21 | */ | 21 | */ |
22 | 22 | ||
23 | #include <linux/version.h> | 23 | #include <linux/version.h> |
24 | #define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,13) | 24 | #define SAA7134_VERSION_CODE KERNEL_VERSION(0,2,14) |
25 | 25 | ||
26 | #include <linux/pci.h> | 26 | #include <linux/pci.h> |
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
diff --git a/drivers/media/video/tea5767.c b/drivers/media/video/tea5767.c index 4d27ac1b7fb8..cebcc1fa68d1 100644 --- a/drivers/media/video/tea5767.c +++ b/drivers/media/video/tea5767.c | |||
@@ -2,7 +2,7 @@ | |||
2 | * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview | 2 | * For Philips TEA5767 FM Chip used on some TV Cards like Prolink Pixelview |
3 | * I2C address is allways 0xC0. | 3 | * I2C address is allways 0xC0. |
4 | * | 4 | * |
5 | * $Id: tea5767.c,v 1.21 2005/07/14 03:06:43 mchehab Exp $ | 5 | * $Id: tea5767.c,v 1.27 2005/07/31 12:10:56 mchehab Exp $ |
6 | * | 6 | * |
7 | * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) | 7 | * Copyright (c) 2005 Mauro Carvalho Chehab (mchehab@brturbo.com.br) |
8 | * This code is placed under the terms of the GNU General Public License | 8 | * This code is placed under the terms of the GNU General Public License |
@@ -15,7 +15,6 @@ | |||
15 | #include <linux/videodev.h> | 15 | #include <linux/videodev.h> |
16 | #include <linux/delay.h> | 16 | #include <linux/delay.h> |
17 | #include <media/tuner.h> | 17 | #include <media/tuner.h> |
18 | #include <media/tuner.h> | ||
19 | 18 | ||
20 | #define PREFIX "TEA5767 " | 19 | #define PREFIX "TEA5767 " |
21 | 20 | ||
@@ -293,16 +292,16 @@ static int tea5767_stereo(struct i2c_client *c) | |||
293 | 292 | ||
294 | int tea5767_autodetection(struct i2c_client *c) | 293 | int tea5767_autodetection(struct i2c_client *c) |
295 | { | 294 | { |
296 | unsigned char buffer[5] = { 0xff, 0xff, 0xff, 0xff, 0xff }; | 295 | unsigned char buffer[7] = { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff }; |
297 | int rc; | 296 | int rc; |
298 | struct tuner *t = i2c_get_clientdata(c); | 297 | struct tuner *t = i2c_get_clientdata(c); |
299 | 298 | ||
300 | if (5 != (rc = i2c_master_recv(c, buffer, 5))) { | 299 | if (7 != (rc = i2c_master_recv(c, buffer, 7))) { |
301 | tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc); | 300 | tuner_warn("It is not a TEA5767. Received %i bytes.\n", rc); |
302 | return EINVAL; | 301 | return EINVAL; |
303 | } | 302 | } |
304 | 303 | ||
305 | /* If all bytes are the same then it's a TV tuner and not a tea5767 chip. */ | 304 | /* If all bytes are the same then it's a TV tuner and not a tea5767 */ |
306 | if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && | 305 | if (buffer[0] == buffer[1] && buffer[0] == buffer[2] && |
307 | buffer[0] == buffer[3] && buffer[0] == buffer[4]) { | 306 | buffer[0] == buffer[3] && buffer[0] == buffer[4]) { |
308 | tuner_warn("All bytes are equal. It is not a TEA5767\n"); | 307 | tuner_warn("All bytes are equal. It is not a TEA5767\n"); |
@@ -318,6 +317,17 @@ int tea5767_autodetection(struct i2c_client *c) | |||
318 | tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); | 317 | tuner_warn("Chip ID is not zero. It is not a TEA5767\n"); |
319 | return EINVAL; | 318 | return EINVAL; |
320 | } | 319 | } |
320 | /* It seems that tea5767 returns 0xff after the 5th byte */ | ||
321 | if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) { | ||
322 | tuner_warn("Returned more than 5 bytes. It is not a TEA5767\n"); | ||
323 | return EINVAL; | ||
324 | } | ||
325 | |||
326 | /* It seems that tea5767 returns 0xff after the 5th byte */ | ||
327 | if ((buffer[5] != 0xff) || (buffer[6] != 0xff)) { | ||
328 | tuner_warn("Returned more than 5 bytes. It is not a TEA5767\n"); | ||
329 | return EINVAL; | ||
330 | } | ||
321 | 331 | ||
322 | tuner_warn("TEA5767 detected.\n"); | 332 | tuner_warn("TEA5767 detected.\n"); |
323 | return 0; | 333 | return 0; |
@@ -327,10 +337,8 @@ int tea5767_tuner_init(struct i2c_client *c) | |||
327 | { | 337 | { |
328 | struct tuner *t = i2c_get_clientdata(c); | 338 | struct tuner *t = i2c_get_clientdata(c); |
329 | 339 | ||
330 | if (tea5767_autodetection(c) == EINVAL) | 340 | tuner_info("type set to %d (%s)\n", t->type, |
331 | return EINVAL; | 341 | "Philips TEA5767HN FM Radio"); |
332 | |||
333 | tuner_info("type set to %d (%s)\n", t->type, "Philips TEA5767HN FM Radio"); | ||
334 | strlcpy(c->name, "tea5767", sizeof(c->name)); | 342 | strlcpy(c->name, "tea5767", sizeof(c->name)); |
335 | 343 | ||
336 | t->tv_freq = set_tv_freq; | 344 | t->tv_freq = set_tv_freq; |
diff --git a/drivers/media/video/tuner-core.c b/drivers/media/video/tuner-core.c index b25a9c08ac02..f0a579827a24 100644 --- a/drivers/media/video/tuner-core.c +++ b/drivers/media/video/tuner-core.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tuner-core.c,v 1.58 2005/07/14 03:06:43 mchehab Exp $ | 2 | * $Id: tuner-core.c,v 1.63 2005/07/28 18:19:55 mchehab Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * core core, i.e. kernel interfaces, registering and so on | 5 | * core core, i.e. kernel interfaces, registering and so on |
@@ -23,6 +23,8 @@ | |||
23 | #include <media/tuner.h> | 23 | #include <media/tuner.h> |
24 | #include <media/audiochip.h> | 24 | #include <media/audiochip.h> |
25 | 25 | ||
26 | #include "msp3400.h" | ||
27 | |||
26 | #define UNSET (-1U) | 28 | #define UNSET (-1U) |
27 | 29 | ||
28 | /* standard i2c insmod options */ | 30 | /* standard i2c insmod options */ |
@@ -42,6 +44,9 @@ module_param(addr, int, 0444); | |||
42 | static unsigned int no_autodetect = 0; | 44 | static unsigned int no_autodetect = 0; |
43 | module_param(no_autodetect, int, 0444); | 45 | module_param(no_autodetect, int, 0444); |
44 | 46 | ||
47 | static unsigned int show_i2c = 0; | ||
48 | module_param(show_i2c, int, 0444); | ||
49 | |||
45 | /* insmod options used at runtime => read/write */ | 50 | /* insmod options used at runtime => read/write */ |
46 | unsigned int tuner_debug = 0; | 51 | unsigned int tuner_debug = 0; |
47 | module_param(tuner_debug, int, 0644); | 52 | module_param(tuner_debug, int, 0644); |
@@ -320,6 +325,17 @@ static int tuner_attach(struct i2c_adapter *adap, int addr, int kind) | |||
320 | 325 | ||
321 | tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); | 326 | tuner_info("chip found @ 0x%x (%s)\n", addr << 1, adap->name); |
322 | 327 | ||
328 | if (show_i2c) { | ||
329 | unsigned char buffer[16]; | ||
330 | int i,rc; | ||
331 | |||
332 | memset(buffer, 0, sizeof(buffer)); | ||
333 | rc = i2c_master_recv(&t->i2c, buffer, sizeof(buffer)); | ||
334 | printk("tuner-%04x I2C RECV = ",addr); | ||
335 | for (i=0;i<rc;i++) | ||
336 | printk("%02x ",buffer[i]); | ||
337 | printk("\n"); | ||
338 | } | ||
323 | /* TEA5767 autodetection code - only for addr = 0xc0 */ | 339 | /* TEA5767 autodetection code - only for addr = 0xc0 */ |
324 | if (!no_autodetect) { | 340 | if (!no_autodetect) { |
325 | if (addr == 0x60) { | 341 | if (addr == 0x60) { |
@@ -451,6 +467,17 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) | |||
451 | break; | 467 | break; |
452 | } | 468 | } |
453 | break; | 469 | break; |
470 | case VIDIOCSAUDIO: | ||
471 | if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) | ||
472 | return 0; | ||
473 | if (check_v4l2(t) == EINVAL) | ||
474 | return 0; | ||
475 | |||
476 | /* Should be implemented, since bttv calls it */ | ||
477 | tuner_dbg("VIDIOCSAUDIO not implemented.\n"); | ||
478 | |||
479 | break; | ||
480 | case MSP_SET_MATRIX: | ||
454 | case TDA9887_SET_CONFIG: | 481 | case TDA9887_SET_CONFIG: |
455 | break; | 482 | break; |
456 | /* --- v4l ioctls --- */ | 483 | /* --- v4l ioctls --- */ |
diff --git a/drivers/media/video/tuner-simple.c b/drivers/media/video/tuner-simple.c index a3f8e83f5314..de0c93aeb75d 100644 --- a/drivers/media/video/tuner-simple.c +++ b/drivers/media/video/tuner-simple.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * $Id: tuner-simple.c,v 1.39 2005/07/07 01:49:30 mkrufky Exp $ | 2 | * $Id: tuner-simple.c,v 1.43 2005/07/28 18:41:21 mchehab Exp $ |
3 | * | 3 | * |
4 | * i2c tv tuner chip device driver | 4 | * i2c tv tuner chip device driver |
5 | * controls all those simple 4-control-bytes style tuners. | 5 | * controls all those simple 4-control-bytes style tuners. |
@@ -245,6 +245,12 @@ static struct tunertype tuners[] = { | |||
245 | /* see tea5767.c for details */}, | 245 | /* see tea5767.c for details */}, |
246 | { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL, | 246 | { "Philips FMD1216ME MK3 Hybrid Tuner", Philips, PAL, |
247 | 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 }, | 247 | 16*160.00,16*442.00,0x51,0x52,0x54,0x86,623 }, |
248 | |||
249 | { "LG TDVS-H062F/TUA6034", LGINNOTEK, NTSC, | ||
250 | 16*160.00,16*455.00,0x01,0x02,0x04,0x8e,732}, | ||
251 | |||
252 | { "Ymec TVF66T5-B/DFF", Philips, PAL, | ||
253 | 16*160.25,16*464.25,0x01,0x02,0x08,0x8e,623}, | ||
248 | }; | 254 | }; |
249 | 255 | ||
250 | unsigned const int tuner_count = ARRAY_SIZE(tuners); | 256 | unsigned const int tuner_count = ARRAY_SIZE(tuners); |
diff --git a/drivers/media/video/tveeprom.c b/drivers/media/video/tveeprom.c index 62b03ef091e0..127ec38ebd60 100644 --- a/drivers/media/video/tveeprom.c +++ b/drivers/media/video/tveeprom.c | |||
@@ -189,7 +189,7 @@ hauppauge_tuner[] = | |||
189 | { TUNER_ABSENT, "Philips FQ1236 MK3"}, | 189 | { TUNER_ABSENT, "Philips FQ1236 MK3"}, |
190 | { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, | 190 | { TUNER_ABSENT, "Samsung TCPN 2121P30A"}, |
191 | { TUNER_ABSENT, "Samsung TCPE 4121P30A"}, | 191 | { TUNER_ABSENT, "Samsung TCPE 4121P30A"}, |
192 | { TUNER_ABSENT, "TCL MFPE05 2"}, | 192 | { TUNER_PHILIPS_FM1216ME_MK3, "TCL MFPE05 2"}, |
193 | /* 90-99 */ | 193 | /* 90-99 */ |
194 | { TUNER_ABSENT, "LG TALN H202T"}, | 194 | { TUNER_ABSENT, "LG TALN H202T"}, |
195 | { TUNER_PHILIPS_FQ1216AME_MK4, "Philips FQ1216AME MK4"}, | 195 | { TUNER_PHILIPS_FQ1216AME_MK4, "Philips FQ1216AME MK4"}, |
diff --git a/drivers/net/cs89x0.c b/drivers/net/cs89x0.c index 2c6dc24c3728..b780307093eb 100644 --- a/drivers/net/cs89x0.c +++ b/drivers/net/cs89x0.c | |||
@@ -417,6 +417,7 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
417 | struct net_local *lp = netdev_priv(dev); | 417 | struct net_local *lp = netdev_priv(dev); |
418 | static unsigned version_printed; | 418 | static unsigned version_printed; |
419 | int i; | 419 | int i; |
420 | int tmp; | ||
420 | unsigned rev_type = 0; | 421 | unsigned rev_type = 0; |
421 | int eeprom_buff[CHKSUM_LEN]; | 422 | int eeprom_buff[CHKSUM_LEN]; |
422 | int retval; | 423 | int retval; |
@@ -492,14 +493,17 @@ cs89x0_probe1(struct net_device *dev, int ioaddr, int modular) | |||
492 | goto out2; | 493 | goto out2; |
493 | } | 494 | } |
494 | } | 495 | } |
495 | printk("PP_addr=0x%x\n", inw(ioaddr + ADD_PORT)); | 496 | printk(KERN_DEBUG "PP_addr at %x: 0x%x\n", |
497 | ioaddr + ADD_PORT, inw(ioaddr + ADD_PORT)); | ||
496 | 498 | ||
497 | ioaddr &= ~3; | 499 | ioaddr &= ~3; |
498 | outw(PP_ChipID, ioaddr + ADD_PORT); | 500 | outw(PP_ChipID, ioaddr + ADD_PORT); |
499 | 501 | ||
500 | if (inw(ioaddr + DATA_PORT) != CHIP_EISA_ID_SIG) { | 502 | tmp = inw(ioaddr + DATA_PORT); |
501 | printk(KERN_ERR "%s: incorrect signature 0x%x\n", | 503 | if (tmp != CHIP_EISA_ID_SIG) { |
502 | dev->name, inw(ioaddr + DATA_PORT)); | 504 | printk(KERN_DEBUG "%s: incorrect signature at %x: 0x%x!=" |
505 | CHIP_EISA_ID_SIG_STR "\n", | ||
506 | dev->name, ioaddr + DATA_PORT, tmp); | ||
503 | retval = -ENODEV; | 507 | retval = -ENODEV; |
504 | goto out2; | 508 | goto out2; |
505 | } | 509 | } |
diff --git a/drivers/net/cs89x0.h b/drivers/net/cs89x0.h index bd3ad8e6cce9..decea264f121 100644 --- a/drivers/net/cs89x0.h +++ b/drivers/net/cs89x0.h | |||
@@ -93,6 +93,7 @@ | |||
93 | #endif | 93 | #endif |
94 | 94 | ||
95 | #define CHIP_EISA_ID_SIG 0x630E /* Product ID Code for Crystal Chip (CS8900 spec 4.3) */ | 95 | #define CHIP_EISA_ID_SIG 0x630E /* Product ID Code for Crystal Chip (CS8900 spec 4.3) */ |
96 | #define CHIP_EISA_ID_SIG_STR "0x630E" | ||
96 | 97 | ||
97 | #ifdef IBMEIPKT | 98 | #ifdef IBMEIPKT |
98 | #define EISA_ID_SIG 0x4D24 /* IBM */ | 99 | #define EISA_ID_SIG 0x4D24 /* IBM */ |
diff --git a/drivers/net/hamradio/Kconfig b/drivers/net/hamradio/Kconfig index 7cdebe1a0b61..0cd54306e636 100644 --- a/drivers/net/hamradio/Kconfig +++ b/drivers/net/hamradio/Kconfig | |||
@@ -17,7 +17,7 @@ config MKISS | |||
17 | 17 | ||
18 | config 6PACK | 18 | config 6PACK |
19 | tristate "Serial port 6PACK driver" | 19 | tristate "Serial port 6PACK driver" |
20 | depends on AX25 && BROKEN_ON_SMP | 20 | depends on AX25 |
21 | ---help--- | 21 | ---help--- |
22 | 6pack is a transmission protocol for the data exchange between your | 22 | 6pack is a transmission protocol for the data exchange between your |
23 | PC and your TNC (the Terminal Node Controller acts as a kind of | 23 | PC and your TNC (the Terminal Node Controller acts as a kind of |
diff --git a/drivers/net/sk98lin/skge.c b/drivers/net/sk98lin/skge.c index 82570ec44d8e..6ee4771addf1 100644 --- a/drivers/net/sk98lin/skge.c +++ b/drivers/net/sk98lin/skge.c | |||
@@ -5133,6 +5133,84 @@ static void __devexit skge_remove_one(struct pci_dev *pdev) | |||
5133 | kfree(pAC); | 5133 | kfree(pAC); |
5134 | } | 5134 | } |
5135 | 5135 | ||
5136 | #ifdef CONFIG_PM | ||
5137 | static int skge_suspend(struct pci_dev *pdev, pm_message_t state) | ||
5138 | { | ||
5139 | struct net_device *dev = pci_get_drvdata(pdev); | ||
5140 | DEV_NET *pNet = netdev_priv(dev); | ||
5141 | SK_AC *pAC = pNet->pAC; | ||
5142 | struct net_device *otherdev = pAC->dev[1]; | ||
5143 | |||
5144 | if (netif_running(dev)) { | ||
5145 | netif_carrier_off(dev); | ||
5146 | DoPrintInterfaceChange = SK_FALSE; | ||
5147 | SkDrvDeInitAdapter(pAC, 0); /* performs SkGeClose */ | ||
5148 | netif_device_detach(dev); | ||
5149 | } | ||
5150 | if (otherdev != dev) { | ||
5151 | if (netif_running(otherdev)) { | ||
5152 | netif_carrier_off(otherdev); | ||
5153 | DoPrintInterfaceChange = SK_FALSE; | ||
5154 | SkDrvDeInitAdapter(pAC, 1); /* performs SkGeClose */ | ||
5155 | netif_device_detach(otherdev); | ||
5156 | } | ||
5157 | } | ||
5158 | |||
5159 | pci_save_state(pdev); | ||
5160 | pci_enable_wake(pdev, pci_choose_state(pdev, state), 0); | ||
5161 | if (pAC->AllocFlag & SK_ALLOC_IRQ) { | ||
5162 | free_irq(dev->irq, dev); | ||
5163 | } | ||
5164 | pci_disable_device(pdev); | ||
5165 | pci_set_power_state(pdev, pci_choose_state(pdev, state)); | ||
5166 | |||
5167 | return 0; | ||
5168 | } | ||
5169 | |||
5170 | static int skge_resume(struct pci_dev *pdev) | ||
5171 | { | ||
5172 | struct net_device *dev = pci_get_drvdata(pdev); | ||
5173 | DEV_NET *pNet = netdev_priv(dev); | ||
5174 | SK_AC *pAC = pNet->pAC; | ||
5175 | struct net_device *otherdev = pAC->dev[1]; | ||
5176 | int ret; | ||
5177 | |||
5178 | pci_set_power_state(pdev, PCI_D0); | ||
5179 | pci_restore_state(pdev); | ||
5180 | pci_enable_device(pdev); | ||
5181 | pci_set_master(pdev); | ||
5182 | if (pAC->GIni.GIMacsFound == 2) | ||
5183 | ret = request_irq(dev->irq, SkGeIsr, SA_SHIRQ, pAC->Name, dev); | ||
5184 | else | ||
5185 | ret = request_irq(dev->irq, SkGeIsrOnePort, SA_SHIRQ, pAC->Name, dev); | ||
5186 | if (ret) { | ||
5187 | printk(KERN_WARNING "sk98lin: unable to acquire IRQ %d\n", dev->irq); | ||
5188 | pAC->AllocFlag &= ~SK_ALLOC_IRQ; | ||
5189 | dev->irq = 0; | ||
5190 | pci_disable_device(pdev); | ||
5191 | return -EBUSY; | ||
5192 | } | ||
5193 | |||
5194 | netif_device_attach(dev); | ||
5195 | if (netif_running(dev)) { | ||
5196 | DoPrintInterfaceChange = SK_FALSE; | ||
5197 | SkDrvInitAdapter(pAC, 0); /* first device */ | ||
5198 | } | ||
5199 | if (otherdev != dev) { | ||
5200 | netif_device_attach(otherdev); | ||
5201 | if (netif_running(otherdev)) { | ||
5202 | DoPrintInterfaceChange = SK_FALSE; | ||
5203 | SkDrvInitAdapter(pAC, 1); /* second device */ | ||
5204 | } | ||
5205 | } | ||
5206 | |||
5207 | return 0; | ||
5208 | } | ||
5209 | #else | ||
5210 | #define skge_suspend NULL | ||
5211 | #define skge_resume NULL | ||
5212 | #endif | ||
5213 | |||
5136 | static struct pci_device_id skge_pci_tbl[] = { | 5214 | static struct pci_device_id skge_pci_tbl[] = { |
5137 | { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 5215 | { PCI_VENDOR_ID_3COM, 0x1700, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
5138 | { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, | 5216 | { PCI_VENDOR_ID_3COM, 0x80eb, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, |
@@ -5158,6 +5236,8 @@ static struct pci_driver skge_driver = { | |||
5158 | .id_table = skge_pci_tbl, | 5236 | .id_table = skge_pci_tbl, |
5159 | .probe = skge_probe_one, | 5237 | .probe = skge_probe_one, |
5160 | .remove = __devexit_p(skge_remove_one), | 5238 | .remove = __devexit_p(skge_remove_one), |
5239 | .suspend = skge_suspend, | ||
5240 | .resume = skge_resume, | ||
5161 | }; | 5241 | }; |
5162 | 5242 | ||
5163 | static int __init skge_init(void) | 5243 | static int __init skge_init(void) |
diff --git a/drivers/net/sk98lin/skgeinit.c b/drivers/net/sk98lin/skgeinit.c index df4483429a77..6cb49dd02251 100644 --- a/drivers/net/sk98lin/skgeinit.c +++ b/drivers/net/sk98lin/skgeinit.c | |||
@@ -2016,7 +2016,7 @@ SK_IOC IoC) /* IO context */ | |||
2016 | * we set the PHY to coma mode and switch to D3 power state. | 2016 | * we set the PHY to coma mode and switch to D3 power state. |
2017 | */ | 2017 | */ |
2018 | if (pAC->GIni.GIYukonLite && | 2018 | if (pAC->GIni.GIYukonLite && |
2019 | pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { | 2019 | pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) { |
2020 | 2020 | ||
2021 | /* for all ports switch PHY to coma mode */ | 2021 | /* for all ports switch PHY to coma mode */ |
2022 | for (i = 0; i < pAC->GIni.GIMacsFound; i++) { | 2022 | for (i = 0; i < pAC->GIni.GIMacsFound; i++) { |
diff --git a/drivers/net/sk98lin/skxmac2.c b/drivers/net/sk98lin/skxmac2.c index 94a09deecb32..42d2d963150a 100644 --- a/drivers/net/sk98lin/skxmac2.c +++ b/drivers/net/sk98lin/skxmac2.c | |||
@@ -1065,7 +1065,7 @@ int Port) /* Port Index (MAC_1 + n) */ | |||
1065 | 1065 | ||
1066 | /* WA code for COMA mode */ | 1066 | /* WA code for COMA mode */ |
1067 | if (pAC->GIni.GIYukonLite && | 1067 | if (pAC->GIni.GIYukonLite && |
1068 | pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { | 1068 | pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) { |
1069 | 1069 | ||
1070 | SK_IN32(IoC, B2_GP_IO, &DWord); | 1070 | SK_IN32(IoC, B2_GP_IO, &DWord); |
1071 | 1071 | ||
@@ -1110,7 +1110,7 @@ int Port) /* Port Index (MAC_1 + n) */ | |||
1110 | 1110 | ||
1111 | /* WA code for COMA mode */ | 1111 | /* WA code for COMA mode */ |
1112 | if (pAC->GIni.GIYukonLite && | 1112 | if (pAC->GIni.GIYukonLite && |
1113 | pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { | 1113 | pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) { |
1114 | 1114 | ||
1115 | SK_IN32(IoC, B2_GP_IO, &DWord); | 1115 | SK_IN32(IoC, B2_GP_IO, &DWord); |
1116 | 1116 | ||
@@ -2126,7 +2126,7 @@ SK_U8 Mode) /* low power mode */ | |||
2126 | int Ret = 0; | 2126 | int Ret = 0; |
2127 | 2127 | ||
2128 | if (pAC->GIni.GIYukonLite && | 2128 | if (pAC->GIni.GIYukonLite && |
2129 | pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { | 2129 | pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) { |
2130 | 2130 | ||
2131 | /* save current power mode */ | 2131 | /* save current power mode */ |
2132 | LastMode = pAC->GIni.GP[Port].PPhyPowerState; | 2132 | LastMode = pAC->GIni.GP[Port].PPhyPowerState; |
@@ -2253,7 +2253,7 @@ int Port) /* Port Index (e.g. MAC_1) */ | |||
2253 | int Ret = 0; | 2253 | int Ret = 0; |
2254 | 2254 | ||
2255 | if (pAC->GIni.GIYukonLite && | 2255 | if (pAC->GIni.GIYukonLite && |
2256 | pAC->GIni.GIChipRev == CHIP_REV_YU_LITE_A3) { | 2256 | pAC->GIni.GIChipRev >= CHIP_REV_YU_LITE_A3) { |
2257 | 2257 | ||
2258 | /* save current power mode */ | 2258 | /* save current power mode */ |
2259 | LastMode = pAC->GIni.GP[Port].PPhyPowerState; | 2259 | LastMode = pAC->GIni.GP[Port].PPhyPowerState; |
diff --git a/drivers/net/skge.c b/drivers/net/skge.c index 5cacc7ad9e79..f15739481d62 100644 --- a/drivers/net/skge.c +++ b/drivers/net/skge.c | |||
@@ -42,7 +42,7 @@ | |||
42 | #include "skge.h" | 42 | #include "skge.h" |
43 | 43 | ||
44 | #define DRV_NAME "skge" | 44 | #define DRV_NAME "skge" |
45 | #define DRV_VERSION "0.7" | 45 | #define DRV_VERSION "0.8" |
46 | #define PFX DRV_NAME " " | 46 | #define PFX DRV_NAME " " |
47 | 47 | ||
48 | #define DEFAULT_TX_RING_SIZE 128 | 48 | #define DEFAULT_TX_RING_SIZE 128 |
@@ -55,7 +55,7 @@ | |||
55 | #define ETH_JUMBO_MTU 9000 | 55 | #define ETH_JUMBO_MTU 9000 |
56 | #define TX_WATCHDOG (5 * HZ) | 56 | #define TX_WATCHDOG (5 * HZ) |
57 | #define NAPI_WEIGHT 64 | 57 | #define NAPI_WEIGHT 64 |
58 | #define BLINK_HZ (HZ/4) | 58 | #define BLINK_MS 250 |
59 | 59 | ||
60 | MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver"); | 60 | MODULE_DESCRIPTION("SysKonnect Gigabit Ethernet driver"); |
61 | MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); | 61 | MODULE_AUTHOR("Stephen Hemminger <shemminger@osdl.org>"); |
@@ -75,7 +75,6 @@ static const struct pci_device_id skge_id_table[] = { | |||
75 | { PCI_DEVICE(PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C940B) }, | 75 | { PCI_DEVICE(PCI_VENDOR_ID_3COM, PCI_DEVICE_ID_3COM_3C940B) }, |
76 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE) }, | 76 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_GE) }, |
77 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU) }, | 77 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, PCI_DEVICE_ID_SYSKONNECT_YU) }, |
78 | { PCI_DEVICE(PCI_VENDOR_ID_SYSKONNECT, 0x9E00) }, /* SK-9Exx */ | ||
79 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T), }, | 78 | { PCI_DEVICE(PCI_VENDOR_ID_DLINK, PCI_DEVICE_ID_DLINK_DGE510T), }, |
80 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4320) }, | 79 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x4320) }, |
81 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5005) }, /* Belkin */ | 80 | { PCI_DEVICE(PCI_VENDOR_ID_MARVELL, 0x5005) }, /* Belkin */ |
@@ -249,7 +248,7 @@ static int skge_set_settings(struct net_device *dev, struct ethtool_cmd *ecmd) | |||
249 | } else { | 248 | } else { |
250 | u32 setting; | 249 | u32 setting; |
251 | 250 | ||
252 | switch(ecmd->speed) { | 251 | switch (ecmd->speed) { |
253 | case SPEED_1000: | 252 | case SPEED_1000: |
254 | if (ecmd->duplex == DUPLEX_FULL) | 253 | if (ecmd->duplex == DUPLEX_FULL) |
255 | setting = SUPPORTED_1000baseT_Full; | 254 | setting = SUPPORTED_1000baseT_Full; |
@@ -620,84 +619,98 @@ static int skge_set_coalesce(struct net_device *dev, | |||
620 | return 0; | 619 | return 0; |
621 | } | 620 | } |
622 | 621 | ||
623 | static void skge_led_on(struct skge_hw *hw, int port) | 622 | enum led_mode { LED_MODE_OFF, LED_MODE_ON, LED_MODE_TST }; |
623 | static void skge_led(struct skge_port *skge, enum led_mode mode) | ||
624 | { | 624 | { |
625 | struct skge_hw *hw = skge->hw; | ||
626 | int port = skge->port; | ||
627 | |||
628 | spin_lock_bh(&hw->phy_lock); | ||
625 | if (hw->chip_id == CHIP_ID_GENESIS) { | 629 | if (hw->chip_id == CHIP_ID_GENESIS) { |
626 | skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_ON); | 630 | switch (mode) { |
627 | skge_write8(hw, B0_LED, LED_STAT_ON); | 631 | case LED_MODE_OFF: |
632 | xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_OFF); | ||
633 | skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF); | ||
634 | skge_write32(hw, SK_REG(port, RX_LED_VAL), 0); | ||
635 | skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_T_OFF); | ||
636 | break; | ||
628 | 637 | ||
629 | skge_write8(hw, SK_REG(port, RX_LED_TST), LED_T_ON); | 638 | case LED_MODE_ON: |
630 | skge_write32(hw, SK_REG(port, RX_LED_VAL), 100); | 639 | skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_ON); |
631 | skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START); | 640 | skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_LINKSYNC_ON); |
632 | 641 | ||
633 | /* For Broadcom Phy only */ | 642 | skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START); |
634 | xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_ON); | 643 | skge_write8(hw, SK_REG(port, TX_LED_CTRL), LED_START); |
635 | } else { | ||
636 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0); | ||
637 | gm_phy_write(hw, port, PHY_MARV_LED_OVER, | ||
638 | PHY_M_LED_MO_DUP(MO_LED_ON) | | ||
639 | PHY_M_LED_MO_10(MO_LED_ON) | | ||
640 | PHY_M_LED_MO_100(MO_LED_ON) | | ||
641 | PHY_M_LED_MO_1000(MO_LED_ON) | | ||
642 | PHY_M_LED_MO_RX(MO_LED_ON)); | ||
643 | } | ||
644 | } | ||
645 | 644 | ||
646 | static void skge_led_off(struct skge_hw *hw, int port) | 645 | break; |
647 | { | ||
648 | if (hw->chip_id == CHIP_ID_GENESIS) { | ||
649 | skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_OFF); | ||
650 | skge_write8(hw, B0_LED, LED_STAT_OFF); | ||
651 | 646 | ||
652 | skge_write32(hw, SK_REG(port, RX_LED_VAL), 0); | 647 | case LED_MODE_TST: |
653 | skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_T_OFF); | 648 | skge_write8(hw, SK_REG(port, RX_LED_TST), LED_T_ON); |
649 | skge_write32(hw, SK_REG(port, RX_LED_VAL), 100); | ||
650 | skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START); | ||
654 | 651 | ||
655 | /* Broadcom only */ | 652 | xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_ON); |
656 | xm_phy_write(hw, port, PHY_BCOM_P_EXT_CTRL, PHY_B_PEC_LED_OFF); | 653 | break; |
654 | } | ||
657 | } else { | 655 | } else { |
658 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0); | 656 | switch (mode) { |
659 | gm_phy_write(hw, port, PHY_MARV_LED_OVER, | 657 | case LED_MODE_OFF: |
660 | PHY_M_LED_MO_DUP(MO_LED_OFF) | | 658 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0); |
661 | PHY_M_LED_MO_10(MO_LED_OFF) | | 659 | gm_phy_write(hw, port, PHY_MARV_LED_OVER, |
662 | PHY_M_LED_MO_100(MO_LED_OFF) | | 660 | PHY_M_LED_MO_DUP(MO_LED_OFF) | |
663 | PHY_M_LED_MO_1000(MO_LED_OFF) | | 661 | PHY_M_LED_MO_10(MO_LED_OFF) | |
664 | PHY_M_LED_MO_RX(MO_LED_OFF)); | 662 | PHY_M_LED_MO_100(MO_LED_OFF) | |
663 | PHY_M_LED_MO_1000(MO_LED_OFF) | | ||
664 | PHY_M_LED_MO_RX(MO_LED_OFF)); | ||
665 | break; | ||
666 | case LED_MODE_ON: | ||
667 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, | ||
668 | PHY_M_LED_PULS_DUR(PULS_170MS) | | ||
669 | PHY_M_LED_BLINK_RT(BLINK_84MS) | | ||
670 | PHY_M_LEDC_TX_CTRL | | ||
671 | PHY_M_LEDC_DP_CTRL); | ||
672 | |||
673 | gm_phy_write(hw, port, PHY_MARV_LED_OVER, | ||
674 | PHY_M_LED_MO_RX(MO_LED_OFF) | | ||
675 | (skge->speed == SPEED_100 ? | ||
676 | PHY_M_LED_MO_100(MO_LED_ON) : 0)); | ||
677 | break; | ||
678 | case LED_MODE_TST: | ||
679 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, 0); | ||
680 | gm_phy_write(hw, port, PHY_MARV_LED_OVER, | ||
681 | PHY_M_LED_MO_DUP(MO_LED_ON) | | ||
682 | PHY_M_LED_MO_10(MO_LED_ON) | | ||
683 | PHY_M_LED_MO_100(MO_LED_ON) | | ||
684 | PHY_M_LED_MO_1000(MO_LED_ON) | | ||
685 | PHY_M_LED_MO_RX(MO_LED_ON)); | ||
686 | } | ||
665 | } | 687 | } |
666 | } | 688 | spin_unlock_bh(&hw->phy_lock); |
667 | |||
668 | static void skge_blink_timer(unsigned long data) | ||
669 | { | ||
670 | struct skge_port *skge = (struct skge_port *) data; | ||
671 | struct skge_hw *hw = skge->hw; | ||
672 | unsigned long flags; | ||
673 | |||
674 | spin_lock_irqsave(&hw->phy_lock, flags); | ||
675 | if (skge->blink_on) | ||
676 | skge_led_on(hw, skge->port); | ||
677 | else | ||
678 | skge_led_off(hw, skge->port); | ||
679 | spin_unlock_irqrestore(&hw->phy_lock, flags); | ||
680 | |||
681 | skge->blink_on = !skge->blink_on; | ||
682 | mod_timer(&skge->led_blink, jiffies + BLINK_HZ); | ||
683 | } | 689 | } |
684 | 690 | ||
685 | /* blink LED's for finding board */ | 691 | /* blink LED's for finding board */ |
686 | static int skge_phys_id(struct net_device *dev, u32 data) | 692 | static int skge_phys_id(struct net_device *dev, u32 data) |
687 | { | 693 | { |
688 | struct skge_port *skge = netdev_priv(dev); | 694 | struct skge_port *skge = netdev_priv(dev); |
695 | unsigned long ms; | ||
696 | enum led_mode mode = LED_MODE_TST; | ||
689 | 697 | ||
690 | if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) | 698 | if (!data || data > (u32)(MAX_SCHEDULE_TIMEOUT / HZ)) |
691 | data = (u32)(MAX_SCHEDULE_TIMEOUT / HZ); | 699 | ms = jiffies_to_msecs(MAX_SCHEDULE_TIMEOUT / HZ) * 1000; |
700 | else | ||
701 | ms = data * 1000; | ||
692 | 702 | ||
693 | /* start blinking */ | 703 | while (ms > 0) { |
694 | skge->blink_on = 1; | 704 | skge_led(skge, mode); |
695 | mod_timer(&skge->led_blink, jiffies+1); | 705 | mode ^= LED_MODE_TST; |
696 | 706 | ||
697 | msleep_interruptible(data * 1000); | 707 | if (msleep_interruptible(BLINK_MS)) |
698 | del_timer_sync(&skge->led_blink); | 708 | break; |
709 | ms -= BLINK_MS; | ||
710 | } | ||
699 | 711 | ||
700 | skge_led_off(skge->hw, skge->port); | 712 | /* back to regular LED state */ |
713 | skge_led(skge, netif_running(dev) ? LED_MODE_ON : LED_MODE_OFF); | ||
701 | 714 | ||
702 | return 0; | 715 | return 0; |
703 | } | 716 | } |
@@ -1028,7 +1041,7 @@ static void bcom_check_link(struct skge_hw *hw, int port) | |||
1028 | } | 1041 | } |
1029 | 1042 | ||
1030 | /* Check Duplex mismatch */ | 1043 | /* Check Duplex mismatch */ |
1031 | switch(aux & PHY_B_AS_AN_RES_MSK) { | 1044 | switch (aux & PHY_B_AS_AN_RES_MSK) { |
1032 | case PHY_B_RES_1000FD: | 1045 | case PHY_B_RES_1000FD: |
1033 | skge->duplex = DUPLEX_FULL; | 1046 | skge->duplex = DUPLEX_FULL; |
1034 | break; | 1047 | break; |
@@ -1099,7 +1112,7 @@ static void bcom_phy_init(struct skge_port *skge, int jumbo) | |||
1099 | r |= XM_MMU_NO_PRE; | 1112 | r |= XM_MMU_NO_PRE; |
1100 | xm_write16(hw, port, XM_MMU_CMD,r); | 1113 | xm_write16(hw, port, XM_MMU_CMD,r); |
1101 | 1114 | ||
1102 | switch(id1) { | 1115 | switch (id1) { |
1103 | case PHY_BCOM_ID1_C0: | 1116 | case PHY_BCOM_ID1_C0: |
1104 | /* | 1117 | /* |
1105 | * Workaround BCOM Errata for the C0 type. | 1118 | * Workaround BCOM Errata for the C0 type. |
@@ -1194,13 +1207,6 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1194 | xm_write16(hw, port, XM_STAT_CMD, | 1207 | xm_write16(hw, port, XM_STAT_CMD, |
1195 | XM_SC_CLR_RXC | XM_SC_CLR_TXC); | 1208 | XM_SC_CLR_RXC | XM_SC_CLR_TXC); |
1196 | 1209 | ||
1197 | /* initialize Rx, Tx and Link LED */ | ||
1198 | skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_ON); | ||
1199 | skge_write8(hw, SK_REG(port, LNK_LED_REG), LINKLED_LINKSYNC_ON); | ||
1200 | |||
1201 | skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_START); | ||
1202 | skge_write8(hw, SK_REG(port, TX_LED_CTRL), LED_START); | ||
1203 | |||
1204 | /* Unreset the XMAC. */ | 1210 | /* Unreset the XMAC. */ |
1205 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST); | 1211 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), MFF_CLR_MAC_RST); |
1206 | 1212 | ||
@@ -1209,7 +1215,6 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1209 | * namely for the 1000baseTX cards that use the XMAC's | 1215 | * namely for the 1000baseTX cards that use the XMAC's |
1210 | * GMII mode. | 1216 | * GMII mode. |
1211 | */ | 1217 | */ |
1212 | spin_lock_bh(&hw->phy_lock); | ||
1213 | /* Take external Phy out of reset */ | 1218 | /* Take external Phy out of reset */ |
1214 | r = skge_read32(hw, B2_GP_IO); | 1219 | r = skge_read32(hw, B2_GP_IO); |
1215 | if (port == 0) | 1220 | if (port == 0) |
@@ -1219,7 +1224,6 @@ static void genesis_mac_init(struct skge_hw *hw, int port) | |||
1219 | 1224 | ||
1220 | skge_write32(hw, B2_GP_IO, r); | 1225 | skge_write32(hw, B2_GP_IO, r); |
1221 | skge_read32(hw, B2_GP_IO); | 1226 | skge_read32(hw, B2_GP_IO); |
1222 | spin_unlock_bh(&hw->phy_lock); | ||
1223 | 1227 | ||
1224 | /* Enable GMII interfac */ | 1228 | /* Enable GMII interfac */ |
1225 | xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD); | 1229 | xm_write16(hw, port, XM_HW_CFG, XM_HW_GMII_MD); |
@@ -1569,7 +1573,6 @@ static void yukon_init(struct skge_hw *hw, int port) | |||
1569 | { | 1573 | { |
1570 | struct skge_port *skge = netdev_priv(hw->dev[port]); | 1574 | struct skge_port *skge = netdev_priv(hw->dev[port]); |
1571 | u16 ctrl, ct1000, adv; | 1575 | u16 ctrl, ct1000, adv; |
1572 | u16 ledctrl, ledover; | ||
1573 | 1576 | ||
1574 | pr_debug("yukon_init\n"); | 1577 | pr_debug("yukon_init\n"); |
1575 | if (skge->autoneg == AUTONEG_ENABLE) { | 1578 | if (skge->autoneg == AUTONEG_ENABLE) { |
@@ -1641,32 +1644,11 @@ static void yukon_init(struct skge_hw *hw, int port) | |||
1641 | gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, adv); | 1644 | gm_phy_write(hw, port, PHY_MARV_AUNE_ADV, adv); |
1642 | gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); | 1645 | gm_phy_write(hw, port, PHY_MARV_CTRL, ctrl); |
1643 | 1646 | ||
1644 | /* Setup Phy LED's */ | ||
1645 | ledctrl = PHY_M_LED_PULS_DUR(PULS_170MS); | ||
1646 | ledover = 0; | ||
1647 | |||
1648 | ledctrl |= PHY_M_LED_BLINK_RT(BLINK_84MS) | PHY_M_LEDC_TX_CTRL; | ||
1649 | |||
1650 | /* turn off the Rx LED (LED_RX) */ | ||
1651 | ledover |= PHY_M_LED_MO_RX(MO_LED_OFF); | ||
1652 | |||
1653 | /* disable blink mode (LED_DUPLEX) on collisions */ | ||
1654 | ctrl |= PHY_M_LEDC_DP_CTRL; | ||
1655 | gm_phy_write(hw, port, PHY_MARV_LED_CTRL, ledctrl); | ||
1656 | |||
1657 | if (skge->autoneg == AUTONEG_DISABLE || skge->speed == SPEED_100) { | ||
1658 | /* turn on 100 Mbps LED (LED_LINK100) */ | ||
1659 | ledover |= PHY_M_LED_MO_100(MO_LED_ON); | ||
1660 | } | ||
1661 | |||
1662 | if (ledover) | ||
1663 | gm_phy_write(hw, port, PHY_MARV_LED_OVER, ledover); | ||
1664 | |||
1665 | /* Enable phy interrupt on autonegotiation complete (or link up) */ | 1647 | /* Enable phy interrupt on autonegotiation complete (or link up) */ |
1666 | if (skge->autoneg == AUTONEG_ENABLE) | 1648 | if (skge->autoneg == AUTONEG_ENABLE) |
1667 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_AN_COMPL); | 1649 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_AN_MSK); |
1668 | else | 1650 | else |
1669 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); | 1651 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_DEF_MSK); |
1670 | } | 1652 | } |
1671 | 1653 | ||
1672 | static void yukon_reset(struct skge_hw *hw, int port) | 1654 | static void yukon_reset(struct skge_hw *hw, int port) |
@@ -1691,7 +1673,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
1691 | 1673 | ||
1692 | /* WA code for COMA mode -- set PHY reset */ | 1674 | /* WA code for COMA mode -- set PHY reset */ |
1693 | if (hw->chip_id == CHIP_ID_YUKON_LITE && | 1675 | if (hw->chip_id == CHIP_ID_YUKON_LITE && |
1694 | hw->chip_rev == CHIP_REV_YU_LITE_A3) | 1676 | hw->chip_rev >= CHIP_REV_YU_LITE_A3) |
1695 | skge_write32(hw, B2_GP_IO, | 1677 | skge_write32(hw, B2_GP_IO, |
1696 | (skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9)); | 1678 | (skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9)); |
1697 | 1679 | ||
@@ -1701,7 +1683,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
1701 | 1683 | ||
1702 | /* WA code for COMA mode -- clear PHY reset */ | 1684 | /* WA code for COMA mode -- clear PHY reset */ |
1703 | if (hw->chip_id == CHIP_ID_YUKON_LITE && | 1685 | if (hw->chip_id == CHIP_ID_YUKON_LITE && |
1704 | hw->chip_rev == CHIP_REV_YU_LITE_A3) | 1686 | hw->chip_rev >= CHIP_REV_YU_LITE_A3) |
1705 | skge_write32(hw, B2_GP_IO, | 1687 | skge_write32(hw, B2_GP_IO, |
1706 | (skge_read32(hw, B2_GP_IO) | GP_DIR_9) | 1688 | (skge_read32(hw, B2_GP_IO) | GP_DIR_9) |
1707 | & ~GP_IO_9); | 1689 | & ~GP_IO_9); |
@@ -1745,9 +1727,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
1745 | gma_write16(hw, port, GM_GP_CTRL, reg); | 1727 | gma_write16(hw, port, GM_GP_CTRL, reg); |
1746 | skge_read16(hw, GMAC_IRQ_SRC); | 1728 | skge_read16(hw, GMAC_IRQ_SRC); |
1747 | 1729 | ||
1748 | spin_lock_bh(&hw->phy_lock); | ||
1749 | yukon_init(hw, port); | 1730 | yukon_init(hw, port); |
1750 | spin_unlock_bh(&hw->phy_lock); | ||
1751 | 1731 | ||
1752 | /* MIB clear */ | 1732 | /* MIB clear */ |
1753 | reg = gma_read16(hw, port, GM_PHY_ADDR); | 1733 | reg = gma_read16(hw, port, GM_PHY_ADDR); |
@@ -1796,7 +1776,7 @@ static void yukon_mac_init(struct skge_hw *hw, int port) | |||
1796 | skge_write16(hw, SK_REG(port, RX_GMF_FL_MSK), RX_FF_FL_DEF_MSK); | 1776 | skge_write16(hw, SK_REG(port, RX_GMF_FL_MSK), RX_FF_FL_DEF_MSK); |
1797 | reg = GMF_OPER_ON | GMF_RX_F_FL_ON; | 1777 | reg = GMF_OPER_ON | GMF_RX_F_FL_ON; |
1798 | if (hw->chip_id == CHIP_ID_YUKON_LITE && | 1778 | if (hw->chip_id == CHIP_ID_YUKON_LITE && |
1799 | hw->chip_rev == CHIP_REV_YU_LITE_A3) | 1779 | hw->chip_rev >= CHIP_REV_YU_LITE_A3) |
1800 | reg &= ~GMF_RX_F_FL_ON; | 1780 | reg &= ~GMF_RX_F_FL_ON; |
1801 | skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR); | 1781 | skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_CLR); |
1802 | skge_write16(hw, SK_REG(port, RX_GMF_CTRL_T), reg); | 1782 | skge_write16(hw, SK_REG(port, RX_GMF_CTRL_T), reg); |
@@ -1813,19 +1793,19 @@ static void yukon_stop(struct skge_port *skge) | |||
1813 | int port = skge->port; | 1793 | int port = skge->port; |
1814 | 1794 | ||
1815 | if (hw->chip_id == CHIP_ID_YUKON_LITE && | 1795 | if (hw->chip_id == CHIP_ID_YUKON_LITE && |
1816 | hw->chip_rev == CHIP_REV_YU_LITE_A3) { | 1796 | hw->chip_rev >= CHIP_REV_YU_LITE_A3) { |
1817 | skge_write32(hw, B2_GP_IO, | 1797 | skge_write32(hw, B2_GP_IO, |
1818 | skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9); | 1798 | skge_read32(hw, B2_GP_IO) | GP_DIR_9 | GP_IO_9); |
1819 | } | 1799 | } |
1820 | 1800 | ||
1821 | gma_write16(hw, port, GM_GP_CTRL, | 1801 | gma_write16(hw, port, GM_GP_CTRL, |
1822 | gma_read16(hw, port, GM_GP_CTRL) | 1802 | gma_read16(hw, port, GM_GP_CTRL) |
1823 | & ~(GM_GPCR_RX_ENA|GM_GPCR_RX_ENA)); | 1803 | & ~(GM_GPCR_TX_ENA|GM_GPCR_RX_ENA)); |
1824 | gma_read16(hw, port, GM_GP_CTRL); | 1804 | gma_read16(hw, port, GM_GP_CTRL); |
1825 | 1805 | ||
1826 | /* set GPHY Control reset */ | 1806 | /* set GPHY Control reset */ |
1827 | gma_write32(hw, port, GPHY_CTRL, GPC_RST_SET); | 1807 | skge_write32(hw, SK_REG(port, GPHY_CTRL), GPC_RST_SET); |
1828 | gma_write32(hw, port, GMAC_CTRL, GMC_RST_SET); | 1808 | skge_write32(hw, SK_REG(port, GMAC_CTRL), GMC_RST_SET); |
1829 | } | 1809 | } |
1830 | 1810 | ||
1831 | static void yukon_get_stats(struct skge_port *skge, u64 *data) | 1811 | static void yukon_get_stats(struct skge_port *skge, u64 *data) |
@@ -1856,11 +1836,12 @@ static void yukon_mac_intr(struct skge_hw *hw, int port) | |||
1856 | 1836 | ||
1857 | if (status & GM_IS_RX_FF_OR) { | 1837 | if (status & GM_IS_RX_FF_OR) { |
1858 | ++skge->net_stats.rx_fifo_errors; | 1838 | ++skge->net_stats.rx_fifo_errors; |
1859 | gma_write8(hw, port, RX_GMF_CTRL_T, GMF_CLI_RX_FO); | 1839 | skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_CLI_RX_FO); |
1860 | } | 1840 | } |
1841 | |||
1861 | if (status & GM_IS_TX_FF_UR) { | 1842 | if (status & GM_IS_TX_FF_UR) { |
1862 | ++skge->net_stats.tx_fifo_errors; | 1843 | ++skge->net_stats.tx_fifo_errors; |
1863 | gma_write8(hw, port, TX_GMF_CTRL_T, GMF_CLI_TX_FU); | 1844 | skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_CLI_TX_FU); |
1864 | } | 1845 | } |
1865 | 1846 | ||
1866 | } | 1847 | } |
@@ -1896,7 +1877,7 @@ static void yukon_link_up(struct skge_port *skge) | |||
1896 | reg |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA; | 1877 | reg |= GM_GPCR_RX_ENA | GM_GPCR_TX_ENA; |
1897 | gma_write16(hw, port, GM_GP_CTRL, reg); | 1878 | gma_write16(hw, port, GM_GP_CTRL, reg); |
1898 | 1879 | ||
1899 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_DEF_MSK); | 1880 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, PHY_M_IS_DEF_MSK); |
1900 | skge_link_up(skge); | 1881 | skge_link_up(skge); |
1901 | } | 1882 | } |
1902 | 1883 | ||
@@ -1904,12 +1885,14 @@ static void yukon_link_down(struct skge_port *skge) | |||
1904 | { | 1885 | { |
1905 | struct skge_hw *hw = skge->hw; | 1886 | struct skge_hw *hw = skge->hw; |
1906 | int port = skge->port; | 1887 | int port = skge->port; |
1888 | u16 ctrl; | ||
1907 | 1889 | ||
1908 | pr_debug("yukon_link_down\n"); | 1890 | pr_debug("yukon_link_down\n"); |
1909 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0); | 1891 | gm_phy_write(hw, port, PHY_MARV_INT_MASK, 0); |
1910 | gm_phy_write(hw, port, GM_GP_CTRL, | 1892 | |
1911 | gm_phy_read(hw, port, GM_GP_CTRL) | 1893 | ctrl = gma_read16(hw, port, GM_GP_CTRL); |
1912 | & ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA)); | 1894 | ctrl &= ~(GM_GPCR_RX_ENA | GM_GPCR_TX_ENA); |
1895 | gma_write16(hw, port, GM_GP_CTRL, ctrl); | ||
1913 | 1896 | ||
1914 | if (skge->flow_control == FLOW_MODE_REM_SEND) { | 1897 | if (skge->flow_control == FLOW_MODE_REM_SEND) { |
1915 | /* restore Asymmetric Pause bit */ | 1898 | /* restore Asymmetric Pause bit */ |
@@ -2097,10 +2080,12 @@ static int skge_up(struct net_device *dev) | |||
2097 | skge_write32(hw, B0_IMSK, hw->intr_mask); | 2080 | skge_write32(hw, B0_IMSK, hw->intr_mask); |
2098 | 2081 | ||
2099 | /* Initialze MAC */ | 2082 | /* Initialze MAC */ |
2083 | spin_lock_bh(&hw->phy_lock); | ||
2100 | if (hw->chip_id == CHIP_ID_GENESIS) | 2084 | if (hw->chip_id == CHIP_ID_GENESIS) |
2101 | genesis_mac_init(hw, port); | 2085 | genesis_mac_init(hw, port); |
2102 | else | 2086 | else |
2103 | yukon_mac_init(hw, port); | 2087 | yukon_mac_init(hw, port); |
2088 | spin_unlock_bh(&hw->phy_lock); | ||
2104 | 2089 | ||
2105 | /* Configure RAMbuffers */ | 2090 | /* Configure RAMbuffers */ |
2106 | chunk = hw->ram_size / ((hw->ports + 1)*2); | 2091 | chunk = hw->ram_size / ((hw->ports + 1)*2); |
@@ -2116,6 +2101,7 @@ static int skge_up(struct net_device *dev) | |||
2116 | /* Start receiver BMU */ | 2101 | /* Start receiver BMU */ |
2117 | wmb(); | 2102 | wmb(); |
2118 | skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); | 2103 | skge_write8(hw, Q_ADDR(rxqaddr[port], Q_CSR), CSR_START | CSR_IRQ_CL_F); |
2104 | skge_led(skge, LED_MODE_ON); | ||
2119 | 2105 | ||
2120 | pr_debug("skge_up completed\n"); | 2106 | pr_debug("skge_up completed\n"); |
2121 | return 0; | 2107 | return 0; |
@@ -2140,8 +2126,6 @@ static int skge_down(struct net_device *dev) | |||
2140 | 2126 | ||
2141 | netif_stop_queue(dev); | 2127 | netif_stop_queue(dev); |
2142 | 2128 | ||
2143 | del_timer_sync(&skge->led_blink); | ||
2144 | |||
2145 | /* Stop transmitter */ | 2129 | /* Stop transmitter */ |
2146 | skge_write8(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_STOP); | 2130 | skge_write8(hw, Q_ADDR(txqaddr[port], Q_CSR), CSR_STOP); |
2147 | skge_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), | 2131 | skge_write32(hw, RB_ADDR(txqaddr[port], RB_CTRL), |
@@ -2175,15 +2159,12 @@ static int skge_down(struct net_device *dev) | |||
2175 | if (hw->chip_id == CHIP_ID_GENESIS) { | 2159 | if (hw->chip_id == CHIP_ID_GENESIS) { |
2176 | skge_write8(hw, SK_REG(port, TX_MFF_CTRL2), MFF_RST_SET); | 2160 | skge_write8(hw, SK_REG(port, TX_MFF_CTRL2), MFF_RST_SET); |
2177 | skge_write8(hw, SK_REG(port, RX_MFF_CTRL2), MFF_RST_SET); | 2161 | skge_write8(hw, SK_REG(port, RX_MFF_CTRL2), MFF_RST_SET); |
2178 | skge_write8(hw, SK_REG(port, TX_LED_CTRL), LED_STOP); | ||
2179 | skge_write8(hw, SK_REG(port, RX_LED_CTRL), LED_STOP); | ||
2180 | } else { | 2162 | } else { |
2181 | skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); | 2163 | skge_write8(hw, SK_REG(port, RX_GMF_CTRL_T), GMF_RST_SET); |
2182 | skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); | 2164 | skge_write8(hw, SK_REG(port, TX_GMF_CTRL_T), GMF_RST_SET); |
2183 | } | 2165 | } |
2184 | 2166 | ||
2185 | /* turn off led's */ | 2167 | skge_led(skge, LED_MODE_OFF); |
2186 | skge_write16(hw, B0_LED, LED_STAT_OFF); | ||
2187 | 2168 | ||
2188 | skge_tx_clean(skge); | 2169 | skge_tx_clean(skge); |
2189 | skge_rx_clean(skge); | 2170 | skge_rx_clean(skge); |
@@ -2633,11 +2614,17 @@ static inline void skge_tx_intr(struct net_device *dev) | |||
2633 | spin_unlock(&skge->tx_lock); | 2614 | spin_unlock(&skge->tx_lock); |
2634 | } | 2615 | } |
2635 | 2616 | ||
2617 | /* Parity errors seem to happen when Genesis is connected to a switch | ||
2618 | * with no other ports present. Heartbeat error?? | ||
2619 | */ | ||
2636 | static void skge_mac_parity(struct skge_hw *hw, int port) | 2620 | static void skge_mac_parity(struct skge_hw *hw, int port) |
2637 | { | 2621 | { |
2638 | printk(KERN_ERR PFX "%s: mac data parity error\n", | 2622 | struct net_device *dev = hw->dev[port]; |
2639 | hw->dev[port] ? hw->dev[port]->name | 2623 | |
2640 | : (port == 0 ? "(port A)": "(port B")); | 2624 | if (dev) { |
2625 | struct skge_port *skge = netdev_priv(dev); | ||
2626 | ++skge->net_stats.tx_heartbeat_errors; | ||
2627 | } | ||
2641 | 2628 | ||
2642 | if (hw->chip_id == CHIP_ID_GENESIS) | 2629 | if (hw->chip_id == CHIP_ID_GENESIS) |
2643 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), | 2630 | skge_write16(hw, SK_REG(port, TX_MFF_CTRL1), |
@@ -3083,10 +3070,6 @@ static struct net_device *skge_devinit(struct skge_hw *hw, int port, | |||
3083 | 3070 | ||
3084 | spin_lock_init(&skge->tx_lock); | 3071 | spin_lock_init(&skge->tx_lock); |
3085 | 3072 | ||
3086 | init_timer(&skge->led_blink); | ||
3087 | skge->led_blink.function = skge_blink_timer; | ||
3088 | skge->led_blink.data = (unsigned long) skge; | ||
3089 | |||
3090 | if (hw->chip_id != CHIP_ID_GENESIS) { | 3073 | if (hw->chip_id != CHIP_ID_GENESIS) { |
3091 | dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; | 3074 | dev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; |
3092 | skge->rx_csum = 1; | 3075 | skge->rx_csum = 1; |
diff --git a/drivers/net/skge.h b/drivers/net/skge.h index fced3d2bc072..b432f1bb8168 100644 --- a/drivers/net/skge.h +++ b/drivers/net/skge.h | |||
@@ -1449,10 +1449,12 @@ enum { | |||
1449 | PHY_M_IS_DTE_CHANGE = 1<<2, /* DTE Power Det. Status Changed */ | 1449 | PHY_M_IS_DTE_CHANGE = 1<<2, /* DTE Power Det. Status Changed */ |
1450 | PHY_M_IS_POL_CHANGE = 1<<1, /* Polarity Changed */ | 1450 | PHY_M_IS_POL_CHANGE = 1<<1, /* Polarity Changed */ |
1451 | PHY_M_IS_JABBER = 1<<0, /* Jabber */ | 1451 | PHY_M_IS_JABBER = 1<<0, /* Jabber */ |
1452 | }; | ||
1453 | 1452 | ||
1454 | #define PHY_M_DEF_MSK ( PHY_M_IS_AN_ERROR | PHY_M_IS_LSP_CHANGE | \ | 1453 | PHY_M_IS_DEF_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_LSP_CHANGE | |
1455 | PHY_M_IS_LST_CHANGE | PHY_M_IS_FIFO_ERROR) | 1454 | PHY_M_IS_LST_CHANGE | PHY_M_IS_FIFO_ERROR, |
1455 | |||
1456 | PHY_M_IS_AN_MSK = PHY_M_IS_AN_ERROR | PHY_M_IS_AN_COMPL, | ||
1457 | }; | ||
1456 | 1458 | ||
1457 | /***** PHY_MARV_EXT_CTRL 16 bit r/w Ext. PHY Specific Ctrl *****/ | 1459 | /***** PHY_MARV_EXT_CTRL 16 bit r/w Ext. PHY Specific Ctrl *****/ |
1458 | enum { | 1460 | enum { |
@@ -1509,7 +1511,7 @@ enum { | |||
1509 | PHY_M_LEDC_TX_C_MSB = 1<<0, /* Tx Control (MSB, 88E1111 only) */ | 1511 | PHY_M_LEDC_TX_C_MSB = 1<<0, /* Tx Control (MSB, 88E1111 only) */ |
1510 | }; | 1512 | }; |
1511 | 1513 | ||
1512 | #define PHY_M_LED_PULS_DUR(x) ( ((x)<<12) & PHY_M_LEDC_PULS_MSK) | 1514 | #define PHY_M_LED_PULS_DUR(x) (((x)<<12) & PHY_M_LEDC_PULS_MSK) |
1513 | 1515 | ||
1514 | enum { | 1516 | enum { |
1515 | PULS_NO_STR = 0,/* no pulse stretching */ | 1517 | PULS_NO_STR = 0,/* no pulse stretching */ |
@@ -1522,7 +1524,7 @@ enum { | |||
1522 | PULS_1300MS = 7,/* 1.3 s to 2.7 s */ | 1524 | PULS_1300MS = 7,/* 1.3 s to 2.7 s */ |
1523 | }; | 1525 | }; |
1524 | 1526 | ||
1525 | #define PHY_M_LED_BLINK_RT(x) ( ((x)<<8) & PHY_M_LEDC_BL_R_MSK) | 1527 | #define PHY_M_LED_BLINK_RT(x) (((x)<<8) & PHY_M_LEDC_BL_R_MSK) |
1526 | 1528 | ||
1527 | enum { | 1529 | enum { |
1528 | BLINK_42MS = 0,/* 42 ms */ | 1530 | BLINK_42MS = 0,/* 42 ms */ |
@@ -1602,9 +1604,9 @@ enum { | |||
1602 | PHY_M_FELP_LED0_MSK = 0xf, /* Bit 3.. 0: LED0 Mask (SPEED) */ | 1604 | PHY_M_FELP_LED0_MSK = 0xf, /* Bit 3.. 0: LED0 Mask (SPEED) */ |
1603 | }; | 1605 | }; |
1604 | 1606 | ||
1605 | #define PHY_M_FELP_LED2_CTRL(x) ( ((x)<<8) & PHY_M_FELP_LED2_MSK) | 1607 | #define PHY_M_FELP_LED2_CTRL(x) (((x)<<8) & PHY_M_FELP_LED2_MSK) |
1606 | #define PHY_M_FELP_LED1_CTRL(x) ( ((x)<<4) & PHY_M_FELP_LED1_MSK) | 1608 | #define PHY_M_FELP_LED1_CTRL(x) (((x)<<4) & PHY_M_FELP_LED1_MSK) |
1607 | #define PHY_M_FELP_LED0_CTRL(x) ( ((x)<<0) & PHY_M_FELP_LED0_MSK) | 1609 | #define PHY_M_FELP_LED0_CTRL(x) (((x)<<0) & PHY_M_FELP_LED0_MSK) |
1608 | 1610 | ||
1609 | enum { | 1611 | enum { |
1610 | LED_PAR_CTRL_COLX = 0x00, | 1612 | LED_PAR_CTRL_COLX = 0x00, |
@@ -1640,7 +1642,7 @@ enum { | |||
1640 | PHY_M_MAC_MD_COPPER = 5,/* Copper only */ | 1642 | PHY_M_MAC_MD_COPPER = 5,/* Copper only */ |
1641 | PHY_M_MAC_MD_1000BX = 7,/* 1000Base-X only */ | 1643 | PHY_M_MAC_MD_1000BX = 7,/* 1000Base-X only */ |
1642 | }; | 1644 | }; |
1643 | #define PHY_M_MAC_MODE_SEL(x) ( ((x)<<7) & PHY_M_MAC_MD_MSK) | 1645 | #define PHY_M_MAC_MODE_SEL(x) (((x)<<7) & PHY_M_MAC_MD_MSK) |
1644 | 1646 | ||
1645 | /***** PHY_MARV_PHY_CTRL (page 3) 16 bit r/w LED Control Reg. *****/ | 1647 | /***** PHY_MARV_PHY_CTRL (page 3) 16 bit r/w LED Control Reg. *****/ |
1646 | enum { | 1648 | enum { |
@@ -1650,10 +1652,10 @@ enum { | |||
1650 | PHY_M_LEDC_STA0_MSK = 0xf, /* Bit 3.. 0: STAT0 LED Ctrl. Mask */ | 1652 | PHY_M_LEDC_STA0_MSK = 0xf, /* Bit 3.. 0: STAT0 LED Ctrl. Mask */ |
1651 | }; | 1653 | }; |
1652 | 1654 | ||
1653 | #define PHY_M_LEDC_LOS_CTRL(x) ( ((x)<<12) & PHY_M_LEDC_LOS_MSK) | 1655 | #define PHY_M_LEDC_LOS_CTRL(x) (((x)<<12) & PHY_M_LEDC_LOS_MSK) |
1654 | #define PHY_M_LEDC_INIT_CTRL(x) ( ((x)<<8) & PHY_M_LEDC_INIT_MSK) | 1656 | #define PHY_M_LEDC_INIT_CTRL(x) (((x)<<8) & PHY_M_LEDC_INIT_MSK) |
1655 | #define PHY_M_LEDC_STA1_CTRL(x) ( ((x)<<4) & PHY_M_LEDC_STA1_MSK) | 1657 | #define PHY_M_LEDC_STA1_CTRL(x) (((x)<<4) & PHY_M_LEDC_STA1_MSK) |
1656 | #define PHY_M_LEDC_STA0_CTRL(x) ( ((x)<<0) & PHY_M_LEDC_STA0_MSK) | 1658 | #define PHY_M_LEDC_STA0_CTRL(x) (((x)<<0) & PHY_M_LEDC_STA0_MSK) |
1657 | 1659 | ||
1658 | /* GMAC registers */ | 1660 | /* GMAC registers */ |
1659 | /* Port Registers */ | 1661 | /* Port Registers */ |
@@ -2505,8 +2507,6 @@ struct skge_port { | |||
2505 | dma_addr_t dma; | 2507 | dma_addr_t dma; |
2506 | unsigned long mem_size; | 2508 | unsigned long mem_size; |
2507 | unsigned int rx_buf_size; | 2509 | unsigned int rx_buf_size; |
2508 | |||
2509 | struct timer_list led_blink; | ||
2510 | }; | 2510 | }; |
2511 | 2511 | ||
2512 | 2512 | ||
@@ -2606,17 +2606,6 @@ static inline void gma_write16(const struct skge_hw *hw, int port, int r, u16 v) | |||
2606 | skge_write16(hw, SK_GMAC_REG(port,r), v); | 2606 | skge_write16(hw, SK_GMAC_REG(port,r), v); |
2607 | } | 2607 | } |
2608 | 2608 | ||
2609 | static inline void gma_write32(const struct skge_hw *hw, int port, int r, u32 v) | ||
2610 | { | ||
2611 | skge_write16(hw, SK_GMAC_REG(port, r), (u16) v); | ||
2612 | skge_write32(hw, SK_GMAC_REG(port, r+4), (u16)(v >> 16)); | ||
2613 | } | ||
2614 | |||
2615 | static inline void gma_write8(const struct skge_hw *hw, int port, int r, u8 v) | ||
2616 | { | ||
2617 | skge_write8(hw, SK_GMAC_REG(port,r), v); | ||
2618 | } | ||
2619 | |||
2620 | static inline void gma_set_addr(struct skge_hw *hw, int port, int reg, | 2609 | static inline void gma_set_addr(struct skge_hw *hw, int port, int reg, |
2621 | const u8 *addr) | 2610 | const u8 *addr) |
2622 | { | 2611 | { |
diff --git a/drivers/net/smc91x.h b/drivers/net/smc91x.h index 7089d86e857a..a9b06b8d8e3f 100644 --- a/drivers/net/smc91x.h +++ b/drivers/net/smc91x.h | |||
@@ -188,7 +188,7 @@ SMC_outw(u16 val, void __iomem *ioaddr, int reg) | |||
188 | #define SMC_IRQ_TRIGGER_TYPE (( \ | 188 | #define SMC_IRQ_TRIGGER_TYPE (( \ |
189 | machine_is_omap_h2() \ | 189 | machine_is_omap_h2() \ |
190 | || machine_is_omap_h3() \ | 190 | || machine_is_omap_h3() \ |
191 | || (machine_is_omap_innovator() && !cpu_is_omap150()) \ | 191 | || (machine_is_omap_innovator() && !cpu_is_omap1510()) \ |
192 | ) ? IRQT_FALLING : IRQT_RISING) | 192 | ) ? IRQT_FALLING : IRQT_RISING) |
193 | 193 | ||
194 | 194 | ||
diff --git a/drivers/pci/bus.c b/drivers/pci/bus.c index fedae89d8f7d..fb9a11243d2a 100644 --- a/drivers/pci/bus.c +++ b/drivers/pci/bus.c | |||
@@ -60,7 +60,9 @@ pci_bus_alloc_resource(struct pci_bus *bus, struct resource *res, | |||
60 | continue; | 60 | continue; |
61 | 61 | ||
62 | /* Ok, try it out.. */ | 62 | /* Ok, try it out.. */ |
63 | ret = allocate_resource(r, res, size, min, -1, align, | 63 | ret = allocate_resource(r, res, size, |
64 | r->start ? : min, | ||
65 | -1, align, | ||
64 | alignf, alignf_data); | 66 | alignf, alignf_data); |
65 | if (ret == 0) | 67 | if (ret == 0) |
66 | break; | 68 | break; |
diff --git a/drivers/pci/probe.c b/drivers/pci/probe.c index df3bdae2040f..93e8a878ea95 100644 --- a/drivers/pci/probe.c +++ b/drivers/pci/probe.c | |||
@@ -507,7 +507,7 @@ int __devinit pci_scan_bridge(struct pci_bus *bus, struct pci_dev * dev, int max | |||
507 | pci_write_config_dword(dev, PCI_PRIMARY_BUS, buses); | 507 | pci_write_config_dword(dev, PCI_PRIMARY_BUS, buses); |
508 | 508 | ||
509 | if (!is_cardbus) { | 509 | if (!is_cardbus) { |
510 | child->bridge_ctl = PCI_BRIDGE_CTL_NO_ISA; | 510 | child->bridge_ctl = bctl | PCI_BRIDGE_CTL_NO_ISA; |
511 | /* | 511 | /* |
512 | * Adjust subordinate busnr in parent buses. | 512 | * Adjust subordinate busnr in parent buses. |
513 | * We do this before scanning for children because | 513 | * We do this before scanning for children because |
diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 1521fd5d95cc..8d0968bd527e 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c | |||
@@ -820,6 +820,11 @@ static void __init asus_hides_smbus_hostbridge(struct pci_dev *dev) | |||
820 | case 0x0001: /* Toshiba Satellite A40 */ | 820 | case 0x0001: /* Toshiba Satellite A40 */ |
821 | asus_hides_smbus = 1; | 821 | asus_hides_smbus = 1; |
822 | } | 822 | } |
823 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) | ||
824 | switch(dev->subsystem_device) { | ||
825 | case 0x0001: /* Toshiba Tecra M2 */ | ||
826 | asus_hides_smbus = 1; | ||
827 | } | ||
823 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { | 828 | } else if (unlikely(dev->subsystem_vendor == PCI_VENDOR_ID_SAMSUNG)) { |
824 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) | 829 | if (dev->device == PCI_DEVICE_ID_INTEL_82855PM_HB) |
825 | switch(dev->subsystem_device) { | 830 | switch(dev->subsystem_device) { |
diff --git a/drivers/pci/rom.c b/drivers/pci/rom.c index 838575e3fac6..713c78f3a65d 100644 --- a/drivers/pci/rom.c +++ b/drivers/pci/rom.c | |||
@@ -125,7 +125,9 @@ void __iomem *pci_map_rom(struct pci_dev *pdev, size_t *size) | |||
125 | image += readw(pds + 16) * 512; | 125 | image += readw(pds + 16) * 512; |
126 | } while (!last_image); | 126 | } while (!last_image); |
127 | 127 | ||
128 | *size = image - rom; | 128 | /* never return a size larger than the PCI resource window */ |
129 | /* there are known ROMs that get the size wrong */ | ||
130 | *size = min((size_t)(image - rom), *size); | ||
129 | 131 | ||
130 | return rom; | 132 | return rom; |
131 | } | 133 | } |
diff --git a/drivers/pci/setup-bus.c b/drivers/pci/setup-bus.c index 9fe48f712be9..a2eebc6eaacc 100644 --- a/drivers/pci/setup-bus.c +++ b/drivers/pci/setup-bus.c | |||
@@ -51,8 +51,6 @@ pbus_assign_resources_sorted(struct pci_bus *bus) | |||
51 | struct resource_list head, *list, *tmp; | 51 | struct resource_list head, *list, *tmp; |
52 | int idx; | 52 | int idx; |
53 | 53 | ||
54 | bus->bridge_ctl &= ~PCI_BRIDGE_CTL_VGA; | ||
55 | |||
56 | head.next = NULL; | 54 | head.next = NULL; |
57 | list_for_each_entry(dev, &bus->devices, bus_list) { | 55 | list_for_each_entry(dev, &bus->devices, bus_list) { |
58 | u16 class = dev->class >> 8; | 56 | u16 class = dev->class >> 8; |
@@ -62,10 +60,6 @@ pbus_assign_resources_sorted(struct pci_bus *bus) | |||
62 | class == PCI_CLASS_BRIDGE_HOST) | 60 | class == PCI_CLASS_BRIDGE_HOST) |
63 | continue; | 61 | continue; |
64 | 62 | ||
65 | if (class == PCI_CLASS_DISPLAY_VGA || | ||
66 | class == PCI_CLASS_NOT_DEFINED_VGA) | ||
67 | bus->bridge_ctl |= PCI_BRIDGE_CTL_VGA; | ||
68 | |||
69 | pdev_sort_resources(dev, &head); | 63 | pdev_sort_resources(dev, &head); |
70 | } | 64 | } |
71 | 65 | ||
@@ -509,12 +503,6 @@ pci_bus_assign_resources(struct pci_bus *bus) | |||
509 | 503 | ||
510 | pbus_assign_resources_sorted(bus); | 504 | pbus_assign_resources_sorted(bus); |
511 | 505 | ||
512 | if (bus->bridge_ctl & PCI_BRIDGE_CTL_VGA) { | ||
513 | /* Propagate presence of the VGA to upstream bridges */ | ||
514 | for (b = bus; b->parent; b = b->parent) { | ||
515 | b->bridge_ctl |= PCI_BRIDGE_CTL_VGA; | ||
516 | } | ||
517 | } | ||
518 | list_for_each_entry(dev, &bus->devices, bus_list) { | 506 | list_for_each_entry(dev, &bus->devices, bus_list) { |
519 | b = dev->subordinate; | 507 | b = dev->subordinate; |
520 | if (!b) | 508 | if (!b) |
diff --git a/drivers/pcmcia/ds.c b/drivers/pcmcia/ds.c index d63f22a5bf7e..43da2e92d50f 100644 --- a/drivers/pcmcia/ds.c +++ b/drivers/pcmcia/ds.c | |||
@@ -589,8 +589,8 @@ static void pcmcia_delayed_add_pseudo_device(void *data) | |||
589 | static inline void pcmcia_add_pseudo_device(struct pcmcia_socket *s) | 589 | static inline void pcmcia_add_pseudo_device(struct pcmcia_socket *s) |
590 | { | 590 | { |
591 | if (!s->pcmcia_state.device_add_pending) { | 591 | if (!s->pcmcia_state.device_add_pending) { |
592 | schedule_work(&s->device_add); | ||
593 | s->pcmcia_state.device_add_pending = 1; | 592 | s->pcmcia_state.device_add_pending = 1; |
593 | schedule_work(&s->device_add); | ||
594 | } | 594 | } |
595 | return; | 595 | return; |
596 | } | 596 | } |
diff --git a/drivers/pcmcia/yenta_socket.c b/drivers/pcmcia/yenta_socket.c index 744e469a9eda..91e7457d5b04 100644 --- a/drivers/pcmcia/yenta_socket.c +++ b/drivers/pcmcia/yenta_socket.c | |||
@@ -642,6 +642,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ | |||
642 | (yenta_search_res(socket, res, BRIDGE_IO_MIN))) { | 642 | (yenta_search_res(socket, res, BRIDGE_IO_MIN))) { |
643 | config_writel(socket, addr_start, res->start); | 643 | config_writel(socket, addr_start, res->start); |
644 | config_writel(socket, addr_end, res->end); | 644 | config_writel(socket, addr_end, res->end); |
645 | return; | ||
645 | } | 646 | } |
646 | } else { | 647 | } else { |
647 | if (type & IORESOURCE_PREFETCH) { | 648 | if (type & IORESOURCE_PREFETCH) { |
@@ -650,6 +651,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ | |||
650 | (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) { | 651 | (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) { |
651 | config_writel(socket, addr_start, res->start); | 652 | config_writel(socket, addr_start, res->start); |
652 | config_writel(socket, addr_end, res->end); | 653 | config_writel(socket, addr_end, res->end); |
654 | return; | ||
653 | } | 655 | } |
654 | /* Approximating prefetchable by non-prefetchable */ | 656 | /* Approximating prefetchable by non-prefetchable */ |
655 | res->flags = IORESOURCE_MEM; | 657 | res->flags = IORESOURCE_MEM; |
@@ -659,6 +661,7 @@ static void yenta_allocate_res(struct yenta_socket *socket, int nr, unsigned typ | |||
659 | (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) { | 661 | (yenta_search_res(socket, res, BRIDGE_MEM_MIN))) { |
660 | config_writel(socket, addr_start, res->start); | 662 | config_writel(socket, addr_start, res->start); |
661 | config_writel(socket, addr_end, res->end); | 663 | config_writel(socket, addr_end, res->end); |
664 | return; | ||
662 | } | 665 | } |
663 | } | 666 | } |
664 | 667 | ||
@@ -1107,8 +1110,6 @@ static int yenta_dev_suspend (struct pci_dev *dev, pm_message_t state) | |||
1107 | pci_read_config_dword(dev, 17*4, &socket->saved_state[1]); | 1110 | pci_read_config_dword(dev, 17*4, &socket->saved_state[1]); |
1108 | pci_disable_device(dev); | 1111 | pci_disable_device(dev); |
1109 | 1112 | ||
1110 | free_irq(dev->irq, socket); | ||
1111 | |||
1112 | /* | 1113 | /* |
1113 | * Some laptops (IBM T22) do not like us putting the Cardbus | 1114 | * Some laptops (IBM T22) do not like us putting the Cardbus |
1114 | * bridge into D3. At a guess, some other laptop will | 1115 | * bridge into D3. At a guess, some other laptop will |
@@ -1134,13 +1135,6 @@ static int yenta_dev_resume (struct pci_dev *dev) | |||
1134 | pci_enable_device(dev); | 1135 | pci_enable_device(dev); |
1135 | pci_set_master(dev); | 1136 | pci_set_master(dev); |
1136 | 1137 | ||
1137 | if (socket->cb_irq) | ||
1138 | if (request_irq(socket->cb_irq, yenta_interrupt, | ||
1139 | SA_SHIRQ, "yenta", socket)) { | ||
1140 | printk(KERN_WARNING "Yenta: request_irq() failed on resume!\n"); | ||
1141 | socket->cb_irq = 0; | ||
1142 | } | ||
1143 | |||
1144 | if (socket->type && socket->type->restore_state) | 1138 | if (socket->type && socket->type->restore_state) |
1145 | socket->type->restore_state(socket); | 1139 | socket->type->restore_state(socket); |
1146 | } | 1140 | } |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 9b7f6f548b1d..ee7a05e0c3ba 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -235,6 +235,9 @@ ccw_device_recog_done(struct ccw_device *cdev, int state) | |||
235 | sch->schib.pmcw.pam & | 235 | sch->schib.pmcw.pam & |
236 | sch->schib.pmcw.pom & | 236 | sch->schib.pmcw.pom & |
237 | sch->opm; | 237 | sch->opm; |
238 | /* Check since device may again have become not operational. */ | ||
239 | if (!sch->schib.pmcw.dnv) | ||
240 | state = DEV_STATE_NOT_OPER; | ||
238 | if (cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID) | 241 | if (cdev->private->state == DEV_STATE_DISCONNECTED_SENSE_ID) |
239 | /* Force reprobe on all chpids. */ | 242 | /* Force reprobe on all chpids. */ |
240 | old_lpm = 0; | 243 | old_lpm = 0; |
diff --git a/drivers/scsi/Kconfig b/drivers/scsi/Kconfig index 96df148ed969..f1e8c4223ed1 100644 --- a/drivers/scsi/Kconfig +++ b/drivers/scsi/Kconfig | |||
@@ -424,7 +424,7 @@ config SCSI_IN2000 | |||
424 | source "drivers/scsi/megaraid/Kconfig.megaraid" | 424 | source "drivers/scsi/megaraid/Kconfig.megaraid" |
425 | 425 | ||
426 | config SCSI_SATA | 426 | config SCSI_SATA |
427 | bool "Serial ATA (SATA) support" | 427 | tristate "Serial ATA (SATA) support" |
428 | depends on SCSI | 428 | depends on SCSI |
429 | help | 429 | help |
430 | This driver family supports Serial ATA host controllers | 430 | This driver family supports Serial ATA host controllers |
diff --git a/drivers/scsi/aacraid/aacraid.h b/drivers/scsi/aacraid/aacraid.h index 3a11a536c0da..4ab07861b457 100644 --- a/drivers/scsi/aacraid/aacraid.h +++ b/drivers/scsi/aacraid/aacraid.h | |||
@@ -15,11 +15,7 @@ | |||
15 | #define AAC_MAX_LUN (8) | 15 | #define AAC_MAX_LUN (8) |
16 | 16 | ||
17 | #define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff) | 17 | #define AAC_MAX_HOSTPHYSMEMPAGES (0xfffff) |
18 | /* | 18 | #define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)512) |
19 | * max_sectors is an unsigned short, otherwise limit is 0x100000000 / 512 | ||
20 | * Linux has starvation problems if we permit larger than 4MB I/O ... | ||
21 | */ | ||
22 | #define AAC_MAX_32BIT_SGBCOUNT ((unsigned short)8192) | ||
23 | 19 | ||
24 | /* | 20 | /* |
25 | * These macros convert from physical channels to virtual channels | 21 | * These macros convert from physical channels to virtual channels |
diff --git a/drivers/scsi/aacraid/linit.c b/drivers/scsi/aacraid/linit.c index c1a4f978fcba..562da90480a1 100644 --- a/drivers/scsi/aacraid/linit.c +++ b/drivers/scsi/aacraid/linit.c | |||
@@ -374,7 +374,8 @@ static int aac_slave_configure(struct scsi_device *sdev) | |||
374 | else | 374 | else |
375 | scsi_adjust_queue_depth(sdev, 0, 1); | 375 | scsi_adjust_queue_depth(sdev, 0, 1); |
376 | 376 | ||
377 | if (host->max_sectors < AAC_MAX_32BIT_SGBCOUNT) | 377 | if (!(((struct aac_dev *)host->hostdata)->adapter_info.options |
378 | & AAC_OPT_NEW_COMM)) | ||
378 | blk_queue_max_segment_size(sdev->request_queue, 65536); | 379 | blk_queue_max_segment_size(sdev->request_queue, 65536); |
379 | 380 | ||
380 | return 0; | 381 | return 0; |
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm.c b/drivers/scsi/aic7xxx/aicasm/aicasm.c index c34639481904..f936b691232f 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm.c +++ b/drivers/scsi/aic7xxx/aicasm/aicasm.c | |||
@@ -369,7 +369,7 @@ output_code() | |||
369 | 369 | ||
370 | fprintf(ofile, "%s\t0x%02x, 0x%02x, 0x%02x, 0x%02x", | 370 | fprintf(ofile, "%s\t0x%02x, 0x%02x, 0x%02x, 0x%02x", |
371 | cur_instr == STAILQ_FIRST(&seq_program) ? "" : ",\n", | 371 | cur_instr == STAILQ_FIRST(&seq_program) ? "" : ",\n", |
372 | #if BYTE_ORDER == LITTLE_ENDIAN | 372 | #ifdef __LITTLE_ENDIAN |
373 | cur_instr->format.bytes[0], | 373 | cur_instr->format.bytes[0], |
374 | cur_instr->format.bytes[1], | 374 | cur_instr->format.bytes[1], |
375 | cur_instr->format.bytes[2], | 375 | cur_instr->format.bytes[2], |
@@ -613,7 +613,7 @@ output_listing(char *ifilename) | |||
613 | line++; | 613 | line++; |
614 | } | 614 | } |
615 | fprintf(listfile, "%03x %02x%02x%02x%02x", instrptr, | 615 | fprintf(listfile, "%03x %02x%02x%02x%02x", instrptr, |
616 | #if BYTE_ORDER == LITTLE_ENDIAN | 616 | #ifdef __LITTLE_ENDIAN |
617 | cur_instr->format.bytes[0], | 617 | cur_instr->format.bytes[0], |
618 | cur_instr->format.bytes[1], | 618 | cur_instr->format.bytes[1], |
619 | cur_instr->format.bytes[2], | 619 | cur_instr->format.bytes[2], |
diff --git a/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h b/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h index 3e80f07df49c..e64f802bbaaa 100644 --- a/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h +++ b/drivers/scsi/aic7xxx/aicasm/aicasm_insformat.h | |||
@@ -42,8 +42,10 @@ | |||
42 | * $FreeBSD$ | 42 | * $FreeBSD$ |
43 | */ | 43 | */ |
44 | 44 | ||
45 | #include <asm/byteorder.h> | ||
46 | |||
45 | struct ins_format1 { | 47 | struct ins_format1 { |
46 | #if BYTE_ORDER == LITTLE_ENDIAN | 48 | #ifdef __LITTLE_ENDIAN |
47 | uint32_t immediate : 8, | 49 | uint32_t immediate : 8, |
48 | source : 9, | 50 | source : 9, |
49 | destination : 9, | 51 | destination : 9, |
@@ -61,7 +63,7 @@ struct ins_format1 { | |||
61 | }; | 63 | }; |
62 | 64 | ||
63 | struct ins_format2 { | 65 | struct ins_format2 { |
64 | #if BYTE_ORDER == LITTLE_ENDIAN | 66 | #ifdef __LITTLE_ENDIAN |
65 | uint32_t shift_control : 8, | 67 | uint32_t shift_control : 8, |
66 | source : 9, | 68 | source : 9, |
67 | destination : 9, | 69 | destination : 9, |
@@ -79,7 +81,7 @@ struct ins_format2 { | |||
79 | }; | 81 | }; |
80 | 82 | ||
81 | struct ins_format3 { | 83 | struct ins_format3 { |
82 | #if BYTE_ORDER == LITTLE_ENDIAN | 84 | #ifdef __LITTLE_ENDIAN |
83 | uint32_t immediate : 8, | 85 | uint32_t immediate : 8, |
84 | source : 9, | 86 | source : 9, |
85 | address : 10, | 87 | address : 10, |
diff --git a/drivers/scsi/ata_piix.c b/drivers/scsi/ata_piix.c index 3be546439252..a2cfade2c1c6 100644 --- a/drivers/scsi/ata_piix.c +++ b/drivers/scsi/ata_piix.c | |||
@@ -38,6 +38,7 @@ enum { | |||
38 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ | 38 | PIIX_IOCFG = 0x54, /* IDE I/O configuration register */ |
39 | ICH5_PMR = 0x90, /* port mapping register */ | 39 | ICH5_PMR = 0x90, /* port mapping register */ |
40 | ICH5_PCS = 0x92, /* port control and status */ | 40 | ICH5_PCS = 0x92, /* port control and status */ |
41 | PIIX_SCC = 0x0A, /* sub-class code register */ | ||
41 | 42 | ||
42 | PIIX_FLAG_AHCI = (1 << 28), /* AHCI possible */ | 43 | PIIX_FLAG_AHCI = (1 << 28), /* AHCI possible */ |
43 | PIIX_FLAG_CHECKINTR = (1 << 29), /* make sure PCI INTx enabled */ | 44 | PIIX_FLAG_CHECKINTR = (1 << 29), /* make sure PCI INTx enabled */ |
@@ -62,6 +63,8 @@ enum { | |||
62 | ich6_sata_rm = 4, | 63 | ich6_sata_rm = 4, |
63 | ich7_sata = 5, | 64 | ich7_sata = 5, |
64 | esb2_sata = 6, | 65 | esb2_sata = 6, |
66 | |||
67 | PIIX_AHCI_DEVICE = 6, | ||
65 | }; | 68 | }; |
66 | 69 | ||
67 | static int piix_init_one (struct pci_dev *pdev, | 70 | static int piix_init_one (struct pci_dev *pdev, |
@@ -574,11 +577,11 @@ static int piix_disable_ahci(struct pci_dev *pdev) | |||
574 | addr = pci_resource_start(pdev, AHCI_PCI_BAR); | 577 | addr = pci_resource_start(pdev, AHCI_PCI_BAR); |
575 | if (!addr || !pci_resource_len(pdev, AHCI_PCI_BAR)) | 578 | if (!addr || !pci_resource_len(pdev, AHCI_PCI_BAR)) |
576 | return 0; | 579 | return 0; |
577 | 580 | ||
578 | mmio = ioremap(addr, 64); | 581 | mmio = ioremap(addr, 64); |
579 | if (!mmio) | 582 | if (!mmio) |
580 | return -ENOMEM; | 583 | return -ENOMEM; |
581 | 584 | ||
582 | tmp = readl(mmio + AHCI_GLOBAL_CTL); | 585 | tmp = readl(mmio + AHCI_GLOBAL_CTL); |
583 | if (tmp & AHCI_ENABLE) { | 586 | if (tmp & AHCI_ENABLE) { |
584 | tmp &= ~AHCI_ENABLE; | 587 | tmp &= ~AHCI_ENABLE; |
@@ -588,7 +591,7 @@ static int piix_disable_ahci(struct pci_dev *pdev) | |||
588 | if (tmp & AHCI_ENABLE) | 591 | if (tmp & AHCI_ENABLE) |
589 | rc = -EIO; | 592 | rc = -EIO; |
590 | } | 593 | } |
591 | 594 | ||
592 | iounmap(mmio); | 595 | iounmap(mmio); |
593 | return rc; | 596 | return rc; |
594 | } | 597 | } |
@@ -626,9 +629,13 @@ static int piix_init_one (struct pci_dev *pdev, const struct pci_device_id *ent) | |||
626 | port_info[1] = NULL; | 629 | port_info[1] = NULL; |
627 | 630 | ||
628 | if (port_info[0]->host_flags & PIIX_FLAG_AHCI) { | 631 | if (port_info[0]->host_flags & PIIX_FLAG_AHCI) { |
629 | int rc = piix_disable_ahci(pdev); | 632 | u8 tmp; |
630 | if (rc) | 633 | pci_read_config_byte(pdev, PIIX_SCC, &tmp); |
631 | return rc; | 634 | if (tmp == PIIX_AHCI_DEVICE) { |
635 | int rc = piix_disable_ahci(pdev); | ||
636 | if (rc) | ||
637 | return rc; | ||
638 | } | ||
632 | } | 639 | } |
633 | 640 | ||
634 | if (port_info[0]->host_flags & PIIX_FLAG_COMBINED) { | 641 | if (port_info[0]->host_flags & PIIX_FLAG_COMBINED) { |
diff --git a/drivers/serial/8250_pnp.c b/drivers/serial/8250_pnp.c index 18c58fb73899..6b321e82cafb 100644 --- a/drivers/serial/8250_pnp.c +++ b/drivers/serial/8250_pnp.c | |||
@@ -394,7 +394,7 @@ static int __devinit serial_pnp_guess_board(struct pnp_dev *dev, int *flags) | |||
394 | } | 394 | } |
395 | 395 | ||
396 | static int __devinit | 396 | static int __devinit |
397 | serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id) | 397 | serial_pnp_probe(struct pnp_dev *dev, const struct pnp_device_id *dev_id) |
398 | { | 398 | { |
399 | struct uart_port port; | 399 | struct uart_port port; |
400 | int ret, line, flags = dev_id->driver_data; | 400 | int ret, line, flags = dev_id->driver_data; |
@@ -406,15 +406,23 @@ serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id) | |||
406 | } | 406 | } |
407 | 407 | ||
408 | memset(&port, 0, sizeof(struct uart_port)); | 408 | memset(&port, 0, sizeof(struct uart_port)); |
409 | port.irq = pnp_irq(dev,0); | 409 | port.irq = pnp_irq(dev, 0); |
410 | port.iobase = pnp_port_start(dev, 0); | 410 | if (pnp_port_valid(dev, 0)) { |
411 | port.iobase = pnp_port_start(dev, 0); | ||
412 | port.iotype = UPIO_PORT; | ||
413 | } else if (pnp_mem_valid(dev, 0)) { | ||
414 | port.mapbase = pnp_mem_start(dev, 0); | ||
415 | port.iotype = UPIO_MEM; | ||
416 | port.flags = UPF_IOREMAP; | ||
417 | } else | ||
418 | return -ENODEV; | ||
411 | 419 | ||
412 | #ifdef SERIAL_DEBUG_PNP | 420 | #ifdef SERIAL_DEBUG_PNP |
413 | printk("Setup PNP port: port %x, irq %d, type %d\n", | 421 | printk("Setup PNP port: port %x, mem 0x%lx, irq %d, type %d\n", |
414 | port.iobase, port.irq, port.iotype); | 422 | port.iobase, port.mapbase, port.irq, port.iotype); |
415 | #endif | 423 | #endif |
416 | 424 | ||
417 | port.flags = UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; | 425 | port.flags |= UPF_SKIP_TEST | UPF_BOOT_AUTOCONF; |
418 | port.uartclk = 1843200; | 426 | port.uartclk = 1843200; |
419 | port.dev = &dev->dev; | 427 | port.dev = &dev->dev; |
420 | 428 | ||
@@ -426,7 +434,7 @@ serial_pnp_probe(struct pnp_dev * dev, const struct pnp_device_id *dev_id) | |||
426 | 434 | ||
427 | } | 435 | } |
428 | 436 | ||
429 | static void __devexit serial_pnp_remove(struct pnp_dev * dev) | 437 | static void __devexit serial_pnp_remove(struct pnp_dev *dev) |
430 | { | 438 | { |
431 | long line = (long)pnp_get_drvdata(dev); | 439 | long line = (long)pnp_get_drvdata(dev); |
432 | if (line) | 440 | if (line) |
diff --git a/drivers/usb/Kconfig b/drivers/usb/Kconfig index cd329dd7fb86..85dacc92545a 100644 --- a/drivers/usb/Kconfig +++ b/drivers/usb/Kconfig | |||
@@ -20,6 +20,7 @@ config USB_ARCH_HAS_OHCI | |||
20 | default y if SA1111 | 20 | default y if SA1111 |
21 | default y if ARCH_OMAP | 21 | default y if ARCH_OMAP |
22 | default y if ARCH_LH7A404 | 22 | default y if ARCH_LH7A404 |
23 | default y if ARCH_S3C2410 | ||
23 | default y if PXA27x | 24 | default y if PXA27x |
24 | # PPC: | 25 | # PPC: |
25 | default y if STB03xxx | 26 | default y if STB03xxx |
diff --git a/drivers/usb/class/cdc-acm.c b/drivers/usb/class/cdc-acm.c index adff5a77e31f..16ecad30e29c 100644 --- a/drivers/usb/class/cdc-acm.c +++ b/drivers/usb/class/cdc-acm.c | |||
@@ -980,6 +980,9 @@ static struct usb_device_id acm_ids[] = { | |||
980 | { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ | 980 | { USB_DEVICE(0x0870, 0x0001), /* Metricom GS Modem */ |
981 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | 981 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ |
982 | }, | 982 | }, |
983 | { USB_DEVICE(0x0482, 0x0203), /* KYOCERA AH-K3001V */ | ||
984 | .driver_info = NO_UNION_NORMAL, /* has no union descriptor */ | ||
985 | }, | ||
983 | /* control interfaces with various AT-command sets */ | 986 | /* control interfaces with various AT-command sets */ |
984 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, | 987 | { USB_INTERFACE_INFO(USB_CLASS_COMM, USB_CDC_SUBCLASS_ACM, |
985 | USB_CDC_ACM_PROTO_AT_V25TER) }, | 988 | USB_CDC_ACM_PROTO_AT_V25TER) }, |
diff --git a/drivers/usb/core/devio.c b/drivers/usb/core/devio.c index 787c27a63c51..f86bf1454e21 100644 --- a/drivers/usb/core/devio.c +++ b/drivers/usb/core/devio.c | |||
@@ -569,8 +569,11 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
569 | free_page((unsigned long)tbuf); | 569 | free_page((unsigned long)tbuf); |
570 | return -EINVAL; | 570 | return -EINVAL; |
571 | } | 571 | } |
572 | snoop(&dev->dev, "control read: bRequest=%02x bRrequestType=%02x wValue=%04x wIndex=%04x\n", | 572 | snoop(&dev->dev, "control read: bRequest=%02x " |
573 | ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, ctrl.wIndex); | 573 | "bRrequestType=%02x wValue=%04x " |
574 | "wIndex=%04x wLength=%04x\n", | ||
575 | ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, | ||
576 | ctrl.wIndex, ctrl.wLength); | ||
574 | 577 | ||
575 | usb_unlock_device(dev); | 578 | usb_unlock_device(dev); |
576 | i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType, | 579 | i = usb_control_msg(dev, usb_rcvctrlpipe(dev, 0), ctrl.bRequest, ctrl.bRequestType, |
@@ -579,11 +582,11 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
579 | if ((i > 0) && ctrl.wLength) { | 582 | if ((i > 0) && ctrl.wLength) { |
580 | if (usbfs_snoop) { | 583 | if (usbfs_snoop) { |
581 | dev_info(&dev->dev, "control read: data "); | 584 | dev_info(&dev->dev, "control read: data "); |
582 | for (j = 0; j < ctrl.wLength; ++j) | 585 | for (j = 0; j < i; ++j) |
583 | printk ("%02x ", (unsigned char)(tbuf)[j]); | 586 | printk ("%02x ", (unsigned char)(tbuf)[j]); |
584 | printk("\n"); | 587 | printk("\n"); |
585 | } | 588 | } |
586 | if (copy_to_user(ctrl.data, tbuf, ctrl.wLength)) { | 589 | if (copy_to_user(ctrl.data, tbuf, i)) { |
587 | free_page((unsigned long)tbuf); | 590 | free_page((unsigned long)tbuf); |
588 | return -EFAULT; | 591 | return -EFAULT; |
589 | } | 592 | } |
@@ -595,8 +598,11 @@ static int proc_control(struct dev_state *ps, void __user *arg) | |||
595 | return -EFAULT; | 598 | return -EFAULT; |
596 | } | 599 | } |
597 | } | 600 | } |
598 | snoop(&dev->dev, "control write: bRequest=%02x bRrequestType=%02x wValue=%04x wIndex=%04x\n", | 601 | snoop(&dev->dev, "control write: bRequest=%02x " |
599 | ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, ctrl.wIndex); | 602 | "bRrequestType=%02x wValue=%04x " |
603 | "wIndex=%04x wLength=%04x\n", | ||
604 | ctrl.bRequest, ctrl.bRequestType, ctrl.wValue, | ||
605 | ctrl.wIndex, ctrl.wLength); | ||
600 | if (usbfs_snoop) { | 606 | if (usbfs_snoop) { |
601 | dev_info(&dev->dev, "control write: data: "); | 607 | dev_info(&dev->dev, "control write: data: "); |
602 | for (j = 0; j < ctrl.wLength; ++j) | 608 | for (j = 0; j < ctrl.wLength; ++j) |
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index 8616356f55e8..79422a3b07bc 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -939,9 +939,9 @@ long usb_calc_bus_time (int speed, int is_input, int isoc, int bytecount) | |||
939 | case USB_SPEED_HIGH: /* ISOC or INTR */ | 939 | case USB_SPEED_HIGH: /* ISOC or INTR */ |
940 | // FIXME adjust for input vs output | 940 | // FIXME adjust for input vs output |
941 | if (isoc) | 941 | if (isoc) |
942 | tmp = HS_USECS (bytecount); | 942 | tmp = HS_NSECS_ISO (bytecount); |
943 | else | 943 | else |
944 | tmp = HS_USECS_ISO (bytecount); | 944 | tmp = HS_NSECS (bytecount); |
945 | return tmp; | 945 | return tmp; |
946 | default: | 946 | default: |
947 | pr_debug ("%s: bogus device speed!\n", usbcore_name); | 947 | pr_debug ("%s: bogus device speed!\n", usbcore_name); |
diff --git a/drivers/usb/core/hcd.h b/drivers/usb/core/hcd.h index 67db4a999b93..28055f95645b 100644 --- a/drivers/usb/core/hcd.h +++ b/drivers/usb/core/hcd.h | |||
@@ -334,17 +334,19 @@ extern void usb_release_bandwidth (struct usb_device *dev, struct urb *urb, | |||
334 | extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb); | 334 | extern int usb_check_bandwidth (struct usb_device *dev, struct urb *urb); |
335 | 335 | ||
336 | /* | 336 | /* |
337 | * Ceiling microseconds (typical) for that many bytes at high speed | 337 | * Ceiling [nano/micro]seconds (typical) for that many bytes at high speed |
338 | * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed | 338 | * ISO is a bit less, no ACK ... from USB 2.0 spec, 5.11.3 (and needed |
339 | * to preallocate bandwidth) | 339 | * to preallocate bandwidth) |
340 | */ | 340 | */ |
341 | #define USB2_HOST_DELAY 5 /* nsec, guess */ | 341 | #define USB2_HOST_DELAY 5 /* nsec, guess */ |
342 | #define HS_USECS(bytes) NS_TO_US ( ((55 * 8 * 2083)/1000) \ | 342 | #define HS_NSECS(bytes) ( ((55 * 8 * 2083)/1000) \ |
343 | + ((2083UL * (3167 + BitTime (bytes)))/1000) \ | 343 | + ((2083UL * (3167 + BitTime (bytes)))/1000) \ |
344 | + USB2_HOST_DELAY) | 344 | + USB2_HOST_DELAY) |
345 | #define HS_USECS_ISO(bytes) NS_TO_US ( ((38 * 8 * 2083)/1000) \ | 345 | #define HS_NSECS_ISO(bytes) ( ((38 * 8 * 2083)/1000) \ |
346 | + ((2083UL * (3167 + BitTime (bytes)))/1000) \ | 346 | + ((2083UL * (3167 + BitTime (bytes)))/1000) \ |
347 | + USB2_HOST_DELAY) | 347 | + USB2_HOST_DELAY) |
348 | #define HS_USECS(bytes) NS_TO_US (HS_NSECS(bytes)) | ||
349 | #define HS_USECS_ISO(bytes) NS_TO_US (HS_NSECS_ISO(bytes)) | ||
348 | 350 | ||
349 | extern long usb_calc_bus_time (int speed, int is_input, | 351 | extern long usb_calc_bus_time (int speed, int is_input, |
350 | int isoc, int bytecount); | 352 | int isoc, int bytecount); |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index a428ef479bd7..88d1b376f67c 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -985,8 +985,10 @@ void usb_disable_device(struct usb_device *dev, int skip_ep0) | |||
985 | for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { | 985 | for (i = 0; i < dev->actconfig->desc.bNumInterfaces; i++) { |
986 | struct usb_interface *interface; | 986 | struct usb_interface *interface; |
987 | 987 | ||
988 | /* remove this interface */ | 988 | /* remove this interface if it has been registered */ |
989 | interface = dev->actconfig->interface[i]; | 989 | interface = dev->actconfig->interface[i]; |
990 | if (!klist_node_attached(&interface->dev.knode_bus)) | ||
991 | continue; | ||
990 | dev_dbg (&dev->dev, "unregistering interface %s\n", | 992 | dev_dbg (&dev->dev, "unregistering interface %s\n", |
991 | interface->dev.bus_id); | 993 | interface->dev.bus_id); |
992 | usb_remove_sysfs_intf_files(interface); | 994 | usb_remove_sysfs_intf_files(interface); |
@@ -1439,7 +1441,7 @@ free_interfaces: | |||
1439 | } | 1441 | } |
1440 | } | 1442 | } |
1441 | 1443 | ||
1442 | return ret; | 1444 | return 0; |
1443 | } | 1445 | } |
1444 | 1446 | ||
1445 | // synchronous request completion model | 1447 | // synchronous request completion model |
diff --git a/drivers/usb/host/ehci-q.c b/drivers/usb/host/ehci-q.c index d74b2d68a50e..4f97a4ad1ed3 100644 --- a/drivers/usb/host/ehci-q.c +++ b/drivers/usb/host/ehci-q.c | |||
@@ -657,8 +657,8 @@ qh_make ( | |||
657 | * For control/bulk requests, the HC or TT handles these. | 657 | * For control/bulk requests, the HC or TT handles these. |
658 | */ | 658 | */ |
659 | if (type == PIPE_INTERRUPT) { | 659 | if (type == PIPE_INTERRUPT) { |
660 | qh->usecs = usb_calc_bus_time (USB_SPEED_HIGH, is_input, 0, | 660 | qh->usecs = NS_TO_US (usb_calc_bus_time (USB_SPEED_HIGH, is_input, 0, |
661 | hb_mult (maxp) * max_packet (maxp)); | 661 | hb_mult (maxp) * max_packet (maxp))); |
662 | qh->start = NO_FRAME; | 662 | qh->start = NO_FRAME; |
663 | 663 | ||
664 | if (urb->dev->speed == USB_SPEED_HIGH) { | 664 | if (urb->dev->speed == USB_SPEED_HIGH) { |
diff --git a/drivers/usb/host/ohci-hcd.c b/drivers/usb/host/ohci-hcd.c index 68decab280dd..56b43f2a0e52 100644 --- a/drivers/usb/host/ohci-hcd.c +++ b/drivers/usb/host/ohci-hcd.c | |||
@@ -887,6 +887,10 @@ MODULE_LICENSE ("GPL"); | |||
887 | #include "ohci-sa1111.c" | 887 | #include "ohci-sa1111.c" |
888 | #endif | 888 | #endif |
889 | 889 | ||
890 | #ifdef CONFIG_ARCH_S3C2410 | ||
891 | #include "ohci-s3c2410.c" | ||
892 | #endif | ||
893 | |||
890 | #ifdef CONFIG_ARCH_OMAP | 894 | #ifdef CONFIG_ARCH_OMAP |
891 | #include "ohci-omap.c" | 895 | #include "ohci-omap.c" |
892 | #endif | 896 | #endif |
@@ -909,6 +913,7 @@ MODULE_LICENSE ("GPL"); | |||
909 | 913 | ||
910 | #if !(defined(CONFIG_PCI) \ | 914 | #if !(defined(CONFIG_PCI) \ |
911 | || defined(CONFIG_SA1111) \ | 915 | || defined(CONFIG_SA1111) \ |
916 | || defined(CONFIG_ARCH_S3C2410) \ | ||
912 | || defined(CONFIG_ARCH_OMAP) \ | 917 | || defined(CONFIG_ARCH_OMAP) \ |
913 | || defined (CONFIG_ARCH_LH7A404) \ | 918 | || defined (CONFIG_ARCH_LH7A404) \ |
914 | || defined (CONFIG_PXA27x) \ | 919 | || defined (CONFIG_PXA27x) \ |
diff --git a/drivers/usb/host/ohci-s3c2410.c b/drivers/usb/host/ohci-s3c2410.c new file mode 100644 index 000000000000..e9401662503c --- /dev/null +++ b/drivers/usb/host/ohci-s3c2410.c | |||
@@ -0,0 +1,496 @@ | |||
1 | /* | ||
2 | * OHCI HCD (Host Controller Driver) for USB. | ||
3 | * | ||
4 | * (C) Copyright 1999 Roman Weissgaerber <weissg@vienna.at> | ||
5 | * (C) Copyright 2000-2002 David Brownell <dbrownell@users.sourceforge.net> | ||
6 | * (C) Copyright 2002 Hewlett-Packard Company | ||
7 | * | ||
8 | * USB Bus Glue for Samsung S3C2410 | ||
9 | * | ||
10 | * Written by Christopher Hoover <ch@hpl.hp.com> | ||
11 | * Based on fragments of previous driver by Rusell King et al. | ||
12 | * | ||
13 | * Modified for S3C2410 from ohci-sa1111.c, ohci-omap.c and ohci-lh7a40.c | ||
14 | * by Ben Dooks, <ben@simtec.co.uk> | ||
15 | * Copyright (C) 2004 Simtec Electronics | ||
16 | * | ||
17 | * Thanks to basprog@mail.ru for updates to newer kernels | ||
18 | * | ||
19 | * This file is licenced under the GPL. | ||
20 | */ | ||
21 | |||
22 | #include <asm/hardware.h> | ||
23 | #include <asm/mach-types.h> | ||
24 | #include <asm/hardware/clock.h> | ||
25 | #include <asm/arch/usb-control.h> | ||
26 | |||
27 | #define valid_port(idx) ((idx) == 1 || (idx) == 2) | ||
28 | |||
29 | /* clock device associated with the hcd */ | ||
30 | |||
31 | static struct clk *clk; | ||
32 | |||
33 | /* forward definitions */ | ||
34 | |||
35 | static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc); | ||
36 | |||
37 | /* conversion functions */ | ||
38 | |||
39 | struct s3c2410_hcd_info *to_s3c2410_info(struct usb_hcd *hcd) | ||
40 | { | ||
41 | return hcd->self.controller->platform_data; | ||
42 | } | ||
43 | |||
44 | static void s3c2410_start_hc(struct platform_device *dev, struct usb_hcd *hcd) | ||
45 | { | ||
46 | struct s3c2410_hcd_info *info = dev->dev.platform_data; | ||
47 | |||
48 | dev_dbg(&dev->dev, "s3c2410_start_hc:\n"); | ||
49 | clk_enable(clk); | ||
50 | |||
51 | if (info != NULL) { | ||
52 | info->hcd = hcd; | ||
53 | info->report_oc = s3c2410_hcd_oc; | ||
54 | |||
55 | if (info->enable_oc != NULL) { | ||
56 | (info->enable_oc)(info, 1); | ||
57 | } | ||
58 | } | ||
59 | } | ||
60 | |||
61 | static void s3c2410_stop_hc(struct platform_device *dev) | ||
62 | { | ||
63 | struct s3c2410_hcd_info *info = dev->dev.platform_data; | ||
64 | |||
65 | dev_dbg(&dev->dev, "s3c2410_stop_hc:\n"); | ||
66 | |||
67 | if (info != NULL) { | ||
68 | info->report_oc = NULL; | ||
69 | info->hcd = NULL; | ||
70 | |||
71 | if (info->enable_oc != NULL) { | ||
72 | (info->enable_oc)(info, 0); | ||
73 | } | ||
74 | } | ||
75 | |||
76 | clk_disable(clk); | ||
77 | } | ||
78 | |||
79 | /* ohci_s3c2410_hub_status_data | ||
80 | * | ||
81 | * update the status data from the hub with anything that | ||
82 | * has been detected by our system | ||
83 | */ | ||
84 | |||
85 | static int | ||
86 | ohci_s3c2410_hub_status_data (struct usb_hcd *hcd, char *buf) | ||
87 | { | ||
88 | struct s3c2410_hcd_info *info = to_s3c2410_info(hcd); | ||
89 | struct s3c2410_hcd_port *port; | ||
90 | int orig; | ||
91 | int portno; | ||
92 | |||
93 | orig = ohci_hub_status_data (hcd, buf); | ||
94 | |||
95 | if (info == NULL) | ||
96 | return orig; | ||
97 | |||
98 | port = &info->port[0]; | ||
99 | |||
100 | /* mark any changed port as changed */ | ||
101 | |||
102 | for (portno = 0; portno < 2; port++, portno++) { | ||
103 | if (port->oc_changed == 1 && | ||
104 | port->flags & S3C_HCDFLG_USED) { | ||
105 | dev_dbg(hcd->self.controller, | ||
106 | "oc change on port %d\n", portno); | ||
107 | |||
108 | if (orig < 1) | ||
109 | orig = 1; | ||
110 | |||
111 | buf[0] |= 1<<(portno+1); | ||
112 | } | ||
113 | } | ||
114 | |||
115 | return orig; | ||
116 | } | ||
117 | |||
118 | /* s3c2410_usb_set_power | ||
119 | * | ||
120 | * configure the power on a port, by calling the platform device | ||
121 | * routine registered with the platform device | ||
122 | */ | ||
123 | |||
124 | static void s3c2410_usb_set_power(struct s3c2410_hcd_info *info, | ||
125 | int port, int to) | ||
126 | { | ||
127 | if (info == NULL) | ||
128 | return; | ||
129 | |||
130 | if (info->power_control != NULL) { | ||
131 | info->port[port-1].power = to; | ||
132 | (info->power_control)(port, to); | ||
133 | } | ||
134 | } | ||
135 | |||
136 | /* ohci_s3c2410_hub_control | ||
137 | * | ||
138 | * look at control requests to the hub, and see if we need | ||
139 | * to take any action or over-ride the results from the | ||
140 | * request. | ||
141 | */ | ||
142 | |||
143 | static int ohci_s3c2410_hub_control ( | ||
144 | struct usb_hcd *hcd, | ||
145 | u16 typeReq, | ||
146 | u16 wValue, | ||
147 | u16 wIndex, | ||
148 | char *buf, | ||
149 | u16 wLength) | ||
150 | { | ||
151 | struct s3c2410_hcd_info *info = to_s3c2410_info(hcd); | ||
152 | struct usb_hub_descriptor *desc; | ||
153 | int ret = -EINVAL; | ||
154 | u32 *data = (u32 *)buf; | ||
155 | |||
156 | dev_dbg(hcd->self.controller, | ||
157 | "s3c2410_hub_control(%p,0x%04x,0x%04x,0x%04x,%p,%04x)\n", | ||
158 | hcd, typeReq, wValue, wIndex, buf, wLength); | ||
159 | |||
160 | /* if we are only an humble host without any special capabilites | ||
161 | * process the request straight away and exit */ | ||
162 | |||
163 | if (info == NULL) { | ||
164 | ret = ohci_hub_control(hcd, typeReq, wValue, | ||
165 | wIndex, buf, wLength); | ||
166 | goto out; | ||
167 | } | ||
168 | |||
169 | /* check the request to see if it needs handling */ | ||
170 | |||
171 | switch (typeReq) { | ||
172 | case SetPortFeature: | ||
173 | if (wValue == USB_PORT_FEAT_POWER) { | ||
174 | dev_dbg(hcd->self.controller, "SetPortFeat: POWER\n"); | ||
175 | s3c2410_usb_set_power(info, wIndex, 1); | ||
176 | goto out; | ||
177 | } | ||
178 | break; | ||
179 | |||
180 | case ClearPortFeature: | ||
181 | switch (wValue) { | ||
182 | case USB_PORT_FEAT_C_OVER_CURRENT: | ||
183 | dev_dbg(hcd->self.controller, | ||
184 | "ClearPortFeature: C_OVER_CURRENT\n"); | ||
185 | |||
186 | if (valid_port(wIndex)) { | ||
187 | info->port[wIndex-1].oc_changed = 0; | ||
188 | info->port[wIndex-1].oc_status = 0; | ||
189 | } | ||
190 | |||
191 | goto out; | ||
192 | |||
193 | case USB_PORT_FEAT_OVER_CURRENT: | ||
194 | dev_dbg(hcd->self.controller, | ||
195 | "ClearPortFeature: OVER_CURRENT\n"); | ||
196 | |||
197 | if (valid_port(wIndex)) { | ||
198 | info->port[wIndex-1].oc_status = 0; | ||
199 | } | ||
200 | |||
201 | goto out; | ||
202 | |||
203 | case USB_PORT_FEAT_POWER: | ||
204 | dev_dbg(hcd->self.controller, | ||
205 | "ClearPortFeature: POWER\n"); | ||
206 | |||
207 | if (valid_port(wIndex)) { | ||
208 | s3c2410_usb_set_power(info, wIndex, 0); | ||
209 | return 0; | ||
210 | } | ||
211 | } | ||
212 | break; | ||
213 | } | ||
214 | |||
215 | ret = ohci_hub_control(hcd, typeReq, wValue, wIndex, buf, wLength); | ||
216 | if (ret) | ||
217 | goto out; | ||
218 | |||
219 | switch (typeReq) { | ||
220 | case GetHubDescriptor: | ||
221 | |||
222 | /* update the hub's descriptor */ | ||
223 | |||
224 | desc = (struct usb_hub_descriptor *)buf; | ||
225 | |||
226 | if (info->power_control == NULL) | ||
227 | return ret; | ||
228 | |||
229 | dev_dbg(hcd->self.controller, "wHubCharacteristics 0x%04x\n", | ||
230 | desc->wHubCharacteristics); | ||
231 | |||
232 | /* remove the old configurations for power-switching, and | ||
233 | * over-current protection, and insert our new configuration | ||
234 | */ | ||
235 | |||
236 | desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_LPSM); | ||
237 | desc->wHubCharacteristics |= cpu_to_le16(0x0001); | ||
238 | |||
239 | if (info->enable_oc) { | ||
240 | desc->wHubCharacteristics &= ~cpu_to_le16(HUB_CHAR_OCPM); | ||
241 | desc->wHubCharacteristics |= cpu_to_le16(0x0008|0x0001); | ||
242 | } | ||
243 | |||
244 | dev_dbg(hcd->self.controller, "wHubCharacteristics after 0x%04x\n", | ||
245 | desc->wHubCharacteristics); | ||
246 | |||
247 | return ret; | ||
248 | |||
249 | case GetPortStatus: | ||
250 | /* check port status */ | ||
251 | |||
252 | dev_dbg(hcd->self.controller, "GetPortStatus(%d)\n", wIndex); | ||
253 | |||
254 | if (valid_port(wIndex)) { | ||
255 | if (info->port[wIndex-1].oc_changed) { | ||
256 | *data |= cpu_to_le32(RH_PS_OCIC); | ||
257 | } | ||
258 | |||
259 | if (info->port[wIndex-1].oc_status) { | ||
260 | *data |= cpu_to_le32(RH_PS_POCI); | ||
261 | } | ||
262 | } | ||
263 | } | ||
264 | |||
265 | out: | ||
266 | return ret; | ||
267 | } | ||
268 | |||
269 | /* s3c2410_hcd_oc | ||
270 | * | ||
271 | * handle an over-current report | ||
272 | */ | ||
273 | |||
274 | static void s3c2410_hcd_oc(struct s3c2410_hcd_info *info, int port_oc) | ||
275 | { | ||
276 | struct s3c2410_hcd_port *port; | ||
277 | struct usb_hcd *hcd; | ||
278 | unsigned long flags; | ||
279 | int portno; | ||
280 | |||
281 | if (info == NULL) | ||
282 | return; | ||
283 | |||
284 | port = &info->port[0]; | ||
285 | hcd = info->hcd; | ||
286 | |||
287 | local_irq_save(flags); | ||
288 | |||
289 | for (portno = 0; portno < 2; port++, portno++) { | ||
290 | if (port_oc & (1<<portno) && | ||
291 | port->flags & S3C_HCDFLG_USED) { | ||
292 | port->oc_status = 1; | ||
293 | port->oc_changed = 1; | ||
294 | |||
295 | /* ok, once over-current is detected, | ||
296 | the port needs to be powered down */ | ||
297 | s3c2410_usb_set_power(info, portno+1, 0); | ||
298 | } | ||
299 | } | ||
300 | |||
301 | local_irq_restore(flags); | ||
302 | } | ||
303 | |||
304 | /* may be called without controller electrically present */ | ||
305 | /* may be called with controller, bus, and devices active */ | ||
306 | |||
307 | /* | ||
308 | * usb_hcd_s3c2410_remove - shutdown processing for HCD | ||
309 | * @dev: USB Host Controller being removed | ||
310 | * Context: !in_interrupt() | ||
311 | * | ||
312 | * Reverses the effect of usb_hcd_3c2410_probe(), first invoking | ||
313 | * the HCD's stop() method. It is always called from a thread | ||
314 | * context, normally "rmmod", "apmd", or something similar. | ||
315 | * | ||
316 | */ | ||
317 | |||
318 | void usb_hcd_s3c2410_remove (struct usb_hcd *hcd, struct platform_device *dev) | ||
319 | { | ||
320 | usb_remove_hcd(hcd); | ||
321 | s3c2410_stop_hc(dev); | ||
322 | iounmap(hcd->regs); | ||
323 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
324 | usb_put_hcd(hcd); | ||
325 | } | ||
326 | |||
327 | /** | ||
328 | * usb_hcd_s3c2410_probe - initialize S3C2410-based HCDs | ||
329 | * Context: !in_interrupt() | ||
330 | * | ||
331 | * Allocates basic resources for this USB host controller, and | ||
332 | * then invokes the start() method for the HCD associated with it | ||
333 | * through the hotplug entry's driver_data. | ||
334 | * | ||
335 | */ | ||
336 | int usb_hcd_s3c2410_probe (const struct hc_driver *driver, | ||
337 | struct platform_device *dev) | ||
338 | { | ||
339 | struct usb_hcd *hcd = NULL; | ||
340 | int retval; | ||
341 | |||
342 | s3c2410_usb_set_power(dev->dev.platform_data, 0, 1); | ||
343 | s3c2410_usb_set_power(dev->dev.platform_data, 1, 1); | ||
344 | |||
345 | hcd = usb_create_hcd(driver, &dev->dev, "s3c24xx"); | ||
346 | if (hcd == NULL) | ||
347 | return -ENOMEM; | ||
348 | |||
349 | hcd->rsrc_start = dev->resource[0].start; | ||
350 | hcd->rsrc_len = dev->resource[0].end - dev->resource[0].start + 1; | ||
351 | |||
352 | if (!request_mem_region(hcd->rsrc_start, hcd->rsrc_len, hcd_name)) { | ||
353 | dev_err(&dev->dev, "request_mem_region failed"); | ||
354 | retval = -EBUSY; | ||
355 | goto err0; | ||
356 | } | ||
357 | |||
358 | clk = clk_get(NULL, "usb-host"); | ||
359 | if (IS_ERR(clk)) { | ||
360 | dev_err(&dev->dev, "cannot get usb-host clock\n"); | ||
361 | retval = -ENOENT; | ||
362 | goto err1; | ||
363 | } | ||
364 | |||
365 | clk_use(clk); | ||
366 | s3c2410_start_hc(dev, hcd); | ||
367 | |||
368 | hcd->regs = ioremap(hcd->rsrc_start, hcd->rsrc_len); | ||
369 | if (!hcd->regs) { | ||
370 | dev_err(&dev->dev, "ioremap failed\n"); | ||
371 | retval = -ENOMEM; | ||
372 | goto err2; | ||
373 | } | ||
374 | |||
375 | ohci_hcd_init(hcd_to_ohci(hcd)); | ||
376 | |||
377 | retval = usb_add_hcd(hcd, dev->resource[1].start, SA_INTERRUPT); | ||
378 | if (retval != 0) | ||
379 | goto err2; | ||
380 | |||
381 | return 0; | ||
382 | |||
383 | err2: | ||
384 | s3c2410_stop_hc(dev); | ||
385 | iounmap(hcd->regs); | ||
386 | clk_unuse(clk); | ||
387 | clk_put(clk); | ||
388 | |||
389 | err1: | ||
390 | release_mem_region(hcd->rsrc_start, hcd->rsrc_len); | ||
391 | |||
392 | err0: | ||
393 | usb_put_hcd(hcd); | ||
394 | return retval; | ||
395 | } | ||
396 | |||
397 | /*-------------------------------------------------------------------------*/ | ||
398 | |||
399 | static int | ||
400 | ohci_s3c2410_start (struct usb_hcd *hcd) | ||
401 | { | ||
402 | struct ohci_hcd *ohci = hcd_to_ohci (hcd); | ||
403 | int ret; | ||
404 | |||
405 | if ((ret = ohci_init(ohci)) < 0) | ||
406 | return ret; | ||
407 | |||
408 | if ((ret = ohci_run (ohci)) < 0) { | ||
409 | err ("can't start %s", hcd->self.bus_name); | ||
410 | ohci_stop (hcd); | ||
411 | return ret; | ||
412 | } | ||
413 | |||
414 | return 0; | ||
415 | } | ||
416 | |||
417 | |||
418 | static const struct hc_driver ohci_s3c2410_hc_driver = { | ||
419 | .description = hcd_name, | ||
420 | .product_desc = "S3C24XX OHCI", | ||
421 | .hcd_priv_size = sizeof(struct ohci_hcd), | ||
422 | |||
423 | /* | ||
424 | * generic hardware linkage | ||
425 | */ | ||
426 | .irq = ohci_irq, | ||
427 | .flags = HCD_USB11 | HCD_MEMORY, | ||
428 | |||
429 | /* | ||
430 | * basic lifecycle operations | ||
431 | */ | ||
432 | .start = ohci_s3c2410_start, | ||
433 | .stop = ohci_stop, | ||
434 | |||
435 | /* | ||
436 | * managing i/o requests and associated device resources | ||
437 | */ | ||
438 | .urb_enqueue = ohci_urb_enqueue, | ||
439 | .urb_dequeue = ohci_urb_dequeue, | ||
440 | .endpoint_disable = ohci_endpoint_disable, | ||
441 | |||
442 | /* | ||
443 | * scheduling support | ||
444 | */ | ||
445 | .get_frame_number = ohci_get_frame, | ||
446 | |||
447 | /* | ||
448 | * root hub support | ||
449 | */ | ||
450 | .hub_status_data = ohci_s3c2410_hub_status_data, | ||
451 | .hub_control = ohci_s3c2410_hub_control, | ||
452 | |||
453 | #if defined(CONFIG_USB_SUSPEND) && 0 | ||
454 | .hub_suspend = ohci_hub_suspend, | ||
455 | .hub_resume = ohci_hub_resume, | ||
456 | #endif | ||
457 | }; | ||
458 | |||
459 | /* device driver */ | ||
460 | |||
461 | static int ohci_hcd_s3c2410_drv_probe(struct device *dev) | ||
462 | { | ||
463 | struct platform_device *pdev = to_platform_device(dev); | ||
464 | return usb_hcd_s3c2410_probe(&ohci_s3c2410_hc_driver, pdev); | ||
465 | } | ||
466 | |||
467 | static int ohci_hcd_s3c2410_drv_remove(struct device *dev) | ||
468 | { | ||
469 | struct platform_device *pdev = to_platform_device(dev); | ||
470 | struct usb_hcd *hcd = dev_get_drvdata(dev); | ||
471 | |||
472 | usb_hcd_s3c2410_remove(hcd, pdev); | ||
473 | return 0; | ||
474 | } | ||
475 | |||
476 | static struct device_driver ohci_hcd_s3c2410_driver = { | ||
477 | .name = "s3c2410-ohci", | ||
478 | .bus = &platform_bus_type, | ||
479 | .probe = ohci_hcd_s3c2410_drv_probe, | ||
480 | .remove = ohci_hcd_s3c2410_drv_remove, | ||
481 | /*.suspend = ohci_hcd_s3c2410_drv_suspend, */ | ||
482 | /*.resume = ohci_hcd_s3c2410_drv_resume, */ | ||
483 | }; | ||
484 | |||
485 | static int __init ohci_hcd_s3c2410_init (void) | ||
486 | { | ||
487 | return driver_register(&ohci_hcd_s3c2410_driver); | ||
488 | } | ||
489 | |||
490 | static void __exit ohci_hcd_s3c2410_cleanup (void) | ||
491 | { | ||
492 | driver_unregister(&ohci_hcd_s3c2410_driver); | ||
493 | } | ||
494 | |||
495 | module_init (ohci_hcd_s3c2410_init); | ||
496 | module_exit (ohci_hcd_s3c2410_cleanup); | ||
diff --git a/drivers/usb/input/acecad.c b/drivers/usb/input/acecad.c index ebcf7c955800..13532f3e3efc 100644 --- a/drivers/usb/input/acecad.c +++ b/drivers/usb/input/acecad.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/module.h> | 31 | #include <linux/module.h> |
32 | #include <linux/init.h> | 32 | #include <linux/init.h> |
33 | #include <linux/usb.h> | 33 | #include <linux/usb.h> |
34 | #include <linux/usb_input.h> | ||
34 | 35 | ||
35 | /* | 36 | /* |
36 | * Version Information | 37 | * Version Information |
@@ -87,8 +88,8 @@ static void usb_acecad_irq(struct urb *urb, struct pt_regs *regs) | |||
87 | if (prox) { | 88 | if (prox) { |
88 | int x = data[1] | (data[2] << 8); | 89 | int x = data[1] | (data[2] << 8); |
89 | int y = data[3] | (data[4] << 8); | 90 | int y = data[3] | (data[4] << 8); |
90 | /*Pressure should compute the same way for flair and 302*/ | 91 | /* Pressure should compute the same way for flair and 302 */ |
91 | int pressure = data[5] | ((int)data[6] << 8); | 92 | int pressure = data[5] | (data[6] << 8); |
92 | int touch = data[0] & 0x01; | 93 | int touch = data[0] & 0x01; |
93 | int stylus = (data[0] & 0x10) >> 4; | 94 | int stylus = (data[0] & 0x10) >> 4; |
94 | int stylus2 = (data[0] & 0x20) >> 5; | 95 | int stylus2 = (data[0] & 0x20) >> 5; |
@@ -104,9 +105,9 @@ static void usb_acecad_irq(struct urb *urb, struct pt_regs *regs) | |||
104 | input_sync(dev); | 105 | input_sync(dev); |
105 | 106 | ||
106 | resubmit: | 107 | resubmit: |
107 | status = usb_submit_urb (urb, GFP_ATOMIC); | 108 | status = usb_submit_urb(urb, GFP_ATOMIC); |
108 | if (status) | 109 | if (status) |
109 | err ("can't resubmit intr, %s-%s/input0, status %d", | 110 | err("can't resubmit intr, %s-%s/input0, status %d", |
110 | acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status); | 111 | acecad->usbdev->bus->bus_name, acecad->usbdev->devpath, status); |
111 | } | 112 | } |
112 | 113 | ||
@@ -212,10 +213,7 @@ static int usb_acecad_probe(struct usb_interface *intf, const struct usb_device_ | |||
212 | 213 | ||
213 | acecad->dev.name = acecad->name; | 214 | acecad->dev.name = acecad->name; |
214 | acecad->dev.phys = acecad->phys; | 215 | acecad->dev.phys = acecad->phys; |
215 | acecad->dev.id.bustype = BUS_USB; | 216 | usb_to_input_id(dev, &acecad->dev.id); |
216 | acecad->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
217 | acecad->dev.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
218 | acecad->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
219 | acecad->dev.dev = &intf->dev; | 217 | acecad->dev.dev = &intf->dev; |
220 | 218 | ||
221 | usb_fill_int_urb(acecad->irq, dev, pipe, | 219 | usb_fill_int_urb(acecad->irq, dev, pipe, |
diff --git a/drivers/usb/input/aiptek.c b/drivers/usb/input/aiptek.c index 6bb0f25e8e93..cd0cbfe20723 100644 --- a/drivers/usb/input/aiptek.c +++ b/drivers/usb/input/aiptek.c | |||
@@ -77,6 +77,7 @@ | |||
77 | #include <linux/module.h> | 77 | #include <linux/module.h> |
78 | #include <linux/init.h> | 78 | #include <linux/init.h> |
79 | #include <linux/usb.h> | 79 | #include <linux/usb.h> |
80 | #include <linux/usb_input.h> | ||
80 | #include <linux/sched.h> | 81 | #include <linux/sched.h> |
81 | #include <asm/uaccess.h> | 82 | #include <asm/uaccess.h> |
82 | #include <asm/unaligned.h> | 83 | #include <asm/unaligned.h> |
@@ -2125,10 +2126,7 @@ aiptek_probe(struct usb_interface *intf, const struct usb_device_id *id) | |||
2125 | aiptek->inputdev.absflat[ABS_WHEEL] = 0; | 2126 | aiptek->inputdev.absflat[ABS_WHEEL] = 0; |
2126 | aiptek->inputdev.name = "Aiptek"; | 2127 | aiptek->inputdev.name = "Aiptek"; |
2127 | aiptek->inputdev.phys = aiptek->features.usbPath; | 2128 | aiptek->inputdev.phys = aiptek->features.usbPath; |
2128 | aiptek->inputdev.id.bustype = BUS_USB; | 2129 | usb_to_input_id(usbdev, &aiptek->inputdev.id); |
2129 | aiptek->inputdev.id.vendor = le16_to_cpu(usbdev->descriptor.idVendor); | ||
2130 | aiptek->inputdev.id.product = le16_to_cpu(usbdev->descriptor.idProduct); | ||
2131 | aiptek->inputdev.id.version = le16_to_cpu(usbdev->descriptor.bcdDevice); | ||
2132 | aiptek->inputdev.dev = &intf->dev; | 2130 | aiptek->inputdev.dev = &intf->dev; |
2133 | 2131 | ||
2134 | aiptek->usbdev = usbdev; | 2132 | aiptek->usbdev = usbdev; |
diff --git a/drivers/usb/input/ati_remote.c b/drivers/usb/input/ati_remote.c index 654ac454744d..fd99681ee483 100644 --- a/drivers/usb/input/ati_remote.c +++ b/drivers/usb/input/ati_remote.c | |||
@@ -94,6 +94,7 @@ | |||
94 | #include <linux/moduleparam.h> | 94 | #include <linux/moduleparam.h> |
95 | #include <linux/input.h> | 95 | #include <linux/input.h> |
96 | #include <linux/usb.h> | 96 | #include <linux/usb.h> |
97 | #include <linux/usb_input.h> | ||
97 | #include <linux/wait.h> | 98 | #include <linux/wait.h> |
98 | 99 | ||
99 | /* | 100 | /* |
@@ -635,11 +636,8 @@ static void ati_remote_input_init(struct ati_remote *ati_remote) | |||
635 | idev->name = ati_remote->name; | 636 | idev->name = ati_remote->name; |
636 | idev->phys = ati_remote->phys; | 637 | idev->phys = ati_remote->phys; |
637 | 638 | ||
638 | idev->id.bustype = BUS_USB; | 639 | usb_to_input_id(ati_remote->udev, &idev->id); |
639 | idev->id.vendor = le16_to_cpu(ati_remote->udev->descriptor.idVendor); | 640 | idev->dev = &ati_remote->udev->dev; |
640 | idev->id.product = le16_to_cpu(ati_remote->udev->descriptor.idProduct); | ||
641 | idev->id.version = le16_to_cpu(ati_remote->udev->descriptor.bcdDevice); | ||
642 | idev->dev = &(ati_remote->udev->dev); | ||
643 | } | 641 | } |
644 | 642 | ||
645 | static int ati_remote_initialize(struct ati_remote *ati_remote) | 643 | static int ati_remote_initialize(struct ati_remote *ati_remote) |
diff --git a/drivers/usb/input/hid-core.c b/drivers/usb/input/hid-core.c index 2350e7a5ad70..b2cb2b35892e 100644 --- a/drivers/usb/input/hid-core.c +++ b/drivers/usb/input/hid-core.c | |||
@@ -789,12 +789,12 @@ static __inline__ int search(__s32 *array, __s32 value, unsigned n) | |||
789 | return -1; | 789 | return -1; |
790 | } | 790 | } |
791 | 791 | ||
792 | static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs) | 792 | static void hid_process_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, int interrupt, struct pt_regs *regs) |
793 | { | 793 | { |
794 | hid_dump_input(usage, value); | 794 | hid_dump_input(usage, value); |
795 | if (hid->claimed & HID_CLAIMED_INPUT) | 795 | if (hid->claimed & HID_CLAIMED_INPUT) |
796 | hidinput_hid_event(hid, field, usage, value, regs); | 796 | hidinput_hid_event(hid, field, usage, value, regs); |
797 | if (hid->claimed & HID_CLAIMED_HIDDEV) | 797 | if (hid->claimed & HID_CLAIMED_HIDDEV && interrupt) |
798 | hiddev_hid_event(hid, field, usage, value, regs); | 798 | hiddev_hid_event(hid, field, usage, value, regs); |
799 | } | 799 | } |
800 | 800 | ||
@@ -804,7 +804,7 @@ static void hid_process_event(struct hid_device *hid, struct hid_field *field, s | |||
804 | * reporting to the layer). | 804 | * reporting to the layer). |
805 | */ | 805 | */ |
806 | 806 | ||
807 | static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, struct pt_regs *regs) | 807 | static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u8 *data, int interrupt, struct pt_regs *regs) |
808 | { | 808 | { |
809 | unsigned n; | 809 | unsigned n; |
810 | unsigned count = field->report_count; | 810 | unsigned count = field->report_count; |
@@ -831,19 +831,19 @@ static void hid_input_field(struct hid_device *hid, struct hid_field *field, __u | |||
831 | for (n = 0; n < count; n++) { | 831 | for (n = 0; n < count; n++) { |
832 | 832 | ||
833 | if (HID_MAIN_ITEM_VARIABLE & field->flags) { | 833 | if (HID_MAIN_ITEM_VARIABLE & field->flags) { |
834 | hid_process_event(hid, field, &field->usage[n], value[n], regs); | 834 | hid_process_event(hid, field, &field->usage[n], value[n], interrupt, regs); |
835 | continue; | 835 | continue; |
836 | } | 836 | } |
837 | 837 | ||
838 | if (field->value[n] >= min && field->value[n] <= max | 838 | if (field->value[n] >= min && field->value[n] <= max |
839 | && field->usage[field->value[n] - min].hid | 839 | && field->usage[field->value[n] - min].hid |
840 | && search(value, field->value[n], count)) | 840 | && search(value, field->value[n], count)) |
841 | hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, regs); | 841 | hid_process_event(hid, field, &field->usage[field->value[n] - min], 0, interrupt, regs); |
842 | 842 | ||
843 | if (value[n] >= min && value[n] <= max | 843 | if (value[n] >= min && value[n] <= max |
844 | && field->usage[value[n] - min].hid | 844 | && field->usage[value[n] - min].hid |
845 | && search(field->value, value[n], count)) | 845 | && search(field->value, value[n], count)) |
846 | hid_process_event(hid, field, &field->usage[value[n] - min], 1, regs); | 846 | hid_process_event(hid, field, &field->usage[value[n] - min], 1, interrupt, regs); |
847 | } | 847 | } |
848 | 848 | ||
849 | memcpy(field->value, value, count * sizeof(__s32)); | 849 | memcpy(field->value, value, count * sizeof(__s32)); |
@@ -851,7 +851,7 @@ exit: | |||
851 | kfree(value); | 851 | kfree(value); |
852 | } | 852 | } |
853 | 853 | ||
854 | static int hid_input_report(int type, struct urb *urb, struct pt_regs *regs) | 854 | static int hid_input_report(int type, struct urb *urb, int interrupt, struct pt_regs *regs) |
855 | { | 855 | { |
856 | struct hid_device *hid = urb->context; | 856 | struct hid_device *hid = urb->context; |
857 | struct hid_report_enum *report_enum = hid->report_enum + type; | 857 | struct hid_report_enum *report_enum = hid->report_enum + type; |
@@ -899,7 +899,7 @@ static int hid_input_report(int type, struct urb *urb, struct pt_regs *regs) | |||
899 | hiddev_report_event(hid, report); | 899 | hiddev_report_event(hid, report); |
900 | 900 | ||
901 | for (n = 0; n < report->maxfield; n++) | 901 | for (n = 0; n < report->maxfield; n++) |
902 | hid_input_field(hid, report->field[n], data, regs); | 902 | hid_input_field(hid, report->field[n], data, interrupt, regs); |
903 | 903 | ||
904 | if (hid->claimed & HID_CLAIMED_INPUT) | 904 | if (hid->claimed & HID_CLAIMED_INPUT) |
905 | hidinput_report_event(hid, report); | 905 | hidinput_report_event(hid, report); |
@@ -918,7 +918,7 @@ static void hid_irq_in(struct urb *urb, struct pt_regs *regs) | |||
918 | 918 | ||
919 | switch (urb->status) { | 919 | switch (urb->status) { |
920 | case 0: /* success */ | 920 | case 0: /* success */ |
921 | hid_input_report(HID_INPUT_REPORT, urb, regs); | 921 | hid_input_report(HID_INPUT_REPORT, urb, 1, regs); |
922 | break; | 922 | break; |
923 | case -ECONNRESET: /* unlink */ | 923 | case -ECONNRESET: /* unlink */ |
924 | case -ENOENT: | 924 | case -ENOENT: |
@@ -1142,7 +1142,7 @@ static void hid_ctrl(struct urb *urb, struct pt_regs *regs) | |||
1142 | switch (urb->status) { | 1142 | switch (urb->status) { |
1143 | case 0: /* success */ | 1143 | case 0: /* success */ |
1144 | if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN) | 1144 | if (hid->ctrl[hid->ctrltail].dir == USB_DIR_IN) |
1145 | hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, regs); | 1145 | hid_input_report(hid->ctrl[hid->ctrltail].report->type, urb, 0, regs); |
1146 | case -ESHUTDOWN: /* unplug */ | 1146 | case -ESHUTDOWN: /* unplug */ |
1147 | case -EILSEQ: /* unplug timectrl on uhci */ | 1147 | case -EILSEQ: /* unplug timectrl on uhci */ |
1148 | unplug = 1; | 1148 | unplug = 1; |
@@ -1372,6 +1372,9 @@ void hid_init_reports(struct hid_device *hid) | |||
1372 | #define USB_VENDOR_ID_A4TECH 0x09da | 1372 | #define USB_VENDOR_ID_A4TECH 0x09da |
1373 | #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 | 1373 | #define USB_DEVICE_ID_A4TECH_WCP32PU 0x0006 |
1374 | 1374 | ||
1375 | #define USB_VENDOR_ID_AASHIMA 0x06D6 | ||
1376 | #define USB_DEVICE_ID_AASHIMA_GAMEPAD 0x0025 | ||
1377 | |||
1375 | #define USB_VENDOR_ID_CYPRESS 0x04b4 | 1378 | #define USB_VENDOR_ID_CYPRESS 0x04b4 |
1376 | #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 | 1379 | #define USB_DEVICE_ID_CYPRESS_MOUSE 0x0001 |
1377 | #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 | 1380 | #define USB_DEVICE_ID_CYPRESS_HIDCOM 0x5500 |
@@ -1548,6 +1551,7 @@ static struct hid_blacklist { | |||
1548 | { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, | 1551 | { USB_VENDOR_ID_A4TECH, USB_DEVICE_ID_A4TECH_WCP32PU, HID_QUIRK_2WHEEL_MOUSE_HACK_7 }, |
1549 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 }, | 1552 | { USB_VENDOR_ID_CYPRESS, USB_DEVICE_ID_CYPRESS_MOUSE, HID_QUIRK_2WHEEL_MOUSE_HACK_5 }, |
1550 | 1553 | ||
1554 | { USB_VENDOR_ID_AASHIMA, USB_DEVICE_ID_AASHIMA_GAMEPAD, HID_QUIRK_BADPAD }, | ||
1551 | { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, | 1555 | { USB_VENDOR_ID_ALPS, USB_DEVICE_ID_IBM_GAMEPAD, HID_QUIRK_BADPAD }, |
1552 | { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, | 1556 | { USB_VENDOR_ID_CHIC, USB_DEVICE_ID_CHIC_GAMEPAD, HID_QUIRK_BADPAD }, |
1553 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, | 1557 | { USB_VENDOR_ID_HAPP, USB_DEVICE_ID_UGCI_DRIVING, HID_QUIRK_BADPAD | HID_QUIRK_MULTI_INPUT }, |
diff --git a/drivers/usb/input/hid-input.c b/drivers/usb/input/hid-input.c index 9ac1e9095334..63a4db721f7e 100644 --- a/drivers/usb/input/hid-input.c +++ b/drivers/usb/input/hid-input.c | |||
@@ -31,6 +31,7 @@ | |||
31 | #include <linux/kernel.h> | 31 | #include <linux/kernel.h> |
32 | #include <linux/input.h> | 32 | #include <linux/input.h> |
33 | #include <linux/usb.h> | 33 | #include <linux/usb.h> |
34 | #include <linux/usb_input.h> | ||
34 | 35 | ||
35 | #undef DEBUG | 36 | #undef DEBUG |
36 | 37 | ||
@@ -397,11 +398,12 @@ ignore: | |||
397 | 398 | ||
398 | void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs) | 399 | void hidinput_hid_event(struct hid_device *hid, struct hid_field *field, struct hid_usage *usage, __s32 value, struct pt_regs *regs) |
399 | { | 400 | { |
400 | struct input_dev *input = &field->hidinput->input; | 401 | struct input_dev *input; |
401 | int *quirks = &hid->quirks; | 402 | int *quirks = &hid->quirks; |
402 | 403 | ||
403 | if (!input) | 404 | if (!field->hidinput) |
404 | return; | 405 | return; |
406 | input = &field->hidinput->input; | ||
405 | 407 | ||
406 | input_regs(input, regs); | 408 | input_regs(input, regs); |
407 | 409 | ||
@@ -581,10 +583,7 @@ int hidinput_connect(struct hid_device *hid) | |||
581 | hidinput->input.name = hid->name; | 583 | hidinput->input.name = hid->name; |
582 | hidinput->input.phys = hid->phys; | 584 | hidinput->input.phys = hid->phys; |
583 | hidinput->input.uniq = hid->uniq; | 585 | hidinput->input.uniq = hid->uniq; |
584 | hidinput->input.id.bustype = BUS_USB; | 586 | usb_to_input_id(dev, &hidinput->input.id); |
585 | hidinput->input.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
586 | hidinput->input.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
587 | hidinput->input.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
588 | hidinput->input.dev = &hid->intf->dev; | 587 | hidinput->input.dev = &hid->intf->dev; |
589 | } | 588 | } |
590 | 589 | ||
diff --git a/drivers/usb/input/itmtouch.c b/drivers/usb/input/itmtouch.c index 47dec6a1b344..0dc439f10823 100644 --- a/drivers/usb/input/itmtouch.c +++ b/drivers/usb/input/itmtouch.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/module.h> | 53 | #include <linux/module.h> |
54 | #include <linux/init.h> | 54 | #include <linux/init.h> |
55 | #include <linux/usb.h> | 55 | #include <linux/usb.h> |
56 | #include <linux/usb_input.h> | ||
56 | 57 | ||
57 | /* only an 8 byte buffer necessary for a single packet */ | 58 | /* only an 8 byte buffer necessary for a single packet */ |
58 | #define ITM_BUFSIZE 8 | 59 | #define ITM_BUFSIZE 8 |
@@ -184,10 +185,7 @@ static int itmtouch_probe(struct usb_interface *intf, const struct usb_device_id | |||
184 | 185 | ||
185 | itmtouch->inputdev.name = itmtouch->name; | 186 | itmtouch->inputdev.name = itmtouch->name; |
186 | itmtouch->inputdev.phys = itmtouch->phys; | 187 | itmtouch->inputdev.phys = itmtouch->phys; |
187 | itmtouch->inputdev.id.bustype = BUS_USB; | 188 | usb_to_input_id(udev, &itmtouch->inputdev.id); |
188 | itmtouch->inputdev.id.vendor = udev->descriptor.idVendor; | ||
189 | itmtouch->inputdev.id.product = udev->descriptor.idProduct; | ||
190 | itmtouch->inputdev.id.version = udev->descriptor.bcdDevice; | ||
191 | itmtouch->inputdev.dev = &intf->dev; | 189 | itmtouch->inputdev.dev = &intf->dev; |
192 | 190 | ||
193 | if (!strlen(itmtouch->name)) | 191 | if (!strlen(itmtouch->name)) |
diff --git a/drivers/usb/input/kbtab.c b/drivers/usb/input/kbtab.c index d2f0f90a9bcd..b6f6ac8d9c2f 100644 --- a/drivers/usb/input/kbtab.c +++ b/drivers/usb/input/kbtab.c | |||
@@ -4,6 +4,7 @@ | |||
4 | #include <linux/module.h> | 4 | #include <linux/module.h> |
5 | #include <linux/init.h> | 5 | #include <linux/init.h> |
6 | #include <linux/usb.h> | 6 | #include <linux/usb.h> |
7 | #include <linux/usb_input.h> | ||
7 | #include <asm/unaligned.h> | 8 | #include <asm/unaligned.h> |
8 | #include <asm/byteorder.h> | 9 | #include <asm/byteorder.h> |
9 | 10 | ||
@@ -167,10 +168,7 @@ static int kbtab_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
167 | 168 | ||
168 | kbtab->dev.name = "KB Gear Tablet"; | 169 | kbtab->dev.name = "KB Gear Tablet"; |
169 | kbtab->dev.phys = kbtab->phys; | 170 | kbtab->dev.phys = kbtab->phys; |
170 | kbtab->dev.id.bustype = BUS_USB; | 171 | usb_to_input_id(dev, &kbtab->dev.id); |
171 | kbtab->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
172 | kbtab->dev.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
173 | kbtab->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
174 | kbtab->dev.dev = &intf->dev; | 172 | kbtab->dev.dev = &intf->dev; |
175 | kbtab->usbdev = dev; | 173 | kbtab->usbdev = dev; |
176 | 174 | ||
diff --git a/drivers/usb/input/mtouchusb.c b/drivers/usb/input/mtouchusb.c index 09b5cc7c66de..ff9275057a18 100644 --- a/drivers/usb/input/mtouchusb.c +++ b/drivers/usb/input/mtouchusb.c | |||
@@ -53,6 +53,7 @@ | |||
53 | #include <linux/module.h> | 53 | #include <linux/module.h> |
54 | #include <linux/init.h> | 54 | #include <linux/init.h> |
55 | #include <linux/usb.h> | 55 | #include <linux/usb.h> |
56 | #include <linux/usb_input.h> | ||
56 | 57 | ||
57 | #define MTOUCHUSB_MIN_XC 0x0 | 58 | #define MTOUCHUSB_MIN_XC 0x0 |
58 | #define MTOUCHUSB_MAX_RAW_XC 0x4000 | 59 | #define MTOUCHUSB_MAX_RAW_XC 0x4000 |
@@ -232,10 +233,7 @@ static int mtouchusb_probe(struct usb_interface *intf, const struct usb_device_i | |||
232 | 233 | ||
233 | mtouch->input.name = mtouch->name; | 234 | mtouch->input.name = mtouch->name; |
234 | mtouch->input.phys = mtouch->phys; | 235 | mtouch->input.phys = mtouch->phys; |
235 | mtouch->input.id.bustype = BUS_USB; | 236 | usb_to_input_id(udev, &mtouch->input.id); |
236 | mtouch->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor); | ||
237 | mtouch->input.id.product = le16_to_cpu(udev->descriptor.idProduct); | ||
238 | mtouch->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice); | ||
239 | mtouch->input.dev = &intf->dev; | 237 | mtouch->input.dev = &intf->dev; |
240 | 238 | ||
241 | mtouch->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | 239 | mtouch->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); |
diff --git a/drivers/usb/input/powermate.c b/drivers/usb/input/powermate.c index 3975b309d55f..ad4afe7e5897 100644 --- a/drivers/usb/input/powermate.c +++ b/drivers/usb/input/powermate.c | |||
@@ -35,6 +35,7 @@ | |||
35 | #include <linux/init.h> | 35 | #include <linux/init.h> |
36 | #include <linux/spinlock.h> | 36 | #include <linux/spinlock.h> |
37 | #include <linux/usb.h> | 37 | #include <linux/usb.h> |
38 | #include <linux/usb_input.h> | ||
38 | 39 | ||
39 | #define POWERMATE_VENDOR 0x077d /* Griffin Technology, Inc. */ | 40 | #define POWERMATE_VENDOR 0x077d /* Griffin Technology, Inc. */ |
40 | #define POWERMATE_PRODUCT_NEW 0x0410 /* Griffin PowerMate */ | 41 | #define POWERMATE_PRODUCT_NEW 0x0410 /* Griffin PowerMate */ |
@@ -389,10 +390,7 @@ static int powermate_probe(struct usb_interface *intf, const struct usb_device_i | |||
389 | pm->input.keybit[LONG(BTN_0)] = BIT(BTN_0); | 390 | pm->input.keybit[LONG(BTN_0)] = BIT(BTN_0); |
390 | pm->input.relbit[LONG(REL_DIAL)] = BIT(REL_DIAL); | 391 | pm->input.relbit[LONG(REL_DIAL)] = BIT(REL_DIAL); |
391 | pm->input.mscbit[LONG(MSC_PULSELED)] = BIT(MSC_PULSELED); | 392 | pm->input.mscbit[LONG(MSC_PULSELED)] = BIT(MSC_PULSELED); |
392 | pm->input.id.bustype = BUS_USB; | 393 | usb_to_input_id(udev, &pm->input.id); |
393 | pm->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor); | ||
394 | pm->input.id.product = le16_to_cpu(udev->descriptor.idProduct); | ||
395 | pm->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice); | ||
396 | pm->input.event = powermate_input_event; | 394 | pm->input.event = powermate_input_event; |
397 | pm->input.dev = &intf->dev; | 395 | pm->input.dev = &intf->dev; |
398 | pm->input.phys = pm->phys; | 396 | pm->input.phys = pm->phys; |
diff --git a/drivers/usb/input/touchkitusb.c b/drivers/usb/input/touchkitusb.c index 386595ee21c0..4276c24a5080 100644 --- a/drivers/usb/input/touchkitusb.c +++ b/drivers/usb/input/touchkitusb.c | |||
@@ -35,7 +35,7 @@ | |||
35 | #define DEBUG | 35 | #define DEBUG |
36 | #endif | 36 | #endif |
37 | #include <linux/usb.h> | 37 | #include <linux/usb.h> |
38 | 38 | #include <linux/usb_input.h> | |
39 | 39 | ||
40 | #define TOUCHKIT_MIN_XC 0x0 | 40 | #define TOUCHKIT_MIN_XC 0x0 |
41 | #define TOUCHKIT_MAX_XC 0x07ff | 41 | #define TOUCHKIT_MAX_XC 0x07ff |
@@ -202,10 +202,7 @@ static int touchkit_probe(struct usb_interface *intf, | |||
202 | 202 | ||
203 | touchkit->input.name = touchkit->name; | 203 | touchkit->input.name = touchkit->name; |
204 | touchkit->input.phys = touchkit->phys; | 204 | touchkit->input.phys = touchkit->phys; |
205 | touchkit->input.id.bustype = BUS_USB; | 205 | usb_to_input_id(udev, &touchkit->input.id); |
206 | touchkit->input.id.vendor = le16_to_cpu(udev->descriptor.idVendor); | ||
207 | touchkit->input.id.product = le16_to_cpu(udev->descriptor.idProduct); | ||
208 | touchkit->input.id.version = le16_to_cpu(udev->descriptor.bcdDevice); | ||
209 | touchkit->input.dev = &intf->dev; | 206 | touchkit->input.dev = &intf->dev; |
210 | 207 | ||
211 | touchkit->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); | 208 | touchkit->input.evbit[0] = BIT(EV_KEY) | BIT(EV_ABS); |
diff --git a/drivers/usb/input/usbkbd.c b/drivers/usb/input/usbkbd.c index f35db1974c42..28987f15eeee 100644 --- a/drivers/usb/input/usbkbd.c +++ b/drivers/usb/input/usbkbd.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/input.h> | 32 | #include <linux/input.h> |
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
34 | #include <linux/usb.h> | 34 | #include <linux/usb.h> |
35 | #include <linux/usb_input.h> | ||
35 | 36 | ||
36 | /* | 37 | /* |
37 | * Version Information | 38 | * Version Information |
@@ -288,10 +289,7 @@ static int usb_kbd_probe(struct usb_interface *iface, | |||
288 | 289 | ||
289 | kbd->dev.name = kbd->name; | 290 | kbd->dev.name = kbd->name; |
290 | kbd->dev.phys = kbd->phys; | 291 | kbd->dev.phys = kbd->phys; |
291 | kbd->dev.id.bustype = BUS_USB; | 292 | usb_to_input_id(dev, &kbd->dev.id); |
292 | kbd->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
293 | kbd->dev.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
294 | kbd->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
295 | kbd->dev.dev = &iface->dev; | 293 | kbd->dev.dev = &iface->dev; |
296 | 294 | ||
297 | if (dev->manufacturer) | 295 | if (dev->manufacturer) |
diff --git a/drivers/usb/input/usbmouse.c b/drivers/usb/input/usbmouse.c index 1ec41b5effe6..4104dec847fb 100644 --- a/drivers/usb/input/usbmouse.c +++ b/drivers/usb/input/usbmouse.c | |||
@@ -32,6 +32,7 @@ | |||
32 | #include <linux/module.h> | 32 | #include <linux/module.h> |
33 | #include <linux/init.h> | 33 | #include <linux/init.h> |
34 | #include <linux/usb.h> | 34 | #include <linux/usb.h> |
35 | #include <linux/usb_input.h> | ||
35 | 36 | ||
36 | /* | 37 | /* |
37 | * Version Information | 38 | * Version Information |
@@ -171,10 +172,7 @@ static int usb_mouse_probe(struct usb_interface * intf, const struct usb_device_ | |||
171 | 172 | ||
172 | mouse->dev.name = mouse->name; | 173 | mouse->dev.name = mouse->name; |
173 | mouse->dev.phys = mouse->phys; | 174 | mouse->dev.phys = mouse->phys; |
174 | mouse->dev.id.bustype = BUS_USB; | 175 | usb_to_input_id(dev, &mouse->dev.id); |
175 | mouse->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
176 | mouse->dev.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
177 | mouse->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
178 | mouse->dev.dev = &intf->dev; | 176 | mouse->dev.dev = &intf->dev; |
179 | 177 | ||
180 | if (dev->manufacturer) | 178 | if (dev->manufacturer) |
diff --git a/drivers/usb/input/wacom.c b/drivers/usb/input/wacom.c index f6b34af66b3d..02412e31a46b 100644 --- a/drivers/usb/input/wacom.c +++ b/drivers/usb/input/wacom.c | |||
@@ -69,6 +69,7 @@ | |||
69 | #include <linux/module.h> | 69 | #include <linux/module.h> |
70 | #include <linux/init.h> | 70 | #include <linux/init.h> |
71 | #include <linux/usb.h> | 71 | #include <linux/usb.h> |
72 | #include <linux/usb_input.h> | ||
72 | #include <asm/unaligned.h> | 73 | #include <asm/unaligned.h> |
73 | #include <asm/byteorder.h> | 74 | #include <asm/byteorder.h> |
74 | 75 | ||
@@ -823,10 +824,7 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i | |||
823 | 824 | ||
824 | wacom->dev.name = wacom->features->name; | 825 | wacom->dev.name = wacom->features->name; |
825 | wacom->dev.phys = wacom->phys; | 826 | wacom->dev.phys = wacom->phys; |
826 | wacom->dev.id.bustype = BUS_USB; | 827 | usb_to_input_id(dev, &wacom->dev.id); |
827 | wacom->dev.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
828 | wacom->dev.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
829 | wacom->dev.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
830 | wacom->dev.dev = &intf->dev; | 828 | wacom->dev.dev = &intf->dev; |
831 | wacom->usbdev = dev; | 829 | wacom->usbdev = dev; |
832 | 830 | ||
diff --git a/drivers/usb/input/xpad.c b/drivers/usb/input/xpad.c index a7fa1b17dcfe..18125e0bffa2 100644 --- a/drivers/usb/input/xpad.c +++ b/drivers/usb/input/xpad.c | |||
@@ -62,6 +62,7 @@ | |||
62 | #include <linux/module.h> | 62 | #include <linux/module.h> |
63 | #include <linux/smp_lock.h> | 63 | #include <linux/smp_lock.h> |
64 | #include <linux/usb.h> | 64 | #include <linux/usb.h> |
65 | #include <linux/usb_input.h> | ||
65 | 66 | ||
66 | #define DRIVER_VERSION "v0.0.5" | 67 | #define DRIVER_VERSION "v0.0.5" |
67 | #define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" | 68 | #define DRIVER_AUTHOR "Marko Friedemann <mfr@bmx-chemnitz.de>" |
@@ -256,10 +257,7 @@ static int xpad_probe(struct usb_interface *intf, const struct usb_device_id *id | |||
256 | 257 | ||
257 | xpad->udev = udev; | 258 | xpad->udev = udev; |
258 | 259 | ||
259 | xpad->dev.id.bustype = BUS_USB; | 260 | usb_to_input_id(udev, &xpad->dev.id); |
260 | xpad->dev.id.vendor = le16_to_cpu(udev->descriptor.idVendor); | ||
261 | xpad->dev.id.product = le16_to_cpu(udev->descriptor.idProduct); | ||
262 | xpad->dev.id.version = le16_to_cpu(udev->descriptor.bcdDevice); | ||
263 | xpad->dev.dev = &intf->dev; | 261 | xpad->dev.dev = &intf->dev; |
264 | xpad->dev.private = xpad; | 262 | xpad->dev.private = xpad; |
265 | xpad->dev.name = xpad_device[i].name; | 263 | xpad->dev.name = xpad_device[i].name; |
diff --git a/drivers/usb/media/konicawc.c b/drivers/usb/media/konicawc.c index 08521a2b4f3d..20ac9e1069d4 100644 --- a/drivers/usb/media/konicawc.c +++ b/drivers/usb/media/konicawc.c | |||
@@ -16,6 +16,7 @@ | |||
16 | #include <linux/module.h> | 16 | #include <linux/module.h> |
17 | #include <linux/init.h> | 17 | #include <linux/init.h> |
18 | #include <linux/input.h> | 18 | #include <linux/input.h> |
19 | #include <linux/usb_input.h> | ||
19 | 20 | ||
20 | #include "usbvideo.h" | 21 | #include "usbvideo.h" |
21 | 22 | ||
@@ -845,10 +846,7 @@ static int konicawc_probe(struct usb_interface *intf, const struct usb_device_id | |||
845 | cam->input.private = cam; | 846 | cam->input.private = cam; |
846 | cam->input.evbit[0] = BIT(EV_KEY); | 847 | cam->input.evbit[0] = BIT(EV_KEY); |
847 | cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0); | 848 | cam->input.keybit[LONG(BTN_0)] = BIT(BTN_0); |
848 | cam->input.id.bustype = BUS_USB; | 849 | usb_to_input_id(dev, &cam->input.id); |
849 | cam->input.id.vendor = le16_to_cpu(dev->descriptor.idVendor); | ||
850 | cam->input.id.product = le16_to_cpu(dev->descriptor.idProduct); | ||
851 | cam->input.id.version = le16_to_cpu(dev->descriptor.bcdDevice); | ||
852 | input_register_device(&cam->input); | 850 | input_register_device(&cam->input); |
853 | 851 | ||
854 | usb_make_path(dev, cam->input_physname, 56); | 852 | usb_make_path(dev, cam->input_physname, 56); |
diff --git a/drivers/usb/misc/ldusb.c b/drivers/usb/misc/ldusb.c index 66ec88354b93..ad17892aac9e 100644 --- a/drivers/usb/misc/ldusb.c +++ b/drivers/usb/misc/ldusb.c | |||
@@ -23,6 +23,7 @@ | |||
23 | * | 23 | * |
24 | * V0.1 (mh) Initial version | 24 | * V0.1 (mh) Initial version |
25 | * V0.11 (mh) Added raw support for HID 1.0 devices (no interrupt out endpoint) | 25 | * V0.11 (mh) Added raw support for HID 1.0 devices (no interrupt out endpoint) |
26 | * V0.12 (mh) Added kmalloc check for string buffer | ||
26 | */ | 27 | */ |
27 | 28 | ||
28 | #include <linux/config.h> | 29 | #include <linux/config.h> |
@@ -84,7 +85,7 @@ static struct usb_device_id ld_usb_table [] = { | |||
84 | { } /* Terminating entry */ | 85 | { } /* Terminating entry */ |
85 | }; | 86 | }; |
86 | MODULE_DEVICE_TABLE(usb, ld_usb_table); | 87 | MODULE_DEVICE_TABLE(usb, ld_usb_table); |
87 | MODULE_VERSION("V0.11"); | 88 | MODULE_VERSION("V0.12"); |
88 | MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>"); | 89 | MODULE_AUTHOR("Michael Hund <mhund@ld-didactic.de>"); |
89 | MODULE_DESCRIPTION("LD USB Driver"); | 90 | MODULE_DESCRIPTION("LD USB Driver"); |
90 | MODULE_LICENSE("GPL"); | 91 | MODULE_LICENSE("GPL"); |
@@ -635,6 +636,10 @@ static int ld_usb_probe(struct usb_interface *intf, const struct usb_device_id * | |||
635 | (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_COM3LAB)) && | 636 | (le16_to_cpu(udev->descriptor.idProduct) == USB_DEVICE_ID_COM3LAB)) && |
636 | (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) { | 637 | (le16_to_cpu(udev->descriptor.bcdDevice) <= 0x103)) { |
637 | buffer = kmalloc(256, GFP_KERNEL); | 638 | buffer = kmalloc(256, GFP_KERNEL); |
639 | if (buffer == NULL) { | ||
640 | dev_err(&intf->dev, "Couldn't allocate string buffer\n"); | ||
641 | goto error; | ||
642 | } | ||
638 | /* usb_string makes SETUP+STALL to leave always ControlReadLoop */ | 643 | /* usb_string makes SETUP+STALL to leave always ControlReadLoop */ |
639 | usb_string(udev, 255, buffer, 256); | 644 | usb_string(udev, 255, buffer, 256); |
640 | kfree(buffer); | 645 | kfree(buffer); |
diff --git a/drivers/usb/net/pegasus.c b/drivers/usb/net/pegasus.c index 5f4496d8dbac..fcd6d3ccef44 100644 --- a/drivers/usb/net/pegasus.c +++ b/drivers/usb/net/pegasus.c | |||
@@ -59,7 +59,6 @@ static const char driver_name[] = "pegasus"; | |||
59 | 59 | ||
60 | static int loopback = 0; | 60 | static int loopback = 0; |
61 | static int mii_mode = 0; | 61 | static int mii_mode = 0; |
62 | static int multicast_filter_limit = 32; | ||
63 | 62 | ||
64 | static struct usb_eth_dev usb_dev_id[] = { | 63 | static struct usb_eth_dev usb_dev_id[] = { |
65 | #define PEGASUS_DEV(pn, vid, pid, flags) \ | 64 | #define PEGASUS_DEV(pn, vid, pid, flags) \ |
diff --git a/drivers/usb/net/rtl8150.c b/drivers/usb/net/rtl8150.c index 626b016addff..59ab40ebb394 100644 --- a/drivers/usb/net/rtl8150.c +++ b/drivers/usb/net/rtl8150.c | |||
@@ -167,8 +167,6 @@ struct rtl8150 { | |||
167 | 167 | ||
168 | typedef struct rtl8150 rtl8150_t; | 168 | typedef struct rtl8150 rtl8150_t; |
169 | 169 | ||
170 | static unsigned long multicast_filter_limit = 32; | ||
171 | |||
172 | static void fill_skb_pool(rtl8150_t *); | 170 | static void fill_skb_pool(rtl8150_t *); |
173 | static void free_skb_pool(rtl8150_t *); | 171 | static void free_skb_pool(rtl8150_t *); |
174 | static inline struct sk_buff *pull_skb(rtl8150_t *); | 172 | static inline struct sk_buff *pull_skb(rtl8150_t *); |
diff --git a/drivers/usb/net/zd1201.c b/drivers/usb/net/zd1201.c index 3b387b005739..29cd801eb958 100644 --- a/drivers/usb/net/zd1201.c +++ b/drivers/usb/net/zd1201.c | |||
@@ -29,6 +29,7 @@ static struct usb_device_id zd1201_table[] = { | |||
29 | {USB_DEVICE(0x0ace, 0x1201)}, /* ZyDAS ZD1201 Wireless USB Adapter */ | 29 | {USB_DEVICE(0x0ace, 0x1201)}, /* ZyDAS ZD1201 Wireless USB Adapter */ |
30 | {USB_DEVICE(0x050d, 0x6051)}, /* Belkin F5D6051 usb adapter */ | 30 | {USB_DEVICE(0x050d, 0x6051)}, /* Belkin F5D6051 usb adapter */ |
31 | {USB_DEVICE(0x0db0, 0x6823)}, /* MSI UB11B usb adapter */ | 31 | {USB_DEVICE(0x0db0, 0x6823)}, /* MSI UB11B usb adapter */ |
32 | {USB_DEVICE(0x1044, 0x8005)}, /* GIGABYTE GN-WLBZ201 usb adapter */ | ||
32 | {} | 33 | {} |
33 | }; | 34 | }; |
34 | 35 | ||
diff --git a/drivers/usb/serial/ftdi_sio.c b/drivers/usb/serial/ftdi_sio.c index 0b03ddab53d9..d1964a0c4168 100644 --- a/drivers/usb/serial/ftdi_sio.c +++ b/drivers/usb/serial/ftdi_sio.c | |||
@@ -429,6 +429,9 @@ static struct usb_device_id id_table_combined [] = { | |||
429 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, | 429 | { USB_DEVICE(FTDI_VID, FTDI_4N_GALAXY_DE_2_PID) }, |
430 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, | 430 | { USB_DEVICE(MOBILITY_VID, MOBILITY_USB_SERIAL_PID) }, |
431 | { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, | 431 | { USB_DEVICE(FTDI_VID, FTDI_ACTIVE_ROBOTS_PID) }, |
432 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y6_PID) }, | ||
433 | { USB_DEVICE(FTDI_VID, FTDI_MHAM_Y8_PID) }, | ||
434 | { USB_DEVICE(EVOLUTION_VID, EVOLUTION_ER1_PID) }, | ||
432 | { } /* Terminating entry */ | 435 | { } /* Terminating entry */ |
433 | }; | 436 | }; |
434 | 437 | ||
@@ -545,6 +548,7 @@ static struct usb_serial_device_type ftdi_sio_device = { | |||
545 | 548 | ||
546 | 549 | ||
547 | #define WDR_TIMEOUT 5000 /* default urb timeout */ | 550 | #define WDR_TIMEOUT 5000 /* default urb timeout */ |
551 | #define WDR_SHORT_TIMEOUT 1000 /* shorter urb timeout */ | ||
548 | 552 | ||
549 | /* High and low are for DTR, RTS etc etc */ | 553 | /* High and low are for DTR, RTS etc etc */ |
550 | #define HIGH 1 | 554 | #define HIGH 1 |
@@ -593,62 +597,59 @@ static __u32 ftdi_232bm_baud_to_divisor(int baud) | |||
593 | return(ftdi_232bm_baud_base_to_divisor(baud, 48000000)); | 597 | return(ftdi_232bm_baud_base_to_divisor(baud, 48000000)); |
594 | } | 598 | } |
595 | 599 | ||
596 | static int set_rts(struct usb_serial_port *port, int high_or_low) | 600 | #define set_mctrl(port, set) update_mctrl((port), (set), 0) |
601 | #define clear_mctrl(port, clear) update_mctrl((port), 0, (clear)) | ||
602 | |||
603 | static int update_mctrl(struct usb_serial_port *port, unsigned int set, unsigned int clear) | ||
597 | { | 604 | { |
598 | struct ftdi_private *priv = usb_get_serial_port_data(port); | 605 | struct ftdi_private *priv = usb_get_serial_port_data(port); |
599 | char *buf; | 606 | char *buf; |
600 | unsigned ftdi_high_or_low; | 607 | unsigned urb_value; |
601 | int rv; | 608 | int rv; |
602 | |||
603 | buf = kmalloc(1, GFP_NOIO); | ||
604 | if (!buf) | ||
605 | return -ENOMEM; | ||
606 | |||
607 | if (high_or_low) { | ||
608 | ftdi_high_or_low = FTDI_SIO_SET_RTS_HIGH; | ||
609 | priv->last_dtr_rts |= TIOCM_RTS; | ||
610 | } else { | ||
611 | ftdi_high_or_low = FTDI_SIO_SET_RTS_LOW; | ||
612 | priv->last_dtr_rts &= ~TIOCM_RTS; | ||
613 | } | ||
614 | rv = usb_control_msg(port->serial->dev, | ||
615 | usb_sndctrlpipe(port->serial->dev, 0), | ||
616 | FTDI_SIO_SET_MODEM_CTRL_REQUEST, | ||
617 | FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, | ||
618 | ftdi_high_or_low, priv->interface, | ||
619 | buf, 0, WDR_TIMEOUT); | ||
620 | |||
621 | kfree(buf); | ||
622 | return rv; | ||
623 | } | ||
624 | 609 | ||
610 | if (((set | clear) & (TIOCM_DTR | TIOCM_RTS)) == 0) { | ||
611 | dbg("%s - DTR|RTS not being set|cleared", __FUNCTION__); | ||
612 | return 0; /* no change */ | ||
613 | } | ||
625 | 614 | ||
626 | static int set_dtr(struct usb_serial_port *port, int high_or_low) | ||
627 | { | ||
628 | struct ftdi_private *priv = usb_get_serial_port_data(port); | ||
629 | char *buf; | ||
630 | unsigned ftdi_high_or_low; | ||
631 | int rv; | ||
632 | |||
633 | buf = kmalloc(1, GFP_NOIO); | 615 | buf = kmalloc(1, GFP_NOIO); |
634 | if (!buf) | 616 | if (!buf) { |
635 | return -ENOMEM; | 617 | return -ENOMEM; |
636 | |||
637 | if (high_or_low) { | ||
638 | ftdi_high_or_low = FTDI_SIO_SET_DTR_HIGH; | ||
639 | priv->last_dtr_rts |= TIOCM_DTR; | ||
640 | } else { | ||
641 | ftdi_high_or_low = FTDI_SIO_SET_DTR_LOW; | ||
642 | priv->last_dtr_rts &= ~TIOCM_DTR; | ||
643 | } | 618 | } |
619 | |||
620 | clear &= ~set; /* 'set' takes precedence over 'clear' */ | ||
621 | urb_value = 0; | ||
622 | if (clear & TIOCM_DTR) | ||
623 | urb_value |= FTDI_SIO_SET_DTR_LOW; | ||
624 | if (clear & TIOCM_RTS) | ||
625 | urb_value |= FTDI_SIO_SET_RTS_LOW; | ||
626 | if (set & TIOCM_DTR) | ||
627 | urb_value |= FTDI_SIO_SET_DTR_HIGH; | ||
628 | if (set & TIOCM_RTS) | ||
629 | urb_value |= FTDI_SIO_SET_RTS_HIGH; | ||
644 | rv = usb_control_msg(port->serial->dev, | 630 | rv = usb_control_msg(port->serial->dev, |
645 | usb_sndctrlpipe(port->serial->dev, 0), | 631 | usb_sndctrlpipe(port->serial->dev, 0), |
646 | FTDI_SIO_SET_MODEM_CTRL_REQUEST, | 632 | FTDI_SIO_SET_MODEM_CTRL_REQUEST, |
647 | FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, | 633 | FTDI_SIO_SET_MODEM_CTRL_REQUEST_TYPE, |
648 | ftdi_high_or_low, priv->interface, | 634 | urb_value, priv->interface, |
649 | buf, 0, WDR_TIMEOUT); | 635 | buf, 0, WDR_TIMEOUT); |
650 | 636 | ||
651 | kfree(buf); | 637 | kfree(buf); |
638 | if (rv < 0) { | ||
639 | err("%s Error from MODEM_CTRL urb: DTR %s, RTS %s", | ||
640 | __FUNCTION__, | ||
641 | (set & TIOCM_DTR) ? "HIGH" : | ||
642 | (clear & TIOCM_DTR) ? "LOW" : "unchanged", | ||
643 | (set & TIOCM_RTS) ? "HIGH" : | ||
644 | (clear & TIOCM_RTS) ? "LOW" : "unchanged"); | ||
645 | } else { | ||
646 | dbg("%s - DTR %s, RTS %s", __FUNCTION__, | ||
647 | (set & TIOCM_DTR) ? "HIGH" : | ||
648 | (clear & TIOCM_DTR) ? "LOW" : "unchanged", | ||
649 | (set & TIOCM_RTS) ? "HIGH" : | ||
650 | (clear & TIOCM_RTS) ? "LOW" : "unchanged"); | ||
651 | priv->last_dtr_rts = (priv->last_dtr_rts & ~clear) | set; | ||
652 | } | ||
652 | return rv; | 653 | return rv; |
653 | } | 654 | } |
654 | 655 | ||
@@ -681,7 +682,7 @@ static int change_speed(struct usb_serial_port *port) | |||
681 | FTDI_SIO_SET_BAUDRATE_REQUEST, | 682 | FTDI_SIO_SET_BAUDRATE_REQUEST, |
682 | FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE, | 683 | FTDI_SIO_SET_BAUDRATE_REQUEST_TYPE, |
683 | urb_value, urb_index, | 684 | urb_value, urb_index, |
684 | buf, 0, 100); | 685 | buf, 0, WDR_SHORT_TIMEOUT); |
685 | 686 | ||
686 | kfree(buf); | 687 | kfree(buf); |
687 | return rv; | 688 | return rv; |
@@ -1219,12 +1220,7 @@ static int ftdi_open (struct usb_serial_port *port, struct file *filp) | |||
1219 | /* FIXME: Flow control might be enabled, so it should be checked - | 1220 | /* FIXME: Flow control might be enabled, so it should be checked - |
1220 | we have no control of defaults! */ | 1221 | we have no control of defaults! */ |
1221 | /* Turn on RTS and DTR since we are not flow controlling by default */ | 1222 | /* Turn on RTS and DTR since we are not flow controlling by default */ |
1222 | if (set_dtr(port, HIGH) < 0) { | 1223 | set_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
1223 | err("%s Error from DTR HIGH urb", __FUNCTION__); | ||
1224 | } | ||
1225 | if (set_rts(port, HIGH) < 0){ | ||
1226 | err("%s Error from RTS HIGH urb", __FUNCTION__); | ||
1227 | } | ||
1228 | 1224 | ||
1229 | /* Not throttled */ | 1225 | /* Not throttled */ |
1230 | spin_lock_irqsave(&priv->rx_lock, flags); | 1226 | spin_lock_irqsave(&priv->rx_lock, flags); |
@@ -1274,14 +1270,8 @@ static void ftdi_close (struct usb_serial_port *port, struct file *filp) | |||
1274 | err("error from flowcontrol urb"); | 1270 | err("error from flowcontrol urb"); |
1275 | } | 1271 | } |
1276 | 1272 | ||
1277 | /* drop DTR */ | 1273 | /* drop RTS and DTR */ |
1278 | if (set_dtr(port, LOW) < 0){ | 1274 | clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
1279 | err("Error from DTR LOW urb"); | ||
1280 | } | ||
1281 | /* drop RTS */ | ||
1282 | if (set_rts(port, LOW) < 0) { | ||
1283 | err("Error from RTS LOW urb"); | ||
1284 | } | ||
1285 | } /* Note change no line if hupcl is off */ | 1275 | } /* Note change no line if hupcl is off */ |
1286 | 1276 | ||
1287 | /* cancel any scheduled reading */ | 1277 | /* cancel any scheduled reading */ |
@@ -1797,7 +1787,7 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_ | |||
1797 | FTDI_SIO_SET_DATA_REQUEST, | 1787 | FTDI_SIO_SET_DATA_REQUEST, |
1798 | FTDI_SIO_SET_DATA_REQUEST_TYPE, | 1788 | FTDI_SIO_SET_DATA_REQUEST_TYPE, |
1799 | urb_value , priv->interface, | 1789 | urb_value , priv->interface, |
1800 | buf, 0, 100) < 0) { | 1790 | buf, 0, WDR_SHORT_TIMEOUT) < 0) { |
1801 | err("%s FAILED to set databits/stopbits/parity", __FUNCTION__); | 1791 | err("%s FAILED to set databits/stopbits/parity", __FUNCTION__); |
1802 | } | 1792 | } |
1803 | 1793 | ||
@@ -1812,25 +1802,14 @@ static void ftdi_set_termios (struct usb_serial_port *port, struct termios *old_ | |||
1812 | err("%s error from disable flowcontrol urb", __FUNCTION__); | 1802 | err("%s error from disable flowcontrol urb", __FUNCTION__); |
1813 | } | 1803 | } |
1814 | /* Drop RTS and DTR */ | 1804 | /* Drop RTS and DTR */ |
1815 | if (set_dtr(port, LOW) < 0){ | 1805 | clear_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
1816 | err("%s Error from DTR LOW urb", __FUNCTION__); | ||
1817 | } | ||
1818 | if (set_rts(port, LOW) < 0){ | ||
1819 | err("%s Error from RTS LOW urb", __FUNCTION__); | ||
1820 | } | ||
1821 | |||
1822 | } else { | 1806 | } else { |
1823 | /* set the baudrate determined before */ | 1807 | /* set the baudrate determined before */ |
1824 | if (change_speed(port)) { | 1808 | if (change_speed(port)) { |
1825 | err("%s urb failed to set baurdrate", __FUNCTION__); | 1809 | err("%s urb failed to set baurdrate", __FUNCTION__); |
1826 | } | 1810 | } |
1827 | /* Ensure RTS and DTR are raised */ | 1811 | /* Ensure RTS and DTR are raised */ |
1828 | else if (set_dtr(port, HIGH) < 0){ | 1812 | set_mctrl(port, TIOCM_DTR | TIOCM_RTS); |
1829 | err("%s Error from DTR HIGH urb", __FUNCTION__); | ||
1830 | } | ||
1831 | else if (set_rts(port, HIGH) < 0){ | ||
1832 | err("%s Error from RTS HIGH urb", __FUNCTION__); | ||
1833 | } | ||
1834 | } | 1813 | } |
1835 | 1814 | ||
1836 | /* Set flow control */ | 1815 | /* Set flow control */ |
@@ -1942,35 +1921,8 @@ static int ftdi_tiocmget (struct usb_serial_port *port, struct file *file) | |||
1942 | 1921 | ||
1943 | static int ftdi_tiocmset(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear) | 1922 | static int ftdi_tiocmset(struct usb_serial_port *port, struct file * file, unsigned int set, unsigned int clear) |
1944 | { | 1923 | { |
1945 | int ret; | ||
1946 | |||
1947 | dbg("%s TIOCMSET", __FUNCTION__); | 1924 | dbg("%s TIOCMSET", __FUNCTION__); |
1948 | if (set & TIOCM_DTR){ | 1925 | return update_mctrl(port, set, clear); |
1949 | if ((ret = set_dtr(port, HIGH)) < 0) { | ||
1950 | err("Urb to set DTR failed"); | ||
1951 | return(ret); | ||
1952 | } | ||
1953 | } | ||
1954 | if (set & TIOCM_RTS) { | ||
1955 | if ((ret = set_rts(port, HIGH)) < 0){ | ||
1956 | err("Urb to set RTS failed"); | ||
1957 | return(ret); | ||
1958 | } | ||
1959 | } | ||
1960 | |||
1961 | if (clear & TIOCM_DTR){ | ||
1962 | if ((ret = set_dtr(port, LOW)) < 0){ | ||
1963 | err("Urb to unset DTR failed"); | ||
1964 | return(ret); | ||
1965 | } | ||
1966 | } | ||
1967 | if (clear & TIOCM_RTS) { | ||
1968 | if ((ret = set_rts(port, LOW)) < 0){ | ||
1969 | err("Urb to unset RTS failed"); | ||
1970 | return(ret); | ||
1971 | } | ||
1972 | } | ||
1973 | return(0); | ||
1974 | } | 1926 | } |
1975 | 1927 | ||
1976 | 1928 | ||
diff --git a/drivers/usb/serial/ftdi_sio.h b/drivers/usb/serial/ftdi_sio.h index 8866376823a5..9f4342093e8b 100644 --- a/drivers/usb/serial/ftdi_sio.h +++ b/drivers/usb/serial/ftdi_sio.h | |||
@@ -265,10 +265,24 @@ | |||
265 | #define MOBILITY_USB_SERIAL_PID 0x0202 /* EasiDock USB 200 serial */ | 265 | #define MOBILITY_USB_SERIAL_PID 0x0202 /* EasiDock USB 200 serial */ |
266 | 266 | ||
267 | /* | 267 | /* |
268 | * microHAM product IDs (http://www.microham.com). | ||
269 | * Submitted by Justin Burket (KL1RL) <zorton@jtan.com>. | ||
270 | */ | ||
271 | #define FTDI_MHAM_Y6_PID 0xEEEA /* USB-Y6 interface */ | ||
272 | #define FTDI_MHAM_Y8_PID 0xEEEB /* USB-Y8 interface */ | ||
273 | |||
274 | /* | ||
268 | * Active Robots product ids. | 275 | * Active Robots product ids. |
269 | */ | 276 | */ |
270 | #define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */ | 277 | #define FTDI_ACTIVE_ROBOTS_PID 0xE548 /* USB comms board */ |
271 | 278 | ||
279 | /* | ||
280 | * Evolution Robotics products (http://www.evolution.com/). | ||
281 | * Submitted by Shawn M. Lavelle. | ||
282 | */ | ||
283 | #define EVOLUTION_VID 0xDEEE /* Vendor ID */ | ||
284 | #define EVOLUTION_ER1_PID 0x0300 /* ER1 Control Module */ | ||
285 | |||
272 | /* Commands */ | 286 | /* Commands */ |
273 | #define FTDI_SIO_RESET 0 /* Reset the port */ | 287 | #define FTDI_SIO_RESET 0 /* Reset the port */ |
274 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ | 288 | #define FTDI_SIO_MODEM_CTRL 1 /* Set the modem control register */ |
diff --git a/drivers/usb/usb-skeleton.c b/drivers/usb/usb-skeleton.c index 6051a646fe69..353f24d45bc1 100644 --- a/drivers/usb/usb-skeleton.c +++ b/drivers/usb/usb-skeleton.c | |||
@@ -257,7 +257,8 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i | |||
257 | endpoint = &iface_desc->endpoint[i].desc; | 257 | endpoint = &iface_desc->endpoint[i].desc; |
258 | 258 | ||
259 | if (!dev->bulk_in_endpointAddr && | 259 | if (!dev->bulk_in_endpointAddr && |
260 | (endpoint->bEndpointAddress & USB_DIR_IN) && | 260 | ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) |
261 | == USB_DIR_IN) && | ||
261 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | 262 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
262 | == USB_ENDPOINT_XFER_BULK)) { | 263 | == USB_ENDPOINT_XFER_BULK)) { |
263 | /* we found a bulk in endpoint */ | 264 | /* we found a bulk in endpoint */ |
@@ -272,7 +273,8 @@ static int skel_probe(struct usb_interface *interface, const struct usb_device_i | |||
272 | } | 273 | } |
273 | 274 | ||
274 | if (!dev->bulk_out_endpointAddr && | 275 | if (!dev->bulk_out_endpointAddr && |
275 | !(endpoint->bEndpointAddress & USB_DIR_OUT) && | 276 | ((endpoint->bEndpointAddress & USB_ENDPOINT_DIR_MASK) |
277 | == USB_DIR_OUT) && | ||
276 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) | 278 | ((endpoint->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) |
277 | == USB_ENDPOINT_XFER_BULK)) { | 279 | == USB_ENDPOINT_XFER_BULK)) { |
278 | /* we found a bulk out endpoint */ | 280 | /* we found a bulk out endpoint */ |
diff --git a/drivers/video/fbmem.c b/drivers/video/fbmem.c index 40784a944d05..d2e19f6dd72c 100644 --- a/drivers/video/fbmem.c +++ b/drivers/video/fbmem.c | |||
@@ -80,10 +80,12 @@ EXPORT_SYMBOL(fb_get_color_depth); | |||
80 | */ | 80 | */ |
81 | void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) | 81 | void fb_pad_aligned_buffer(u8 *dst, u32 d_pitch, u8 *src, u32 s_pitch, u32 height) |
82 | { | 82 | { |
83 | int i; | 83 | int i, j; |
84 | 84 | ||
85 | for (i = height; i--; ) { | 85 | for (i = height; i--; ) { |
86 | memcpy(dst, src, s_pitch); | 86 | /* s_pitch is a few bytes at the most, memcpy is suboptimal */ |
87 | for (j = 0; j < s_pitch; j++) | ||
88 | dst[j] = src[j]; | ||
87 | src += s_pitch; | 89 | src += s_pitch; |
88 | dst += d_pitch; | 90 | dst += d_pitch; |
89 | } | 91 | } |
diff --git a/drivers/video/fbsysfs.c b/drivers/video/fbsysfs.c index 63b505cce4ec..1147b899f007 100644 --- a/drivers/video/fbsysfs.c +++ b/drivers/video/fbsysfs.c | |||
@@ -244,15 +244,15 @@ static ssize_t show_virtual(struct class_device *class_device, char *buf) | |||
244 | 244 | ||
245 | /* Format for cmap is "%02x%c%4x%4x%4x\n" */ | 245 | /* Format for cmap is "%02x%c%4x%4x%4x\n" */ |
246 | /* %02x entry %c transp %4x red %4x blue %4x green \n */ | 246 | /* %02x entry %c transp %4x red %4x blue %4x green \n */ |
247 | /* 255 rows at 16 chars equals 4096 */ | 247 | /* 256 rows at 16 chars equals 4096, the normal page size */ |
248 | /* PAGE_SIZE can be 4096 or larger */ | 248 | /* the code will automatically adjust for different page sizes */ |
249 | static ssize_t store_cmap(struct class_device *class_device, const char *buf, | 249 | static ssize_t store_cmap(struct class_device *class_device, const char *buf, |
250 | size_t count) | 250 | size_t count) |
251 | { | 251 | { |
252 | struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | 252 | struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); |
253 | int rc, i, start, length, transp = 0; | 253 | int rc, i, start, length, transp = 0; |
254 | 254 | ||
255 | if ((count > 4096) || ((count % 16) != 0) || (PAGE_SIZE < 4096)) | 255 | if ((count > PAGE_SIZE) || ((count % 16) != 0)) |
256 | return -EINVAL; | 256 | return -EINVAL; |
257 | 257 | ||
258 | if (!fb_info->fbops->fb_setcolreg && !fb_info->fbops->fb_setcmap) | 258 | if (!fb_info->fbops->fb_setcolreg && !fb_info->fbops->fb_setcmap) |
@@ -317,18 +317,18 @@ static ssize_t show_cmap(struct class_device *class_device, char *buf) | |||
317 | !fb_info->cmap.green) | 317 | !fb_info->cmap.green) |
318 | return -EINVAL; | 318 | return -EINVAL; |
319 | 319 | ||
320 | if (PAGE_SIZE < 4096) | 320 | if (fb_info->cmap.len > PAGE_SIZE / 16) |
321 | return -EINVAL; | 321 | return -EINVAL; |
322 | 322 | ||
323 | /* don't mess with the format, the buffer is PAGE_SIZE */ | 323 | /* don't mess with the format, the buffer is PAGE_SIZE */ |
324 | /* 255 entries at 16 chars per line equals 4096 = PAGE_SIZE */ | 324 | /* 256 entries at 16 chars per line equals 4096 = PAGE_SIZE */ |
325 | for (i = 0; i < fb_info->cmap.len; i++) { | 325 | for (i = 0; i < fb_info->cmap.len; i++) { |
326 | sprintf(&buf[ i * 16], "%02x%c%4x%4x%4x\n", i + fb_info->cmap.start, | 326 | snprintf(&buf[ i * 16], PAGE_SIZE - i * 16, "%02x%c%4x%4x%4x\n", i + fb_info->cmap.start, |
327 | ((fb_info->cmap.transp && fb_info->cmap.transp[i]) ? '*' : ' '), | 327 | ((fb_info->cmap.transp && fb_info->cmap.transp[i]) ? '*' : ' '), |
328 | fb_info->cmap.red[i], fb_info->cmap.blue[i], | 328 | fb_info->cmap.red[i], fb_info->cmap.blue[i], |
329 | fb_info->cmap.green[i]); | 329 | fb_info->cmap.green[i]); |
330 | } | 330 | } |
331 | return 4096; | 331 | return 16 * fb_info->cmap.len; |
332 | } | 332 | } |
333 | 333 | ||
334 | static ssize_t store_blank(struct class_device *class_device, const char * buf, | 334 | static ssize_t store_blank(struct class_device *class_device, const char * buf, |
@@ -414,6 +414,13 @@ static ssize_t show_pan(struct class_device *class_device, char *buf) | |||
414 | fb_info->var.xoffset); | 414 | fb_info->var.xoffset); |
415 | } | 415 | } |
416 | 416 | ||
417 | static ssize_t show_name(struct class_device *class_device, char *buf) | ||
418 | { | ||
419 | struct fb_info *fb_info = (struct fb_info *)class_get_devdata(class_device); | ||
420 | |||
421 | return snprintf(buf, PAGE_SIZE, "%s\n", fb_info->fix.id); | ||
422 | } | ||
423 | |||
417 | static struct class_device_attribute class_device_attrs[] = { | 424 | static struct class_device_attribute class_device_attrs[] = { |
418 | __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), | 425 | __ATTR(bits_per_pixel, S_IRUGO|S_IWUSR, show_bpp, store_bpp), |
419 | __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), | 426 | __ATTR(blank, S_IRUGO|S_IWUSR, show_blank, store_blank), |
@@ -424,6 +431,7 @@ static struct class_device_attribute class_device_attrs[] = { | |||
424 | __ATTR(modes, S_IRUGO|S_IWUSR, show_modes, store_modes), | 431 | __ATTR(modes, S_IRUGO|S_IWUSR, show_modes, store_modes), |
425 | __ATTR(pan, S_IRUGO|S_IWUSR, show_pan, store_pan), | 432 | __ATTR(pan, S_IRUGO|S_IWUSR, show_pan, store_pan), |
426 | __ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual), | 433 | __ATTR(virtual_size, S_IRUGO|S_IWUSR, show_virtual, store_virtual), |
434 | __ATTR(name, S_IRUGO, show_name, NULL), | ||
427 | }; | 435 | }; |
428 | 436 | ||
429 | int fb_init_class_device(struct fb_info *fb_info) | 437 | int fb_init_class_device(struct fb_info *fb_info) |
diff --git a/drivers/video/tridentfb.c b/drivers/video/tridentfb.c index da8004e5d03d..698ca9232e73 100644 --- a/drivers/video/tridentfb.c +++ b/drivers/video/tridentfb.c | |||
@@ -454,13 +454,16 @@ static struct accel_switch accel_image = { | |||
454 | static void tridentfb_fillrect(struct fb_info * info, const struct fb_fillrect *fr) | 454 | static void tridentfb_fillrect(struct fb_info * info, const struct fb_fillrect *fr) |
455 | { | 455 | { |
456 | int bpp = info->var.bits_per_pixel; | 456 | int bpp = info->var.bits_per_pixel; |
457 | int col; | 457 | int col = 0; |
458 | 458 | ||
459 | switch (bpp) { | 459 | switch (bpp) { |
460 | default: | 460 | default: |
461 | case 8: col = fr->color; | 461 | case 8: col |= fr->color; |
462 | col |= col << 8; | ||
463 | col |= col << 16; | ||
462 | break; | 464 | break; |
463 | case 16: col = ((u32 *)(info->pseudo_palette))[fr->color]; | 465 | case 16: col = ((u32 *)(info->pseudo_palette))[fr->color]; |
466 | |||
464 | break; | 467 | break; |
465 | case 32: col = ((u32 *)(info->pseudo_palette))[fr->color]; | 468 | case 32: col = ((u32 *)(info->pseudo_palette))[fr->color]; |
466 | break; | 469 | break; |
@@ -882,8 +885,9 @@ static int tridentfb_set_par(struct fb_info *info) | |||
882 | 885 | ||
883 | write3X4(GraphEngReg, 0x80); //enable GE for text acceleration | 886 | write3X4(GraphEngReg, 0x80); //enable GE for text acceleration |
884 | 887 | ||
885 | // if (info->var.accel_flags & FB_ACCELF_TEXT) | 888 | #ifdef CONFIG_FB_TRIDENT_ACCEL |
886 | //FIXME acc->init_accel(info->var.xres,bpp); | 889 | acc->init_accel(info->var.xres,bpp); |
890 | #endif | ||
887 | 891 | ||
888 | switch (bpp) { | 892 | switch (bpp) { |
889 | case 8: tmp = 0x00; break; | 893 | case 8: tmp = 0x00; break; |
@@ -900,7 +904,7 @@ static int tridentfb_set_par(struct fb_info *info) | |||
900 | write3X4(DRAMControl, tmp); //both IO,linear enable | 904 | write3X4(DRAMControl, tmp); //both IO,linear enable |
901 | 905 | ||
902 | write3X4(InterfaceSel, read3X4(InterfaceSel) | 0x40); | 906 | write3X4(InterfaceSel, read3X4(InterfaceSel) | 0x40); |
903 | write3X4(Performance,0x20); | 907 | write3X4(Performance,0x92); |
904 | write3X4(PCIReg,0x07); //MMIO & PCI read and write burst enable | 908 | write3X4(PCIReg,0x07); //MMIO & PCI read and write burst enable |
905 | 909 | ||
906 | /* convert from picoseconds to MHz */ | 910 | /* convert from picoseconds to MHz */ |
@@ -981,12 +985,14 @@ static int tridentfb_setcolreg(unsigned regno, unsigned red, unsigned green, | |||
981 | t_outb(green>>10,0x3C9); | 985 | t_outb(green>>10,0x3C9); |
982 | t_outb(blue>>10,0x3C9); | 986 | t_outb(blue>>10,0x3C9); |
983 | 987 | ||
984 | } else | 988 | } else if (bpp == 16) { /* RGB 565 */ |
985 | if (bpp == 16) /* RGB 565 */ | 989 | u32 col; |
986 | ((u32*)info->pseudo_palette)[regno] = (red & 0xF800) | | 990 | |
987 | ((green & 0xFC00) >> 5) | ((blue & 0xF800) >> 11); | 991 | col = (red & 0xF800) | ((green & 0xFC00) >> 5) | |
988 | else | 992 | ((blue & 0xF800) >> 11); |
989 | if (bpp == 32) /* ARGB 8888 */ | 993 | col |= col << 16; |
994 | ((u32 *)(info->pseudo_palette))[regno] = col; | ||
995 | } else if (bpp == 32) /* ARGB 8888 */ | ||
990 | ((u32*)info->pseudo_palette)[regno] = | 996 | ((u32*)info->pseudo_palette)[regno] = |
991 | ((transp & 0xFF00) <<16) | | 997 | ((transp & 0xFF00) <<16) | |
992 | ((red & 0xFF00) << 8) | | 998 | ((red & 0xFF00) << 8) | |
diff --git a/drivers/video/vesafb.c b/drivers/video/vesafb.c index 9ed1a931dd31..a272592b0373 100644 --- a/drivers/video/vesafb.c +++ b/drivers/video/vesafb.c | |||
@@ -45,7 +45,7 @@ static struct fb_fix_screeninfo vesafb_fix __initdata = { | |||
45 | }; | 45 | }; |
46 | 46 | ||
47 | static int inverse = 0; | 47 | static int inverse = 0; |
48 | static int mtrr = 1; | 48 | static int mtrr = 3; /* default to write-combining */ |
49 | static int vram_remap __initdata = 0; /* Set amount of memory to be used */ | 49 | static int vram_remap __initdata = 0; /* Set amount of memory to be used */ |
50 | static int vram_total __initdata = 0; /* Set total amount of memory */ | 50 | static int vram_total __initdata = 0; /* Set total amount of memory */ |
51 | static int pmi_setpal = 0; /* pmi for palette changes ??? */ | 51 | static int pmi_setpal = 0; /* pmi for palette changes ??? */ |
@@ -204,8 +204,8 @@ static int __init vesafb_setup(char *options) | |||
204 | pmi_setpal=0; | 204 | pmi_setpal=0; |
205 | else if (! strcmp(this_opt, "pmipal")) | 205 | else if (! strcmp(this_opt, "pmipal")) |
206 | pmi_setpal=1; | 206 | pmi_setpal=1; |
207 | else if (! strcmp(this_opt, "mtrr")) | 207 | else if (! strncmp(this_opt, "mtrr:", 5)) |
208 | mtrr=1; | 208 | mtrr = simple_strtoul(this_opt+5, NULL, 0); |
209 | else if (! strcmp(this_opt, "nomtrr")) | 209 | else if (! strcmp(this_opt, "nomtrr")) |
210 | mtrr=0; | 210 | mtrr=0; |
211 | else if (! strncmp(this_opt, "vtotal:", 7)) | 211 | else if (! strncmp(this_opt, "vtotal:", 7)) |
@@ -387,14 +387,39 @@ static int __init vesafb_probe(struct device *device) | |||
387 | 387 | ||
388 | if (mtrr) { | 388 | if (mtrr) { |
389 | unsigned int temp_size = size_total; | 389 | unsigned int temp_size = size_total; |
390 | /* Find the largest power-of-two */ | 390 | unsigned int type = 0; |
391 | while (temp_size & (temp_size - 1)) | 391 | |
392 | temp_size &= (temp_size - 1); | 392 | switch (mtrr) { |
393 | 393 | case 1: | |
394 | /* Try and find a power of two to add */ | 394 | type = MTRR_TYPE_UNCACHABLE; |
395 | while (temp_size > PAGE_SIZE && | 395 | break; |
396 | mtrr_add(vesafb_fix.smem_start, temp_size, MTRR_TYPE_WRCOMB, 1)==-EINVAL) { | 396 | case 2: |
397 | temp_size >>= 1; | 397 | type = MTRR_TYPE_WRBACK; |
398 | break; | ||
399 | case 3: | ||
400 | type = MTRR_TYPE_WRCOMB; | ||
401 | break; | ||
402 | case 4: | ||
403 | type = MTRR_TYPE_WRTHROUGH; | ||
404 | break; | ||
405 | default: | ||
406 | type = 0; | ||
407 | break; | ||
408 | } | ||
409 | |||
410 | if (type) { | ||
411 | int rc; | ||
412 | |||
413 | /* Find the largest power-of-two */ | ||
414 | while (temp_size & (temp_size - 1)) | ||
415 | temp_size &= (temp_size - 1); | ||
416 | |||
417 | /* Try and find a power of two to add */ | ||
418 | do { | ||
419 | rc = mtrr_add(vesafb_fix.smem_start, temp_size, | ||
420 | type, 1); | ||
421 | temp_size >>= 1; | ||
422 | } while (temp_size >= PAGE_SIZE && rc == -EINVAL); | ||
398 | } | 423 | } |
399 | } | 424 | } |
400 | 425 | ||
diff --git a/drivers/w1/Kconfig b/drivers/w1/Kconfig index 4f120796273e..711b90903e7b 100644 --- a/drivers/w1/Kconfig +++ b/drivers/w1/Kconfig | |||
@@ -30,7 +30,7 @@ config W1_DS9490 | |||
30 | This support is also available as a module. If so, the module | 30 | This support is also available as a module. If so, the module |
31 | will be called ds9490r.ko. | 31 | will be called ds9490r.ko. |
32 | 32 | ||
33 | config W1_DS9490R_BRIDGE | 33 | config W1_DS9490_BRIDGE |
34 | tristate "DS9490R USB <-> W1 transport layer for 1-wire" | 34 | tristate "DS9490R USB <-> W1 transport layer for 1-wire" |
35 | depends on W1_DS9490 | 35 | depends on W1_DS9490 |
36 | help | 36 | help |