diff options
author | Jeff Garzik <jeff@garzik.org> | 2007-12-01 16:18:56 -0500 |
---|---|---|
committer | Jeff Garzik <jeff@garzik.org> | 2007-12-01 16:18:56 -0500 |
commit | c99da91e7a12724127475a85cc7a38214b3504e2 (patch) | |
tree | de0eb3fe32ce58804457963fd133a53bb8fba5b8 /drivers | |
parent | a31e23e15cbb9734c5883a4a7f58d8712d303e0b (diff) | |
parent | 92d499d991ec4f5cbd00d6f33967eab9d3ee8d6c (diff) |
Merge branch 'master' into upstream-fixes
Diffstat (limited to 'drivers')
152 files changed, 2151 insertions, 1445 deletions
diff --git a/drivers/acpi/Kconfig b/drivers/acpi/Kconfig index 087a7028ae84..b9f923ef173d 100644 --- a/drivers/acpi/Kconfig +++ b/drivers/acpi/Kconfig | |||
@@ -50,7 +50,6 @@ config ACPI_SLEEP | |||
50 | config ACPI_PROCFS | 50 | config ACPI_PROCFS |
51 | bool "Deprecated /proc/acpi files" | 51 | bool "Deprecated /proc/acpi files" |
52 | depends on PROC_FS | 52 | depends on PROC_FS |
53 | default y | ||
54 | ---help--- | 53 | ---help--- |
55 | For backwards compatibility, this option allows | 54 | For backwards compatibility, this option allows |
56 | deprecated /proc/acpi/ files to exist, even when | 55 | deprecated /proc/acpi/ files to exist, even when |
@@ -61,7 +60,6 @@ config ACPI_PROCFS | |||
61 | /proc/acpi/info (/sys/modules/acpi/parameters/acpica_version) | 60 | /proc/acpi/info (/sys/modules/acpi/parameters/acpica_version) |
62 | /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) | 61 | /proc/acpi/dsdt (/sys/firmware/acpi/tables/DSDT) |
63 | /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) | 62 | /proc/acpi/fadt (/sys/firmware/acpi/tables/FACP) |
64 | /proc/acpi/battery (/sys/class/power_supply) | ||
65 | /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) | 63 | /proc/acpi/debug_layer (/sys/module/acpi/parameters/debug_layer) |
66 | /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level) | 64 | /proc/acpi/debug_level (/sys/module/acpi/parameters/debug_level) |
67 | 65 | ||
@@ -69,7 +67,21 @@ config ACPI_PROCFS | |||
69 | and functions which do not yet exist in /sys. | 67 | and functions which do not yet exist in /sys. |
70 | 68 | ||
71 | Say N to delete /proc/acpi/ files that have moved to /sys/ | 69 | Say N to delete /proc/acpi/ files that have moved to /sys/ |
72 | 70 | config ACPI_PROCFS_POWER | |
71 | bool "Deprecated power /proc/acpi folders" | ||
72 | depends on PROC_FS | ||
73 | default y | ||
74 | ---help--- | ||
75 | For backwards compatibility, this option allows | ||
76 | deprecated power /proc/acpi/ folders to exist, even when | ||
77 | they have been replaced by functions in /sys. | ||
78 | The deprecated folders (and their replacements) include: | ||
79 | /proc/acpi/battery/* (/sys/class/power_supply/*) | ||
80 | /proc/acpi/ac_adapter/* (sys/class/power_supply/*) | ||
81 | This option has no effect on /proc/acpi/ folders | ||
82 | and functions, which do not yet exist in /sys | ||
83 | |||
84 | Say N to delete power /proc/acpi/ folders that have moved to /sys/ | ||
73 | config ACPI_PROC_EVENT | 85 | config ACPI_PROC_EVENT |
74 | bool "Deprecated /proc/acpi/event support" | 86 | bool "Deprecated /proc/acpi/event support" |
75 | depends on PROC_FS | 87 | depends on PROC_FS |
diff --git a/drivers/acpi/Makefile b/drivers/acpi/Makefile index 54e3ab0e5fc0..456446f90077 100644 --- a/drivers/acpi/Makefile +++ b/drivers/acpi/Makefile | |||
@@ -58,6 +58,6 @@ obj-$(CONFIG_ACPI_NUMA) += numa.o | |||
58 | obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o | 58 | obj-$(CONFIG_ACPI_ASUS) += asus_acpi.o |
59 | obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o | 59 | obj-$(CONFIG_ACPI_TOSHIBA) += toshiba_acpi.o |
60 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o | 60 | obj-$(CONFIG_ACPI_HOTPLUG_MEMORY) += acpi_memhotplug.o |
61 | obj-y += cm_sbs.o | 61 | obj-$(CONFIG_ACPI_PROCFS_POWER) += cm_sbs.o |
62 | obj-$(CONFIG_ACPI_SBS) += sbs.o | 62 | obj-$(CONFIG_ACPI_SBS) += sbs.o |
63 | obj-$(CONFIG_ACPI_SBS) += sbshc.o | 63 | obj-$(CONFIG_ACPI_SBS) += sbshc.o |
diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c index 30238f6ff232..76ed4f52bebd 100644 --- a/drivers/acpi/ac.c +++ b/drivers/acpi/ac.c | |||
@@ -27,7 +27,7 @@ | |||
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> | 29 | #include <linux/types.h> |
30 | #ifdef CONFIG_ACPI_PROCFS | 30 | #ifdef CONFIG_ACPI_PROCFS_POWER |
31 | #include <linux/proc_fs.h> | 31 | #include <linux/proc_fs.h> |
32 | #include <linux/seq_file.h> | 32 | #include <linux/seq_file.h> |
33 | #endif | 33 | #endif |
@@ -51,7 +51,7 @@ MODULE_AUTHOR("Paul Diefenbaugh"); | |||
51 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); | 51 | MODULE_DESCRIPTION("ACPI AC Adapter Driver"); |
52 | MODULE_LICENSE("GPL"); | 52 | MODULE_LICENSE("GPL"); |
53 | 53 | ||
54 | #ifdef CONFIG_ACPI_PROCFS | 54 | #ifdef CONFIG_ACPI_PROCFS_POWER |
55 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); | 55 | extern struct proc_dir_entry *acpi_lock_ac_dir(void); |
56 | extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); | 56 | extern void *acpi_unlock_ac_dir(struct proc_dir_entry *acpi_ac_dir); |
57 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); | 57 | static int acpi_ac_open_fs(struct inode *inode, struct file *file); |
@@ -86,7 +86,7 @@ struct acpi_ac { | |||
86 | 86 | ||
87 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); | 87 | #define to_acpi_ac(x) container_of(x, struct acpi_ac, charger); |
88 | 88 | ||
89 | #ifdef CONFIG_ACPI_PROCFS | 89 | #ifdef CONFIG_ACPI_PROCFS_POWER |
90 | static const struct file_operations acpi_ac_fops = { | 90 | static const struct file_operations acpi_ac_fops = { |
91 | .open = acpi_ac_open_fs, | 91 | .open = acpi_ac_open_fs, |
92 | .read = seq_read, | 92 | .read = seq_read, |
@@ -136,7 +136,7 @@ static int acpi_ac_get_state(struct acpi_ac *ac) | |||
136 | return 0; | 136 | return 0; |
137 | } | 137 | } |
138 | 138 | ||
139 | #ifdef CONFIG_ACPI_PROCFS | 139 | #ifdef CONFIG_ACPI_PROCFS_POWER |
140 | /* -------------------------------------------------------------------------- | 140 | /* -------------------------------------------------------------------------- |
141 | FS Interface (/proc) | 141 | FS Interface (/proc) |
142 | -------------------------------------------------------------------------- */ | 142 | -------------------------------------------------------------------------- */ |
@@ -275,7 +275,7 @@ static int acpi_ac_add(struct acpi_device *device) | |||
275 | if (result) | 275 | if (result) |
276 | goto end; | 276 | goto end; |
277 | 277 | ||
278 | #ifdef CONFIG_ACPI_PROCFS | 278 | #ifdef CONFIG_ACPI_PROCFS_POWER |
279 | result = acpi_ac_add_fs(device); | 279 | result = acpi_ac_add_fs(device); |
280 | #endif | 280 | #endif |
281 | if (result) | 281 | if (result) |
@@ -300,7 +300,7 @@ static int acpi_ac_add(struct acpi_device *device) | |||
300 | 300 | ||
301 | end: | 301 | end: |
302 | if (result) { | 302 | if (result) { |
303 | #ifdef CONFIG_ACPI_PROCFS | 303 | #ifdef CONFIG_ACPI_PROCFS_POWER |
304 | acpi_ac_remove_fs(device); | 304 | acpi_ac_remove_fs(device); |
305 | #endif | 305 | #endif |
306 | kfree(ac); | 306 | kfree(ac); |
@@ -339,7 +339,7 @@ static int acpi_ac_remove(struct acpi_device *device, int type) | |||
339 | ACPI_ALL_NOTIFY, acpi_ac_notify); | 339 | ACPI_ALL_NOTIFY, acpi_ac_notify); |
340 | if (ac->charger.dev) | 340 | if (ac->charger.dev) |
341 | power_supply_unregister(&ac->charger); | 341 | power_supply_unregister(&ac->charger); |
342 | #ifdef CONFIG_ACPI_PROCFS | 342 | #ifdef CONFIG_ACPI_PROCFS_POWER |
343 | acpi_ac_remove_fs(device); | 343 | acpi_ac_remove_fs(device); |
344 | #endif | 344 | #endif |
345 | 345 | ||
@@ -355,7 +355,7 @@ static int __init acpi_ac_init(void) | |||
355 | if (acpi_disabled) | 355 | if (acpi_disabled) |
356 | return -ENODEV; | 356 | return -ENODEV; |
357 | 357 | ||
358 | #ifdef CONFIG_ACPI_PROCFS | 358 | #ifdef CONFIG_ACPI_PROCFS_POWER |
359 | acpi_ac_dir = acpi_lock_ac_dir(); | 359 | acpi_ac_dir = acpi_lock_ac_dir(); |
360 | if (!acpi_ac_dir) | 360 | if (!acpi_ac_dir) |
361 | return -ENODEV; | 361 | return -ENODEV; |
@@ -363,7 +363,7 @@ static int __init acpi_ac_init(void) | |||
363 | 363 | ||
364 | result = acpi_bus_register_driver(&acpi_ac_driver); | 364 | result = acpi_bus_register_driver(&acpi_ac_driver); |
365 | if (result < 0) { | 365 | if (result < 0) { |
366 | #ifdef CONFIG_ACPI_PROCFS | 366 | #ifdef CONFIG_ACPI_PROCFS_POWER |
367 | acpi_unlock_ac_dir(acpi_ac_dir); | 367 | acpi_unlock_ac_dir(acpi_ac_dir); |
368 | #endif | 368 | #endif |
369 | return -ENODEV; | 369 | return -ENODEV; |
@@ -377,7 +377,7 @@ static void __exit acpi_ac_exit(void) | |||
377 | 377 | ||
378 | acpi_bus_unregister_driver(&acpi_ac_driver); | 378 | acpi_bus_unregister_driver(&acpi_ac_driver); |
379 | 379 | ||
380 | #ifdef CONFIG_ACPI_PROCFS | 380 | #ifdef CONFIG_ACPI_PROCFS_POWER |
381 | acpi_unlock_ac_dir(acpi_ac_dir); | 381 | acpi_unlock_ac_dir(acpi_ac_dir); |
382 | #endif | 382 | #endif |
383 | 383 | ||
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c index 192c244f6190..7d6be23eff89 100644 --- a/drivers/acpi/battery.c +++ b/drivers/acpi/battery.c | |||
@@ -31,7 +31,7 @@ | |||
31 | #include <linux/types.h> | 31 | #include <linux/types.h> |
32 | #include <linux/jiffies.h> | 32 | #include <linux/jiffies.h> |
33 | 33 | ||
34 | #ifdef CONFIG_ACPI_PROCFS | 34 | #ifdef CONFIG_ACPI_PROCFS_POWER |
35 | #include <linux/proc_fs.h> | 35 | #include <linux/proc_fs.h> |
36 | #include <linux/seq_file.h> | 36 | #include <linux/seq_file.h> |
37 | #include <asm/uaccess.h> | 37 | #include <asm/uaccess.h> |
@@ -63,7 +63,7 @@ static unsigned int cache_time = 1000; | |||
63 | module_param(cache_time, uint, 0644); | 63 | module_param(cache_time, uint, 0644); |
64 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); | 64 | MODULE_PARM_DESC(cache_time, "cache time in milliseconds"); |
65 | 65 | ||
66 | #ifdef CONFIG_ACPI_PROCFS | 66 | #ifdef CONFIG_ACPI_PROCFS_POWER |
67 | extern struct proc_dir_entry *acpi_lock_battery_dir(void); | 67 | extern struct proc_dir_entry *acpi_lock_battery_dir(void); |
68 | extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); | 68 | extern void *acpi_unlock_battery_dir(struct proc_dir_entry *acpi_battery_dir); |
69 | 69 | ||
@@ -153,6 +153,8 @@ static int acpi_battery_get_property(struct power_supply *psy, | |||
153 | val->intval = POWER_SUPPLY_STATUS_CHARGING; | 153 | val->intval = POWER_SUPPLY_STATUS_CHARGING; |
154 | else if (battery->state == 0) | 154 | else if (battery->state == 0) |
155 | val->intval = POWER_SUPPLY_STATUS_FULL; | 155 | val->intval = POWER_SUPPLY_STATUS_FULL; |
156 | else | ||
157 | val->intval = POWER_SUPPLY_STATUS_UNKNOWN; | ||
156 | break; | 158 | break; |
157 | case POWER_SUPPLY_PROP_PRESENT: | 159 | case POWER_SUPPLY_PROP_PRESENT: |
158 | val->intval = acpi_battery_present(battery); | 160 | val->intval = acpi_battery_present(battery); |
@@ -221,7 +223,7 @@ static enum power_supply_property energy_battery_props[] = { | |||
221 | POWER_SUPPLY_PROP_MANUFACTURER, | 223 | POWER_SUPPLY_PROP_MANUFACTURER, |
222 | }; | 224 | }; |
223 | 225 | ||
224 | #ifdef CONFIG_ACPI_PROCFS | 226 | #ifdef CONFIG_ACPI_PROCFS_POWER |
225 | inline char *acpi_battery_units(struct acpi_battery *battery) | 227 | inline char *acpi_battery_units(struct acpi_battery *battery) |
226 | { | 228 | { |
227 | return (battery->power_unit)?"mA":"mW"; | 229 | return (battery->power_unit)?"mA":"mW"; |
@@ -479,7 +481,7 @@ static int acpi_battery_update(struct acpi_battery *battery) | |||
479 | FS Interface (/proc) | 481 | FS Interface (/proc) |
480 | -------------------------------------------------------------------------- */ | 482 | -------------------------------------------------------------------------- */ |
481 | 483 | ||
482 | #ifdef CONFIG_ACPI_PROCFS | 484 | #ifdef CONFIG_ACPI_PROCFS_POWER |
483 | static struct proc_dir_entry *acpi_battery_dir; | 485 | static struct proc_dir_entry *acpi_battery_dir; |
484 | 486 | ||
485 | static int acpi_battery_print_info(struct seq_file *seq, int result) | 487 | static int acpi_battery_print_info(struct seq_file *seq, int result) |
@@ -786,7 +788,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
786 | acpi_driver_data(device) = battery; | 788 | acpi_driver_data(device) = battery; |
787 | mutex_init(&battery->lock); | 789 | mutex_init(&battery->lock); |
788 | acpi_battery_update(battery); | 790 | acpi_battery_update(battery); |
789 | #ifdef CONFIG_ACPI_PROCFS | 791 | #ifdef CONFIG_ACPI_PROCFS_POWER |
790 | result = acpi_battery_add_fs(device); | 792 | result = acpi_battery_add_fs(device); |
791 | if (result) | 793 | if (result) |
792 | goto end; | 794 | goto end; |
@@ -804,7 +806,7 @@ static int acpi_battery_add(struct acpi_device *device) | |||
804 | device->status.battery_present ? "present" : "absent"); | 806 | device->status.battery_present ? "present" : "absent"); |
805 | end: | 807 | end: |
806 | if (result) { | 808 | if (result) { |
807 | #ifdef CONFIG_ACPI_PROCFS | 809 | #ifdef CONFIG_ACPI_PROCFS_POWER |
808 | acpi_battery_remove_fs(device); | 810 | acpi_battery_remove_fs(device); |
809 | #endif | 811 | #endif |
810 | kfree(battery); | 812 | kfree(battery); |
@@ -823,7 +825,7 @@ static int acpi_battery_remove(struct acpi_device *device, int type) | |||
823 | status = acpi_remove_notify_handler(device->handle, | 825 | status = acpi_remove_notify_handler(device->handle, |
824 | ACPI_ALL_NOTIFY, | 826 | ACPI_ALL_NOTIFY, |
825 | acpi_battery_notify); | 827 | acpi_battery_notify); |
826 | #ifdef CONFIG_ACPI_PROCFS | 828 | #ifdef CONFIG_ACPI_PROCFS_POWER |
827 | acpi_battery_remove_fs(device); | 829 | acpi_battery_remove_fs(device); |
828 | #endif | 830 | #endif |
829 | sysfs_remove_battery(battery); | 831 | sysfs_remove_battery(battery); |
@@ -859,13 +861,13 @@ static int __init acpi_battery_init(void) | |||
859 | { | 861 | { |
860 | if (acpi_disabled) | 862 | if (acpi_disabled) |
861 | return -ENODEV; | 863 | return -ENODEV; |
862 | #ifdef CONFIG_ACPI_PROCFS | 864 | #ifdef CONFIG_ACPI_PROCFS_POWER |
863 | acpi_battery_dir = acpi_lock_battery_dir(); | 865 | acpi_battery_dir = acpi_lock_battery_dir(); |
864 | if (!acpi_battery_dir) | 866 | if (!acpi_battery_dir) |
865 | return -ENODEV; | 867 | return -ENODEV; |
866 | #endif | 868 | #endif |
867 | if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { | 869 | if (acpi_bus_register_driver(&acpi_battery_driver) < 0) { |
868 | #ifdef CONFIG_ACPI_PROCFS | 870 | #ifdef CONFIG_ACPI_PROCFS_POWER |
869 | acpi_unlock_battery_dir(acpi_battery_dir); | 871 | acpi_unlock_battery_dir(acpi_battery_dir); |
870 | #endif | 872 | #endif |
871 | return -ENODEV; | 873 | return -ENODEV; |
@@ -876,7 +878,7 @@ static int __init acpi_battery_init(void) | |||
876 | static void __exit acpi_battery_exit(void) | 878 | static void __exit acpi_battery_exit(void) |
877 | { | 879 | { |
878 | acpi_bus_unregister_driver(&acpi_battery_driver); | 880 | acpi_bus_unregister_driver(&acpi_battery_driver); |
879 | #ifdef CONFIG_ACPI_PROCFS | 881 | #ifdef CONFIG_ACPI_PROCFS_POWER |
880 | acpi_unlock_battery_dir(acpi_battery_dir); | 882 | acpi_unlock_battery_dir(acpi_battery_dir); |
881 | #endif | 883 | #endif |
882 | } | 884 | } |
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c index 06b78e5e33a1..d411017f8c06 100644 --- a/drivers/acpi/ec.c +++ b/drivers/acpi/ec.c | |||
@@ -47,6 +47,9 @@ | |||
47 | #undef PREFIX | 47 | #undef PREFIX |
48 | #define PREFIX "ACPI: EC: " | 48 | #define PREFIX "ACPI: EC: " |
49 | 49 | ||
50 | /* Uncomment next line to get verbose print outs*/ | ||
51 | /* #define DEBUG */ | ||
52 | |||
50 | /* EC status register */ | 53 | /* EC status register */ |
51 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ | 54 | #define ACPI_EC_FLAG_OBF 0x01 /* Output buffer full */ |
52 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ | 55 | #define ACPI_EC_FLAG_IBF 0x02 /* Input buffer full */ |
@@ -75,7 +78,10 @@ enum { | |||
75 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ | 78 | EC_FLAGS_WAIT_GPE = 0, /* Don't check status until GPE arrives */ |
76 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ | 79 | EC_FLAGS_QUERY_PENDING, /* Query is pending */ |
77 | EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ | 80 | EC_FLAGS_GPE_MODE, /* Expect GPE to be sent for status change */ |
78 | EC_FLAGS_ONLY_IBF_GPE, /* Expect GPE only for IBF = 0 event */ | 81 | EC_FLAGS_NO_ADDRESS_GPE, /* Expect GPE only for non-address event */ |
82 | EC_FLAGS_ADDRESS, /* Address is being written */ | ||
83 | EC_FLAGS_NO_WDATA_GPE, /* Don't expect WDATA GPE event */ | ||
84 | EC_FLAGS_WDATA, /* Data is being written */ | ||
79 | }; | 85 | }; |
80 | 86 | ||
81 | static int acpi_ec_remove(struct acpi_device *device, int type); | 87 | static int acpi_ec_remove(struct acpi_device *device, int type); |
@@ -131,21 +137,27 @@ static struct acpi_ec { | |||
131 | 137 | ||
132 | static inline u8 acpi_ec_read_status(struct acpi_ec *ec) | 138 | static inline u8 acpi_ec_read_status(struct acpi_ec *ec) |
133 | { | 139 | { |
134 | return inb(ec->command_addr); | 140 | u8 x = inb(ec->command_addr); |
141 | pr_debug(PREFIX "---> status = 0x%2x\n", x); | ||
142 | return x; | ||
135 | } | 143 | } |
136 | 144 | ||
137 | static inline u8 acpi_ec_read_data(struct acpi_ec *ec) | 145 | static inline u8 acpi_ec_read_data(struct acpi_ec *ec) |
138 | { | 146 | { |
147 | u8 x = inb(ec->data_addr); | ||
148 | pr_debug(PREFIX "---> data = 0x%2x\n", x); | ||
139 | return inb(ec->data_addr); | 149 | return inb(ec->data_addr); |
140 | } | 150 | } |
141 | 151 | ||
142 | static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command) | 152 | static inline void acpi_ec_write_cmd(struct acpi_ec *ec, u8 command) |
143 | { | 153 | { |
154 | pr_debug(PREFIX "<--- command = 0x%2x\n", command); | ||
144 | outb(command, ec->command_addr); | 155 | outb(command, ec->command_addr); |
145 | } | 156 | } |
146 | 157 | ||
147 | static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) | 158 | static inline void acpi_ec_write_data(struct acpi_ec *ec, u8 data) |
148 | { | 159 | { |
160 | pr_debug(PREFIX "<--- data = 0x%2x\n", data); | ||
149 | outb(data, ec->data_addr); | 161 | outb(data, ec->data_addr); |
150 | } | 162 | } |
151 | 163 | ||
@@ -166,38 +178,54 @@ static inline int acpi_ec_check_status(struct acpi_ec *ec, enum ec_event event) | |||
166 | 178 | ||
167 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) | 179 | static int acpi_ec_wait(struct acpi_ec *ec, enum ec_event event, int force_poll) |
168 | { | 180 | { |
181 | int ret = 0; | ||
182 | if (unlikely(test_bit(EC_FLAGS_ADDRESS, &ec->flags) && | ||
183 | test_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags))) | ||
184 | force_poll = 1; | ||
185 | if (unlikely(test_bit(EC_FLAGS_WDATA, &ec->flags) && | ||
186 | test_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags))) | ||
187 | force_poll = 1; | ||
169 | if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && | 188 | if (likely(test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) && |
170 | likely(!force_poll)) { | 189 | likely(!force_poll)) { |
171 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), | 190 | if (wait_event_timeout(ec->wait, acpi_ec_check_status(ec, event), |
172 | msecs_to_jiffies(ACPI_EC_DELAY))) | 191 | msecs_to_jiffies(ACPI_EC_DELAY))) |
173 | return 0; | 192 | goto end; |
174 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 193 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
175 | if (acpi_ec_check_status(ec, event)) { | 194 | if (acpi_ec_check_status(ec, event)) { |
176 | if (event == ACPI_EC_EVENT_OBF_1) { | 195 | if (test_bit(EC_FLAGS_ADDRESS, &ec->flags)) { |
177 | /* miss OBF = 1 GPE, don't expect it anymore */ | 196 | /* miss address GPE, don't expect it anymore */ |
178 | printk(KERN_INFO PREFIX "missing OBF_1 confirmation," | 197 | pr_info(PREFIX "missing address confirmation, " |
179 | "switching to degraded mode.\n"); | 198 | "don't expect it any longer.\n"); |
180 | set_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags); | 199 | set_bit(EC_FLAGS_NO_ADDRESS_GPE, &ec->flags); |
200 | } else if (test_bit(EC_FLAGS_WDATA, &ec->flags)) { | ||
201 | /* miss write data GPE, don't expect it */ | ||
202 | pr_info(PREFIX "missing write data confirmation, " | ||
203 | "don't expect it any longer.\n"); | ||
204 | set_bit(EC_FLAGS_NO_WDATA_GPE, &ec->flags); | ||
181 | } else { | 205 | } else { |
182 | /* missing GPEs, switch back to poll mode */ | 206 | /* missing GPEs, switch back to poll mode */ |
183 | printk(KERN_INFO PREFIX "missing IBF_1 confirmations," | 207 | if (printk_ratelimit()) |
184 | "switch off interrupt mode.\n"); | 208 | pr_info(PREFIX "missing confirmations, " |
209 | "switch off interrupt mode.\n"); | ||
185 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 210 | clear_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
186 | } | 211 | } |
187 | return 0; | 212 | goto end; |
188 | } | 213 | } |
189 | } else { | 214 | } else { |
190 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); | 215 | unsigned long delay = jiffies + msecs_to_jiffies(ACPI_EC_DELAY); |
191 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 216 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
192 | while (time_before(jiffies, delay)) { | 217 | while (time_before(jiffies, delay)) { |
193 | if (acpi_ec_check_status(ec, event)) | 218 | if (acpi_ec_check_status(ec, event)) |
194 | return 0; | 219 | goto end; |
195 | } | 220 | } |
196 | } | 221 | } |
197 | printk(KERN_ERR PREFIX "acpi_ec_wait timeout," | 222 | pr_err(PREFIX "acpi_ec_wait timeout," |
198 | " status = %d, expect_event = %d\n", | 223 | " status = %d, expect_event = %d\n", |
199 | acpi_ec_read_status(ec), event); | 224 | acpi_ec_read_status(ec), event); |
200 | return -ETIME; | 225 | ret = -ETIME; |
226 | end: | ||
227 | clear_bit(EC_FLAGS_ADDRESS, &ec->flags); | ||
228 | return ret; | ||
201 | } | 229 | } |
202 | 230 | ||
203 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | 231 | static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, |
@@ -208,22 +236,26 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
208 | int result = 0; | 236 | int result = 0; |
209 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 237 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
210 | acpi_ec_write_cmd(ec, command); | 238 | acpi_ec_write_cmd(ec, command); |
211 | 239 | pr_debug(PREFIX "transaction start\n"); | |
212 | for (; wdata_len > 0; --wdata_len) { | 240 | for (; wdata_len > 0; --wdata_len) { |
213 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); | 241 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); |
214 | if (result) { | 242 | if (result) { |
215 | printk(KERN_ERR PREFIX | 243 | pr_err(PREFIX |
216 | "write_cmd timeout, command = %d\n", command); | 244 | "write_cmd timeout, command = %d\n", command); |
217 | goto end; | 245 | goto end; |
218 | } | 246 | } |
247 | /* mark the address byte written to EC */ | ||
248 | if (rdata_len + wdata_len > 1) | ||
249 | set_bit(EC_FLAGS_ADDRESS, &ec->flags); | ||
219 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 250 | set_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
220 | acpi_ec_write_data(ec, *(wdata++)); | 251 | acpi_ec_write_data(ec, *(wdata++)); |
221 | } | 252 | } |
222 | 253 | ||
223 | if (!rdata_len) { | 254 | if (!rdata_len) { |
255 | set_bit(EC_FLAGS_WDATA, &ec->flags); | ||
224 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); | 256 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, force_poll); |
225 | if (result) { | 257 | if (result) { |
226 | printk(KERN_ERR PREFIX | 258 | pr_err(PREFIX |
227 | "finish-write timeout, command = %d\n", command); | 259 | "finish-write timeout, command = %d\n", command); |
228 | goto end; | 260 | goto end; |
229 | } | 261 | } |
@@ -231,12 +263,9 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
231 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); | 263 | clear_bit(EC_FLAGS_QUERY_PENDING, &ec->flags); |
232 | 264 | ||
233 | for (; rdata_len > 0; --rdata_len) { | 265 | for (; rdata_len > 0; --rdata_len) { |
234 | if (test_bit(EC_FLAGS_ONLY_IBF_GPE, &ec->flags)) | ||
235 | force_poll = 1; | ||
236 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll); | 266 | result = acpi_ec_wait(ec, ACPI_EC_EVENT_OBF_1, force_poll); |
237 | if (result) { | 267 | if (result) { |
238 | printk(KERN_ERR PREFIX "read timeout, command = %d\n", | 268 | pr_err(PREFIX "read timeout, command = %d\n", command); |
239 | command); | ||
240 | goto end; | 269 | goto end; |
241 | } | 270 | } |
242 | /* Don't expect GPE after last read */ | 271 | /* Don't expect GPE after last read */ |
@@ -245,6 +274,7 @@ static int acpi_ec_transaction_unlocked(struct acpi_ec *ec, u8 command, | |||
245 | *(rdata++) = acpi_ec_read_data(ec); | 274 | *(rdata++) = acpi_ec_read_data(ec); |
246 | } | 275 | } |
247 | end: | 276 | end: |
277 | pr_debug(PREFIX "transaction end\n"); | ||
248 | return result; | 278 | return result; |
249 | } | 279 | } |
250 | 280 | ||
@@ -273,8 +303,8 @@ static int acpi_ec_transaction(struct acpi_ec *ec, u8 command, | |||
273 | 303 | ||
274 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0); | 304 | status = acpi_ec_wait(ec, ACPI_EC_EVENT_IBF_0, 0); |
275 | if (status) { | 305 | if (status) { |
276 | printk(KERN_ERR PREFIX | 306 | pr_err(PREFIX "input buffer is not empty, " |
277 | "input buffer is not empty, aborting transaction\n"); | 307 | "aborting transaction\n"); |
278 | goto end; | 308 | goto end; |
279 | } | 309 | } |
280 | 310 | ||
@@ -488,6 +518,7 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
488 | acpi_status status = AE_OK; | 518 | acpi_status status = AE_OK; |
489 | struct acpi_ec *ec = data; | 519 | struct acpi_ec *ec = data; |
490 | 520 | ||
521 | pr_debug(PREFIX "~~~> interrupt\n"); | ||
491 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); | 522 | clear_bit(EC_FLAGS_WAIT_GPE, &ec->flags); |
492 | if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) | 523 | if (test_bit(EC_FLAGS_GPE_MODE, &ec->flags)) |
493 | wake_up(&ec->wait); | 524 | wake_up(&ec->wait); |
@@ -498,8 +529,9 @@ static u32 acpi_ec_gpe_handler(void *data) | |||
498 | acpi_ec_gpe_query, ec); | 529 | acpi_ec_gpe_query, ec); |
499 | } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) { | 530 | } else if (unlikely(!test_bit(EC_FLAGS_GPE_MODE, &ec->flags))) { |
500 | /* this is non-query, must be confirmation */ | 531 | /* this is non-query, must be confirmation */ |
501 | printk(KERN_INFO PREFIX "non-query interrupt received," | 532 | if (printk_ratelimit()) |
502 | " switching to interrupt mode\n"); | 533 | pr_info(PREFIX "non-query interrupt received," |
534 | " switching to interrupt mode\n"); | ||
503 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); | 535 | set_bit(EC_FLAGS_GPE_MODE, &ec->flags); |
504 | } | 536 | } |
505 | 537 | ||
@@ -701,10 +733,10 @@ static void ec_remove_handlers(struct acpi_ec *ec) | |||
701 | { | 733 | { |
702 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, | 734 | if (ACPI_FAILURE(acpi_remove_address_space_handler(ec->handle, |
703 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) | 735 | ACPI_ADR_SPACE_EC, &acpi_ec_space_handler))) |
704 | printk(KERN_ERR PREFIX "failed to remove space handler\n"); | 736 | pr_err(PREFIX "failed to remove space handler\n"); |
705 | if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe, | 737 | if (ACPI_FAILURE(acpi_remove_gpe_handler(NULL, ec->gpe, |
706 | &acpi_ec_gpe_handler))) | 738 | &acpi_ec_gpe_handler))) |
707 | printk(KERN_ERR PREFIX "failed to remove gpe handler\n"); | 739 | pr_err(PREFIX "failed to remove gpe handler\n"); |
708 | ec->handlers_installed = 0; | 740 | ec->handlers_installed = 0; |
709 | } | 741 | } |
710 | 742 | ||
@@ -747,9 +779,9 @@ static int acpi_ec_add(struct acpi_device *device) | |||
747 | first_ec = ec; | 779 | first_ec = ec; |
748 | acpi_driver_data(device) = ec; | 780 | acpi_driver_data(device) = ec; |
749 | acpi_ec_add_fs(device); | 781 | acpi_ec_add_fs(device); |
750 | printk(KERN_INFO PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", | 782 | pr_info(PREFIX "GPE = 0x%lx, I/O: command/status = 0x%lx, data = 0x%lx\n", |
751 | ec->gpe, ec->command_addr, ec->data_addr); | 783 | ec->gpe, ec->command_addr, ec->data_addr); |
752 | printk(KERN_INFO PREFIX "driver started in %s mode\n", | 784 | pr_info(PREFIX "driver started in %s mode\n", |
753 | (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))?"interrupt":"poll"); | 785 | (test_bit(EC_FLAGS_GPE_MODE, &ec->flags))?"interrupt":"poll"); |
754 | return 0; | 786 | return 0; |
755 | } | 787 | } |
@@ -875,18 +907,26 @@ int __init acpi_ec_ecdt_probe(void) | |||
875 | status = acpi_get_table(ACPI_SIG_ECDT, 1, | 907 | status = acpi_get_table(ACPI_SIG_ECDT, 1, |
876 | (struct acpi_table_header **)&ecdt_ptr); | 908 | (struct acpi_table_header **)&ecdt_ptr); |
877 | if (ACPI_SUCCESS(status)) { | 909 | if (ACPI_SUCCESS(status)) { |
878 | printk(KERN_INFO PREFIX "EC description table is found, configuring boot EC\n"); | 910 | pr_info(PREFIX "EC description table is found, configuring boot EC\n"); |
879 | boot_ec->command_addr = ecdt_ptr->control.address; | 911 | boot_ec->command_addr = ecdt_ptr->control.address; |
880 | boot_ec->data_addr = ecdt_ptr->data.address; | 912 | boot_ec->data_addr = ecdt_ptr->data.address; |
881 | boot_ec->gpe = ecdt_ptr->gpe; | 913 | boot_ec->gpe = ecdt_ptr->gpe; |
882 | boot_ec->handle = ACPI_ROOT_OBJECT; | 914 | boot_ec->handle = ACPI_ROOT_OBJECT; |
883 | } else { | 915 | } else { |
916 | /* This workaround is needed only on some broken machines, | ||
917 | * which require early EC, but fail to provide ECDT */ | ||
918 | acpi_handle x; | ||
884 | printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); | 919 | printk(KERN_DEBUG PREFIX "Look up EC in DSDT\n"); |
885 | status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, | 920 | status = acpi_get_devices(ec_device_ids[0].id, ec_parse_device, |
886 | boot_ec, NULL); | 921 | boot_ec, NULL); |
887 | /* Check that acpi_get_devices actually find something */ | 922 | /* Check that acpi_get_devices actually find something */ |
888 | if (ACPI_FAILURE(status) || !boot_ec->handle) | 923 | if (ACPI_FAILURE(status) || !boot_ec->handle) |
889 | goto error; | 924 | goto error; |
925 | /* We really need to limit this workaround, the only ASUS, | ||
926 | * which needs it, has fake EC._INI method, so use it as flag. | ||
927 | */ | ||
928 | if (ACPI_FAILURE(acpi_get_handle(boot_ec->handle, "_INI", &x))) | ||
929 | goto error; | ||
890 | } | 930 | } |
891 | 931 | ||
892 | ret = ec_install_handlers(boot_ec); | 932 | ret = ec_install_handlers(boot_ec); |
diff --git a/drivers/acpi/osl.c b/drivers/acpi/osl.c index aabc6ca4a81c..e3a673a00845 100644 --- a/drivers/acpi/osl.c +++ b/drivers/acpi/osl.c | |||
@@ -387,17 +387,14 @@ acpi_status acpi_os_read_port(acpi_io_address port, u32 * value, u32 width) | |||
387 | if (!value) | 387 | if (!value) |
388 | value = &dummy; | 388 | value = &dummy; |
389 | 389 | ||
390 | switch (width) { | 390 | *value = 0; |
391 | case 8: | 391 | if (width <= 8) { |
392 | *(u8 *) value = inb(port); | 392 | *(u8 *) value = inb(port); |
393 | break; | 393 | } else if (width <= 16) { |
394 | case 16: | ||
395 | *(u16 *) value = inw(port); | 394 | *(u16 *) value = inw(port); |
396 | break; | 395 | } else if (width <= 32) { |
397 | case 32: | ||
398 | *(u32 *) value = inl(port); | 396 | *(u32 *) value = inl(port); |
399 | break; | 397 | } else { |
400 | default: | ||
401 | BUG(); | 398 | BUG(); |
402 | } | 399 | } |
403 | 400 | ||
@@ -408,17 +405,13 @@ EXPORT_SYMBOL(acpi_os_read_port); | |||
408 | 405 | ||
409 | acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) | 406 | acpi_status acpi_os_write_port(acpi_io_address port, u32 value, u32 width) |
410 | { | 407 | { |
411 | switch (width) { | 408 | if (width <= 8) { |
412 | case 8: | ||
413 | outb(value, port); | 409 | outb(value, port); |
414 | break; | 410 | } else if (width <= 16) { |
415 | case 16: | ||
416 | outw(value, port); | 411 | outw(value, port); |
417 | break; | 412 | } else if (width <= 32) { |
418 | case 32: | ||
419 | outl(value, port); | 413 | outl(value, port); |
420 | break; | 414 | } else { |
421 | default: | ||
422 | BUG(); | 415 | BUG(); |
423 | } | 416 | } |
424 | 417 | ||
diff --git a/drivers/acpi/processor_core.c b/drivers/acpi/processor_core.c index 235a51e328c3..e48ee4f8749f 100644 --- a/drivers/acpi/processor_core.c +++ b/drivers/acpi/processor_core.c | |||
@@ -494,7 +494,7 @@ static int get_cpu_id(acpi_handle handle, u32 acpi_id) | |||
494 | if (apic_id == -1) | 494 | if (apic_id == -1) |
495 | return apic_id; | 495 | return apic_id; |
496 | 496 | ||
497 | for (i = 0; i < NR_CPUS; ++i) { | 497 | for_each_possible_cpu(i) { |
498 | if (cpu_physical_id(i) == apic_id) | 498 | if (cpu_physical_id(i) == apic_id) |
499 | return i; | 499 | return i; |
500 | } | 500 | } |
@@ -612,12 +612,6 @@ static int acpi_processor_get_info(struct acpi_processor *pr, unsigned has_uid) | |||
612 | request_region(pr->throttling.address, 6, "ACPI CPU throttle"); | 612 | request_region(pr->throttling.address, 6, "ACPI CPU throttle"); |
613 | } | 613 | } |
614 | 614 | ||
615 | #ifdef CONFIG_CPU_FREQ | ||
616 | acpi_processor_ppc_has_changed(pr); | ||
617 | #endif | ||
618 | acpi_processor_get_throttling_info(pr); | ||
619 | acpi_processor_get_limit_info(pr); | ||
620 | |||
621 | return 0; | 615 | return 0; |
622 | } | 616 | } |
623 | 617 | ||
@@ -638,7 +632,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
638 | return 0; | 632 | return 0; |
639 | } | 633 | } |
640 | 634 | ||
641 | BUG_ON((pr->id >= NR_CPUS) || (pr->id < 0)); | 635 | BUG_ON((pr->id >= nr_cpu_ids) || (pr->id < 0)); |
642 | 636 | ||
643 | /* | 637 | /* |
644 | * Buggy BIOS check | 638 | * Buggy BIOS check |
@@ -647,7 +641,7 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
647 | */ | 641 | */ |
648 | if (processor_device_array[pr->id] != NULL && | 642 | if (processor_device_array[pr->id] != NULL && |
649 | processor_device_array[pr->id] != device) { | 643 | processor_device_array[pr->id] != device) { |
650 | printk(KERN_WARNING "BIOS reported wrong ACPI id" | 644 | printk(KERN_WARNING "BIOS reported wrong ACPI id " |
651 | "for the processor\n"); | 645 | "for the processor\n"); |
652 | return -ENODEV; | 646 | return -ENODEV; |
653 | } | 647 | } |
@@ -665,6 +659,12 @@ static int __cpuinit acpi_processor_start(struct acpi_device *device) | |||
665 | /* _PDC call should be done before doing anything else (if reqd.). */ | 659 | /* _PDC call should be done before doing anything else (if reqd.). */ |
666 | arch_acpi_processor_init_pdc(pr); | 660 | arch_acpi_processor_init_pdc(pr); |
667 | acpi_processor_set_pdc(pr); | 661 | acpi_processor_set_pdc(pr); |
662 | #ifdef CONFIG_CPU_FREQ | ||
663 | acpi_processor_ppc_has_changed(pr); | ||
664 | #endif | ||
665 | acpi_processor_get_throttling_info(pr); | ||
666 | acpi_processor_get_limit_info(pr); | ||
667 | |||
668 | 668 | ||
669 | acpi_processor_power_init(pr, device); | 669 | acpi_processor_power_init(pr, device); |
670 | 670 | ||
@@ -684,7 +684,7 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) | |||
684 | { | 684 | { |
685 | struct acpi_processor *pr = data; | 685 | struct acpi_processor *pr = data; |
686 | struct acpi_device *device = NULL; | 686 | struct acpi_device *device = NULL; |
687 | 687 | int saved; | |
688 | 688 | ||
689 | if (!pr) | 689 | if (!pr) |
690 | return; | 690 | return; |
@@ -694,7 +694,10 @@ static void acpi_processor_notify(acpi_handle handle, u32 event, void *data) | |||
694 | 694 | ||
695 | switch (event) { | 695 | switch (event) { |
696 | case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: | 696 | case ACPI_PROCESSOR_NOTIFY_PERFORMANCE: |
697 | saved = pr->performance_platform_limit; | ||
697 | acpi_processor_ppc_has_changed(pr); | 698 | acpi_processor_ppc_has_changed(pr); |
699 | if (saved == pr->performance_platform_limit) | ||
700 | break; | ||
698 | acpi_bus_generate_proc_event(device, event, | 701 | acpi_bus_generate_proc_event(device, event, |
699 | pr->performance_platform_limit); | 702 | pr->performance_platform_limit); |
700 | acpi_bus_generate_netlink_event(device->pnp.device_class, | 703 | acpi_bus_generate_netlink_event(device->pnp.device_class, |
@@ -771,7 +774,7 @@ static int acpi_processor_remove(struct acpi_device *device, int type) | |||
771 | 774 | ||
772 | pr = acpi_driver_data(device); | 775 | pr = acpi_driver_data(device); |
773 | 776 | ||
774 | if (pr->id >= NR_CPUS) { | 777 | if (pr->id >= nr_cpu_ids) { |
775 | kfree(pr); | 778 | kfree(pr); |
776 | return 0; | 779 | return 0; |
777 | } | 780 | } |
@@ -842,7 +845,7 @@ int acpi_processor_device_add(acpi_handle handle, struct acpi_device **device) | |||
842 | if (!pr) | 845 | if (!pr) |
843 | return -ENODEV; | 846 | return -ENODEV; |
844 | 847 | ||
845 | if ((pr->id >= 0) && (pr->id < NR_CPUS)) { | 848 | if ((pr->id >= 0) && (pr->id < nr_cpu_ids)) { |
846 | kobject_uevent(&(*device)->dev.kobj, KOBJ_ONLINE); | 849 | kobject_uevent(&(*device)->dev.kobj, KOBJ_ONLINE); |
847 | } | 850 | } |
848 | return 0; | 851 | return 0; |
@@ -880,13 +883,13 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) | |||
880 | break; | 883 | break; |
881 | } | 884 | } |
882 | 885 | ||
883 | if (pr->id >= 0 && (pr->id < NR_CPUS)) { | 886 | if (pr->id >= 0 && (pr->id < nr_cpu_ids)) { |
884 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); | 887 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); |
885 | break; | 888 | break; |
886 | } | 889 | } |
887 | 890 | ||
888 | result = acpi_processor_start(device); | 891 | result = acpi_processor_start(device); |
889 | if ((!result) && ((pr->id >= 0) && (pr->id < NR_CPUS))) { | 892 | if ((!result) && ((pr->id >= 0) && (pr->id < nr_cpu_ids))) { |
890 | kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); | 893 | kobject_uevent(&device->dev.kobj, KOBJ_ONLINE); |
891 | } else { | 894 | } else { |
892 | printk(KERN_ERR PREFIX "Device [%s] failed to start\n", | 895 | printk(KERN_ERR PREFIX "Device [%s] failed to start\n", |
@@ -909,7 +912,7 @@ acpi_processor_hotplug_notify(acpi_handle handle, u32 event, void *data) | |||
909 | return; | 912 | return; |
910 | } | 913 | } |
911 | 914 | ||
912 | if ((pr->id < NR_CPUS) && (cpu_present(pr->id))) | 915 | if ((pr->id < nr_cpu_ids) && (cpu_present(pr->id))) |
913 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); | 916 | kobject_uevent(&device->dev.kobj, KOBJ_OFFLINE); |
914 | break; | 917 | break; |
915 | default: | 918 | default: |
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c index f996d0e37689..b1fbee3f7fe1 100644 --- a/drivers/acpi/processor_idle.c +++ b/drivers/acpi/processor_idle.c | |||
@@ -197,6 +197,19 @@ static inline u32 ticks_elapsed_in_us(u32 t1, u32 t2) | |||
197 | return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2); | 197 | return PM_TIMER_TICKS_TO_US((0xFFFFFFFF - t1) + t2); |
198 | } | 198 | } |
199 | 199 | ||
200 | static void acpi_safe_halt(void) | ||
201 | { | ||
202 | current_thread_info()->status &= ~TS_POLLING; | ||
203 | /* | ||
204 | * TS_POLLING-cleared state must be visible before we | ||
205 | * test NEED_RESCHED: | ||
206 | */ | ||
207 | smp_mb(); | ||
208 | if (!need_resched()) | ||
209 | safe_halt(); | ||
210 | current_thread_info()->status |= TS_POLLING; | ||
211 | } | ||
212 | |||
200 | #ifndef CONFIG_CPU_IDLE | 213 | #ifndef CONFIG_CPU_IDLE |
201 | 214 | ||
202 | static void | 215 | static void |
@@ -239,19 +252,6 @@ acpi_processor_power_activate(struct acpi_processor *pr, | |||
239 | return; | 252 | return; |
240 | } | 253 | } |
241 | 254 | ||
242 | static void acpi_safe_halt(void) | ||
243 | { | ||
244 | current_thread_info()->status &= ~TS_POLLING; | ||
245 | /* | ||
246 | * TS_POLLING-cleared state must be visible before we | ||
247 | * test NEED_RESCHED: | ||
248 | */ | ||
249 | smp_mb(); | ||
250 | if (!need_resched()) | ||
251 | safe_halt(); | ||
252 | current_thread_info()->status |= TS_POLLING; | ||
253 | } | ||
254 | |||
255 | static atomic_t c3_cpu_count; | 255 | static atomic_t c3_cpu_count; |
256 | 256 | ||
257 | /* Common C-state entry for C2, C3, .. */ | 257 | /* Common C-state entry for C2, C3, .. */ |
@@ -1373,15 +1373,7 @@ static int acpi_idle_enter_c1(struct cpuidle_device *dev, | |||
1373 | if (pr->flags.bm_check) | 1373 | if (pr->flags.bm_check) |
1374 | acpi_idle_update_bm_rld(pr, cx); | 1374 | acpi_idle_update_bm_rld(pr, cx); |
1375 | 1375 | ||
1376 | current_thread_info()->status &= ~TS_POLLING; | 1376 | acpi_safe_halt(); |
1377 | /* | ||
1378 | * TS_POLLING-cleared state must be visible before we test | ||
1379 | * NEED_RESCHED: | ||
1380 | */ | ||
1381 | smp_mb(); | ||
1382 | if (!need_resched()) | ||
1383 | safe_halt(); | ||
1384 | current_thread_info()->status |= TS_POLLING; | ||
1385 | 1377 | ||
1386 | cx->usage++; | 1378 | cx->usage++; |
1387 | 1379 | ||
@@ -1399,6 +1391,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1399 | struct acpi_processor *pr; | 1391 | struct acpi_processor *pr; |
1400 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); | 1392 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); |
1401 | u32 t1, t2; | 1393 | u32 t1, t2; |
1394 | int sleep_ticks = 0; | ||
1395 | |||
1402 | pr = processors[smp_processor_id()]; | 1396 | pr = processors[smp_processor_id()]; |
1403 | 1397 | ||
1404 | if (unlikely(!pr)) | 1398 | if (unlikely(!pr)) |
@@ -1428,6 +1422,8 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1428 | ACPI_FLUSH_CPU_CACHE(); | 1422 | ACPI_FLUSH_CPU_CACHE(); |
1429 | 1423 | ||
1430 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1424 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
1425 | /* Tell the scheduler that we are going deep-idle: */ | ||
1426 | sched_clock_idle_sleep_event(); | ||
1431 | acpi_state_timer_broadcast(pr, cx, 1); | 1427 | acpi_state_timer_broadcast(pr, cx, 1); |
1432 | acpi_idle_do_entry(cx); | 1428 | acpi_idle_do_entry(cx); |
1433 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1429 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
@@ -1436,6 +1432,10 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1436 | /* TSC could halt in idle, so notify users */ | 1432 | /* TSC could halt in idle, so notify users */ |
1437 | mark_tsc_unstable("TSC halts in idle");; | 1433 | mark_tsc_unstable("TSC halts in idle");; |
1438 | #endif | 1434 | #endif |
1435 | sleep_ticks = ticks_elapsed(t1, t2); | ||
1436 | |||
1437 | /* Tell the scheduler how much we idled: */ | ||
1438 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | ||
1439 | 1439 | ||
1440 | local_irq_enable(); | 1440 | local_irq_enable(); |
1441 | current_thread_info()->status |= TS_POLLING; | 1441 | current_thread_info()->status |= TS_POLLING; |
@@ -1443,7 +1443,7 @@ static int acpi_idle_enter_simple(struct cpuidle_device *dev, | |||
1443 | cx->usage++; | 1443 | cx->usage++; |
1444 | 1444 | ||
1445 | acpi_state_timer_broadcast(pr, cx, 0); | 1445 | acpi_state_timer_broadcast(pr, cx, 0); |
1446 | cx->time += ticks_elapsed(t1, t2); | 1446 | cx->time += sleep_ticks; |
1447 | return ticks_elapsed_in_us(t1, t2); | 1447 | return ticks_elapsed_in_us(t1, t2); |
1448 | } | 1448 | } |
1449 | 1449 | ||
@@ -1463,6 +1463,8 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1463 | struct acpi_processor *pr; | 1463 | struct acpi_processor *pr; |
1464 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); | 1464 | struct acpi_processor_cx *cx = cpuidle_get_statedata(state); |
1465 | u32 t1, t2; | 1465 | u32 t1, t2; |
1466 | int sleep_ticks = 0; | ||
1467 | |||
1466 | pr = processors[smp_processor_id()]; | 1468 | pr = processors[smp_processor_id()]; |
1467 | 1469 | ||
1468 | if (unlikely(!pr)) | 1470 | if (unlikely(!pr)) |
@@ -1471,6 +1473,15 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1471 | if (acpi_idle_suspend) | 1473 | if (acpi_idle_suspend) |
1472 | return(acpi_idle_enter_c1(dev, state)); | 1474 | return(acpi_idle_enter_c1(dev, state)); |
1473 | 1475 | ||
1476 | if (acpi_idle_bm_check()) { | ||
1477 | if (dev->safe_state) { | ||
1478 | return dev->safe_state->enter(dev, dev->safe_state); | ||
1479 | } else { | ||
1480 | acpi_safe_halt(); | ||
1481 | return 0; | ||
1482 | } | ||
1483 | } | ||
1484 | |||
1474 | local_irq_disable(); | 1485 | local_irq_disable(); |
1475 | current_thread_info()->status &= ~TS_POLLING; | 1486 | current_thread_info()->status &= ~TS_POLLING; |
1476 | /* | 1487 | /* |
@@ -1485,38 +1496,45 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1485 | return 0; | 1496 | return 0; |
1486 | } | 1497 | } |
1487 | 1498 | ||
1499 | /* Tell the scheduler that we are going deep-idle: */ | ||
1500 | sched_clock_idle_sleep_event(); | ||
1488 | /* | 1501 | /* |
1489 | * Must be done before busmaster disable as we might need to | 1502 | * Must be done before busmaster disable as we might need to |
1490 | * access HPET ! | 1503 | * access HPET ! |
1491 | */ | 1504 | */ |
1492 | acpi_state_timer_broadcast(pr, cx, 1); | 1505 | acpi_state_timer_broadcast(pr, cx, 1); |
1493 | 1506 | ||
1494 | if (acpi_idle_bm_check()) { | 1507 | acpi_idle_update_bm_rld(pr, cx); |
1495 | cx = pr->power.bm_state; | ||
1496 | |||
1497 | acpi_idle_update_bm_rld(pr, cx); | ||
1498 | |||
1499 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | ||
1500 | acpi_idle_do_entry(cx); | ||
1501 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | ||
1502 | } else { | ||
1503 | acpi_idle_update_bm_rld(pr, cx); | ||
1504 | 1508 | ||
1509 | /* | ||
1510 | * disable bus master | ||
1511 | * bm_check implies we need ARB_DIS | ||
1512 | * !bm_check implies we need cache flush | ||
1513 | * bm_control implies whether we can do ARB_DIS | ||
1514 | * | ||
1515 | * That leaves a case where bm_check is set and bm_control is | ||
1516 | * not set. In that case we cannot do much, we enter C3 | ||
1517 | * without doing anything. | ||
1518 | */ | ||
1519 | if (pr->flags.bm_check && pr->flags.bm_control) { | ||
1505 | spin_lock(&c3_lock); | 1520 | spin_lock(&c3_lock); |
1506 | c3_cpu_count++; | 1521 | c3_cpu_count++; |
1507 | /* Disable bus master arbitration when all CPUs are in C3 */ | 1522 | /* Disable bus master arbitration when all CPUs are in C3 */ |
1508 | if (c3_cpu_count == num_online_cpus()) | 1523 | if (c3_cpu_count == num_online_cpus()) |
1509 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); | 1524 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 1); |
1510 | spin_unlock(&c3_lock); | 1525 | spin_unlock(&c3_lock); |
1526 | } else if (!pr->flags.bm_check) { | ||
1527 | ACPI_FLUSH_CPU_CACHE(); | ||
1528 | } | ||
1511 | 1529 | ||
1512 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1530 | t1 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
1513 | acpi_idle_do_entry(cx); | 1531 | acpi_idle_do_entry(cx); |
1514 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); | 1532 | t2 = inl(acpi_gbl_FADT.xpm_timer_block.address); |
1515 | 1533 | ||
1534 | /* Re-enable bus master arbitration */ | ||
1535 | if (pr->flags.bm_check && pr->flags.bm_control) { | ||
1516 | spin_lock(&c3_lock); | 1536 | spin_lock(&c3_lock); |
1517 | /* Re-enable bus master arbitration */ | 1537 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); |
1518 | if (c3_cpu_count == num_online_cpus()) | ||
1519 | acpi_set_register(ACPI_BITREG_ARB_DISABLE, 0); | ||
1520 | c3_cpu_count--; | 1538 | c3_cpu_count--; |
1521 | spin_unlock(&c3_lock); | 1539 | spin_unlock(&c3_lock); |
1522 | } | 1540 | } |
@@ -1525,6 +1543,9 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1525 | /* TSC could halt in idle, so notify users */ | 1543 | /* TSC could halt in idle, so notify users */ |
1526 | mark_tsc_unstable("TSC halts in idle"); | 1544 | mark_tsc_unstable("TSC halts in idle"); |
1527 | #endif | 1545 | #endif |
1546 | sleep_ticks = ticks_elapsed(t1, t2); | ||
1547 | /* Tell the scheduler how much we idled: */ | ||
1548 | sched_clock_idle_wakeup_event(sleep_ticks*PM_TIMER_TICK_NS); | ||
1528 | 1549 | ||
1529 | local_irq_enable(); | 1550 | local_irq_enable(); |
1530 | current_thread_info()->status |= TS_POLLING; | 1551 | current_thread_info()->status |= TS_POLLING; |
@@ -1532,7 +1553,7 @@ static int acpi_idle_enter_bm(struct cpuidle_device *dev, | |||
1532 | cx->usage++; | 1553 | cx->usage++; |
1533 | 1554 | ||
1534 | acpi_state_timer_broadcast(pr, cx, 0); | 1555 | acpi_state_timer_broadcast(pr, cx, 0); |
1535 | cx->time += ticks_elapsed(t1, t2); | 1556 | cx->time += sleep_ticks; |
1536 | return ticks_elapsed_in_us(t1, t2); | 1557 | return ticks_elapsed_in_us(t1, t2); |
1537 | } | 1558 | } |
1538 | 1559 | ||
@@ -1584,12 +1605,14 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) | |||
1584 | case ACPI_STATE_C1: | 1605 | case ACPI_STATE_C1: |
1585 | state->flags |= CPUIDLE_FLAG_SHALLOW; | 1606 | state->flags |= CPUIDLE_FLAG_SHALLOW; |
1586 | state->enter = acpi_idle_enter_c1; | 1607 | state->enter = acpi_idle_enter_c1; |
1608 | dev->safe_state = state; | ||
1587 | break; | 1609 | break; |
1588 | 1610 | ||
1589 | case ACPI_STATE_C2: | 1611 | case ACPI_STATE_C2: |
1590 | state->flags |= CPUIDLE_FLAG_BALANCED; | 1612 | state->flags |= CPUIDLE_FLAG_BALANCED; |
1591 | state->flags |= CPUIDLE_FLAG_TIME_VALID; | 1613 | state->flags |= CPUIDLE_FLAG_TIME_VALID; |
1592 | state->enter = acpi_idle_enter_simple; | 1614 | state->enter = acpi_idle_enter_simple; |
1615 | dev->safe_state = state; | ||
1593 | break; | 1616 | break; |
1594 | 1617 | ||
1595 | case ACPI_STATE_C3: | 1618 | case ACPI_STATE_C3: |
@@ -1610,14 +1633,6 @@ static int acpi_processor_setup_cpuidle(struct acpi_processor *pr) | |||
1610 | if (!count) | 1633 | if (!count) |
1611 | return -EINVAL; | 1634 | return -EINVAL; |
1612 | 1635 | ||
1613 | /* find the deepest state that can handle active BM */ | ||
1614 | if (pr->flags.bm_check) { | ||
1615 | for (i = 1; i < ACPI_PROCESSOR_MAX_POWER && i <= max_cstate; i++) | ||
1616 | if (pr->power.states[i].type == ACPI_STATE_C3) | ||
1617 | break; | ||
1618 | pr->power.bm_state = &pr->power.states[i-1]; | ||
1619 | } | ||
1620 | |||
1621 | return 0; | 1636 | return 0; |
1622 | } | 1637 | } |
1623 | 1638 | ||
@@ -1658,6 +1673,7 @@ int __cpuinit acpi_processor_power_init(struct acpi_processor *pr, | |||
1658 | 1673 | ||
1659 | if (!first_run) { | 1674 | if (!first_run) { |
1660 | dmi_check_system(processor_power_dmi_table); | 1675 | dmi_check_system(processor_power_dmi_table); |
1676 | max_cstate = acpi_processor_cstate_check(max_cstate); | ||
1661 | if (max_cstate < ACPI_C_STATES_MAX) | 1677 | if (max_cstate < ACPI_C_STATES_MAX) |
1662 | printk(KERN_NOTICE | 1678 | printk(KERN_NOTICE |
1663 | "ACPI: processor limited to max C-state %d\n", | 1679 | "ACPI: processor limited to max C-state %d\n", |
diff --git a/drivers/acpi/processor_throttling.c b/drivers/acpi/processor_throttling.c index 0b8204e7082a..c26c61fb36c3 100644 --- a/drivers/acpi/processor_throttling.c +++ b/drivers/acpi/processor_throttling.c | |||
@@ -70,7 +70,55 @@ static int acpi_processor_get_platform_limit(struct acpi_processor *pr) | |||
70 | 70 | ||
71 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr) | 71 | int acpi_processor_tstate_has_changed(struct acpi_processor *pr) |
72 | { | 72 | { |
73 | return acpi_processor_get_platform_limit(pr); | 73 | int result = 0; |
74 | int throttling_limit; | ||
75 | int current_state; | ||
76 | struct acpi_processor_limit *limit; | ||
77 | int target_state; | ||
78 | |||
79 | result = acpi_processor_get_platform_limit(pr); | ||
80 | if (result) { | ||
81 | /* Throttling Limit is unsupported */ | ||
82 | return result; | ||
83 | } | ||
84 | |||
85 | throttling_limit = pr->throttling_platform_limit; | ||
86 | if (throttling_limit >= pr->throttling.state_count) { | ||
87 | /* Uncorrect Throttling Limit */ | ||
88 | return -EINVAL; | ||
89 | } | ||
90 | |||
91 | current_state = pr->throttling.state; | ||
92 | if (current_state > throttling_limit) { | ||
93 | /* | ||
94 | * The current state can meet the requirement of | ||
95 | * _TPC limit. But it is reasonable that OSPM changes | ||
96 | * t-states from high to low for better performance. | ||
97 | * Of course the limit condition of thermal | ||
98 | * and user should be considered. | ||
99 | */ | ||
100 | limit = &pr->limit; | ||
101 | target_state = throttling_limit; | ||
102 | if (limit->thermal.tx > target_state) | ||
103 | target_state = limit->thermal.tx; | ||
104 | if (limit->user.tx > target_state) | ||
105 | target_state = limit->user.tx; | ||
106 | } else if (current_state == throttling_limit) { | ||
107 | /* | ||
108 | * Unnecessary to change the throttling state | ||
109 | */ | ||
110 | return 0; | ||
111 | } else { | ||
112 | /* | ||
113 | * If the current state is lower than the limit of _TPC, it | ||
114 | * will be forced to switch to the throttling state defined | ||
115 | * by throttling_platfor_limit. | ||
116 | * Because the previous state meets with the limit condition | ||
117 | * of thermal and user, it is unnecessary to check it again. | ||
118 | */ | ||
119 | target_state = throttling_limit; | ||
120 | } | ||
121 | return acpi_processor_set_throttling(pr, target_state); | ||
74 | } | 122 | } |
75 | 123 | ||
76 | /* | 124 | /* |
@@ -83,6 +131,7 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr) | |||
83 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | 131 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; |
84 | union acpi_object *ptc = NULL; | 132 | union acpi_object *ptc = NULL; |
85 | union acpi_object obj = { 0 }; | 133 | union acpi_object obj = { 0 }; |
134 | struct acpi_processor_throttling *throttling; | ||
86 | 135 | ||
87 | status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); | 136 | status = acpi_evaluate_object(pr->handle, "_PTC", NULL, &buffer); |
88 | if (ACPI_FAILURE(status)) { | 137 | if (ACPI_FAILURE(status)) { |
@@ -134,6 +183,22 @@ static int acpi_processor_get_throttling_control(struct acpi_processor *pr) | |||
134 | memcpy(&pr->throttling.status_register, obj.buffer.pointer, | 183 | memcpy(&pr->throttling.status_register, obj.buffer.pointer, |
135 | sizeof(struct acpi_ptc_register)); | 184 | sizeof(struct acpi_ptc_register)); |
136 | 185 | ||
186 | throttling = &pr->throttling; | ||
187 | |||
188 | if ((throttling->control_register.bit_width + | ||
189 | throttling->control_register.bit_offset) > 32) { | ||
190 | printk(KERN_ERR PREFIX "Invalid _PTC control register\n"); | ||
191 | result = -EFAULT; | ||
192 | goto end; | ||
193 | } | ||
194 | |||
195 | if ((throttling->status_register.bit_width + | ||
196 | throttling->status_register.bit_offset) > 32) { | ||
197 | printk(KERN_ERR PREFIX "Invalid _PTC status register\n"); | ||
198 | result = -EFAULT; | ||
199 | goto end; | ||
200 | } | ||
201 | |||
137 | end: | 202 | end: |
138 | kfree(buffer.pointer); | 203 | kfree(buffer.pointer); |
139 | 204 | ||
@@ -328,44 +393,132 @@ static int acpi_processor_get_throttling_fadt(struct acpi_processor *pr) | |||
328 | return 0; | 393 | return 0; |
329 | } | 394 | } |
330 | 395 | ||
331 | static int acpi_read_throttling_status(struct acpi_processor_throttling | 396 | #ifdef CONFIG_X86 |
332 | *throttling) | 397 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, |
398 | acpi_integer * value) | ||
333 | { | 399 | { |
334 | int value = -1; | 400 | struct cpuinfo_x86 *c; |
401 | u64 msr_high, msr_low; | ||
402 | unsigned int cpu; | ||
403 | u64 msr = 0; | ||
404 | int ret = -1; | ||
405 | |||
406 | cpu = pr->id; | ||
407 | c = &cpu_data(cpu); | ||
408 | |||
409 | if ((c->x86_vendor != X86_VENDOR_INTEL) || | ||
410 | !cpu_has(c, X86_FEATURE_ACPI)) { | ||
411 | printk(KERN_ERR PREFIX | ||
412 | "HARDWARE addr space,NOT supported yet\n"); | ||
413 | } else { | ||
414 | msr_low = 0; | ||
415 | msr_high = 0; | ||
416 | rdmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, | ||
417 | (u32 *)&msr_low , (u32 *) &msr_high); | ||
418 | msr = (msr_high << 32) | msr_low; | ||
419 | *value = (acpi_integer) msr; | ||
420 | ret = 0; | ||
421 | } | ||
422 | return ret; | ||
423 | } | ||
424 | |||
425 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | ||
426 | { | ||
427 | struct cpuinfo_x86 *c; | ||
428 | unsigned int cpu; | ||
429 | int ret = -1; | ||
430 | u64 msr; | ||
431 | |||
432 | cpu = pr->id; | ||
433 | c = &cpu_data(cpu); | ||
434 | |||
435 | if ((c->x86_vendor != X86_VENDOR_INTEL) || | ||
436 | !cpu_has(c, X86_FEATURE_ACPI)) { | ||
437 | printk(KERN_ERR PREFIX | ||
438 | "HARDWARE addr space,NOT supported yet\n"); | ||
439 | } else { | ||
440 | msr = value; | ||
441 | wrmsr_on_cpu(cpu, MSR_IA32_THERM_CONTROL, | ||
442 | msr & 0xffffffff, msr >> 32); | ||
443 | ret = 0; | ||
444 | } | ||
445 | return ret; | ||
446 | } | ||
447 | #else | ||
448 | static int acpi_throttling_rdmsr(struct acpi_processor *pr, | ||
449 | acpi_integer * value) | ||
450 | { | ||
451 | printk(KERN_ERR PREFIX | ||
452 | "HARDWARE addr space,NOT supported yet\n"); | ||
453 | return -1; | ||
454 | } | ||
455 | |||
456 | static int acpi_throttling_wrmsr(struct acpi_processor *pr, acpi_integer value) | ||
457 | { | ||
458 | printk(KERN_ERR PREFIX | ||
459 | "HARDWARE addr space,NOT supported yet\n"); | ||
460 | return -1; | ||
461 | } | ||
462 | #endif | ||
463 | |||
464 | static int acpi_read_throttling_status(struct acpi_processor *pr, | ||
465 | acpi_integer *value) | ||
466 | { | ||
467 | u32 bit_width, bit_offset; | ||
468 | u64 ptc_value; | ||
469 | u64 ptc_mask; | ||
470 | struct acpi_processor_throttling *throttling; | ||
471 | int ret = -1; | ||
472 | |||
473 | throttling = &pr->throttling; | ||
335 | switch (throttling->status_register.space_id) { | 474 | switch (throttling->status_register.space_id) { |
336 | case ACPI_ADR_SPACE_SYSTEM_IO: | 475 | case ACPI_ADR_SPACE_SYSTEM_IO: |
476 | ptc_value = 0; | ||
477 | bit_width = throttling->status_register.bit_width; | ||
478 | bit_offset = throttling->status_register.bit_offset; | ||
479 | |||
337 | acpi_os_read_port((acpi_io_address) throttling->status_register. | 480 | acpi_os_read_port((acpi_io_address) throttling->status_register. |
338 | address, &value, | 481 | address, (u32 *) &ptc_value, |
339 | (u32) throttling->status_register.bit_width * | 482 | (u32) (bit_width + bit_offset)); |
340 | 8); | 483 | ptc_mask = (1 << bit_width) - 1; |
484 | *value = (acpi_integer) ((ptc_value >> bit_offset) & ptc_mask); | ||
485 | ret = 0; | ||
341 | break; | 486 | break; |
342 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 487 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
343 | printk(KERN_ERR PREFIX | 488 | ret = acpi_throttling_rdmsr(pr, value); |
344 | "HARDWARE addr space,NOT supported yet\n"); | ||
345 | break; | 489 | break; |
346 | default: | 490 | default: |
347 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | 491 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", |
348 | (u32) (throttling->status_register.space_id)); | 492 | (u32) (throttling->status_register.space_id)); |
349 | } | 493 | } |
350 | return value; | 494 | return ret; |
351 | } | 495 | } |
352 | 496 | ||
353 | static int acpi_write_throttling_state(struct acpi_processor_throttling | 497 | static int acpi_write_throttling_state(struct acpi_processor *pr, |
354 | *throttling, int value) | 498 | acpi_integer value) |
355 | { | 499 | { |
500 | u32 bit_width, bit_offset; | ||
501 | u64 ptc_value; | ||
502 | u64 ptc_mask; | ||
503 | struct acpi_processor_throttling *throttling; | ||
356 | int ret = -1; | 504 | int ret = -1; |
357 | 505 | ||
506 | throttling = &pr->throttling; | ||
358 | switch (throttling->control_register.space_id) { | 507 | switch (throttling->control_register.space_id) { |
359 | case ACPI_ADR_SPACE_SYSTEM_IO: | 508 | case ACPI_ADR_SPACE_SYSTEM_IO: |
509 | bit_width = throttling->control_register.bit_width; | ||
510 | bit_offset = throttling->control_register.bit_offset; | ||
511 | ptc_mask = (1 << bit_width) - 1; | ||
512 | ptc_value = value & ptc_mask; | ||
513 | |||
360 | acpi_os_write_port((acpi_io_address) throttling-> | 514 | acpi_os_write_port((acpi_io_address) throttling-> |
361 | control_register.address, value, | 515 | control_register.address, |
362 | (u32) throttling->control_register. | 516 | (u32) (ptc_value << bit_offset), |
363 | bit_width * 8); | 517 | (u32) (bit_width + bit_offset)); |
364 | ret = 0; | 518 | ret = 0; |
365 | break; | 519 | break; |
366 | case ACPI_ADR_SPACE_FIXED_HARDWARE: | 520 | case ACPI_ADR_SPACE_FIXED_HARDWARE: |
367 | printk(KERN_ERR PREFIX | 521 | ret = acpi_throttling_wrmsr(pr, value); |
368 | "HARDWARE addr space,NOT supported yet\n"); | ||
369 | break; | 522 | break; |
370 | default: | 523 | default: |
371 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", | 524 | printk(KERN_ERR PREFIX "Unknown addr space %d\n", |
@@ -374,7 +527,8 @@ static int acpi_write_throttling_state(struct acpi_processor_throttling | |||
374 | return ret; | 527 | return ret; |
375 | } | 528 | } |
376 | 529 | ||
377 | static int acpi_get_throttling_state(struct acpi_processor *pr, int value) | 530 | static int acpi_get_throttling_state(struct acpi_processor *pr, |
531 | acpi_integer value) | ||
378 | { | 532 | { |
379 | int i; | 533 | int i; |
380 | 534 | ||
@@ -390,22 +544,26 @@ static int acpi_get_throttling_state(struct acpi_processor *pr, int value) | |||
390 | return i; | 544 | return i; |
391 | } | 545 | } |
392 | 546 | ||
393 | static int acpi_get_throttling_value(struct acpi_processor *pr, int state) | 547 | static int acpi_get_throttling_value(struct acpi_processor *pr, |
548 | int state, acpi_integer *value) | ||
394 | { | 549 | { |
395 | int value = -1; | 550 | int ret = -1; |
551 | |||
396 | if (state >= 0 && state <= pr->throttling.state_count) { | 552 | if (state >= 0 && state <= pr->throttling.state_count) { |
397 | struct acpi_processor_tx_tss *tx = | 553 | struct acpi_processor_tx_tss *tx = |
398 | (struct acpi_processor_tx_tss *)&(pr->throttling. | 554 | (struct acpi_processor_tx_tss *)&(pr->throttling. |
399 | states_tss[state]); | 555 | states_tss[state]); |
400 | value = tx->control; | 556 | *value = tx->control; |
557 | ret = 0; | ||
401 | } | 558 | } |
402 | return value; | 559 | return ret; |
403 | } | 560 | } |
404 | 561 | ||
405 | static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | 562 | static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) |
406 | { | 563 | { |
407 | int state = 0; | 564 | int state = 0; |
408 | u32 value = 0; | 565 | int ret; |
566 | acpi_integer value; | ||
409 | 567 | ||
410 | if (!pr) | 568 | if (!pr) |
411 | return -EINVAL; | 569 | return -EINVAL; |
@@ -415,8 +573,9 @@ static int acpi_processor_get_throttling_ptc(struct acpi_processor *pr) | |||
415 | 573 | ||
416 | pr->throttling.state = 0; | 574 | pr->throttling.state = 0; |
417 | local_irq_disable(); | 575 | local_irq_disable(); |
418 | value = acpi_read_throttling_status(&pr->throttling); | 576 | value = 0; |
419 | if (value >= 0) { | 577 | ret = acpi_read_throttling_status(pr, &value); |
578 | if (ret >= 0) { | ||
420 | state = acpi_get_throttling_state(pr, value); | 579 | state = acpi_get_throttling_state(pr, value); |
421 | pr->throttling.state = state; | 580 | pr->throttling.state = state; |
422 | } | 581 | } |
@@ -430,6 +589,40 @@ static int acpi_processor_get_throttling(struct acpi_processor *pr) | |||
430 | return pr->throttling.acpi_processor_get_throttling(pr); | 589 | return pr->throttling.acpi_processor_get_throttling(pr); |
431 | } | 590 | } |
432 | 591 | ||
592 | static int acpi_processor_get_fadt_info(struct acpi_processor *pr) | ||
593 | { | ||
594 | int i, step; | ||
595 | |||
596 | if (!pr->throttling.address) { | ||
597 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); | ||
598 | return -EINVAL; | ||
599 | } else if (!pr->throttling.duty_width) { | ||
600 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); | ||
601 | return -EINVAL; | ||
602 | } | ||
603 | /* TBD: Support duty_cycle values that span bit 4. */ | ||
604 | else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { | ||
605 | printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n"); | ||
606 | return -EINVAL; | ||
607 | } | ||
608 | |||
609 | pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width; | ||
610 | |||
611 | /* | ||
612 | * Compute state values. Note that throttling displays a linear power | ||
613 | * performance relationship (at 50% performance the CPU will consume | ||
614 | * 50% power). Values are in 1/10th of a percent to preserve accuracy. | ||
615 | */ | ||
616 | |||
617 | step = (1000 / pr->throttling.state_count); | ||
618 | |||
619 | for (i = 0; i < pr->throttling.state_count; i++) { | ||
620 | pr->throttling.states[i].performance = 1000 - step * i; | ||
621 | pr->throttling.states[i].power = 1000 - step * i; | ||
622 | } | ||
623 | return 0; | ||
624 | } | ||
625 | |||
433 | static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, | 626 | static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, |
434 | int state) | 627 | int state) |
435 | { | 628 | { |
@@ -506,7 +699,8 @@ static int acpi_processor_set_throttling_fadt(struct acpi_processor *pr, | |||
506 | static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | 699 | static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, |
507 | int state) | 700 | int state) |
508 | { | 701 | { |
509 | u32 value = 0; | 702 | int ret; |
703 | acpi_integer value; | ||
510 | 704 | ||
511 | if (!pr) | 705 | if (!pr) |
512 | return -EINVAL; | 706 | return -EINVAL; |
@@ -524,10 +718,10 @@ static int acpi_processor_set_throttling_ptc(struct acpi_processor *pr, | |||
524 | return -EPERM; | 718 | return -EPERM; |
525 | 719 | ||
526 | local_irq_disable(); | 720 | local_irq_disable(); |
527 | 721 | value = 0; | |
528 | value = acpi_get_throttling_value(pr, state); | 722 | ret = acpi_get_throttling_value(pr, state, &value); |
529 | if (value >= 0) { | 723 | if (ret >= 0) { |
530 | acpi_write_throttling_state(&pr->throttling, value); | 724 | acpi_write_throttling_state(pr, value); |
531 | pr->throttling.state = state; | 725 | pr->throttling.state = state; |
532 | } | 726 | } |
533 | local_irq_enable(); | 727 | local_irq_enable(); |
@@ -543,8 +737,6 @@ int acpi_processor_set_throttling(struct acpi_processor *pr, int state) | |||
543 | int acpi_processor_get_throttling_info(struct acpi_processor *pr) | 737 | int acpi_processor_get_throttling_info(struct acpi_processor *pr) |
544 | { | 738 | { |
545 | int result = 0; | 739 | int result = 0; |
546 | int step = 0; | ||
547 | int i = 0; | ||
548 | 740 | ||
549 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, | 741 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, |
550 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", | 742 | "pblk_address[0x%08x] duty_offset[%d] duty_width[%d]\n", |
@@ -563,6 +755,8 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
563 | acpi_processor_get_throttling_states(pr) || | 755 | acpi_processor_get_throttling_states(pr) || |
564 | acpi_processor_get_platform_limit(pr)) | 756 | acpi_processor_get_platform_limit(pr)) |
565 | { | 757 | { |
758 | if (acpi_processor_get_fadt_info(pr)) | ||
759 | return 0; | ||
566 | pr->throttling.acpi_processor_get_throttling = | 760 | pr->throttling.acpi_processor_get_throttling = |
567 | &acpi_processor_get_throttling_fadt; | 761 | &acpi_processor_get_throttling_fadt; |
568 | pr->throttling.acpi_processor_set_throttling = | 762 | pr->throttling.acpi_processor_set_throttling = |
@@ -576,19 +770,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
576 | 770 | ||
577 | acpi_processor_get_tsd(pr); | 771 | acpi_processor_get_tsd(pr); |
578 | 772 | ||
579 | if (!pr->throttling.address) { | ||
580 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling register\n")); | ||
581 | return 0; | ||
582 | } else if (!pr->throttling.duty_width) { | ||
583 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "No throttling states\n")); | ||
584 | return 0; | ||
585 | } | ||
586 | /* TBD: Support duty_cycle values that span bit 4. */ | ||
587 | else if ((pr->throttling.duty_offset + pr->throttling.duty_width) > 4) { | ||
588 | printk(KERN_WARNING PREFIX "duty_cycle spans bit 4\n"); | ||
589 | return 0; | ||
590 | } | ||
591 | |||
592 | /* | 773 | /* |
593 | * PIIX4 Errata: We don't support throttling on the original PIIX4. | 774 | * PIIX4 Errata: We don't support throttling on the original PIIX4. |
594 | * This shouldn't be an issue as few (if any) mobile systems ever | 775 | * This shouldn't be an issue as few (if any) mobile systems ever |
@@ -600,21 +781,6 @@ int acpi_processor_get_throttling_info(struct acpi_processor *pr) | |||
600 | return 0; | 781 | return 0; |
601 | } | 782 | } |
602 | 783 | ||
603 | pr->throttling.state_count = 1 << acpi_gbl_FADT.duty_width; | ||
604 | |||
605 | /* | ||
606 | * Compute state values. Note that throttling displays a linear power/ | ||
607 | * performance relationship (at 50% performance the CPU will consume | ||
608 | * 50% power). Values are in 1/10th of a percent to preserve accuracy. | ||
609 | */ | ||
610 | |||
611 | step = (1000 / pr->throttling.state_count); | ||
612 | |||
613 | for (i = 0; i < pr->throttling.state_count; i++) { | ||
614 | pr->throttling.states[i].performance = step * i; | ||
615 | pr->throttling.states[i].power = step * i; | ||
616 | } | ||
617 | |||
618 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n", | 784 | ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Found %d throttling states\n", |
619 | pr->throttling.state_count)); | 785 | pr->throttling.state_count)); |
620 | 786 | ||
diff --git a/drivers/acpi/sbs.c b/drivers/acpi/sbs.c index 90fd09c65f95..6045cdbe176b 100644 --- a/drivers/acpi/sbs.c +++ b/drivers/acpi/sbs.c | |||
@@ -29,7 +29,7 @@ | |||
29 | #include <linux/moduleparam.h> | 29 | #include <linux/moduleparam.h> |
30 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
31 | 31 | ||
32 | #ifdef CONFIG_ACPI_PROCFS | 32 | #ifdef CONFIG_ACPI_PROCFS_POWER |
33 | #include <linux/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
34 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
35 | #include <asm/uaccess.h> | 35 | #include <asm/uaccess.h> |
@@ -88,7 +88,7 @@ MODULE_DEVICE_TABLE(acpi, sbs_device_ids); | |||
88 | struct acpi_battery { | 88 | struct acpi_battery { |
89 | struct power_supply bat; | 89 | struct power_supply bat; |
90 | struct acpi_sbs *sbs; | 90 | struct acpi_sbs *sbs; |
91 | #ifdef CONFIG_ACPI_PROCFS | 91 | #ifdef CONFIG_ACPI_PROCFS_POWER |
92 | struct proc_dir_entry *proc_entry; | 92 | struct proc_dir_entry *proc_entry; |
93 | #endif | 93 | #endif |
94 | unsigned long update_time; | 94 | unsigned long update_time; |
@@ -113,6 +113,7 @@ struct acpi_battery { | |||
113 | u16 spec; | 113 | u16 spec; |
114 | u8 id; | 114 | u8 id; |
115 | u8 present:1; | 115 | u8 present:1; |
116 | u8 have_sysfs_alarm:1; | ||
116 | }; | 117 | }; |
117 | 118 | ||
118 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); | 119 | #define to_acpi_battery(x) container_of(x, struct acpi_battery, bat); |
@@ -122,7 +123,7 @@ struct acpi_sbs { | |||
122 | struct acpi_device *device; | 123 | struct acpi_device *device; |
123 | struct acpi_smb_hc *hc; | 124 | struct acpi_smb_hc *hc; |
124 | struct mutex lock; | 125 | struct mutex lock; |
125 | #ifdef CONFIG_ACPI_PROCFS | 126 | #ifdef CONFIG_ACPI_PROCFS_POWER |
126 | struct proc_dir_entry *charger_entry; | 127 | struct proc_dir_entry *charger_entry; |
127 | #endif | 128 | #endif |
128 | struct acpi_battery battery[MAX_SBS_BAT]; | 129 | struct acpi_battery battery[MAX_SBS_BAT]; |
@@ -468,7 +469,7 @@ static struct device_attribute alarm_attr = { | |||
468 | FS Interface (/proc/acpi) | 469 | FS Interface (/proc/acpi) |
469 | -------------------------------------------------------------------------- */ | 470 | -------------------------------------------------------------------------- */ |
470 | 471 | ||
471 | #ifdef CONFIG_ACPI_PROCFS | 472 | #ifdef CONFIG_ACPI_PROCFS_POWER |
472 | /* Generic Routines */ | 473 | /* Generic Routines */ |
473 | static int | 474 | static int |
474 | acpi_sbs_add_fs(struct proc_dir_entry **dir, | 475 | acpi_sbs_add_fs(struct proc_dir_entry **dir, |
@@ -789,7 +790,7 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
789 | return result; | 790 | return result; |
790 | 791 | ||
791 | sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id); | 792 | sprintf(battery->name, ACPI_BATTERY_DIR_NAME, id); |
792 | #ifdef CONFIG_ACPI_PROCFS | 793 | #ifdef CONFIG_ACPI_PROCFS_POWER |
793 | acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir, | 794 | acpi_sbs_add_fs(&battery->proc_entry, acpi_battery_dir, |
794 | battery->name, &acpi_battery_info_fops, | 795 | battery->name, &acpi_battery_info_fops, |
795 | &acpi_battery_state_fops, &acpi_battery_alarm_fops, | 796 | &acpi_battery_state_fops, &acpi_battery_alarm_fops, |
@@ -808,7 +809,13 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
808 | } | 809 | } |
809 | battery->bat.get_property = acpi_sbs_battery_get_property; | 810 | battery->bat.get_property = acpi_sbs_battery_get_property; |
810 | result = power_supply_register(&sbs->device->dev, &battery->bat); | 811 | result = power_supply_register(&sbs->device->dev, &battery->bat); |
811 | device_create_file(battery->bat.dev, &alarm_attr); | 812 | if (result) |
813 | goto end; | ||
814 | result = device_create_file(battery->bat.dev, &alarm_attr); | ||
815 | if (result) | ||
816 | goto end; | ||
817 | battery->have_sysfs_alarm = 1; | ||
818 | end: | ||
812 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", | 819 | printk(KERN_INFO PREFIX "%s [%s]: Battery Slot [%s] (battery %s)\n", |
813 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), | 820 | ACPI_SBS_DEVICE_NAME, acpi_device_bid(sbs->device), |
814 | battery->name, sbs->battery->present ? "present" : "absent"); | 821 | battery->name, sbs->battery->present ? "present" : "absent"); |
@@ -817,14 +824,16 @@ static int acpi_battery_add(struct acpi_sbs *sbs, int id) | |||
817 | 824 | ||
818 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) | 825 | static void acpi_battery_remove(struct acpi_sbs *sbs, int id) |
819 | { | 826 | { |
820 | if (sbs->battery[id].bat.dev) | 827 | struct acpi_battery *battery = &sbs->battery[id]; |
821 | device_remove_file(sbs->battery[id].bat.dev, &alarm_attr); | 828 | |
822 | power_supply_unregister(&sbs->battery[id].bat); | 829 | if (battery->bat.dev) { |
823 | #ifdef CONFIG_ACPI_PROCFS | 830 | if (battery->have_sysfs_alarm) |
824 | if (sbs->battery[id].proc_entry) { | 831 | device_remove_file(battery->bat.dev, &alarm_attr); |
825 | acpi_sbs_remove_fs(&(sbs->battery[id].proc_entry), | 832 | power_supply_unregister(&battery->bat); |
826 | acpi_battery_dir); | ||
827 | } | 833 | } |
834 | #ifdef CONFIG_ACPI_PROCFS_POWER | ||
835 | if (battery->proc_entry) | ||
836 | acpi_sbs_remove_fs(&battery->proc_entry, acpi_battery_dir); | ||
828 | #endif | 837 | #endif |
829 | } | 838 | } |
830 | 839 | ||
@@ -835,7 +844,7 @@ static int acpi_charger_add(struct acpi_sbs *sbs) | |||
835 | result = acpi_ac_get_present(sbs); | 844 | result = acpi_ac_get_present(sbs); |
836 | if (result) | 845 | if (result) |
837 | goto end; | 846 | goto end; |
838 | #ifdef CONFIG_ACPI_PROCFS | 847 | #ifdef CONFIG_ACPI_PROCFS_POWER |
839 | result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir, | 848 | result = acpi_sbs_add_fs(&sbs->charger_entry, acpi_ac_dir, |
840 | ACPI_AC_DIR_NAME, NULL, | 849 | ACPI_AC_DIR_NAME, NULL, |
841 | &acpi_ac_state_fops, NULL, sbs); | 850 | &acpi_ac_state_fops, NULL, sbs); |
@@ -859,7 +868,7 @@ static void acpi_charger_remove(struct acpi_sbs *sbs) | |||
859 | { | 868 | { |
860 | if (sbs->charger.dev) | 869 | if (sbs->charger.dev) |
861 | power_supply_unregister(&sbs->charger); | 870 | power_supply_unregister(&sbs->charger); |
862 | #ifdef CONFIG_ACPI_PROCFS | 871 | #ifdef CONFIG_ACPI_PROCFS_POWER |
863 | if (sbs->charger_entry) | 872 | if (sbs->charger_entry) |
864 | acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); | 873 | acpi_sbs_remove_fs(&sbs->charger_entry, acpi_ac_dir); |
865 | #endif | 874 | #endif |
@@ -965,7 +974,7 @@ static int acpi_sbs_remove(struct acpi_device *device, int type) | |||
965 | 974 | ||
966 | static void acpi_sbs_rmdirs(void) | 975 | static void acpi_sbs_rmdirs(void) |
967 | { | 976 | { |
968 | #ifdef CONFIG_ACPI_PROCFS | 977 | #ifdef CONFIG_ACPI_PROCFS_POWER |
969 | if (acpi_ac_dir) { | 978 | if (acpi_ac_dir) { |
970 | acpi_unlock_ac_dir(acpi_ac_dir); | 979 | acpi_unlock_ac_dir(acpi_ac_dir); |
971 | acpi_ac_dir = NULL; | 980 | acpi_ac_dir = NULL; |
@@ -1004,7 +1013,7 @@ static int __init acpi_sbs_init(void) | |||
1004 | 1013 | ||
1005 | if (acpi_disabled) | 1014 | if (acpi_disabled) |
1006 | return -ENODEV; | 1015 | return -ENODEV; |
1007 | #ifdef CONFIG_ACPI_PROCFS | 1016 | #ifdef CONFIG_ACPI_PROCFS_POWER |
1008 | acpi_ac_dir = acpi_lock_ac_dir(); | 1017 | acpi_ac_dir = acpi_lock_ac_dir(); |
1009 | if (!acpi_ac_dir) | 1018 | if (!acpi_ac_dir) |
1010 | return -ENODEV; | 1019 | return -ENODEV; |
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c index 5f1d85f2ffe4..010f19652f80 100644 --- a/drivers/acpi/tables/tbutils.c +++ b/drivers/acpi/tables/tbutils.c | |||
@@ -449,7 +449,7 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags) | |||
449 | /* XSDT has NULL entry, RSDT is used */ | 449 | /* XSDT has NULL entry, RSDT is used */ |
450 | address = rsdt_address; | 450 | address = rsdt_address; |
451 | table_entry_size = sizeof(u32); | 451 | table_entry_size = sizeof(u32); |
452 | ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry," | 452 | ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry, " |
453 | "using RSDT")); | 453 | "using RSDT")); |
454 | } | 454 | } |
455 | } | 455 | } |
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index bac956b30c57..44a0d9ba9bd6 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include <linux/init.h> | 29 | #include <linux/init.h> |
30 | #include <linux/types.h> | 30 | #include <linux/types.h> |
31 | #include <linux/list.h> | 31 | #include <linux/list.h> |
32 | #include <linux/mutex.h> | ||
32 | #include <linux/proc_fs.h> | 33 | #include <linux/proc_fs.h> |
33 | #include <linux/seq_file.h> | 34 | #include <linux/seq_file.h> |
34 | #include <linux/input.h> | 35 | #include <linux/input.h> |
@@ -135,8 +136,8 @@ struct acpi_video_bus { | |||
135 | u8 attached_count; | 136 | u8 attached_count; |
136 | struct acpi_video_bus_cap cap; | 137 | struct acpi_video_bus_cap cap; |
137 | struct acpi_video_bus_flags flags; | 138 | struct acpi_video_bus_flags flags; |
138 | struct semaphore sem; | ||
139 | struct list_head video_device_list; | 139 | struct list_head video_device_list; |
140 | struct mutex device_list_lock; /* protects video_device_list */ | ||
140 | struct proc_dir_entry *dir; | 141 | struct proc_dir_entry *dir; |
141 | struct input_dev *input; | 142 | struct input_dev *input; |
142 | char phys[32]; /* for input device */ | 143 | char phys[32]; /* for input device */ |
@@ -896,7 +897,7 @@ acpi_video_device_write_brightness(struct file *file, | |||
896 | { | 897 | { |
897 | struct seq_file *m = file->private_data; | 898 | struct seq_file *m = file->private_data; |
898 | struct acpi_video_device *dev = m->private; | 899 | struct acpi_video_device *dev = m->private; |
899 | char str[4] = { 0 }; | 900 | char str[5] = { 0 }; |
900 | unsigned int level = 0; | 901 | unsigned int level = 0; |
901 | int i; | 902 | int i; |
902 | 903 | ||
@@ -1436,9 +1437,9 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1436 | return -ENODEV; | 1437 | return -ENODEV; |
1437 | } | 1438 | } |
1438 | 1439 | ||
1439 | down(&video->sem); | 1440 | mutex_lock(&video->device_list_lock); |
1440 | list_add_tail(&data->entry, &video->video_device_list); | 1441 | list_add_tail(&data->entry, &video->video_device_list); |
1441 | up(&video->sem); | 1442 | mutex_unlock(&video->device_list_lock); |
1442 | 1443 | ||
1443 | acpi_video_device_add_fs(device); | 1444 | acpi_video_device_add_fs(device); |
1444 | 1445 | ||
@@ -1462,12 +1463,14 @@ acpi_video_bus_get_one_device(struct acpi_device *device, | |||
1462 | 1463 | ||
1463 | static void acpi_video_device_rebind(struct acpi_video_bus *video) | 1464 | static void acpi_video_device_rebind(struct acpi_video_bus *video) |
1464 | { | 1465 | { |
1465 | struct list_head *node, *next; | 1466 | struct acpi_video_device *dev; |
1466 | list_for_each_safe(node, next, &video->video_device_list) { | 1467 | |
1467 | struct acpi_video_device *dev = | 1468 | mutex_lock(&video->device_list_lock); |
1468 | container_of(node, struct acpi_video_device, entry); | 1469 | |
1470 | list_for_each_entry(dev, &video->video_device_list, entry) | ||
1469 | acpi_video_device_bind(video, dev); | 1471 | acpi_video_device_bind(video, dev); |
1470 | } | 1472 | |
1473 | mutex_unlock(&video->device_list_lock); | ||
1471 | } | 1474 | } |
1472 | 1475 | ||
1473 | /* | 1476 | /* |
@@ -1592,30 +1595,33 @@ static int acpi_video_device_enumerate(struct acpi_video_bus *video) | |||
1592 | 1595 | ||
1593 | static int acpi_video_switch_output(struct acpi_video_bus *video, int event) | 1596 | static int acpi_video_switch_output(struct acpi_video_bus *video, int event) |
1594 | { | 1597 | { |
1595 | struct list_head *node, *next; | 1598 | struct list_head *node; |
1596 | struct acpi_video_device *dev = NULL; | 1599 | struct acpi_video_device *dev = NULL; |
1597 | struct acpi_video_device *dev_next = NULL; | 1600 | struct acpi_video_device *dev_next = NULL; |
1598 | struct acpi_video_device *dev_prev = NULL; | 1601 | struct acpi_video_device *dev_prev = NULL; |
1599 | unsigned long state; | 1602 | unsigned long state; |
1600 | int status = 0; | 1603 | int status = 0; |
1601 | 1604 | ||
1605 | mutex_lock(&video->device_list_lock); | ||
1602 | 1606 | ||
1603 | list_for_each_safe(node, next, &video->video_device_list) { | 1607 | list_for_each(node, &video->video_device_list) { |
1604 | dev = container_of(node, struct acpi_video_device, entry); | 1608 | dev = container_of(node, struct acpi_video_device, entry); |
1605 | status = acpi_video_device_get_state(dev, &state); | 1609 | status = acpi_video_device_get_state(dev, &state); |
1606 | if (state & 0x2) { | 1610 | if (state & 0x2) { |
1607 | dev_next = | 1611 | dev_next = container_of(node->next, |
1608 | container_of(node->next, struct acpi_video_device, | 1612 | struct acpi_video_device, entry); |
1609 | entry); | 1613 | dev_prev = container_of(node->prev, |
1610 | dev_prev = | 1614 | struct acpi_video_device, entry); |
1611 | container_of(node->prev, struct acpi_video_device, | ||
1612 | entry); | ||
1613 | goto out; | 1615 | goto out; |
1614 | } | 1616 | } |
1615 | } | 1617 | } |
1618 | |||
1616 | dev_next = container_of(node->next, struct acpi_video_device, entry); | 1619 | dev_next = container_of(node->next, struct acpi_video_device, entry); |
1617 | dev_prev = container_of(node->prev, struct acpi_video_device, entry); | 1620 | dev_prev = container_of(node->prev, struct acpi_video_device, entry); |
1618 | out: | 1621 | |
1622 | out: | ||
1623 | mutex_unlock(&video->device_list_lock); | ||
1624 | |||
1619 | switch (event) { | 1625 | switch (event) { |
1620 | case ACPI_VIDEO_NOTIFY_CYCLE: | 1626 | case ACPI_VIDEO_NOTIFY_CYCLE: |
1621 | case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: | 1627 | case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: |
@@ -1691,24 +1697,17 @@ acpi_video_bus_get_devices(struct acpi_video_bus *video, | |||
1691 | struct acpi_device *device) | 1697 | struct acpi_device *device) |
1692 | { | 1698 | { |
1693 | int status = 0; | 1699 | int status = 0; |
1694 | struct list_head *node, *next; | 1700 | struct acpi_device *dev; |
1695 | |||
1696 | 1701 | ||
1697 | acpi_video_device_enumerate(video); | 1702 | acpi_video_device_enumerate(video); |
1698 | 1703 | ||
1699 | list_for_each_safe(node, next, &device->children) { | 1704 | list_for_each_entry(dev, &device->children, node) { |
1700 | struct acpi_device *dev = | ||
1701 | list_entry(node, struct acpi_device, node); | ||
1702 | |||
1703 | if (!dev) | ||
1704 | continue; | ||
1705 | 1705 | ||
1706 | status = acpi_video_bus_get_one_device(dev, video); | 1706 | status = acpi_video_bus_get_one_device(dev, video); |
1707 | if (ACPI_FAILURE(status)) { | 1707 | if (ACPI_FAILURE(status)) { |
1708 | ACPI_EXCEPTION((AE_INFO, status, "Cant attach device")); | 1708 | ACPI_EXCEPTION((AE_INFO, status, "Cant attach device")); |
1709 | continue; | 1709 | continue; |
1710 | } | 1710 | } |
1711 | |||
1712 | } | 1711 | } |
1713 | return status; | 1712 | return status; |
1714 | } | 1713 | } |
@@ -1724,9 +1723,6 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | |||
1724 | 1723 | ||
1725 | video = device->video; | 1724 | video = device->video; |
1726 | 1725 | ||
1727 | down(&video->sem); | ||
1728 | list_del(&device->entry); | ||
1729 | up(&video->sem); | ||
1730 | acpi_video_device_remove_fs(device->dev); | 1726 | acpi_video_device_remove_fs(device->dev); |
1731 | 1727 | ||
1732 | status = acpi_remove_notify_handler(device->dev->handle, | 1728 | status = acpi_remove_notify_handler(device->dev->handle, |
@@ -1734,32 +1730,34 @@ static int acpi_video_bus_put_one_device(struct acpi_video_device *device) | |||
1734 | acpi_video_device_notify); | 1730 | acpi_video_device_notify); |
1735 | backlight_device_unregister(device->backlight); | 1731 | backlight_device_unregister(device->backlight); |
1736 | video_output_unregister(device->output_dev); | 1732 | video_output_unregister(device->output_dev); |
1733 | |||
1737 | return 0; | 1734 | return 0; |
1738 | } | 1735 | } |
1739 | 1736 | ||
1740 | static int acpi_video_bus_put_devices(struct acpi_video_bus *video) | 1737 | static int acpi_video_bus_put_devices(struct acpi_video_bus *video) |
1741 | { | 1738 | { |
1742 | int status; | 1739 | int status; |
1743 | struct list_head *node, *next; | 1740 | struct acpi_video_device *dev, *next; |
1744 | 1741 | ||
1742 | mutex_lock(&video->device_list_lock); | ||
1745 | 1743 | ||
1746 | list_for_each_safe(node, next, &video->video_device_list) { | 1744 | list_for_each_entry_safe(dev, next, &video->video_device_list, entry) { |
1747 | struct acpi_video_device *data = | ||
1748 | list_entry(node, struct acpi_video_device, entry); | ||
1749 | if (!data) | ||
1750 | continue; | ||
1751 | 1745 | ||
1752 | status = acpi_video_bus_put_one_device(data); | 1746 | status = acpi_video_bus_put_one_device(dev); |
1753 | if (ACPI_FAILURE(status)) | 1747 | if (ACPI_FAILURE(status)) |
1754 | printk(KERN_WARNING PREFIX | 1748 | printk(KERN_WARNING PREFIX |
1755 | "hhuuhhuu bug in acpi video driver.\n"); | 1749 | "hhuuhhuu bug in acpi video driver.\n"); |
1756 | 1750 | ||
1757 | if (data->brightness) | 1751 | if (dev->brightness) { |
1758 | kfree(data->brightness->levels); | 1752 | kfree(dev->brightness->levels); |
1759 | kfree(data->brightness); | 1753 | kfree(dev->brightness); |
1760 | kfree(data); | 1754 | } |
1755 | list_del(&dev->entry); | ||
1756 | kfree(dev); | ||
1761 | } | 1757 | } |
1762 | 1758 | ||
1759 | mutex_unlock(&video->device_list_lock); | ||
1760 | |||
1763 | return 0; | 1761 | return 0; |
1764 | } | 1762 | } |
1765 | 1763 | ||
@@ -1782,9 +1780,6 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data) | |||
1782 | struct input_dev *input; | 1780 | struct input_dev *input; |
1783 | int keycode; | 1781 | int keycode; |
1784 | 1782 | ||
1785 | |||
1786 | printk("video bus notify\n"); | ||
1787 | |||
1788 | if (!video) | 1783 | if (!video) |
1789 | return; | 1784 | return; |
1790 | 1785 | ||
@@ -1897,14 +1892,10 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data) | |||
1897 | static int instance; | 1892 | static int instance; |
1898 | static int acpi_video_bus_add(struct acpi_device *device) | 1893 | static int acpi_video_bus_add(struct acpi_device *device) |
1899 | { | 1894 | { |
1900 | int result = 0; | 1895 | acpi_status status; |
1901 | acpi_status status = 0; | 1896 | struct acpi_video_bus *video; |
1902 | struct acpi_video_bus *video = NULL; | ||
1903 | struct input_dev *input; | 1897 | struct input_dev *input; |
1904 | 1898 | int error; | |
1905 | |||
1906 | if (!device) | ||
1907 | return -EINVAL; | ||
1908 | 1899 | ||
1909 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); | 1900 | video = kzalloc(sizeof(struct acpi_video_bus), GFP_KERNEL); |
1910 | if (!video) | 1901 | if (!video) |
@@ -1923,15 +1914,15 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1923 | acpi_driver_data(device) = video; | 1914 | acpi_driver_data(device) = video; |
1924 | 1915 | ||
1925 | acpi_video_bus_find_cap(video); | 1916 | acpi_video_bus_find_cap(video); |
1926 | result = acpi_video_bus_check(video); | 1917 | error = acpi_video_bus_check(video); |
1927 | if (result) | 1918 | if (error) |
1928 | goto end; | 1919 | goto err_free_video; |
1929 | 1920 | ||
1930 | result = acpi_video_bus_add_fs(device); | 1921 | error = acpi_video_bus_add_fs(device); |
1931 | if (result) | 1922 | if (error) |
1932 | goto end; | 1923 | goto err_free_video; |
1933 | 1924 | ||
1934 | init_MUTEX(&video->sem); | 1925 | mutex_init(&video->device_list_lock); |
1935 | INIT_LIST_HEAD(&video->video_device_list); | 1926 | INIT_LIST_HEAD(&video->video_device_list); |
1936 | 1927 | ||
1937 | acpi_video_bus_get_devices(video, device); | 1928 | acpi_video_bus_get_devices(video, device); |
@@ -1943,16 +1934,15 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1943 | if (ACPI_FAILURE(status)) { | 1934 | if (ACPI_FAILURE(status)) { |
1944 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, | 1935 | ACPI_DEBUG_PRINT((ACPI_DB_ERROR, |
1945 | "Error installing notify handler\n")); | 1936 | "Error installing notify handler\n")); |
1946 | acpi_video_bus_stop_devices(video); | 1937 | error = -ENODEV; |
1947 | acpi_video_bus_put_devices(video); | 1938 | goto err_stop_video; |
1948 | kfree(video->attached_array); | ||
1949 | acpi_video_bus_remove_fs(device); | ||
1950 | result = -ENODEV; | ||
1951 | goto end; | ||
1952 | } | 1939 | } |
1953 | 1940 | ||
1954 | |||
1955 | video->input = input = input_allocate_device(); | 1941 | video->input = input = input_allocate_device(); |
1942 | if (!input) { | ||
1943 | error = -ENOMEM; | ||
1944 | goto err_uninstall_notify; | ||
1945 | } | ||
1956 | 1946 | ||
1957 | snprintf(video->phys, sizeof(video->phys), | 1947 | snprintf(video->phys, sizeof(video->phys), |
1958 | "%s/video/input0", acpi_device_hid(video->device)); | 1948 | "%s/video/input0", acpi_device_hid(video->device)); |
@@ -1961,6 +1951,7 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1961 | input->phys = video->phys; | 1951 | input->phys = video->phys; |
1962 | input->id.bustype = BUS_HOST; | 1952 | input->id.bustype = BUS_HOST; |
1963 | input->id.product = 0x06; | 1953 | input->id.product = 0x06; |
1954 | input->dev.parent = &device->dev; | ||
1964 | input->evbit[0] = BIT(EV_KEY); | 1955 | input->evbit[0] = BIT(EV_KEY); |
1965 | set_bit(KEY_SWITCHVIDEOMODE, input->keybit); | 1956 | set_bit(KEY_SWITCHVIDEOMODE, input->keybit); |
1966 | set_bit(KEY_VIDEO_NEXT, input->keybit); | 1957 | set_bit(KEY_VIDEO_NEXT, input->keybit); |
@@ -1971,18 +1962,10 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1971 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); | 1962 | set_bit(KEY_BRIGHTNESS_ZERO, input->keybit); |
1972 | set_bit(KEY_DISPLAY_OFF, input->keybit); | 1963 | set_bit(KEY_DISPLAY_OFF, input->keybit); |
1973 | set_bit(KEY_UNKNOWN, input->keybit); | 1964 | set_bit(KEY_UNKNOWN, input->keybit); |
1974 | result = input_register_device(input); | ||
1975 | if (result) { | ||
1976 | acpi_remove_notify_handler(video->device->handle, | ||
1977 | ACPI_DEVICE_NOTIFY, | ||
1978 | acpi_video_bus_notify); | ||
1979 | acpi_video_bus_stop_devices(video); | ||
1980 | acpi_video_bus_put_devices(video); | ||
1981 | kfree(video->attached_array); | ||
1982 | acpi_video_bus_remove_fs(device); | ||
1983 | goto end; | ||
1984 | } | ||
1985 | 1965 | ||
1966 | error = input_register_device(input); | ||
1967 | if (error) | ||
1968 | goto err_free_input_dev; | ||
1986 | 1969 | ||
1987 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", | 1970 | printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", |
1988 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), | 1971 | ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), |
@@ -1990,11 +1973,23 @@ static int acpi_video_bus_add(struct acpi_device *device) | |||
1990 | video->flags.rom ? "yes" : "no", | 1973 | video->flags.rom ? "yes" : "no", |
1991 | video->flags.post ? "yes" : "no"); | 1974 | video->flags.post ? "yes" : "no"); |
1992 | 1975 | ||
1993 | end: | 1976 | return 0; |
1994 | if (result) | 1977 | |
1995 | kfree(video); | 1978 | err_free_input_dev: |
1979 | input_free_device(input); | ||
1980 | err_uninstall_notify: | ||
1981 | acpi_remove_notify_handler(device->handle, ACPI_DEVICE_NOTIFY, | ||
1982 | acpi_video_bus_notify); | ||
1983 | err_stop_video: | ||
1984 | acpi_video_bus_stop_devices(video); | ||
1985 | acpi_video_bus_put_devices(video); | ||
1986 | kfree(video->attached_array); | ||
1987 | acpi_video_bus_remove_fs(device); | ||
1988 | err_free_video: | ||
1989 | kfree(video); | ||
1990 | acpi_driver_data(device) = NULL; | ||
1996 | 1991 | ||
1997 | return result; | 1992 | return error; |
1998 | } | 1993 | } |
1999 | 1994 | ||
2000 | static int acpi_video_bus_remove(struct acpi_device *device, int type) | 1995 | static int acpi_video_bus_remove(struct acpi_device *device, int type) |
diff --git a/drivers/ata/ata_piix.c b/drivers/ata/ata_piix.c index 328ce8a08426..483269db2c7d 100644 --- a/drivers/ata/ata_piix.c +++ b/drivers/ata/ata_piix.c | |||
@@ -119,18 +119,19 @@ enum { | |||
119 | PIIX_80C_SEC = (1 << 7) | (1 << 6), | 119 | PIIX_80C_SEC = (1 << 7) | (1 << 6), |
120 | 120 | ||
121 | /* controller IDs */ | 121 | /* controller IDs */ |
122 | piix_pata_33 = 0, /* PIIX4 at 33Mhz */ | 122 | piix_pata_mwdma = 0, /* PIIX3 MWDMA only */ |
123 | ich_pata_33 = 1, /* ICH up to UDMA 33 only */ | 123 | piix_pata_33, /* PIIX4 at 33Mhz */ |
124 | ich_pata_66 = 2, /* ICH up to 66 Mhz */ | 124 | ich_pata_33, /* ICH up to UDMA 33 only */ |
125 | ich_pata_100 = 3, /* ICH up to UDMA 100 */ | 125 | ich_pata_66, /* ICH up to 66 Mhz */ |
126 | ich5_sata = 5, | 126 | ich_pata_100, /* ICH up to UDMA 100 */ |
127 | ich6_sata = 6, | 127 | ich5_sata, |
128 | ich6_sata_ahci = 7, | 128 | ich6_sata, |
129 | ich6m_sata_ahci = 8, | 129 | ich6_sata_ahci, |
130 | ich8_sata_ahci = 9, | 130 | ich6m_sata_ahci, |
131 | piix_pata_mwdma = 10, /* PIIX3 MWDMA only */ | 131 | ich8_sata_ahci, |
132 | tolapai_sata_ahci = 11, | 132 | ich8_2port_sata, |
133 | ich9_2port_sata = 12, | 133 | ich8m_apple_sata_ahci, /* locks up on second port enable */ |
134 | tolapai_sata_ahci, | ||
134 | 135 | ||
135 | /* constants for mapping table */ | 136 | /* constants for mapping table */ |
136 | P0 = 0, /* port 0 */ | 137 | P0 = 0, /* port 0 */ |
@@ -239,19 +240,21 @@ static const struct pci_device_id piix_pci_tbl[] = { | |||
239 | /* SATA Controller 1 IDE (ICH8) */ | 240 | /* SATA Controller 1 IDE (ICH8) */ |
240 | { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, | 241 | { 0x8086, 0x2820, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
241 | /* SATA Controller 2 IDE (ICH8) */ | 242 | /* SATA Controller 2 IDE (ICH8) */ |
242 | { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, | 243 | { 0x8086, 0x2825, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
243 | /* Mobile SATA Controller IDE (ICH8M) */ | 244 | /* Mobile SATA Controller IDE (ICH8M) */ |
244 | { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, | 245 | { 0x8086, 0x2828, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
246 | /* Mobile SATA Controller IDE (ICH8M), Apple */ | ||
247 | { 0x8086, 0x2828, 0x106b, 0x00a0, 0, 0, ich8m_apple_sata_ahci }, | ||
245 | /* SATA Controller IDE (ICH9) */ | 248 | /* SATA Controller IDE (ICH9) */ |
246 | { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, | 249 | { 0x8086, 0x2920, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
247 | /* SATA Controller IDE (ICH9) */ | 250 | /* SATA Controller IDE (ICH9) */ |
248 | { 0x8086, 0x2921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, | 251 | { 0x8086, 0x2921, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
249 | /* SATA Controller IDE (ICH9) */ | 252 | /* SATA Controller IDE (ICH9) */ |
250 | { 0x8086, 0x2926, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, | 253 | { 0x8086, 0x2926, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
251 | /* SATA Controller IDE (ICH9M) */ | 254 | /* SATA Controller IDE (ICH9M) */ |
252 | { 0x8086, 0x2928, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, | 255 | { 0x8086, 0x2928, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
253 | /* SATA Controller IDE (ICH9M) */ | 256 | /* SATA Controller IDE (ICH9M) */ |
254 | { 0x8086, 0x292d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich9_2port_sata }, | 257 | { 0x8086, 0x292d, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_2port_sata }, |
255 | /* SATA Controller IDE (ICH9M) */ | 258 | /* SATA Controller IDE (ICH9M) */ |
256 | { 0x8086, 0x292e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, | 259 | { 0x8086, 0x292e, PCI_ANY_ID, PCI_ANY_ID, 0, 0, ich8_sata_ahci }, |
257 | /* SATA Controller IDE (Tolapai) */ | 260 | /* SATA Controller IDE (Tolapai) */ |
@@ -427,7 +430,7 @@ static const struct piix_map_db ich6m_map_db = { | |||
427 | 430 | ||
428 | static const struct piix_map_db ich8_map_db = { | 431 | static const struct piix_map_db ich8_map_db = { |
429 | .mask = 0x3, | 432 | .mask = 0x3, |
430 | .port_enable = 0x3, | 433 | .port_enable = 0xf, |
431 | .map = { | 434 | .map = { |
432 | /* PM PS SM SS MAP */ | 435 | /* PM PS SM SS MAP */ |
433 | { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */ | 436 | { P0, P2, P1, P3 }, /* 00b (hardwired when in AHCI) */ |
@@ -437,7 +440,7 @@ static const struct piix_map_db ich8_map_db = { | |||
437 | }, | 440 | }, |
438 | }; | 441 | }; |
439 | 442 | ||
440 | static const struct piix_map_db tolapai_map_db = { | 443 | static const struct piix_map_db ich8_2port_map_db = { |
441 | .mask = 0x3, | 444 | .mask = 0x3, |
442 | .port_enable = 0x3, | 445 | .port_enable = 0x3, |
443 | .map = { | 446 | .map = { |
@@ -449,7 +452,19 @@ static const struct piix_map_db tolapai_map_db = { | |||
449 | }, | 452 | }, |
450 | }; | 453 | }; |
451 | 454 | ||
452 | static const struct piix_map_db ich9_2port_map_db = { | 455 | static const struct piix_map_db ich8m_apple_map_db = { |
456 | .mask = 0x3, | ||
457 | .port_enable = 0x1, | ||
458 | .map = { | ||
459 | /* PM PS SM SS MAP */ | ||
460 | { P0, NA, NA, NA }, /* 00b */ | ||
461 | { RV, RV, RV, RV }, | ||
462 | { P0, P2, IDE, IDE }, /* 10b */ | ||
463 | { RV, RV, RV, RV }, | ||
464 | }, | ||
465 | }; | ||
466 | |||
467 | static const struct piix_map_db tolapai_map_db = { | ||
453 | .mask = 0x3, | 468 | .mask = 0x3, |
454 | .port_enable = 0x3, | 469 | .port_enable = 0x3, |
455 | .map = { | 470 | .map = { |
@@ -467,11 +482,21 @@ static const struct piix_map_db *piix_map_db_table[] = { | |||
467 | [ich6_sata_ahci] = &ich6_map_db, | 482 | [ich6_sata_ahci] = &ich6_map_db, |
468 | [ich6m_sata_ahci] = &ich6m_map_db, | 483 | [ich6m_sata_ahci] = &ich6m_map_db, |
469 | [ich8_sata_ahci] = &ich8_map_db, | 484 | [ich8_sata_ahci] = &ich8_map_db, |
485 | [ich8_2port_sata] = &ich8_2port_map_db, | ||
486 | [ich8m_apple_sata_ahci] = &ich8m_apple_map_db, | ||
470 | [tolapai_sata_ahci] = &tolapai_map_db, | 487 | [tolapai_sata_ahci] = &tolapai_map_db, |
471 | [ich9_2port_sata] = &ich9_2port_map_db, | ||
472 | }; | 488 | }; |
473 | 489 | ||
474 | static struct ata_port_info piix_port_info[] = { | 490 | static struct ata_port_info piix_port_info[] = { |
491 | [piix_pata_mwdma] = /* PIIX3 MWDMA only */ | ||
492 | { | ||
493 | .sht = &piix_sht, | ||
494 | .flags = PIIX_PATA_FLAGS, | ||
495 | .pio_mask = 0x1f, /* pio0-4 */ | ||
496 | .mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */ | ||
497 | .port_ops = &piix_pata_ops, | ||
498 | }, | ||
499 | |||
475 | [piix_pata_33] = /* PIIX4 at 33MHz */ | 500 | [piix_pata_33] = /* PIIX4 at 33MHz */ |
476 | { | 501 | { |
477 | .sht = &piix_sht, | 502 | .sht = &piix_sht, |
@@ -565,13 +590,15 @@ static struct ata_port_info piix_port_info[] = { | |||
565 | .port_ops = &piix_sata_ops, | 590 | .port_ops = &piix_sata_ops, |
566 | }, | 591 | }, |
567 | 592 | ||
568 | [piix_pata_mwdma] = /* PIIX3 MWDMA only */ | 593 | [ich8_2port_sata] = |
569 | { | 594 | { |
570 | .sht = &piix_sht, | 595 | .sht = &piix_sht, |
571 | .flags = PIIX_PATA_FLAGS, | 596 | .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR | |
597 | PIIX_FLAG_AHCI, | ||
572 | .pio_mask = 0x1f, /* pio0-4 */ | 598 | .pio_mask = 0x1f, /* pio0-4 */ |
573 | .mwdma_mask = 0x06, /* mwdma1-2 ?? CHECK 0 should be ok but slow */ | 599 | .mwdma_mask = 0x07, /* mwdma0-2 */ |
574 | .port_ops = &piix_pata_ops, | 600 | .udma_mask = ATA_UDMA6, |
601 | .port_ops = &piix_sata_ops, | ||
575 | }, | 602 | }, |
576 | 603 | ||
577 | [tolapai_sata_ahci] = | 604 | [tolapai_sata_ahci] = |
@@ -585,7 +612,7 @@ static struct ata_port_info piix_port_info[] = { | |||
585 | .port_ops = &piix_sata_ops, | 612 | .port_ops = &piix_sata_ops, |
586 | }, | 613 | }, |
587 | 614 | ||
588 | [ich9_2port_sata] = | 615 | [ich8m_apple_sata_ahci] = |
589 | { | 616 | { |
590 | .sht = &piix_sht, | 617 | .sht = &piix_sht, |
591 | .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR | | 618 | .flags = PIIX_SATA_FLAGS | PIIX_FLAG_SCR | |
@@ -595,6 +622,7 @@ static struct ata_port_info piix_port_info[] = { | |||
595 | .udma_mask = ATA_UDMA6, | 622 | .udma_mask = ATA_UDMA6, |
596 | .port_ops = &piix_sata_ops, | 623 | .port_ops = &piix_sata_ops, |
597 | }, | 624 | }, |
625 | |||
598 | }; | 626 | }; |
599 | 627 | ||
600 | static struct pci_bits piix_enable_bits[] = { | 628 | static struct pci_bits piix_enable_bits[] = { |
@@ -974,6 +1002,13 @@ static int piix_broken_suspend(void) | |||
974 | }, | 1002 | }, |
975 | }, | 1003 | }, |
976 | { | 1004 | { |
1005 | .ident = "SATELLITE U205", | ||
1006 | .matches = { | ||
1007 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | ||
1008 | DMI_MATCH(DMI_PRODUCT_NAME, "SATELLITE U205"), | ||
1009 | }, | ||
1010 | }, | ||
1011 | { | ||
977 | .ident = "Portege M500", | 1012 | .ident = "Portege M500", |
978 | .matches = { | 1013 | .matches = { |
979 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), | 1014 | DMI_MATCH(DMI_SYS_VENDOR, "TOSHIBA"), |
@@ -1086,12 +1121,12 @@ static int piix_disable_ahci(struct pci_dev *pdev) | |||
1086 | if (!mmio) | 1121 | if (!mmio) |
1087 | return -ENOMEM; | 1122 | return -ENOMEM; |
1088 | 1123 | ||
1089 | tmp = readl(mmio + AHCI_GLOBAL_CTL); | 1124 | tmp = ioread32(mmio + AHCI_GLOBAL_CTL); |
1090 | if (tmp & AHCI_ENABLE) { | 1125 | if (tmp & AHCI_ENABLE) { |
1091 | tmp &= ~AHCI_ENABLE; | 1126 | tmp &= ~AHCI_ENABLE; |
1092 | writel(tmp, mmio + AHCI_GLOBAL_CTL); | 1127 | iowrite32(tmp, mmio + AHCI_GLOBAL_CTL); |
1093 | 1128 | ||
1094 | tmp = readl(mmio + AHCI_GLOBAL_CTL); | 1129 | tmp = ioread32(mmio + AHCI_GLOBAL_CTL); |
1095 | if (tmp & AHCI_ENABLE) | 1130 | if (tmp & AHCI_ENABLE) |
1096 | rc = -EIO; | 1131 | rc = -EIO; |
1097 | } | 1132 | } |
diff --git a/drivers/ata/libata-core.c b/drivers/ata/libata-core.c index 81898036dbca..33f06277b3be 100644 --- a/drivers/ata/libata-core.c +++ b/drivers/ata/libata-core.c | |||
@@ -30,6 +30,14 @@ | |||
30 | * Hardware documentation available from http://www.t13.org/ and | 30 | * Hardware documentation available from http://www.t13.org/ and |
31 | * http://www.sata-io.org/ | 31 | * http://www.sata-io.org/ |
32 | * | 32 | * |
33 | * Standards documents from: | ||
34 | * http://www.t13.org (ATA standards, PCI DMA IDE spec) | ||
35 | * http://www.t10.org (SCSI MMC - for ATAPI MMC) | ||
36 | * http://www.sata-io.org (SATA) | ||
37 | * http://www.compactflash.org (CF) | ||
38 | * http://www.qic.org (QIC157 - Tape and DSC) | ||
39 | * http://www.ce-ata.org (CE-ATA: not supported) | ||
40 | * | ||
33 | */ | 41 | */ |
34 | 42 | ||
35 | #include <linux/kernel.h> | 43 | #include <linux/kernel.h> |
@@ -2307,8 +2315,10 @@ int ata_dev_configure(struct ata_device *dev) | |||
2307 | } | 2315 | } |
2308 | 2316 | ||
2309 | if ((dev->class == ATA_DEV_ATAPI) && | 2317 | if ((dev->class == ATA_DEV_ATAPI) && |
2310 | (atapi_command_packet_set(id) == TYPE_TAPE)) | 2318 | (atapi_command_packet_set(id) == TYPE_TAPE)) { |
2311 | dev->max_sectors = ATA_MAX_SECTORS_TAPE; | 2319 | dev->max_sectors = ATA_MAX_SECTORS_TAPE; |
2320 | dev->horkage |= ATA_HORKAGE_STUCK_ERR; | ||
2321 | } | ||
2312 | 2322 | ||
2313 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_128) | 2323 | if (dev->horkage & ATA_HORKAGE_MAX_SEC_128) |
2314 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, | 2324 | dev->max_sectors = min_t(unsigned int, ATA_MAX_SECTORS_128, |
@@ -2581,81 +2591,6 @@ void sata_print_link_status(struct ata_link *link) | |||
2581 | } | 2591 | } |
2582 | 2592 | ||
2583 | /** | 2593 | /** |
2584 | * __sata_phy_reset - Wake/reset a low-level SATA PHY | ||
2585 | * @ap: SATA port associated with target SATA PHY. | ||
2586 | * | ||
2587 | * This function issues commands to standard SATA Sxxx | ||
2588 | * PHY registers, to wake up the phy (and device), and | ||
2589 | * clear any reset condition. | ||
2590 | * | ||
2591 | * LOCKING: | ||
2592 | * PCI/etc. bus probe sem. | ||
2593 | * | ||
2594 | */ | ||
2595 | void __sata_phy_reset(struct ata_port *ap) | ||
2596 | { | ||
2597 | struct ata_link *link = &ap->link; | ||
2598 | unsigned long timeout = jiffies + (HZ * 5); | ||
2599 | u32 sstatus; | ||
2600 | |||
2601 | if (ap->flags & ATA_FLAG_SATA_RESET) { | ||
2602 | /* issue phy wake/reset */ | ||
2603 | sata_scr_write_flush(link, SCR_CONTROL, 0x301); | ||
2604 | /* Couldn't find anything in SATA I/II specs, but | ||
2605 | * AHCI-1.1 10.4.2 says at least 1 ms. */ | ||
2606 | mdelay(1); | ||
2607 | } | ||
2608 | /* phy wake/clear reset */ | ||
2609 | sata_scr_write_flush(link, SCR_CONTROL, 0x300); | ||
2610 | |||
2611 | /* wait for phy to become ready, if necessary */ | ||
2612 | do { | ||
2613 | msleep(200); | ||
2614 | sata_scr_read(link, SCR_STATUS, &sstatus); | ||
2615 | if ((sstatus & 0xf) != 1) | ||
2616 | break; | ||
2617 | } while (time_before(jiffies, timeout)); | ||
2618 | |||
2619 | /* print link status */ | ||
2620 | sata_print_link_status(link); | ||
2621 | |||
2622 | /* TODO: phy layer with polling, timeouts, etc. */ | ||
2623 | if (!ata_link_offline(link)) | ||
2624 | ata_port_probe(ap); | ||
2625 | else | ||
2626 | ata_port_disable(ap); | ||
2627 | |||
2628 | if (ap->flags & ATA_FLAG_DISABLED) | ||
2629 | return; | ||
2630 | |||
2631 | if (ata_busy_sleep(ap, ATA_TMOUT_BOOT_QUICK, ATA_TMOUT_BOOT)) { | ||
2632 | ata_port_disable(ap); | ||
2633 | return; | ||
2634 | } | ||
2635 | |||
2636 | ap->cbl = ATA_CBL_SATA; | ||
2637 | } | ||
2638 | |||
2639 | /** | ||
2640 | * sata_phy_reset - Reset SATA bus. | ||
2641 | * @ap: SATA port associated with target SATA PHY. | ||
2642 | * | ||
2643 | * This function resets the SATA bus, and then probes | ||
2644 | * the bus for devices. | ||
2645 | * | ||
2646 | * LOCKING: | ||
2647 | * PCI/etc. bus probe sem. | ||
2648 | * | ||
2649 | */ | ||
2650 | void sata_phy_reset(struct ata_port *ap) | ||
2651 | { | ||
2652 | __sata_phy_reset(ap); | ||
2653 | if (ap->flags & ATA_FLAG_DISABLED) | ||
2654 | return; | ||
2655 | ata_bus_reset(ap); | ||
2656 | } | ||
2657 | |||
2658 | /** | ||
2659 | * ata_dev_pair - return other device on cable | 2594 | * ata_dev_pair - return other device on cable |
2660 | * @adev: device | 2595 | * @adev: device |
2661 | * | 2596 | * |
@@ -5490,11 +5425,19 @@ fsm_start: | |||
5490 | * let the EH abort the command or reset the device. | 5425 | * let the EH abort the command or reset the device. |
5491 | */ | 5426 | */ |
5492 | if (unlikely(status & (ATA_ERR | ATA_DF))) { | 5427 | if (unlikely(status & (ATA_ERR | ATA_DF))) { |
5493 | ata_port_printk(ap, KERN_WARNING, "DRQ=1 with device " | 5428 | /* Some ATAPI tape drives forget to clear the ERR bit |
5494 | "error, dev_stat 0x%X\n", status); | 5429 | * when doing the next command (mostly request sense). |
5495 | qc->err_mask |= AC_ERR_HSM; | 5430 | * We ignore ERR here to workaround and proceed sending |
5496 | ap->hsm_task_state = HSM_ST_ERR; | 5431 | * the CDB. |
5497 | goto fsm_start; | 5432 | */ |
5433 | if (!(qc->dev->horkage & ATA_HORKAGE_STUCK_ERR)) { | ||
5434 | ata_port_printk(ap, KERN_WARNING, | ||
5435 | "DRQ=1 with device error, " | ||
5436 | "dev_stat 0x%X\n", status); | ||
5437 | qc->err_mask |= AC_ERR_HSM; | ||
5438 | ap->hsm_task_state = HSM_ST_ERR; | ||
5439 | goto fsm_start; | ||
5440 | } | ||
5498 | } | 5441 | } |
5499 | 5442 | ||
5500 | /* Send the CDB (atapi) or the first data block (ata pio out). | 5443 | /* Send the CDB (atapi) or the first data block (ata pio out). |
@@ -7653,8 +7596,6 @@ EXPORT_SYMBOL_GPL(ata_dev_disable); | |||
7653 | EXPORT_SYMBOL_GPL(sata_set_spd); | 7596 | EXPORT_SYMBOL_GPL(sata_set_spd); |
7654 | EXPORT_SYMBOL_GPL(sata_link_debounce); | 7597 | EXPORT_SYMBOL_GPL(sata_link_debounce); |
7655 | EXPORT_SYMBOL_GPL(sata_link_resume); | 7598 | EXPORT_SYMBOL_GPL(sata_link_resume); |
7656 | EXPORT_SYMBOL_GPL(sata_phy_reset); | ||
7657 | EXPORT_SYMBOL_GPL(__sata_phy_reset); | ||
7658 | EXPORT_SYMBOL_GPL(ata_bus_reset); | 7599 | EXPORT_SYMBOL_GPL(ata_bus_reset); |
7659 | EXPORT_SYMBOL_GPL(ata_std_prereset); | 7600 | EXPORT_SYMBOL_GPL(ata_std_prereset); |
7660 | EXPORT_SYMBOL_GPL(ata_std_softreset); | 7601 | EXPORT_SYMBOL_GPL(ata_std_softreset); |
@@ -7725,7 +7666,6 @@ EXPORT_SYMBOL_GPL(ata_port_desc); | |||
7725 | #ifdef CONFIG_PCI | 7666 | #ifdef CONFIG_PCI |
7726 | EXPORT_SYMBOL_GPL(ata_port_pbar_desc); | 7667 | EXPORT_SYMBOL_GPL(ata_port_pbar_desc); |
7727 | #endif /* CONFIG_PCI */ | 7668 | #endif /* CONFIG_PCI */ |
7728 | EXPORT_SYMBOL_GPL(ata_eng_timeout); | ||
7729 | EXPORT_SYMBOL_GPL(ata_port_schedule_eh); | 7669 | EXPORT_SYMBOL_GPL(ata_port_schedule_eh); |
7730 | EXPORT_SYMBOL_GPL(ata_link_abort); | 7670 | EXPORT_SYMBOL_GPL(ata_link_abort); |
7731 | EXPORT_SYMBOL_GPL(ata_port_abort); | 7671 | EXPORT_SYMBOL_GPL(ata_port_abort); |
diff --git a/drivers/ata/libata-eh.c b/drivers/ata/libata-eh.c index ed8813b222a0..0dac69db1fdf 100644 --- a/drivers/ata/libata-eh.c +++ b/drivers/ata/libata-eh.c | |||
@@ -559,101 +559,6 @@ void ata_port_wait_eh(struct ata_port *ap) | |||
559 | } | 559 | } |
560 | } | 560 | } |
561 | 561 | ||
562 | /** | ||
563 | * ata_qc_timeout - Handle timeout of queued command | ||
564 | * @qc: Command that timed out | ||
565 | * | ||
566 | * Some part of the kernel (currently, only the SCSI layer) | ||
567 | * has noticed that the active command on port @ap has not | ||
568 | * completed after a specified length of time. Handle this | ||
569 | * condition by disabling DMA (if necessary) and completing | ||
570 | * transactions, with error if necessary. | ||
571 | * | ||
572 | * This also handles the case of the "lost interrupt", where | ||
573 | * for some reason (possibly hardware bug, possibly driver bug) | ||
574 | * an interrupt was not delivered to the driver, even though the | ||
575 | * transaction completed successfully. | ||
576 | * | ||
577 | * TODO: kill this function once old EH is gone. | ||
578 | * | ||
579 | * LOCKING: | ||
580 | * Inherited from SCSI layer (none, can sleep) | ||
581 | */ | ||
582 | static void ata_qc_timeout(struct ata_queued_cmd *qc) | ||
583 | { | ||
584 | struct ata_port *ap = qc->ap; | ||
585 | u8 host_stat = 0, drv_stat; | ||
586 | unsigned long flags; | ||
587 | |||
588 | DPRINTK("ENTER\n"); | ||
589 | |||
590 | ap->hsm_task_state = HSM_ST_IDLE; | ||
591 | |||
592 | spin_lock_irqsave(ap->lock, flags); | ||
593 | |||
594 | switch (qc->tf.protocol) { | ||
595 | |||
596 | case ATA_PROT_DMA: | ||
597 | case ATA_PROT_ATAPI_DMA: | ||
598 | host_stat = ap->ops->bmdma_status(ap); | ||
599 | |||
600 | /* before we do anything else, clear DMA-Start bit */ | ||
601 | ap->ops->bmdma_stop(qc); | ||
602 | |||
603 | /* fall through */ | ||
604 | |||
605 | default: | ||
606 | ata_altstatus(ap); | ||
607 | drv_stat = ata_chk_status(ap); | ||
608 | |||
609 | /* ack bmdma irq events */ | ||
610 | ap->ops->irq_clear(ap); | ||
611 | |||
612 | ata_dev_printk(qc->dev, KERN_ERR, "command 0x%x timeout, " | ||
613 | "stat 0x%x host_stat 0x%x\n", | ||
614 | qc->tf.command, drv_stat, host_stat); | ||
615 | |||
616 | /* complete taskfile transaction */ | ||
617 | qc->err_mask |= AC_ERR_TIMEOUT; | ||
618 | break; | ||
619 | } | ||
620 | |||
621 | spin_unlock_irqrestore(ap->lock, flags); | ||
622 | |||
623 | ata_eh_qc_complete(qc); | ||
624 | |||
625 | DPRINTK("EXIT\n"); | ||
626 | } | ||
627 | |||
628 | /** | ||
629 | * ata_eng_timeout - Handle timeout of queued command | ||
630 | * @ap: Port on which timed-out command is active | ||
631 | * | ||
632 | * Some part of the kernel (currently, only the SCSI layer) | ||
633 | * has noticed that the active command on port @ap has not | ||
634 | * completed after a specified length of time. Handle this | ||
635 | * condition by disabling DMA (if necessary) and completing | ||
636 | * transactions, with error if necessary. | ||
637 | * | ||
638 | * This also handles the case of the "lost interrupt", where | ||
639 | * for some reason (possibly hardware bug, possibly driver bug) | ||
640 | * an interrupt was not delivered to the driver, even though the | ||
641 | * transaction completed successfully. | ||
642 | * | ||
643 | * TODO: kill this function once old EH is gone. | ||
644 | * | ||
645 | * LOCKING: | ||
646 | * Inherited from SCSI layer (none, can sleep) | ||
647 | */ | ||
648 | void ata_eng_timeout(struct ata_port *ap) | ||
649 | { | ||
650 | DPRINTK("ENTER\n"); | ||
651 | |||
652 | ata_qc_timeout(ata_qc_from_tag(ap, ap->link.active_tag)); | ||
653 | |||
654 | DPRINTK("EXIT\n"); | ||
655 | } | ||
656 | |||
657 | static int ata_eh_nr_in_flight(struct ata_port *ap) | 562 | static int ata_eh_nr_in_flight(struct ata_port *ap) |
658 | { | 563 | { |
659 | unsigned int tag; | 564 | unsigned int tag; |
diff --git a/drivers/ata/libata-scsi.c b/drivers/ata/libata-scsi.c index 94144ed50a6b..a883bb03d4c7 100644 --- a/drivers/ata/libata-scsi.c +++ b/drivers/ata/libata-scsi.c | |||
@@ -2485,11 +2485,40 @@ static unsigned int atapi_xlat(struct ata_queued_cmd *qc) | |||
2485 | if (!using_pio && ata_check_atapi_dma(qc)) | 2485 | if (!using_pio && ata_check_atapi_dma(qc)) |
2486 | using_pio = 1; | 2486 | using_pio = 1; |
2487 | 2487 | ||
2488 | /* Some controller variants snoop this value for Packet transfers | 2488 | /* Some controller variants snoop this value for Packet |
2489 | to do state machine and FIFO management. Thus we want to set it | 2489 | * transfers to do state machine and FIFO management. Thus we |
2490 | properly, and for DMA where it is effectively meaningless */ | 2490 | * want to set it properly, and for DMA where it is |
2491 | * effectively meaningless. | ||
2492 | */ | ||
2491 | nbytes = min(qc->nbytes, (unsigned int)63 * 1024); | 2493 | nbytes = min(qc->nbytes, (unsigned int)63 * 1024); |
2492 | 2494 | ||
2495 | /* Most ATAPI devices which honor transfer chunk size don't | ||
2496 | * behave according to the spec when odd chunk size which | ||
2497 | * matches the transfer length is specified. If the number of | ||
2498 | * bytes to transfer is 2n+1. According to the spec, what | ||
2499 | * should happen is to indicate that 2n+1 is going to be | ||
2500 | * transferred and transfer 2n+2 bytes where the last byte is | ||
2501 | * padding. | ||
2502 | * | ||
2503 | * In practice, this doesn't happen. ATAPI devices first | ||
2504 | * indicate and transfer 2n bytes and then indicate and | ||
2505 | * transfer 2 bytes where the last byte is padding. | ||
2506 | * | ||
2507 | * This inconsistency confuses several controllers which | ||
2508 | * perform PIO using DMA such as Intel AHCIs and sil3124/32. | ||
2509 | * These controllers use actual number of transferred bytes to | ||
2510 | * update DMA poitner and transfer of 4n+2 bytes make those | ||
2511 | * controller push DMA pointer by 4n+4 bytes because SATA data | ||
2512 | * FISes are aligned to 4 bytes. This causes data corruption | ||
2513 | * and buffer overrun. | ||
2514 | * | ||
2515 | * Always setting nbytes to even number solves this problem | ||
2516 | * because then ATAPI devices don't have to split data at 2n | ||
2517 | * boundaries. | ||
2518 | */ | ||
2519 | if (nbytes & 0x1) | ||
2520 | nbytes++; | ||
2521 | |||
2493 | qc->tf.lbam = (nbytes & 0xFF); | 2522 | qc->tf.lbam = (nbytes & 0xFF); |
2494 | qc->tf.lbah = (nbytes >> 8); | 2523 | qc->tf.lbah = (nbytes >> 8); |
2495 | 2524 | ||
@@ -2869,7 +2898,8 @@ static inline int __ata_scsi_queuecmd(struct scsi_cmnd *scmd, | |||
2869 | xlat_func = NULL; | 2898 | xlat_func = NULL; |
2870 | if (likely((scsi_op != ATA_16) || !atapi_passthru16)) { | 2899 | if (likely((scsi_op != ATA_16) || !atapi_passthru16)) { |
2871 | /* relay SCSI command to ATAPI device */ | 2900 | /* relay SCSI command to ATAPI device */ |
2872 | if (unlikely(scmd->cmd_len > dev->cdb_len)) | 2901 | int len = COMMAND_SIZE(scsi_op); |
2902 | if (unlikely(len > scmd->cmd_len || len > dev->cdb_len)) | ||
2873 | goto bad_cdb_len; | 2903 | goto bad_cdb_len; |
2874 | 2904 | ||
2875 | xlat_func = atapi_xlat; | 2905 | xlat_func = atapi_xlat; |
diff --git a/drivers/ata/pata_ali.c b/drivers/ata/pata_ali.c index 364534e7aff4..8caf9afc8b90 100644 --- a/drivers/ata/pata_ali.c +++ b/drivers/ata/pata_ali.c | |||
@@ -63,6 +63,9 @@ static int ali_cable_override(struct pci_dev *pdev) | |||
63 | /* Fujitsu P2000 */ | 63 | /* Fujitsu P2000 */ |
64 | if (pdev->subsystem_vendor == 0x10CF && pdev->subsystem_device == 0x10AF) | 64 | if (pdev->subsystem_vendor == 0x10CF && pdev->subsystem_device == 0x10AF) |
65 | return 1; | 65 | return 1; |
66 | /* Mitac 8317 (Winbook-A) and relatives */ | ||
67 | if (pdev->subsystem_vendor == 0x1071 && pdev->subsystem_device == 0x8317) | ||
68 | return 1; | ||
66 | /* Systems by DMI */ | 69 | /* Systems by DMI */ |
67 | if (dmi_check_system(cable_dmi_table)) | 70 | if (dmi_check_system(cable_dmi_table)) |
68 | return 1; | 71 | return 1; |
@@ -282,6 +285,21 @@ static void ali_lock_sectors(struct ata_device *adev) | |||
282 | adev->max_sectors = 255; | 285 | adev->max_sectors = 255; |
283 | } | 286 | } |
284 | 287 | ||
288 | /** | ||
289 | * ali_check_atapi_dma - DMA check for most ALi controllers | ||
290 | * @adev: Device | ||
291 | * | ||
292 | * Called to decide whether commands should be sent by DMA or PIO | ||
293 | */ | ||
294 | |||
295 | static int ali_check_atapi_dma(struct ata_queued_cmd *qc) | ||
296 | { | ||
297 | /* If its not a media command, its not worth it */ | ||
298 | if (qc->nbytes < 2048) | ||
299 | return -EOPNOTSUPP; | ||
300 | return 0; | ||
301 | } | ||
302 | |||
285 | static struct scsi_host_template ali_sht = { | 303 | static struct scsi_host_template ali_sht = { |
286 | .module = THIS_MODULE, | 304 | .module = THIS_MODULE, |
287 | .name = DRV_NAME, | 305 | .name = DRV_NAME, |
@@ -378,6 +396,7 @@ static struct ata_port_operations ali_c2_port_ops = { | |||
378 | .mode_filter = ata_pci_default_filter, | 396 | .mode_filter = ata_pci_default_filter, |
379 | .tf_load = ata_tf_load, | 397 | .tf_load = ata_tf_load, |
380 | .tf_read = ata_tf_read, | 398 | .tf_read = ata_tf_read, |
399 | .check_atapi_dma = ali_check_atapi_dma, | ||
381 | .check_status = ata_check_status, | 400 | .check_status = ata_check_status, |
382 | .exec_command = ata_exec_command, | 401 | .exec_command = ata_exec_command, |
383 | .dev_select = ata_std_dev_select, | 402 | .dev_select = ata_std_dev_select, |
@@ -415,6 +434,7 @@ static struct ata_port_operations ali_c5_port_ops = { | |||
415 | .mode_filter = ata_pci_default_filter, | 434 | .mode_filter = ata_pci_default_filter, |
416 | .tf_load = ata_tf_load, | 435 | .tf_load = ata_tf_load, |
417 | .tf_read = ata_tf_read, | 436 | .tf_read = ata_tf_read, |
437 | .check_atapi_dma = ali_check_atapi_dma, | ||
418 | .check_status = ata_check_status, | 438 | .check_status = ata_check_status, |
419 | .exec_command = ata_exec_command, | 439 | .exec_command = ata_exec_command, |
420 | .dev_select = ata_std_dev_select, | 440 | .dev_select = ata_std_dev_select, |
diff --git a/drivers/ata/pata_bf54x.c b/drivers/ata/pata_bf54x.c index b5e38426b815..81db405a5445 100644 --- a/drivers/ata/pata_bf54x.c +++ b/drivers/ata/pata_bf54x.c | |||
@@ -1145,13 +1145,13 @@ static unsigned char bfin_bmdma_status(struct ata_port *ap) | |||
1145 | unsigned short int_status = ATAPI_GET_INT_STATUS(base); | 1145 | unsigned short int_status = ATAPI_GET_INT_STATUS(base); |
1146 | 1146 | ||
1147 | if (ATAPI_GET_STATUS(base) & (MULTI_XFER_ON|ULTRA_XFER_ON)) { | 1147 | if (ATAPI_GET_STATUS(base) & (MULTI_XFER_ON|ULTRA_XFER_ON)) { |
1148 | host_stat = ATA_DMA_ACTIVE; | 1148 | host_stat |= ATA_DMA_ACTIVE; |
1149 | } | 1149 | } |
1150 | if (int_status & (MULTI_DONE_INT|UDMAIN_DONE_INT|UDMAOUT_DONE_INT)) { | 1150 | if (int_status & (MULTI_DONE_INT|UDMAIN_DONE_INT|UDMAOUT_DONE_INT)) { |
1151 | host_stat = ATA_DMA_INTR; | 1151 | host_stat |= ATA_DMA_INTR; |
1152 | } | 1152 | } |
1153 | if (int_status & (MULTI_TERM_INT|UDMAIN_TERM_INT|UDMAOUT_TERM_INT)) { | 1153 | if (int_status & (MULTI_TERM_INT|UDMAIN_TERM_INT|UDMAOUT_TERM_INT)) { |
1154 | host_stat = ATA_DMA_ERR; | 1154 | host_stat |= ATA_DMA_ERR; |
1155 | } | 1155 | } |
1156 | 1156 | ||
1157 | return host_stat; | 1157 | return host_stat; |
diff --git a/drivers/ata/pata_hpt37x.c b/drivers/ata/pata_hpt37x.c index 3816b8605e0d..46dc70e0dee7 100644 --- a/drivers/ata/pata_hpt37x.c +++ b/drivers/ata/pata_hpt37x.c | |||
@@ -329,7 +329,7 @@ static int hpt37x_pre_reset(struct ata_link *link, unsigned long deadline) | |||
329 | /* Restore state */ | 329 | /* Restore state */ |
330 | pci_write_config_byte(pdev, 0x5B, scr2); | 330 | pci_write_config_byte(pdev, 0x5B, scr2); |
331 | 331 | ||
332 | if (ata66 & (1 << ap->port_no)) | 332 | if (ata66 & (2 >> ap->port_no)) |
333 | ap->cbl = ATA_CBL_PATA40; | 333 | ap->cbl = ATA_CBL_PATA40; |
334 | else | 334 | else |
335 | ap->cbl = ATA_CBL_PATA80; | 335 | ap->cbl = ATA_CBL_PATA80; |
diff --git a/drivers/ata/pata_isapnp.c b/drivers/ata/pata_isapnp.c index 88ab0e1d353f..4320e7986321 100644 --- a/drivers/ata/pata_isapnp.c +++ b/drivers/ata/pata_isapnp.c | |||
@@ -75,13 +75,16 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev | |||
75 | struct ata_host *host; | 75 | struct ata_host *host; |
76 | struct ata_port *ap; | 76 | struct ata_port *ap; |
77 | void __iomem *cmd_addr, *ctl_addr; | 77 | void __iomem *cmd_addr, *ctl_addr; |
78 | int irq = 0; | ||
79 | irq_handler_t handler = NULL; | ||
78 | 80 | ||
79 | if (pnp_port_valid(idev, 0) == 0) | 81 | if (pnp_port_valid(idev, 0) == 0) |
80 | return -ENODEV; | 82 | return -ENODEV; |
81 | 83 | ||
82 | /* FIXME: Should selected polled PIO here not fail */ | 84 | if (pnp_irq_valid(idev, 0)) { |
83 | if (pnp_irq_valid(idev, 0) == 0) | 85 | irq = pnp_irq(idev, 0); |
84 | return -ENODEV; | 86 | handler = ata_interrupt; |
87 | } | ||
85 | 88 | ||
86 | /* allocate host */ | 89 | /* allocate host */ |
87 | host = ata_host_alloc(&idev->dev, 1); | 90 | host = ata_host_alloc(&idev->dev, 1); |
@@ -115,7 +118,7 @@ static int isapnp_init_one(struct pnp_dev *idev, const struct pnp_device_id *dev | |||
115 | (unsigned long long)pnp_port_start(idev, 1)); | 118 | (unsigned long long)pnp_port_start(idev, 1)); |
116 | 119 | ||
117 | /* activate */ | 120 | /* activate */ |
118 | return ata_host_activate(host, pnp_irq(idev, 0), ata_interrupt, 0, | 121 | return ata_host_activate(host, irq, handler, 0, |
119 | &isapnp_sht); | 122 | &isapnp_sht); |
120 | } | 123 | } |
121 | 124 | ||
diff --git a/drivers/ata/pata_jmicron.c b/drivers/ata/pata_jmicron.c index 225a7223a726..5b8174d94067 100644 --- a/drivers/ata/pata_jmicron.c +++ b/drivers/ata/pata_jmicron.c | |||
@@ -80,11 +80,10 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline) | |||
80 | * actually do our cable checking etc. Thankfully we don't need | 80 | * actually do our cable checking etc. Thankfully we don't need |
81 | * to do the plumbing for other cases. | 81 | * to do the plumbing for other cases. |
82 | */ | 82 | */ |
83 | switch (port_map[port]) | 83 | switch (port_map[port]) { |
84 | { | ||
85 | case PORT_PATA0: | 84 | case PORT_PATA0: |
86 | if (control & (1 << 5)) | 85 | if ((control & (1 << 5)) == 0) |
87 | return 0; | 86 | return -ENOENT; |
88 | if (control & (1 << 3)) /* 40/80 pin primary */ | 87 | if (control & (1 << 3)) /* 40/80 pin primary */ |
89 | ap->cbl = ATA_CBL_PATA40; | 88 | ap->cbl = ATA_CBL_PATA40; |
90 | else | 89 | else |
@@ -93,7 +92,7 @@ static int jmicron_pre_reset(struct ata_link *link, unsigned long deadline) | |||
93 | case PORT_PATA1: | 92 | case PORT_PATA1: |
94 | /* Bit 21 is set if the port is enabled */ | 93 | /* Bit 21 is set if the port is enabled */ |
95 | if ((control5 & (1 << 21)) == 0) | 94 | if ((control5 & (1 << 21)) == 0) |
96 | return 0; | 95 | return -ENOENT; |
97 | if (control5 & (1 << 19)) /* 40/80 pin secondary */ | 96 | if (control5 & (1 << 19)) /* 40/80 pin secondary */ |
98 | ap->cbl = ATA_CBL_PATA40; | 97 | ap->cbl = ATA_CBL_PATA40; |
99 | else | 98 | else |
diff --git a/drivers/ata/pata_sil680.c b/drivers/ata/pata_sil680.c index 5c1e9cb59ecb..503245a1eafa 100644 --- a/drivers/ata/pata_sil680.c +++ b/drivers/ata/pata_sil680.c | |||
@@ -33,7 +33,7 @@ | |||
33 | #include <linux/libata.h> | 33 | #include <linux/libata.h> |
34 | 34 | ||
35 | #define DRV_NAME "pata_sil680" | 35 | #define DRV_NAME "pata_sil680" |
36 | #define DRV_VERSION "0.4.7" | 36 | #define DRV_VERSION "0.4.8" |
37 | 37 | ||
38 | #define SIL680_MMIO_BAR 5 | 38 | #define SIL680_MMIO_BAR 5 |
39 | 39 | ||
@@ -94,34 +94,6 @@ static int sil680_cable_detect(struct ata_port *ap) { | |||
94 | } | 94 | } |
95 | 95 | ||
96 | /** | 96 | /** |
97 | * sil680_bus_reset - reset the SIL680 bus | ||
98 | * @link: ATA link to reset | ||
99 | * @deadline: deadline jiffies for the operation | ||
100 | * | ||
101 | * Perform the SIL680 housekeeping when doing an ATA bus reset | ||
102 | */ | ||
103 | |||
104 | static int sil680_bus_reset(struct ata_link *link, unsigned int *classes, | ||
105 | unsigned long deadline) | ||
106 | { | ||
107 | struct ata_port *ap = link->ap; | ||
108 | struct pci_dev *pdev = to_pci_dev(ap->host->dev); | ||
109 | unsigned long addr = sil680_selreg(ap, 0); | ||
110 | u8 reset; | ||
111 | |||
112 | pci_read_config_byte(pdev, addr, &reset); | ||
113 | pci_write_config_byte(pdev, addr, reset | 0x03); | ||
114 | udelay(25); | ||
115 | pci_write_config_byte(pdev, addr, reset); | ||
116 | return ata_std_softreset(link, classes, deadline); | ||
117 | } | ||
118 | |||
119 | static void sil680_error_handler(struct ata_port *ap) | ||
120 | { | ||
121 | ata_bmdma_drive_eh(ap, ata_std_prereset, sil680_bus_reset, NULL, ata_std_postreset); | ||
122 | } | ||
123 | |||
124 | /** | ||
125 | * sil680_set_piomode - set initial PIO mode data | 97 | * sil680_set_piomode - set initial PIO mode data |
126 | * @ap: ATA interface | 98 | * @ap: ATA interface |
127 | * @adev: ATA device | 99 | * @adev: ATA device |
@@ -249,7 +221,7 @@ static struct ata_port_operations sil680_port_ops = { | |||
249 | 221 | ||
250 | .freeze = ata_bmdma_freeze, | 222 | .freeze = ata_bmdma_freeze, |
251 | .thaw = ata_bmdma_thaw, | 223 | .thaw = ata_bmdma_thaw, |
252 | .error_handler = sil680_error_handler, | 224 | .error_handler = ata_bmdma_error_handler, |
253 | .post_internal_cmd = ata_bmdma_post_internal_cmd, | 225 | .post_internal_cmd = ata_bmdma_post_internal_cmd, |
254 | .cable_detect = sil680_cable_detect, | 226 | .cable_detect = sil680_cable_detect, |
255 | 227 | ||
diff --git a/drivers/ata/pata_sis.c b/drivers/ata/pata_sis.c index 3b5be77e861c..87546d9f1ca0 100644 --- a/drivers/ata/pata_sis.c +++ b/drivers/ata/pata_sis.c | |||
@@ -55,6 +55,7 @@ static const struct sis_laptop sis_laptop[] = { | |||
55 | /* devid, subvendor, subdev */ | 55 | /* devid, subvendor, subdev */ |
56 | { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ | 56 | { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ |
57 | { 0x5513, 0x1734, 0x105F }, /* FSC Amilo A1630 */ | 57 | { 0x5513, 0x1734, 0x105F }, /* FSC Amilo A1630 */ |
58 | { 0x5513, 0x1071, 0x8640 }, /* EasyNote K5305 */ | ||
58 | /* end marker */ | 59 | /* end marker */ |
59 | { 0, } | 60 | { 0, } |
60 | }; | 61 | }; |
diff --git a/drivers/ata/sata_sil24.c b/drivers/ata/sata_sil24.c index 187dcb02c681..96fd5260446d 100644 --- a/drivers/ata/sata_sil24.c +++ b/drivers/ata/sata_sil24.c | |||
@@ -63,6 +63,21 @@ enum { | |||
63 | SIL24_HOST_BAR = 0, | 63 | SIL24_HOST_BAR = 0, |
64 | SIL24_PORT_BAR = 2, | 64 | SIL24_PORT_BAR = 2, |
65 | 65 | ||
66 | /* sil24 fetches in chunks of 64bytes. The first block | ||
67 | * contains the PRB and two SGEs. From the second block, it's | ||
68 | * consisted of four SGEs and called SGT. Calculate the | ||
69 | * number of SGTs that fit into one page. | ||
70 | */ | ||
71 | SIL24_PRB_SZ = sizeof(struct sil24_prb) | ||
72 | + 2 * sizeof(struct sil24_sge), | ||
73 | SIL24_MAX_SGT = (PAGE_SIZE - SIL24_PRB_SZ) | ||
74 | / (4 * sizeof(struct sil24_sge)), | ||
75 | |||
76 | /* This will give us one unused SGEs for ATA. This extra SGE | ||
77 | * will be used to store CDB for ATAPI devices. | ||
78 | */ | ||
79 | SIL24_MAX_SGE = 4 * SIL24_MAX_SGT + 1, | ||
80 | |||
66 | /* | 81 | /* |
67 | * Global controller registers (128 bytes @ BAR0) | 82 | * Global controller registers (128 bytes @ BAR0) |
68 | */ | 83 | */ |
@@ -247,13 +262,13 @@ enum { | |||
247 | 262 | ||
248 | struct sil24_ata_block { | 263 | struct sil24_ata_block { |
249 | struct sil24_prb prb; | 264 | struct sil24_prb prb; |
250 | struct sil24_sge sge[LIBATA_MAX_PRD]; | 265 | struct sil24_sge sge[SIL24_MAX_SGE]; |
251 | }; | 266 | }; |
252 | 267 | ||
253 | struct sil24_atapi_block { | 268 | struct sil24_atapi_block { |
254 | struct sil24_prb prb; | 269 | struct sil24_prb prb; |
255 | u8 cdb[16]; | 270 | u8 cdb[16]; |
256 | struct sil24_sge sge[LIBATA_MAX_PRD - 1]; | 271 | struct sil24_sge sge[SIL24_MAX_SGE]; |
257 | }; | 272 | }; |
258 | 273 | ||
259 | union sil24_cmd_block { | 274 | union sil24_cmd_block { |
@@ -378,7 +393,7 @@ static struct scsi_host_template sil24_sht = { | |||
378 | .change_queue_depth = ata_scsi_change_queue_depth, | 393 | .change_queue_depth = ata_scsi_change_queue_depth, |
379 | .can_queue = SIL24_MAX_CMDS, | 394 | .can_queue = SIL24_MAX_CMDS, |
380 | .this_id = ATA_SHT_THIS_ID, | 395 | .this_id = ATA_SHT_THIS_ID, |
381 | .sg_tablesize = LIBATA_MAX_PRD, | 396 | .sg_tablesize = SIL24_MAX_SGE, |
382 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, | 397 | .cmd_per_lun = ATA_SHT_CMD_PER_LUN, |
383 | .emulated = ATA_SHT_EMULATED, | 398 | .emulated = ATA_SHT_EMULATED, |
384 | .use_clustering = ATA_SHT_USE_CLUSTERING, | 399 | .use_clustering = ATA_SHT_USE_CLUSTERING, |
@@ -1284,6 +1299,7 @@ static void sil24_init_controller(struct ata_host *host) | |||
1284 | 1299 | ||
1285 | static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | 1300 | static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) |
1286 | { | 1301 | { |
1302 | extern int __MARKER__sil24_cmd_block_is_sized_wrongly; | ||
1287 | static int printed_version; | 1303 | static int printed_version; |
1288 | struct ata_port_info pi = sil24_port_info[ent->driver_data]; | 1304 | struct ata_port_info pi = sil24_port_info[ent->driver_data]; |
1289 | const struct ata_port_info *ppi[] = { &pi, NULL }; | 1305 | const struct ata_port_info *ppi[] = { &pi, NULL }; |
@@ -1292,6 +1308,10 @@ static int sil24_init_one(struct pci_dev *pdev, const struct pci_device_id *ent) | |||
1292 | int i, rc; | 1308 | int i, rc; |
1293 | u32 tmp; | 1309 | u32 tmp; |
1294 | 1310 | ||
1311 | /* cause link error if sil24_cmd_block is sized wrongly */ | ||
1312 | if (sizeof(union sil24_cmd_block) != PAGE_SIZE) | ||
1313 | __MARKER__sil24_cmd_block_is_sized_wrongly = 1; | ||
1314 | |||
1295 | if (!printed_version++) | 1315 | if (!printed_version++) |
1296 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); | 1316 | dev_printk(KERN_DEBUG, &pdev->dev, "version " DRV_VERSION "\n"); |
1297 | 1317 | ||
diff --git a/drivers/atm/he.c b/drivers/atm/he.c index d33aba6864c2..3b64a99772ea 100644 --- a/drivers/atm/he.c +++ b/drivers/atm/he.c | |||
@@ -394,6 +394,11 @@ he_init_one(struct pci_dev *pci_dev, const struct pci_device_id *pci_ent) | |||
394 | he_dev->atm_dev->dev_data = he_dev; | 394 | he_dev->atm_dev->dev_data = he_dev; |
395 | atm_dev->dev_data = he_dev; | 395 | atm_dev->dev_data = he_dev; |
396 | he_dev->number = atm_dev->number; | 396 | he_dev->number = atm_dev->number; |
397 | #ifdef USE_TASKLET | ||
398 | tasklet_init(&he_dev->tasklet, he_tasklet, (unsigned long) he_dev); | ||
399 | #endif | ||
400 | spin_lock_init(&he_dev->global_lock); | ||
401 | |||
397 | if (he_start(atm_dev)) { | 402 | if (he_start(atm_dev)) { |
398 | he_stop(he_dev); | 403 | he_stop(he_dev); |
399 | err = -ENODEV; | 404 | err = -ENODEV; |
@@ -1173,11 +1178,6 @@ he_start(struct atm_dev *dev) | |||
1173 | if ((err = he_init_irq(he_dev)) != 0) | 1178 | if ((err = he_init_irq(he_dev)) != 0) |
1174 | return err; | 1179 | return err; |
1175 | 1180 | ||
1176 | #ifdef USE_TASKLET | ||
1177 | tasklet_init(&he_dev->tasklet, he_tasklet, (unsigned long) he_dev); | ||
1178 | #endif | ||
1179 | spin_lock_init(&he_dev->global_lock); | ||
1180 | |||
1181 | /* 4.11 enable pci bus controller state machines */ | 1181 | /* 4.11 enable pci bus controller state machines */ |
1182 | host_cntl |= (OUTFF_ENB | CMDFF_ENB | | 1182 | host_cntl |= (OUTFF_ENB | CMDFF_ENB | |
1183 | QUICK_RD_RETRY | QUICK_WR_RETRY | PERR_INT_ENB); | 1183 | QUICK_RD_RETRY | QUICK_WR_RETRY | PERR_INT_ENB); |
diff --git a/drivers/base/core.c b/drivers/base/core.c index 3f4d6aa13990..2683eac30c68 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c | |||
@@ -770,9 +770,10 @@ int device_add(struct device *dev) | |||
770 | error = device_add_attrs(dev); | 770 | error = device_add_attrs(dev); |
771 | if (error) | 771 | if (error) |
772 | goto AttrsError; | 772 | goto AttrsError; |
773 | error = device_pm_add(dev); | 773 | error = dpm_sysfs_add(dev); |
774 | if (error) | 774 | if (error) |
775 | goto PMError; | 775 | goto PMError; |
776 | device_pm_add(dev); | ||
776 | error = bus_add_device(dev); | 777 | error = bus_add_device(dev); |
777 | if (error) | 778 | if (error) |
778 | goto BusError; | 779 | goto BusError; |
@@ -797,6 +798,7 @@ int device_add(struct device *dev) | |||
797 | return error; | 798 | return error; |
798 | BusError: | 799 | BusError: |
799 | device_pm_remove(dev); | 800 | device_pm_remove(dev); |
801 | dpm_sysfs_remove(dev); | ||
800 | PMError: | 802 | PMError: |
801 | if (dev->bus) | 803 | if (dev->bus) |
802 | blocking_notifier_call_chain(&dev->bus->bus_notifier, | 804 | blocking_notifier_call_chain(&dev->bus->bus_notifier, |
diff --git a/drivers/base/power/Makefile b/drivers/base/power/Makefile index a803733c839e..44504e6618fb 100644 --- a/drivers/base/power/Makefile +++ b/drivers/base/power/Makefile | |||
@@ -1,5 +1,6 @@ | |||
1 | obj-y := shutdown.o | 1 | obj-y := shutdown.o |
2 | obj-$(CONFIG_PM_SLEEP) += main.o sysfs.o | 2 | obj-$(CONFIG_PM) += sysfs.o |
3 | obj-$(CONFIG_PM_SLEEP) += main.o | ||
3 | obj-$(CONFIG_PM_TRACE) += trace.o | 4 | obj-$(CONFIG_PM_TRACE) += trace.o |
4 | 5 | ||
5 | ifeq ($(CONFIG_DEBUG_DRIVER),y) | 6 | ifeq ($(CONFIG_DEBUG_DRIVER),y) |
diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c index 0ab4ab21f564..691ffb64cc37 100644 --- a/drivers/base/power/main.c +++ b/drivers/base/power/main.c | |||
@@ -38,20 +38,14 @@ static DEFINE_MUTEX(dpm_list_mtx); | |||
38 | int (*platform_enable_wakeup)(struct device *dev, int is_on); | 38 | int (*platform_enable_wakeup)(struct device *dev, int is_on); |
39 | 39 | ||
40 | 40 | ||
41 | int device_pm_add(struct device *dev) | 41 | void device_pm_add(struct device *dev) |
42 | { | 42 | { |
43 | int error; | ||
44 | |||
45 | pr_debug("PM: Adding info for %s:%s\n", | 43 | pr_debug("PM: Adding info for %s:%s\n", |
46 | dev->bus ? dev->bus->name : "No Bus", | 44 | dev->bus ? dev->bus->name : "No Bus", |
47 | kobject_name(&dev->kobj)); | 45 | kobject_name(&dev->kobj)); |
48 | mutex_lock(&dpm_list_mtx); | 46 | mutex_lock(&dpm_list_mtx); |
49 | list_add_tail(&dev->power.entry, &dpm_active); | 47 | list_add_tail(&dev->power.entry, &dpm_active); |
50 | error = dpm_sysfs_add(dev); | ||
51 | if (error) | ||
52 | list_del(&dev->power.entry); | ||
53 | mutex_unlock(&dpm_list_mtx); | 48 | mutex_unlock(&dpm_list_mtx); |
54 | return error; | ||
55 | } | 49 | } |
56 | 50 | ||
57 | void device_pm_remove(struct device *dev) | 51 | void device_pm_remove(struct device *dev) |
diff --git a/drivers/base/power/power.h b/drivers/base/power/power.h index 5c4efd493fa5..379da4e958e0 100644 --- a/drivers/base/power/power.h +++ b/drivers/base/power/power.h | |||
@@ -13,14 +13,29 @@ extern void device_shutdown(void); | |||
13 | 13 | ||
14 | extern struct list_head dpm_active; /* The active device list */ | 14 | extern struct list_head dpm_active; /* The active device list */ |
15 | 15 | ||
16 | static inline struct device * to_device(struct list_head * entry) | 16 | static inline struct device *to_device(struct list_head *entry) |
17 | { | 17 | { |
18 | return container_of(entry, struct device, power.entry); | 18 | return container_of(entry, struct device, power.entry); |
19 | } | 19 | } |
20 | 20 | ||
21 | extern int device_pm_add(struct device *); | 21 | extern void device_pm_add(struct device *); |
22 | extern void device_pm_remove(struct device *); | 22 | extern void device_pm_remove(struct device *); |
23 | 23 | ||
24 | #else /* CONFIG_PM_SLEEP */ | ||
25 | |||
26 | |||
27 | static inline void device_pm_add(struct device *dev) | ||
28 | { | ||
29 | } | ||
30 | |||
31 | static inline void device_pm_remove(struct device *dev) | ||
32 | { | ||
33 | } | ||
34 | |||
35 | #endif | ||
36 | |||
37 | #ifdef CONFIG_PM | ||
38 | |||
24 | /* | 39 | /* |
25 | * sysfs.c | 40 | * sysfs.c |
26 | */ | 41 | */ |
@@ -28,16 +43,15 @@ extern void device_pm_remove(struct device *); | |||
28 | extern int dpm_sysfs_add(struct device *); | 43 | extern int dpm_sysfs_add(struct device *); |
29 | extern void dpm_sysfs_remove(struct device *); | 44 | extern void dpm_sysfs_remove(struct device *); |
30 | 45 | ||
31 | #else /* CONFIG_PM_SLEEP */ | 46 | #else /* CONFIG_PM */ |
32 | |||
33 | 47 | ||
34 | static inline int device_pm_add(struct device * dev) | 48 | static inline int dpm_sysfs_add(struct device *dev) |
35 | { | 49 | { |
36 | return 0; | 50 | return 0; |
37 | } | 51 | } |
38 | static inline void device_pm_remove(struct device * dev) | ||
39 | { | ||
40 | 52 | ||
53 | static inline void dpm_sysfs_remove(struct device *dev) | ||
54 | { | ||
41 | } | 55 | } |
42 | 56 | ||
43 | #endif | 57 | #endif |
diff --git a/drivers/block/virtio_blk.c b/drivers/block/virtio_blk.c index 3cf7129d83e6..924ddd8bccd2 100644 --- a/drivers/block/virtio_blk.c +++ b/drivers/block/virtio_blk.c | |||
@@ -223,7 +223,7 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
223 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_CAPACITY, &cap); | 223 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_CAPACITY, &cap); |
224 | if (err) { | 224 | if (err) { |
225 | dev_err(&vdev->dev, "Bad/missing capacity in config\n"); | 225 | dev_err(&vdev->dev, "Bad/missing capacity in config\n"); |
226 | goto out_put_disk; | 226 | goto out_cleanup_queue; |
227 | } | 227 | } |
228 | 228 | ||
229 | /* If capacity is too big, truncate with warning. */ | 229 | /* If capacity is too big, truncate with warning. */ |
@@ -239,7 +239,7 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
239 | blk_queue_max_segment_size(vblk->disk->queue, v); | 239 | blk_queue_max_segment_size(vblk->disk->queue, v); |
240 | else if (err != -ENOENT) { | 240 | else if (err != -ENOENT) { |
241 | dev_err(&vdev->dev, "Bad SIZE_MAX in config\n"); | 241 | dev_err(&vdev->dev, "Bad SIZE_MAX in config\n"); |
242 | goto out_put_disk; | 242 | goto out_cleanup_queue; |
243 | } | 243 | } |
244 | 244 | ||
245 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SEG_MAX, &v); | 245 | err = virtio_config_val(vdev, VIRTIO_CONFIG_BLK_F_SEG_MAX, &v); |
@@ -247,12 +247,14 @@ static int virtblk_probe(struct virtio_device *vdev) | |||
247 | blk_queue_max_hw_segments(vblk->disk->queue, v); | 247 | blk_queue_max_hw_segments(vblk->disk->queue, v); |
248 | else if (err != -ENOENT) { | 248 | else if (err != -ENOENT) { |
249 | dev_err(&vdev->dev, "Bad SEG_MAX in config\n"); | 249 | dev_err(&vdev->dev, "Bad SEG_MAX in config\n"); |
250 | goto out_put_disk; | 250 | goto out_cleanup_queue; |
251 | } | 251 | } |
252 | 252 | ||
253 | add_disk(vblk->disk); | 253 | add_disk(vblk->disk); |
254 | return 0; | 254 | return 0; |
255 | 255 | ||
256 | out_cleanup_queue: | ||
257 | blk_cleanup_queue(vblk->disk->queue); | ||
256 | out_put_disk: | 258 | out_put_disk: |
257 | put_disk(vblk->disk); | 259 | put_disk(vblk->disk); |
258 | out_unregister_blkdev: | 260 | out_unregister_blkdev: |
@@ -277,6 +279,8 @@ static void virtblk_remove(struct virtio_device *vdev) | |||
277 | put_disk(vblk->disk); | 279 | put_disk(vblk->disk); |
278 | unregister_blkdev(major, "virtblk"); | 280 | unregister_blkdev(major, "virtblk"); |
279 | mempool_destroy(vblk->pool); | 281 | mempool_destroy(vblk->pool); |
282 | /* There should be nothing in the queue now, so no need to shutdown */ | ||
283 | vdev->config->del_vq(vblk->vq); | ||
280 | kfree(vblk); | 284 | kfree(vblk); |
281 | } | 285 | } |
282 | 286 | ||
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index bf18d757b876..a509b8d79781 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -457,7 +457,7 @@ config LEGACY_PTYS | |||
457 | config LEGACY_PTY_COUNT | 457 | config LEGACY_PTY_COUNT |
458 | int "Maximum number of legacy PTY in use" | 458 | int "Maximum number of legacy PTY in use" |
459 | depends on LEGACY_PTYS | 459 | depends on LEGACY_PTYS |
460 | range 1 256 | 460 | range 0 256 |
461 | default "256" | 461 | default "256" |
462 | ---help--- | 462 | ---help--- |
463 | The maximum number of legacy PTYs that can be used at any one time. | 463 | The maximum number of legacy PTYs that can be used at any one time. |
diff --git a/drivers/char/sonypi.c b/drivers/char/sonypi.c index 877e53dcb996..921c6d2bc8fc 100644 --- a/drivers/char/sonypi.c +++ b/drivers/char/sonypi.c | |||
@@ -1163,7 +1163,7 @@ static struct acpi_driver sonypi_acpi_driver = { | |||
1163 | }; | 1163 | }; |
1164 | #endif | 1164 | #endif |
1165 | 1165 | ||
1166 | static int __devinit sonypi_create_input_devices(void) | 1166 | static int __devinit sonypi_create_input_devices(struct platform_device *pdev) |
1167 | { | 1167 | { |
1168 | struct input_dev *jog_dev; | 1168 | struct input_dev *jog_dev; |
1169 | struct input_dev *key_dev; | 1169 | struct input_dev *key_dev; |
@@ -1177,6 +1177,7 @@ static int __devinit sonypi_create_input_devices(void) | |||
1177 | jog_dev->name = "Sony Vaio Jogdial"; | 1177 | jog_dev->name = "Sony Vaio Jogdial"; |
1178 | jog_dev->id.bustype = BUS_ISA; | 1178 | jog_dev->id.bustype = BUS_ISA; |
1179 | jog_dev->id.vendor = PCI_VENDOR_ID_SONY; | 1179 | jog_dev->id.vendor = PCI_VENDOR_ID_SONY; |
1180 | jog_dev->dev.parent = &pdev->dev; | ||
1180 | 1181 | ||
1181 | jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 1182 | jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
1182 | jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE); | 1183 | jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE); |
@@ -1191,6 +1192,7 @@ static int __devinit sonypi_create_input_devices(void) | |||
1191 | key_dev->name = "Sony Vaio Keys"; | 1192 | key_dev->name = "Sony Vaio Keys"; |
1192 | key_dev->id.bustype = BUS_ISA; | 1193 | key_dev->id.bustype = BUS_ISA; |
1193 | key_dev->id.vendor = PCI_VENDOR_ID_SONY; | 1194 | key_dev->id.vendor = PCI_VENDOR_ID_SONY; |
1195 | key_dev->dev.parent = &pdev->dev; | ||
1194 | 1196 | ||
1195 | /* Initialize the Input Drivers: special keys */ | 1197 | /* Initialize the Input Drivers: special keys */ |
1196 | key_dev->evbit[0] = BIT_MASK(EV_KEY); | 1198 | key_dev->evbit[0] = BIT_MASK(EV_KEY); |
@@ -1385,7 +1387,7 @@ static int __devinit sonypi_probe(struct platform_device *dev) | |||
1385 | 1387 | ||
1386 | if (useinput) { | 1388 | if (useinput) { |
1387 | 1389 | ||
1388 | error = sonypi_create_input_devices(); | 1390 | error = sonypi_create_input_devices(dev); |
1389 | if (error) { | 1391 | if (error) { |
1390 | printk(KERN_ERR | 1392 | printk(KERN_ERR |
1391 | "sonypi: failed to create input devices\n"); | 1393 | "sonypi: failed to create input devices\n"); |
@@ -1432,7 +1434,7 @@ static int __devexit sonypi_remove(struct platform_device *dev) | |||
1432 | { | 1434 | { |
1433 | sonypi_disable(); | 1435 | sonypi_disable(); |
1434 | 1436 | ||
1435 | synchronize_sched(); /* Allow sonypi interrupt to complete. */ | 1437 | synchronize_irq(sonypi_device.irq); |
1436 | flush_scheduled_work(); | 1438 | flush_scheduled_work(); |
1437 | 1439 | ||
1438 | if (useinput) { | 1440 | if (useinput) { |
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index fd771a4d6d18..81503d94fecc 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -450,6 +450,11 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, | |||
450 | goto out_err; | 450 | goto out_err; |
451 | } | 451 | } |
452 | 452 | ||
453 | if (request_locality(chip, 0) != 0) { | ||
454 | rc = -ENODEV; | ||
455 | goto out_err; | ||
456 | } | ||
457 | |||
453 | vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); | 458 | vendor = ioread32(chip->vendor.iobase + TPM_DID_VID(0)); |
454 | 459 | ||
455 | /* Default timeouts */ | 460 | /* Default timeouts */ |
@@ -487,11 +492,6 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, | |||
487 | if (intfcaps & TPM_INTF_DATA_AVAIL_INT) | 492 | if (intfcaps & TPM_INTF_DATA_AVAIL_INT) |
488 | dev_dbg(dev, "\tData Avail Int Support\n"); | 493 | dev_dbg(dev, "\tData Avail Int Support\n"); |
489 | 494 | ||
490 | if (request_locality(chip, 0) != 0) { | ||
491 | rc = -ENODEV; | ||
492 | goto out_err; | ||
493 | } | ||
494 | |||
495 | /* INTERRUPT Setup */ | 495 | /* INTERRUPT Setup */ |
496 | init_waitqueue_head(&chip->vendor.read_queue); | 496 | init_waitqueue_head(&chip->vendor.read_queue); |
497 | init_waitqueue_head(&chip->vendor.int_queue); | 497 | init_waitqueue_head(&chip->vendor.int_queue); |
diff --git a/drivers/dma/Kconfig b/drivers/dma/Kconfig index 6a7d25fc2470..c46b7c219ee9 100644 --- a/drivers/dma/Kconfig +++ b/drivers/dma/Kconfig | |||
@@ -3,11 +3,13 @@ | |||
3 | # | 3 | # |
4 | 4 | ||
5 | menuconfig DMADEVICES | 5 | menuconfig DMADEVICES |
6 | bool "DMA Offload Engine support" | 6 | bool "DMA Engine support" |
7 | depends on (PCI && X86) || ARCH_IOP32X || ARCH_IOP33X || ARCH_IOP13XX | 7 | depends on (PCI && X86) || ARCH_IOP32X || ARCH_IOP33X || ARCH_IOP13XX |
8 | help | 8 | help |
9 | Intel(R) offload engines enable offloading memory copies in the | 9 | DMA engines can do asynchronous data transfers without |
10 | network stack and RAID operations in the MD driver. | 10 | involving the host CPU. Currently, this framework can be |
11 | used to offload memory copies in the network stack and | ||
12 | RAID operations in the MD driver. | ||
11 | 13 | ||
12 | if DMADEVICES | 14 | if DMADEVICES |
13 | 15 | ||
diff --git a/drivers/ide/Kconfig b/drivers/ide/Kconfig index e445fe6e4ba9..45b22282f149 100644 --- a/drivers/ide/Kconfig +++ b/drivers/ide/Kconfig | |||
@@ -313,7 +313,6 @@ comment "IDE chipset support/bugfixes" | |||
313 | 313 | ||
314 | config IDE_GENERIC | 314 | config IDE_GENERIC |
315 | tristate "generic/default IDE chipset support" | 315 | tristate "generic/default IDE chipset support" |
316 | default H8300 | ||
317 | help | 316 | help |
318 | If unsure, say N. | 317 | If unsure, say N. |
319 | 318 | ||
@@ -484,6 +483,7 @@ config WDC_ALI15X3 | |||
484 | 483 | ||
485 | config BLK_DEV_AMD74XX | 484 | config BLK_DEV_AMD74XX |
486 | tristate "AMD and nVidia IDE support" | 485 | tristate "AMD and nVidia IDE support" |
486 | depends on !ARM | ||
487 | select BLK_DEV_IDEDMA_PCI | 487 | select BLK_DEV_IDEDMA_PCI |
488 | help | 488 | help |
489 | This driver adds explicit support for AMD-7xx and AMD-8111 chips | 489 | This driver adds explicit support for AMD-7xx and AMD-8111 chips |
@@ -883,6 +883,49 @@ config BLK_DEV_IDE_BAST | |||
883 | Say Y here if you want to support the onboard IDE channels on the | 883 | Say Y here if you want to support the onboard IDE channels on the |
884 | Simtec BAST or the Thorcom VR1000 | 884 | Simtec BAST or the Thorcom VR1000 |
885 | 885 | ||
886 | config ETRAX_IDE | ||
887 | bool "ETRAX IDE support" | ||
888 | depends on CRIS && BROKEN | ||
889 | select BLK_DEV_IDEDMA | ||
890 | select IDE_GENERIC | ||
891 | help | ||
892 | Enables the ETRAX IDE driver. | ||
893 | |||
894 | You can't use parallel ports or SCSI ports at the same time. | ||
895 | |||
896 | config ETRAX_IDE_DELAY | ||
897 | int "Delay for drives to regain consciousness" | ||
898 | depends on ETRAX_IDE && ETRAX_ARCH_V10 | ||
899 | default 15 | ||
900 | help | ||
901 | Number of seconds to wait for IDE drives to spin up after an IDE | ||
902 | reset. | ||
903 | |||
904 | choice | ||
905 | prompt "IDE reset pin" | ||
906 | depends on ETRAX_IDE && ETRAX_ARCH_V10 | ||
907 | default ETRAX_IDE_PB7_RESET | ||
908 | |||
909 | config ETRAX_IDE_PB7_RESET | ||
910 | bool "Port_PB_Bit_7" | ||
911 | help | ||
912 | IDE reset on pin 7 on port B | ||
913 | |||
914 | config ETRAX_IDE_G27_RESET | ||
915 | bool "Port_G_Bit_27" | ||
916 | help | ||
917 | IDE reset on pin 27 on port G | ||
918 | |||
919 | endchoice | ||
920 | |||
921 | config IDE_H8300 | ||
922 | bool "H8300 IDE support" | ||
923 | depends on H8300 | ||
924 | select IDE_GENERIC | ||
925 | default y | ||
926 | help | ||
927 | Enables the H8300 IDE driver. | ||
928 | |||
886 | config BLK_DEV_GAYLE | 929 | config BLK_DEV_GAYLE |
887 | bool "Amiga Gayle IDE interface support" | 930 | bool "Amiga Gayle IDE interface support" |
888 | depends on AMIGA | 931 | depends on AMIGA |
@@ -963,7 +1006,7 @@ config BLK_DEV_Q40IDE | |||
963 | 1006 | ||
964 | config BLK_DEV_MPC8xx_IDE | 1007 | config BLK_DEV_MPC8xx_IDE |
965 | bool "MPC8xx IDE support" | 1008 | bool "MPC8xx IDE support" |
966 | depends on 8xx && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE | 1009 | depends on 8xx && (LWMON || IVMS8 || IVML24 || TQM8xxL) && IDE=y && BLK_DEV_IDE=y && !PPC_MERGE |
967 | select IDE_GENERIC | 1010 | select IDE_GENERIC |
968 | help | 1011 | help |
969 | This option provides support for IDE on Motorola MPC8xx Systems. | 1012 | This option provides support for IDE on Motorola MPC8xx Systems. |
diff --git a/drivers/ide/Makefile b/drivers/ide/Makefile index 75dc6969e0a7..b181fc672057 100644 --- a/drivers/ide/Makefile +++ b/drivers/ide/Makefile | |||
@@ -39,7 +39,7 @@ ide-core-$(CONFIG_BLK_DEV_MPC8xx_IDE) += ppc/mpc8xx.o | |||
39 | ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o | 39 | ide-core-$(CONFIG_BLK_DEV_IDE_PMAC) += ppc/pmac.o |
40 | 40 | ||
41 | # built-in only drivers from h8300/ | 41 | # built-in only drivers from h8300/ |
42 | ide-core-$(CONFIG_H8300) += h8300/ide-h8300.o | 42 | ide-core-$(CONFIG_IDE_H8300) += h8300/ide-h8300.o |
43 | 43 | ||
44 | obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o | 44 | obj-$(CONFIG_BLK_DEV_IDE) += ide-core.o |
45 | obj-$(CONFIG_IDE_GENERIC) += ide-generic.o | 45 | obj-$(CONFIG_IDE_GENERIC) += ide-generic.o |
diff --git a/drivers/ide/cris/ide-cris.c b/drivers/ide/cris/ide-cris.c index 7f5bc2ee6c7e..476e0d65ed43 100644 --- a/drivers/ide/cris/ide-cris.c +++ b/drivers/ide/cris/ide-cris.c | |||
@@ -773,15 +773,16 @@ init_e100_ide (void) | |||
773 | /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */ | 773 | /* the IDE control register is at ATA address 6, with CS1 active instead of CS0 */ |
774 | ide_offsets[IDE_CONTROL_OFFSET] = cris_ide_reg_addr(6, 1, 0); | 774 | ide_offsets[IDE_CONTROL_OFFSET] = cris_ide_reg_addr(6, 1, 0); |
775 | 775 | ||
776 | /* first fill in some stuff in the ide_hwifs fields */ | 776 | for (h = 0; h < 4; h++) { |
777 | ide_hwif_t *hwif = NULL; | ||
777 | 778 | ||
778 | for(h = 0; h < MAX_HWIFS; h++) { | ||
779 | ide_hwif_t *hwif = &ide_hwifs[h]; | ||
780 | ide_setup_ports(&hw, cris_ide_base_address(h), | 779 | ide_setup_ports(&hw, cris_ide_base_address(h), |
781 | ide_offsets, | 780 | ide_offsets, |
782 | 0, 0, cris_ide_ack_intr, | 781 | 0, 0, cris_ide_ack_intr, |
783 | ide_default_irq(0)); | 782 | ide_default_irq(0)); |
784 | ide_register_hw(&hw, NULL, 1, &hwif); | 783 | ide_register_hw(&hw, NULL, 1, &hwif); |
784 | if (hwif == NULL) | ||
785 | continue; | ||
785 | hwif->mmio = 1; | 786 | hwif->mmio = 1; |
786 | hwif->chipset = ide_etrax100; | 787 | hwif->chipset = ide_etrax100; |
787 | hwif->set_pio_mode = &cris_set_pio_mode; | 788 | hwif->set_pio_mode = &cris_set_pio_mode; |
diff --git a/drivers/ide/ide-dma.c b/drivers/ide/ide-dma.c index e3add70b9cd8..0d795a1678c7 100644 --- a/drivers/ide/ide-dma.c +++ b/drivers/ide/ide-dma.c | |||
@@ -130,6 +130,7 @@ static const struct drive_list_entry drive_blacklist [] = { | |||
130 | { "_NEC DV5800A", NULL }, | 130 | { "_NEC DV5800A", NULL }, |
131 | { "SAMSUNG CD-ROM SN-124", "N001" }, | 131 | { "SAMSUNG CD-ROM SN-124", "N001" }, |
132 | { "Seagate STT20000A", NULL }, | 132 | { "Seagate STT20000A", NULL }, |
133 | { "CD-ROM CDR_U200", "1.09" }, | ||
133 | { NULL , NULL } | 134 | { NULL , NULL } |
134 | 135 | ||
135 | }; | 136 | }; |
diff --git a/drivers/ide/ide-iops.c b/drivers/ide/ide-iops.c index e17a9ee120ea..5c3256180ae5 100644 --- a/drivers/ide/ide-iops.c +++ b/drivers/ide/ide-iops.c | |||
@@ -303,9 +303,6 @@ void default_hwif_transport(ide_hwif_t *hwif) | |||
303 | hwif->atapi_output_bytes = atapi_output_bytes; | 303 | hwif->atapi_output_bytes = atapi_output_bytes; |
304 | } | 304 | } |
305 | 305 | ||
306 | /* | ||
307 | * Beginning of Taskfile OPCODE Library and feature sets. | ||
308 | */ | ||
309 | void ide_fix_driveid (struct hd_driveid *id) | 306 | void ide_fix_driveid (struct hd_driveid *id) |
310 | { | 307 | { |
311 | #ifndef __LITTLE_ENDIAN | 308 | #ifndef __LITTLE_ENDIAN |
@@ -592,6 +589,9 @@ EXPORT_SYMBOL_GPL(ide_in_drive_list); | |||
592 | static const struct drive_list_entry ivb_list[] = { | 589 | static const struct drive_list_entry ivb_list[] = { |
593 | { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, | 590 | { "QUANTUM FIREBALLlct10 05" , "A03.0900" }, |
594 | { "TSSTcorp CDDVDW SH-S202J" , "SB00" }, | 591 | { "TSSTcorp CDDVDW SH-S202J" , "SB00" }, |
592 | { "TSSTcorp CDDVDW SH-S202J" , "SB01" }, | ||
593 | { "TSSTcorp CDDVDW SH-S202N" , "SB00" }, | ||
594 | { "TSSTcorp CDDVDW SH-S202N" , "SB01" }, | ||
595 | { NULL , NULL } | 595 | { NULL , NULL } |
596 | }; | 596 | }; |
597 | 597 | ||
@@ -756,7 +756,7 @@ int ide_driveid_update(ide_drive_t *drive) | |||
756 | int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | 756 | int ide_config_drive_speed(ide_drive_t *drive, u8 speed) |
757 | { | 757 | { |
758 | ide_hwif_t *hwif = drive->hwif; | 758 | ide_hwif_t *hwif = drive->hwif; |
759 | int error; | 759 | int error = 0; |
760 | u8 stat; | 760 | u8 stat; |
761 | 761 | ||
762 | // while (HWGROUP(drive)->busy) | 762 | // while (HWGROUP(drive)->busy) |
@@ -767,6 +767,10 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
767 | hwif->dma_host_off(drive); | 767 | hwif->dma_host_off(drive); |
768 | #endif | 768 | #endif |
769 | 769 | ||
770 | /* Skip setting PIO flow-control modes on pre-EIDE drives */ | ||
771 | if ((speed & 0xf8) == XFER_PIO_0 && !(drive->id->capability & 0x08)) | ||
772 | goto skip; | ||
773 | |||
770 | /* | 774 | /* |
771 | * Don't use ide_wait_cmd here - it will | 775 | * Don't use ide_wait_cmd here - it will |
772 | * attempt to set_geometry and recalibrate, | 776 | * attempt to set_geometry and recalibrate, |
@@ -814,6 +818,7 @@ int ide_config_drive_speed(ide_drive_t *drive, u8 speed) | |||
814 | drive->id->dma_mword &= ~0x0F00; | 818 | drive->id->dma_mword &= ~0x0F00; |
815 | drive->id->dma_1word &= ~0x0F00; | 819 | drive->id->dma_1word &= ~0x0F00; |
816 | 820 | ||
821 | skip: | ||
817 | #ifdef CONFIG_BLK_DEV_IDEDMA | 822 | #ifdef CONFIG_BLK_DEV_IDEDMA |
818 | if (speed >= XFER_SW_DMA_0) | 823 | if (speed >= XFER_SW_DMA_0) |
819 | hwif->dma_host_on(drive); | 824 | hwif->dma_host_on(drive); |
diff --git a/drivers/ide/ide-probe.c b/drivers/ide/ide-probe.c index 56fb0b843429..ee848c705995 100644 --- a/drivers/ide/ide-probe.c +++ b/drivers/ide/ide-probe.c | |||
@@ -644,7 +644,7 @@ static void hwif_register (ide_hwif_t *hwif) | |||
644 | 644 | ||
645 | static int wait_hwif_ready(ide_hwif_t *hwif) | 645 | static int wait_hwif_ready(ide_hwif_t *hwif) |
646 | { | 646 | { |
647 | int rc; | 647 | int unit, rc; |
648 | 648 | ||
649 | printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name); | 649 | printk(KERN_DEBUG "Probing IDE interface %s...\n", hwif->name); |
650 | 650 | ||
@@ -661,20 +661,26 @@ static int wait_hwif_ready(ide_hwif_t *hwif) | |||
661 | return rc; | 661 | return rc; |
662 | 662 | ||
663 | /* Now make sure both master & slave are ready */ | 663 | /* Now make sure both master & slave are ready */ |
664 | SELECT_DRIVE(&hwif->drives[0]); | 664 | for (unit = 0; unit < MAX_DRIVES; unit++) { |
665 | hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]); | 665 | ide_drive_t *drive = &hwif->drives[unit]; |
666 | mdelay(2); | ||
667 | rc = ide_wait_not_busy(hwif, 35000); | ||
668 | if (rc) | ||
669 | return rc; | ||
670 | SELECT_DRIVE(&hwif->drives[1]); | ||
671 | hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]); | ||
672 | mdelay(2); | ||
673 | rc = ide_wait_not_busy(hwif, 35000); | ||
674 | 666 | ||
667 | /* Ignore disks that we will not probe for later. */ | ||
668 | if (!drive->noprobe || drive->present) { | ||
669 | SELECT_DRIVE(drive); | ||
670 | hwif->OUTB(8, hwif->io_ports[IDE_CONTROL_OFFSET]); | ||
671 | mdelay(2); | ||
672 | rc = ide_wait_not_busy(hwif, 35000); | ||
673 | if (rc) | ||
674 | goto out; | ||
675 | } else | ||
676 | printk(KERN_DEBUG "%s: ide_wait_not_busy() skipped\n", | ||
677 | drive->name); | ||
678 | } | ||
679 | out: | ||
675 | /* Exit function with master reselected (let's be sane) */ | 680 | /* Exit function with master reselected (let's be sane) */ |
676 | SELECT_DRIVE(&hwif->drives[0]); | 681 | if (unit) |
677 | 682 | SELECT_DRIVE(&hwif->drives[0]); | |
683 | |||
678 | return rc; | 684 | return rc; |
679 | } | 685 | } |
680 | 686 | ||
diff --git a/drivers/ide/legacy/ali14xx.c b/drivers/ide/legacy/ali14xx.c index 10311ecc674a..38c3a6d63f30 100644 --- a/drivers/ide/legacy/ali14xx.c +++ b/drivers/ide/legacy/ali14xx.c | |||
@@ -53,12 +53,13 @@ | |||
53 | 53 | ||
54 | /* port addresses for auto-detection */ | 54 | /* port addresses for auto-detection */ |
55 | #define ALI_NUM_PORTS 4 | 55 | #define ALI_NUM_PORTS 4 |
56 | static int ports[ALI_NUM_PORTS] __initdata = {0x074, 0x0f4, 0x034, 0x0e4}; | 56 | static const int ports[ALI_NUM_PORTS] __initdata = |
57 | { 0x074, 0x0f4, 0x034, 0x0e4 }; | ||
57 | 58 | ||
58 | /* register initialization data */ | 59 | /* register initialization data */ |
59 | typedef struct { u8 reg, data; } RegInitializer; | 60 | typedef struct { u8 reg, data; } RegInitializer; |
60 | 61 | ||
61 | static RegInitializer initData[] __initdata = { | 62 | static const RegInitializer initData[] __initdata = { |
62 | {0x01, 0x0f}, {0x02, 0x00}, {0x03, 0x00}, {0x04, 0x00}, | 63 | {0x01, 0x0f}, {0x02, 0x00}, {0x03, 0x00}, {0x04, 0x00}, |
63 | {0x05, 0x00}, {0x06, 0x00}, {0x07, 0x2b}, {0x0a, 0x0f}, | 64 | {0x05, 0x00}, {0x06, 0x00}, {0x07, 0x2b}, {0x0a, 0x0f}, |
64 | {0x25, 0x00}, {0x26, 0x00}, {0x27, 0x00}, {0x28, 0x00}, | 65 | {0x25, 0x00}, {0x26, 0x00}, {0x27, 0x00}, {0x28, 0x00}, |
@@ -177,7 +178,7 @@ static int __init findPort (void) | |||
177 | * Initialize controller registers with default values. | 178 | * Initialize controller registers with default values. |
178 | */ | 179 | */ |
179 | static int __init initRegisters (void) { | 180 | static int __init initRegisters (void) { |
180 | RegInitializer *p; | 181 | const RegInitializer *p; |
181 | u8 t; | 182 | u8 t; |
182 | unsigned long flags; | 183 | unsigned long flags; |
183 | 184 | ||
diff --git a/drivers/ide/legacy/macide.c b/drivers/ide/legacy/macide.c index e87cd2f16430..5c6aa77c2370 100644 --- a/drivers/ide/legacy/macide.c +++ b/drivers/ide/legacy/macide.c | |||
@@ -81,7 +81,7 @@ int macide_ack_intr(ide_hwif_t* hwif) | |||
81 | * Probe for a Macintosh IDE interface | 81 | * Probe for a Macintosh IDE interface |
82 | */ | 82 | */ |
83 | 83 | ||
84 | void macide_init(void) | 84 | void __init macide_init(void) |
85 | { | 85 | { |
86 | hw_regs_t hw; | 86 | hw_regs_t hw; |
87 | ide_hwif_t *hwif; | 87 | ide_hwif_t *hwif; |
diff --git a/drivers/ide/legacy/q40ide.c b/drivers/ide/legacy/q40ide.c index a73db1bd482d..6ea46a6723e2 100644 --- a/drivers/ide/legacy/q40ide.c +++ b/drivers/ide/legacy/q40ide.c | |||
@@ -111,7 +111,7 @@ static const char *q40_ide_names[Q40IDE_NUM_HWIFS]={ | |||
111 | * Probe for Q40 IDE interfaces | 111 | * Probe for Q40 IDE interfaces |
112 | */ | 112 | */ |
113 | 113 | ||
114 | void q40ide_init(void) | 114 | void __init q40ide_init(void) |
115 | { | 115 | { |
116 | int i; | 116 | int i; |
117 | ide_hwif_t *hwif; | 117 | ide_hwif_t *hwif; |
diff --git a/drivers/ide/pci/aec62xx.c b/drivers/ide/pci/aec62xx.c index 19ec421f7b9f..44268504ae43 100644 --- a/drivers/ide/pci/aec62xx.c +++ b/drivers/ide/pci/aec62xx.c | |||
@@ -260,6 +260,11 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi | |||
260 | { | 260 | { |
261 | struct ide_port_info d; | 261 | struct ide_port_info d; |
262 | u8 idx = id->driver_data; | 262 | u8 idx = id->driver_data; |
263 | int err; | ||
264 | |||
265 | err = pci_enable_device(dev); | ||
266 | if (err) | ||
267 | return err; | ||
263 | 268 | ||
264 | d = aec62xx_chipsets[idx]; | 269 | d = aec62xx_chipsets[idx]; |
265 | 270 | ||
@@ -272,7 +277,11 @@ static int __devinit aec62xx_init_one(struct pci_dev *dev, const struct pci_devi | |||
272 | } | 277 | } |
273 | } | 278 | } |
274 | 279 | ||
275 | return ide_setup_pci_device(dev, &d); | 280 | err = ide_setup_pci_device(dev, &d); |
281 | if (err) | ||
282 | pci_disable_device(dev); | ||
283 | |||
284 | return err; | ||
276 | } | 285 | } |
277 | 286 | ||
278 | static const struct pci_device_id aec62xx_pci_tbl[] = { | 287 | static const struct pci_device_id aec62xx_pci_tbl[] = { |
diff --git a/drivers/ide/pci/alim15x3.c b/drivers/ide/pci/alim15x3.c index a607dd31a64c..ce293936af4b 100644 --- a/drivers/ide/pci/alim15x3.c +++ b/drivers/ide/pci/alim15x3.c | |||
@@ -603,6 +603,11 @@ static int ali_cable_override(struct pci_dev *pdev) | |||
603 | pdev->subsystem_device == 0x10AF) | 603 | pdev->subsystem_device == 0x10AF) |
604 | return 1; | 604 | return 1; |
605 | 605 | ||
606 | /* Mitac 8317 (Winbook-A) and relatives */ | ||
607 | if (pdev->subsystem_vendor == 0x1071 && | ||
608 | pdev->subsystem_device == 0x8317) | ||
609 | return 1; | ||
610 | |||
606 | /* Systems by DMI */ | 611 | /* Systems by DMI */ |
607 | if (dmi_check_system(cable_dmi_table)) | 612 | if (dmi_check_system(cable_dmi_table)) |
608 | return 1; | 613 | return 1; |
diff --git a/drivers/ide/pci/piix.c b/drivers/ide/pci/piix.c index 63625a0be712..27781d294cea 100644 --- a/drivers/ide/pci/piix.c +++ b/drivers/ide/pci/piix.c | |||
@@ -306,6 +306,7 @@ static const struct ich_laptop ich_laptop[] = { | |||
306 | { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ | 306 | { 0x27DF, 0x0005, 0x0280 }, /* ICH7 on Acer 5602WLMi */ |
307 | { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ | 307 | { 0x27DF, 0x1025, 0x0110 }, /* ICH7 on Acer 3682WLMi */ |
308 | { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ | 308 | { 0x27DF, 0x1043, 0x1267 }, /* ICH7 on Asus W5F */ |
309 | { 0x27DF, 0x103C, 0x30A1 }, /* ICH7 on HP Compaq nc2400 */ | ||
309 | { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on Acer Aspire 2023WLMi */ | 310 | { 0x24CA, 0x1025, 0x0061 }, /* ICH4 on Acer Aspire 2023WLMi */ |
310 | /* end marker */ | 311 | /* end marker */ |
311 | { 0, } | 312 | { 0, } |
diff --git a/drivers/ide/pci/siimage.c b/drivers/ide/pci/siimage.c index 6d99441c605b..5709c252543b 100644 --- a/drivers/ide/pci/siimage.c +++ b/drivers/ide/pci/siimage.c | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * linux/drivers/ide/pci/siimage.c Version 1.18 Oct 18 2007 | 2 | * linux/drivers/ide/pci/siimage.c Version 1.19 Nov 16 2007 |
3 | * | 3 | * |
4 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> | 4 | * Copyright (C) 2001-2002 Andre Hedrick <andre@linux-ide.org> |
5 | * Copyright (C) 2003 Red Hat <alan@redhat.com> | 5 | * Copyright (C) 2003 Red Hat <alan@redhat.com> |
@@ -460,48 +460,6 @@ static void sil_sata_pre_reset(ide_drive_t *drive) | |||
460 | } | 460 | } |
461 | 461 | ||
462 | /** | 462 | /** |
463 | * siimage_reset - reset a device on an siimage controller | ||
464 | * @drive: drive to reset | ||
465 | * | ||
466 | * Perform a controller level reset fo the device. For | ||
467 | * SATA we must also check the PHY. | ||
468 | */ | ||
469 | |||
470 | static void siimage_reset (ide_drive_t *drive) | ||
471 | { | ||
472 | ide_hwif_t *hwif = HWIF(drive); | ||
473 | u8 reset = 0; | ||
474 | unsigned long addr = siimage_selreg(hwif, 0); | ||
475 | |||
476 | if (hwif->mmio) { | ||
477 | reset = hwif->INB(addr); | ||
478 | hwif->OUTB((reset|0x03), addr); | ||
479 | /* FIXME:posting */ | ||
480 | udelay(25); | ||
481 | hwif->OUTB(reset, addr); | ||
482 | (void) hwif->INB(addr); | ||
483 | } else { | ||
484 | pci_read_config_byte(hwif->pci_dev, addr, &reset); | ||
485 | pci_write_config_byte(hwif->pci_dev, addr, reset|0x03); | ||
486 | udelay(25); | ||
487 | pci_write_config_byte(hwif->pci_dev, addr, reset); | ||
488 | pci_read_config_byte(hwif->pci_dev, addr, &reset); | ||
489 | } | ||
490 | |||
491 | if (SATA_STATUS_REG) { | ||
492 | /* SATA_STATUS_REG is valid only when in MMIO mode */ | ||
493 | u32 sata_stat = readl((void __iomem *)SATA_STATUS_REG); | ||
494 | printk(KERN_WARNING "%s: reset phy, status=0x%08x, %s\n", | ||
495 | hwif->name, sata_stat, __FUNCTION__); | ||
496 | if (!(sata_stat)) { | ||
497 | printk(KERN_WARNING "%s: reset phy dead, status=0x%08x\n", | ||
498 | hwif->name, sata_stat); | ||
499 | drive->failures++; | ||
500 | } | ||
501 | } | ||
502 | } | ||
503 | |||
504 | /** | ||
505 | * proc_reports_siimage - add siimage controller to proc | 463 | * proc_reports_siimage - add siimage controller to proc |
506 | * @dev: PCI device | 464 | * @dev: PCI device |
507 | * @clocking: SCSC value | 465 | * @clocking: SCSC value |
@@ -857,7 +815,6 @@ static void __devinit init_hwif_siimage(ide_hwif_t *hwif) | |||
857 | { | 815 | { |
858 | u8 sata = is_sata(hwif); | 816 | u8 sata = is_sata(hwif); |
859 | 817 | ||
860 | hwif->resetproc = &siimage_reset; | ||
861 | hwif->set_pio_mode = &sil_set_pio_mode; | 818 | hwif->set_pio_mode = &sil_set_pio_mode; |
862 | hwif->set_dma_mode = &sil_set_dma_mode; | 819 | hwif->set_dma_mode = &sil_set_dma_mode; |
863 | 820 | ||
diff --git a/drivers/ide/pci/sis5513.c b/drivers/ide/pci/sis5513.c index f6e2ab3dd166..d90b42917775 100644 --- a/drivers/ide/pci/sis5513.c +++ b/drivers/ide/pci/sis5513.c | |||
@@ -526,6 +526,7 @@ static const struct sis_laptop sis_laptop[] = { | |||
526 | /* devid, subvendor, subdev */ | 526 | /* devid, subvendor, subdev */ |
527 | { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ | 527 | { 0x5513, 0x1043, 0x1107 }, /* ASUS A6K */ |
528 | { 0x5513, 0x1734, 0x105f }, /* FSC Amilo A1630 */ | 528 | { 0x5513, 0x1734, 0x105f }, /* FSC Amilo A1630 */ |
529 | { 0x5513, 0x1071, 0x8640 }, /* EasyNote K5305 */ | ||
529 | /* end marker */ | 530 | /* end marker */ |
530 | { 0, } | 531 | { 0, } |
531 | }; | 532 | }; |
diff --git a/drivers/ide/pci/trm290.c b/drivers/ide/pci/trm290.c index 5011ba22e36c..0895e753a35d 100644 --- a/drivers/ide/pci/trm290.c +++ b/drivers/ide/pci/trm290.c | |||
@@ -240,9 +240,6 @@ static int trm290_ide_dma_test_irq (ide_drive_t *drive) | |||
240 | return (status == 0x00ff); | 240 | return (status == 0x00ff); |
241 | } | 241 | } |
242 | 242 | ||
243 | /* | ||
244 | * Invoked from ide-dma.c at boot time. | ||
245 | */ | ||
246 | static void __devinit init_hwif_trm290(ide_hwif_t *hwif) | 243 | static void __devinit init_hwif_trm290(ide_hwif_t *hwif) |
247 | { | 244 | { |
248 | unsigned int cfgbase = 0; | 245 | unsigned int cfgbase = 0; |
diff --git a/drivers/ide/ppc/pmac.c b/drivers/ide/ppc/pmac.c index 5afdfef7264c..7f7a59885777 100644 --- a/drivers/ide/ppc/pmac.c +++ b/drivers/ide/ppc/pmac.c | |||
@@ -1513,7 +1513,7 @@ pmac_ide_build_dmatable(ide_drive_t *drive, struct request *rq) | |||
1513 | 1513 | ||
1514 | if (pmif->broken_dma && cur_addr & (L1_CACHE_BYTES - 1)) { | 1514 | if (pmif->broken_dma && cur_addr & (L1_CACHE_BYTES - 1)) { |
1515 | if (pmif->broken_dma_warn == 0) { | 1515 | if (pmif->broken_dma_warn == 0) { |
1516 | printk(KERN_WARNING "%s: DMA on non aligned address," | 1516 | printk(KERN_WARNING "%s: DMA on non aligned address, " |
1517 | "switching to PIO on Ohare chipset\n", drive->name); | 1517 | "switching to PIO on Ohare chipset\n", drive->name); |
1518 | pmif->broken_dma_warn = 1; | 1518 | pmif->broken_dma_warn = 1; |
1519 | } | 1519 | } |
diff --git a/drivers/infiniband/hw/ehca/ehca_av.c b/drivers/infiniband/hw/ehca/ehca_av.c index 453eb995c1d4..f7782c882ab4 100644 --- a/drivers/infiniband/hw/ehca/ehca_av.c +++ b/drivers/infiniband/hw/ehca/ehca_av.c | |||
@@ -76,8 +76,12 @@ int ehca_calc_ipd(struct ehca_shca *shca, int port, | |||
76 | 76 | ||
77 | link = ib_width_enum_to_int(pa.active_width) * pa.active_speed; | 77 | link = ib_width_enum_to_int(pa.active_width) * pa.active_speed; |
78 | 78 | ||
79 | /* IPD = round((link / path) - 1) */ | 79 | if (path >= link) |
80 | *ipd = ((link + (path >> 1)) / path) - 1; | 80 | /* no need to throttle if path faster than link */ |
81 | *ipd = 0; | ||
82 | else | ||
83 | /* IPD = round((link / path) - 1) */ | ||
84 | *ipd = ((link + (path >> 1)) / path) - 1; | ||
81 | 85 | ||
82 | return 0; | 86 | return 0; |
83 | } | 87 | } |
diff --git a/drivers/infiniband/hw/ehca/ehca_qp.c b/drivers/infiniband/hw/ehca/ehca_qp.c index 2e3e6547cb78..dd126681fed0 100644 --- a/drivers/infiniband/hw/ehca/ehca_qp.c +++ b/drivers/infiniband/hw/ehca/ehca_qp.c | |||
@@ -1203,7 +1203,7 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1203 | mqpcb->service_level = attr->ah_attr.sl; | 1203 | mqpcb->service_level = attr->ah_attr.sl; |
1204 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL, 1); | 1204 | update_mask |= EHCA_BMASK_SET(MQPCB_MASK_SERVICE_LEVEL, 1); |
1205 | 1205 | ||
1206 | if (ehca_calc_ipd(shca, my_qp->init_attr.port_num, | 1206 | if (ehca_calc_ipd(shca, mqpcb->prim_phys_port, |
1207 | attr->ah_attr.static_rate, | 1207 | attr->ah_attr.static_rate, |
1208 | &mqpcb->max_static_rate)) { | 1208 | &mqpcb->max_static_rate)) { |
1209 | ret = -EINVAL; | 1209 | ret = -EINVAL; |
@@ -1302,7 +1302,7 @@ static int internal_modify_qp(struct ib_qp *ibqp, | |||
1302 | mqpcb->source_path_bits_al = attr->alt_ah_attr.src_path_bits; | 1302 | mqpcb->source_path_bits_al = attr->alt_ah_attr.src_path_bits; |
1303 | mqpcb->service_level_al = attr->alt_ah_attr.sl; | 1303 | mqpcb->service_level_al = attr->alt_ah_attr.sl; |
1304 | 1304 | ||
1305 | if (ehca_calc_ipd(shca, my_qp->init_attr.port_num, | 1305 | if (ehca_calc_ipd(shca, mqpcb->alt_phys_port, |
1306 | attr->alt_ah_attr.static_rate, | 1306 | attr->alt_ah_attr.static_rate, |
1307 | &mqpcb->max_static_rate_al)) { | 1307 | &mqpcb->max_static_rate_al)) { |
1308 | ret = -EINVAL; | 1308 | ret = -EINVAL; |
diff --git a/drivers/infiniband/hw/ipath/ipath_cq.c b/drivers/infiniband/hw/ipath/ipath_cq.c index 08d8ae148cd0..d1380c7a1703 100644 --- a/drivers/infiniband/hw/ipath/ipath_cq.c +++ b/drivers/infiniband/hw/ipath/ipath_cq.c | |||
@@ -395,12 +395,9 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) | |||
395 | goto bail; | 395 | goto bail; |
396 | } | 396 | } |
397 | 397 | ||
398 | /* | 398 | /* Check that we can write the offset to mmap. */ |
399 | * Return the address of the WC as the offset to mmap. | ||
400 | * See ipath_mmap() for details. | ||
401 | */ | ||
402 | if (udata && udata->outlen >= sizeof(__u64)) { | 399 | if (udata && udata->outlen >= sizeof(__u64)) { |
403 | __u64 offset = (__u64) wc; | 400 | __u64 offset = 0; |
404 | 401 | ||
405 | ret = ib_copy_to_udata(udata, &offset, sizeof(offset)); | 402 | ret = ib_copy_to_udata(udata, &offset, sizeof(offset)); |
406 | if (ret) | 403 | if (ret) |
@@ -450,6 +447,18 @@ int ipath_resize_cq(struct ib_cq *ibcq, int cqe, struct ib_udata *udata) | |||
450 | struct ipath_mmap_info *ip = cq->ip; | 447 | struct ipath_mmap_info *ip = cq->ip; |
451 | 448 | ||
452 | ipath_update_mmap_info(dev, ip, sz, wc); | 449 | ipath_update_mmap_info(dev, ip, sz, wc); |
450 | |||
451 | /* | ||
452 | * Return the offset to mmap. | ||
453 | * See ipath_mmap() for details. | ||
454 | */ | ||
455 | if (udata && udata->outlen >= sizeof(__u64)) { | ||
456 | ret = ib_copy_to_udata(udata, &ip->offset, | ||
457 | sizeof(ip->offset)); | ||
458 | if (ret) | ||
459 | goto bail; | ||
460 | } | ||
461 | |||
453 | spin_lock_irq(&dev->pending_lock); | 462 | spin_lock_irq(&dev->pending_lock); |
454 | if (list_empty(&ip->pending_mmaps)) | 463 | if (list_empty(&ip->pending_mmaps)) |
455 | list_add(&ip->pending_mmaps, &dev->pending_mmaps); | 464 | list_add(&ip->pending_mmaps, &dev->pending_mmaps); |
diff --git a/drivers/infiniband/hw/ipath/ipath_qp.c b/drivers/infiniband/hw/ipath/ipath_qp.c index 6a41fdbc8e57..b997ff88401b 100644 --- a/drivers/infiniband/hw/ipath/ipath_qp.c +++ b/drivers/infiniband/hw/ipath/ipath_qp.c | |||
@@ -835,7 +835,8 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
835 | init_attr->qp_type); | 835 | init_attr->qp_type); |
836 | if (err) { | 836 | if (err) { |
837 | ret = ERR_PTR(err); | 837 | ret = ERR_PTR(err); |
838 | goto bail_rwq; | 838 | vfree(qp->r_rq.wq); |
839 | goto bail_qp; | ||
839 | } | 840 | } |
840 | qp->ip = NULL; | 841 | qp->ip = NULL; |
841 | ipath_reset_qp(qp); | 842 | ipath_reset_qp(qp); |
@@ -863,7 +864,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
863 | sizeof(offset)); | 864 | sizeof(offset)); |
864 | if (err) { | 865 | if (err) { |
865 | ret = ERR_PTR(err); | 866 | ret = ERR_PTR(err); |
866 | goto bail_rwq; | 867 | goto bail_ip; |
867 | } | 868 | } |
868 | } else { | 869 | } else { |
869 | u32 s = sizeof(struct ipath_rwq) + | 870 | u32 s = sizeof(struct ipath_rwq) + |
@@ -875,7 +876,7 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
875 | qp->r_rq.wq); | 876 | qp->r_rq.wq); |
876 | if (!qp->ip) { | 877 | if (!qp->ip) { |
877 | ret = ERR_PTR(-ENOMEM); | 878 | ret = ERR_PTR(-ENOMEM); |
878 | goto bail_rwq; | 879 | goto bail_ip; |
879 | } | 880 | } |
880 | 881 | ||
881 | err = ib_copy_to_udata(udata, &(qp->ip->offset), | 882 | err = ib_copy_to_udata(udata, &(qp->ip->offset), |
@@ -907,9 +908,11 @@ struct ib_qp *ipath_create_qp(struct ib_pd *ibpd, | |||
907 | goto bail; | 908 | goto bail; |
908 | 909 | ||
909 | bail_ip: | 910 | bail_ip: |
910 | kfree(qp->ip); | 911 | if (qp->ip) |
911 | bail_rwq: | 912 | kref_put(&qp->ip->ref, ipath_release_mmap_info); |
912 | vfree(qp->r_rq.wq); | 913 | else |
914 | vfree(qp->r_rq.wq); | ||
915 | ipath_free_qp(&dev->qp_table, qp); | ||
913 | bail_qp: | 916 | bail_qp: |
914 | kfree(qp); | 917 | kfree(qp); |
915 | bail_swq: | 918 | bail_swq: |
diff --git a/drivers/infiniband/hw/ipath/ipath_srq.c b/drivers/infiniband/hw/ipath/ipath_srq.c index 40c36ec19016..2fef36f4b675 100644 --- a/drivers/infiniband/hw/ipath/ipath_srq.c +++ b/drivers/infiniband/hw/ipath/ipath_srq.c | |||
@@ -59,7 +59,7 @@ int ipath_post_srq_receive(struct ib_srq *ibsrq, struct ib_recv_wr *wr, | |||
59 | 59 | ||
60 | if ((unsigned) wr->num_sge > srq->rq.max_sge) { | 60 | if ((unsigned) wr->num_sge > srq->rq.max_sge) { |
61 | *bad_wr = wr; | 61 | *bad_wr = wr; |
62 | ret = -ENOMEM; | 62 | ret = -EINVAL; |
63 | goto bail; | 63 | goto bail; |
64 | } | 64 | } |
65 | 65 | ||
@@ -211,11 +211,11 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, | |||
211 | struct ib_udata *udata) | 211 | struct ib_udata *udata) |
212 | { | 212 | { |
213 | struct ipath_srq *srq = to_isrq(ibsrq); | 213 | struct ipath_srq *srq = to_isrq(ibsrq); |
214 | struct ipath_rwq *wq; | ||
214 | int ret = 0; | 215 | int ret = 0; |
215 | 216 | ||
216 | if (attr_mask & IB_SRQ_MAX_WR) { | 217 | if (attr_mask & IB_SRQ_MAX_WR) { |
217 | struct ipath_rwq *owq; | 218 | struct ipath_rwq *owq; |
218 | struct ipath_rwq *wq; | ||
219 | struct ipath_rwqe *p; | 219 | struct ipath_rwqe *p; |
220 | u32 sz, size, n, head, tail; | 220 | u32 sz, size, n, head, tail; |
221 | 221 | ||
@@ -236,27 +236,20 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, | |||
236 | goto bail; | 236 | goto bail; |
237 | } | 237 | } |
238 | 238 | ||
239 | /* | 239 | /* Check that we can write the offset to mmap. */ |
240 | * Return the address of the RWQ as the offset to mmap. | ||
241 | * See ipath_mmap() for details. | ||
242 | */ | ||
243 | if (udata && udata->inlen >= sizeof(__u64)) { | 240 | if (udata && udata->inlen >= sizeof(__u64)) { |
244 | __u64 offset_addr; | 241 | __u64 offset_addr; |
245 | __u64 offset = (__u64) wq; | 242 | __u64 offset = 0; |
246 | 243 | ||
247 | ret = ib_copy_from_udata(&offset_addr, udata, | 244 | ret = ib_copy_from_udata(&offset_addr, udata, |
248 | sizeof(offset_addr)); | 245 | sizeof(offset_addr)); |
249 | if (ret) { | 246 | if (ret) |
250 | vfree(wq); | 247 | goto bail_free; |
251 | goto bail; | ||
252 | } | ||
253 | udata->outbuf = (void __user *) offset_addr; | 248 | udata->outbuf = (void __user *) offset_addr; |
254 | ret = ib_copy_to_udata(udata, &offset, | 249 | ret = ib_copy_to_udata(udata, &offset, |
255 | sizeof(offset)); | 250 | sizeof(offset)); |
256 | if (ret) { | 251 | if (ret) |
257 | vfree(wq); | 252 | goto bail_free; |
258 | goto bail; | ||
259 | } | ||
260 | } | 253 | } |
261 | 254 | ||
262 | spin_lock_irq(&srq->rq.lock); | 255 | spin_lock_irq(&srq->rq.lock); |
@@ -277,10 +270,8 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, | |||
277 | else | 270 | else |
278 | n -= tail; | 271 | n -= tail; |
279 | if (size <= n) { | 272 | if (size <= n) { |
280 | spin_unlock_irq(&srq->rq.lock); | ||
281 | vfree(wq); | ||
282 | ret = -EINVAL; | 273 | ret = -EINVAL; |
283 | goto bail; | 274 | goto bail_unlock; |
284 | } | 275 | } |
285 | n = 0; | 276 | n = 0; |
286 | p = wq->wq; | 277 | p = wq->wq; |
@@ -314,6 +305,18 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, | |||
314 | u32 s = sizeof(struct ipath_rwq) + size * sz; | 305 | u32 s = sizeof(struct ipath_rwq) + size * sz; |
315 | 306 | ||
316 | ipath_update_mmap_info(dev, ip, s, wq); | 307 | ipath_update_mmap_info(dev, ip, s, wq); |
308 | |||
309 | /* | ||
310 | * Return the offset to mmap. | ||
311 | * See ipath_mmap() for details. | ||
312 | */ | ||
313 | if (udata && udata->inlen >= sizeof(__u64)) { | ||
314 | ret = ib_copy_to_udata(udata, &ip->offset, | ||
315 | sizeof(ip->offset)); | ||
316 | if (ret) | ||
317 | goto bail; | ||
318 | } | ||
319 | |||
317 | spin_lock_irq(&dev->pending_lock); | 320 | spin_lock_irq(&dev->pending_lock); |
318 | if (list_empty(&ip->pending_mmaps)) | 321 | if (list_empty(&ip->pending_mmaps)) |
319 | list_add(&ip->pending_mmaps, | 322 | list_add(&ip->pending_mmaps, |
@@ -328,7 +331,12 @@ int ipath_modify_srq(struct ib_srq *ibsrq, struct ib_srq_attr *attr, | |||
328 | srq->limit = attr->srq_limit; | 331 | srq->limit = attr->srq_limit; |
329 | spin_unlock_irq(&srq->rq.lock); | 332 | spin_unlock_irq(&srq->rq.lock); |
330 | } | 333 | } |
334 | goto bail; | ||
331 | 335 | ||
336 | bail_unlock: | ||
337 | spin_unlock_irq(&srq->rq.lock); | ||
338 | bail_free: | ||
339 | vfree(wq); | ||
332 | bail: | 340 | bail: |
333 | return ret; | 341 | return ret; |
334 | } | 342 | } |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index 74f77e7c2c1b..c4c998446c7b 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c | |||
@@ -302,8 +302,10 @@ static int ipath_post_one_send(struct ipath_qp *qp, struct ib_send_wr *wr) | |||
302 | next = qp->s_head + 1; | 302 | next = qp->s_head + 1; |
303 | if (next >= qp->s_size) | 303 | if (next >= qp->s_size) |
304 | next = 0; | 304 | next = 0; |
305 | if (next == qp->s_last) | 305 | if (next == qp->s_last) { |
306 | goto bail_inval; | 306 | ret = -ENOMEM; |
307 | goto bail; | ||
308 | } | ||
307 | 309 | ||
308 | wqe = get_swqe_ptr(qp, qp->s_head); | 310 | wqe = get_swqe_ptr(qp, qp->s_head); |
309 | wqe->wr = *wr; | 311 | wqe->wr = *wr; |
@@ -404,7 +406,7 @@ static int ipath_post_receive(struct ib_qp *ibqp, struct ib_recv_wr *wr, | |||
404 | 406 | ||
405 | if ((unsigned) wr->num_sge > qp->r_rq.max_sge) { | 407 | if ((unsigned) wr->num_sge > qp->r_rq.max_sge) { |
406 | *bad_wr = wr; | 408 | *bad_wr = wr; |
407 | ret = -ENOMEM; | 409 | ret = -EINVAL; |
408 | goto bail; | 410 | goto bail; |
409 | } | 411 | } |
410 | 412 | ||
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index a03a65ebcf0c..c9f6077b615e 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -460,6 +460,9 @@ static struct ipoib_path *path_rec_create(struct net_device *dev, void *gid) | |||
460 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 460 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
461 | struct ipoib_path *path; | 461 | struct ipoib_path *path; |
462 | 462 | ||
463 | if (!priv->broadcast) | ||
464 | return NULL; | ||
465 | |||
463 | path = kzalloc(sizeof *path, GFP_ATOMIC); | 466 | path = kzalloc(sizeof *path, GFP_ATOMIC); |
464 | if (!path) | 467 | if (!path) |
465 | return NULL; | 468 | return NULL; |
diff --git a/drivers/infiniband/ulp/iser/iser_memory.c b/drivers/infiniband/ulp/iser/iser_memory.c index d68798061795..4a17743a639f 100644 --- a/drivers/infiniband/ulp/iser/iser_memory.c +++ b/drivers/infiniband/ulp/iser/iser_memory.c | |||
@@ -310,13 +310,15 @@ static unsigned int iser_data_buf_aligned_len(struct iser_data_buf *data, | |||
310 | if (i + 1 < data->dma_nents) { | 310 | if (i + 1 < data->dma_nents) { |
311 | next_addr = ib_sg_dma_address(ibdev, sg_next(sg)); | 311 | next_addr = ib_sg_dma_address(ibdev, sg_next(sg)); |
312 | /* are i, i+1 fragments of the same page? */ | 312 | /* are i, i+1 fragments of the same page? */ |
313 | if (end_addr == next_addr) | 313 | if (end_addr == next_addr) { |
314 | cnt++; | ||
314 | continue; | 315 | continue; |
315 | else if (!IS_4K_ALIGNED(end_addr)) { | 316 | } else if (!IS_4K_ALIGNED(end_addr)) { |
316 | ret_len = cnt + 1; | 317 | ret_len = cnt + 1; |
317 | break; | 318 | break; |
318 | } | 319 | } |
319 | } | 320 | } |
321 | cnt++; | ||
320 | } | 322 | } |
321 | if (i == data->dma_nents) | 323 | if (i == data->dma_nents) |
322 | ret_len = cnt; /* loop ended */ | 324 | ret_len = cnt; /* loop ended */ |
diff --git a/drivers/input/keyboard/Kconfig b/drivers/input/keyboard/Kconfig index 2316a018fae6..dfa6592c10f6 100644 --- a/drivers/input/keyboard/Kconfig +++ b/drivers/input/keyboard/Kconfig | |||
@@ -286,7 +286,7 @@ config KEYBOARD_MAPLE | |||
286 | 286 | ||
287 | config KEYBOARD_BFIN | 287 | config KEYBOARD_BFIN |
288 | tristate "Blackfin BF54x keypad support" | 288 | tristate "Blackfin BF54x keypad support" |
289 | depends on BF54x | 289 | depends on (BF54x && !BF544) |
290 | help | 290 | help |
291 | Say Y here if you want to use the BF54x keypad. | 291 | Say Y here if you want to use the BF54x keypad. |
292 | 292 | ||
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c index 3eddf52a0bba..6a9ca4bdcb74 100644 --- a/drivers/input/keyboard/gpio_keys.c +++ b/drivers/input/keyboard/gpio_keys.c | |||
@@ -75,16 +75,32 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
75 | 75 | ||
76 | for (i = 0; i < pdata->nbuttons; i++) { | 76 | for (i = 0; i < pdata->nbuttons; i++) { |
77 | struct gpio_keys_button *button = &pdata->buttons[i]; | 77 | struct gpio_keys_button *button = &pdata->buttons[i]; |
78 | int irq = gpio_to_irq(button->gpio); | 78 | int irq; |
79 | unsigned int type = button->type ?: EV_KEY; | 79 | unsigned int type = button->type ?: EV_KEY; |
80 | 80 | ||
81 | error = gpio_request(button->gpio, button->desc ?: "gpio_keys"); | ||
82 | if (error < 0) { | ||
83 | pr_err("gpio-keys: failed to request GPIO %d," | ||
84 | " error %d\n", button->gpio, error); | ||
85 | goto fail; | ||
86 | } | ||
87 | |||
88 | error = gpio_direction_input(button->gpio); | ||
89 | if (error < 0) { | ||
90 | pr_err("gpio-keys: failed to configure input" | ||
91 | " direction for GPIO %d, error %d\n", | ||
92 | button->gpio, error); | ||
93 | gpio_free(button->gpio); | ||
94 | goto fail; | ||
95 | } | ||
96 | |||
97 | irq = gpio_to_irq(button->gpio); | ||
81 | if (irq < 0) { | 98 | if (irq < 0) { |
82 | error = irq; | 99 | error = irq; |
83 | printk(KERN_ERR | 100 | pr_err("gpio-keys: Unable to get irq number" |
84 | "gpio-keys: " | 101 | " for GPIO %d, error %d\n", |
85 | "Unable to get irq number for GPIO %d," | ||
86 | "error %d\n", | ||
87 | button->gpio, error); | 102 | button->gpio, error); |
103 | gpio_free(button->gpio); | ||
88 | goto fail; | 104 | goto fail; |
89 | } | 105 | } |
90 | 106 | ||
@@ -94,9 +110,9 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
94 | button->desc ? button->desc : "gpio_keys", | 110 | button->desc ? button->desc : "gpio_keys", |
95 | pdev); | 111 | pdev); |
96 | if (error) { | 112 | if (error) { |
97 | printk(KERN_ERR | 113 | pr_err("gpio-keys: Unable to claim irq %d; error %d\n", |
98 | "gpio-keys: Unable to claim irq %d; error %d\n", | ||
99 | irq, error); | 114 | irq, error); |
115 | gpio_free(button->gpio); | ||
100 | goto fail; | 116 | goto fail; |
101 | } | 117 | } |
102 | 118 | ||
@@ -108,8 +124,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
108 | 124 | ||
109 | error = input_register_device(input); | 125 | error = input_register_device(input); |
110 | if (error) { | 126 | if (error) { |
111 | printk(KERN_ERR | 127 | pr_err("gpio-keys: Unable to register input device, " |
112 | "gpio-keys: Unable to register input device, " | ||
113 | "error: %d\n", error); | 128 | "error: %d\n", error); |
114 | goto fail; | 129 | goto fail; |
115 | } | 130 | } |
@@ -119,8 +134,10 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev) | |||
119 | return 0; | 134 | return 0; |
120 | 135 | ||
121 | fail: | 136 | fail: |
122 | while (--i >= 0) | 137 | while (--i >= 0) { |
123 | free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev); | 138 | free_irq(gpio_to_irq(pdata->buttons[i].gpio), pdev); |
139 | gpio_free(pdata->buttons[i].gpio); | ||
140 | } | ||
124 | 141 | ||
125 | platform_set_drvdata(pdev, NULL); | 142 | platform_set_drvdata(pdev, NULL); |
126 | input_free_device(input); | 143 | input_free_device(input); |
@@ -139,6 +156,7 @@ static int __devexit gpio_keys_remove(struct platform_device *pdev) | |||
139 | for (i = 0; i < pdata->nbuttons; i++) { | 156 | for (i = 0; i < pdata->nbuttons; i++) { |
140 | int irq = gpio_to_irq(pdata->buttons[i].gpio); | 157 | int irq = gpio_to_irq(pdata->buttons[i].gpio); |
141 | free_irq(irq, pdev); | 158 | free_irq(irq, pdev); |
159 | gpio_free(pdata->buttons[i].gpio); | ||
142 | } | 160 | } |
143 | 161 | ||
144 | input_unregister_device(input); | 162 | input_unregister_device(input); |
diff --git a/drivers/input/serio/Kconfig b/drivers/input/serio/Kconfig index 5ce632ca6815..b88569e21d60 100644 --- a/drivers/input/serio/Kconfig +++ b/drivers/input/serio/Kconfig | |||
@@ -21,7 +21,7 @@ if SERIO | |||
21 | config SERIO_I8042 | 21 | config SERIO_I8042 |
22 | tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86 | 22 | tristate "i8042 PC Keyboard controller" if EMBEDDED || !X86 |
23 | default y | 23 | default y |
24 | depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && !M68K && !BFIN | 24 | depends on !PARISC && (!ARM || ARCH_SHARK || FOOTBRIDGE_HOST) && !M68K && !BLACKFIN |
25 | ---help--- | 25 | ---help--- |
26 | i8042 is the chip over which the standard AT keyboard and PS/2 | 26 | i8042 is the chip over which the standard AT keyboard and PS/2 |
27 | mouse are connected to the computer. If you use these devices, | 27 | mouse are connected to the computer. If you use these devices, |
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h index f8fe42148093..c5e68dcd88ac 100644 --- a/drivers/input/serio/i8042-x86ia64io.h +++ b/drivers/input/serio/i8042-x86ia64io.h | |||
@@ -110,6 +110,14 @@ static struct dmi_system_id __initdata i8042_dmi_noloop_table[] = { | |||
110 | DMI_MATCH(DMI_PRODUCT_VERSION, "5a"), | 110 | DMI_MATCH(DMI_PRODUCT_VERSION, "5a"), |
111 | }, | 111 | }, |
112 | }, | 112 | }, |
113 | { | ||
114 | .ident = "Microsoft Virtual Machine", | ||
115 | .matches = { | ||
116 | DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"), | ||
117 | DMI_MATCH(DMI_PRODUCT_NAME, "Virtual Machine"), | ||
118 | DMI_MATCH(DMI_PRODUCT_VERSION, "VS2005R2"), | ||
119 | }, | ||
120 | }, | ||
113 | { } | 121 | { } |
114 | }; | 122 | }; |
115 | 123 | ||
diff --git a/drivers/isdn/hisax/hfcscard.c b/drivers/isdn/hisax/hfcscard.c index 57670dc5034d..909d6709ec16 100644 --- a/drivers/isdn/hisax/hfcscard.c +++ b/drivers/isdn/hisax/hfcscard.c | |||
@@ -118,8 +118,7 @@ hfcs_card_msg(struct IsdnCardState *cs, int mt, void *arg) | |||
118 | return(0); | 118 | return(0); |
119 | case CARD_INIT: | 119 | case CARD_INIT: |
120 | delay = (75*HZ)/100 +1; | 120 | delay = (75*HZ)/100 +1; |
121 | cs->hw.hfcD.timer.expires = jiffies + delay; | 121 | mod_timer(&cs->hw.hfcD.timer, jiffies + delay); |
122 | add_timer(&cs->hw.hfcD.timer); | ||
123 | spin_lock_irqsave(&cs->lock, flags); | 122 | spin_lock_irqsave(&cs->lock, flags); |
124 | reset_hfcs(cs); | 123 | reset_hfcs(cs); |
125 | init2bds0(cs); | 124 | init2bds0(cs); |
diff --git a/drivers/isdn/i4l/isdn_net.c b/drivers/isdn/i4l/isdn_net.c index b39d1f5b378e..ced83c202cac 100644 --- a/drivers/isdn/i4l/isdn_net.c +++ b/drivers/isdn/i4l/isdn_net.c | |||
@@ -2104,7 +2104,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup) | |||
2104 | u_long flags; | 2104 | u_long flags; |
2105 | isdn_net_dev *p; | 2105 | isdn_net_dev *p; |
2106 | isdn_net_phone *n; | 2106 | isdn_net_phone *n; |
2107 | char nr[32]; | 2107 | char nr[ISDN_MSNLEN]; |
2108 | char *my_eaz; | 2108 | char *my_eaz; |
2109 | 2109 | ||
2110 | /* Search name in netdev-chain */ | 2110 | /* Search name in netdev-chain */ |
@@ -2113,7 +2113,7 @@ isdn_net_find_icall(int di, int ch, int idx, setup_parm *setup) | |||
2113 | nr[1] = '\0'; | 2113 | nr[1] = '\0'; |
2114 | printk(KERN_INFO "isdn_net: Incoming call without OAD, assuming '0'\n"); | 2114 | printk(KERN_INFO "isdn_net: Incoming call without OAD, assuming '0'\n"); |
2115 | } else | 2115 | } else |
2116 | strcpy(nr, setup->phone); | 2116 | strlcpy(nr, setup->phone, ISDN_MSNLEN); |
2117 | si1 = (int) setup->si1; | 2117 | si1 = (int) setup->si1; |
2118 | si2 = (int) setup->si2; | 2118 | si2 = (int) setup->si2; |
2119 | if (!setup->eazmsn[0]) { | 2119 | if (!setup->eazmsn[0]) { |
@@ -2789,7 +2789,7 @@ isdn_net_setcfg(isdn_net_ioctl_cfg * cfg) | |||
2789 | chidx = -1; | 2789 | chidx = -1; |
2790 | } | 2790 | } |
2791 | } | 2791 | } |
2792 | strcpy(lp->msn, cfg->eaz); | 2792 | strlcpy(lp->msn, cfg->eaz, sizeof(lp->msn)); |
2793 | lp->pre_device = drvidx; | 2793 | lp->pre_device = drvidx; |
2794 | lp->pre_channel = chidx; | 2794 | lp->pre_channel = chidx; |
2795 | lp->onhtime = cfg->onhtime; | 2795 | lp->onhtime = cfg->onhtime; |
@@ -2936,7 +2936,7 @@ isdn_net_addphone(isdn_net_ioctl_phone * phone) | |||
2936 | if (p) { | 2936 | if (p) { |
2937 | if (!(n = kmalloc(sizeof(isdn_net_phone), GFP_KERNEL))) | 2937 | if (!(n = kmalloc(sizeof(isdn_net_phone), GFP_KERNEL))) |
2938 | return -ENOMEM; | 2938 | return -ENOMEM; |
2939 | strcpy(n->num, phone->phone); | 2939 | strlcpy(n->num, phone->phone, sizeof(n->num)); |
2940 | n->next = p->local->phone[phone->outgoing & 1]; | 2940 | n->next = p->local->phone[phone->outgoing & 1]; |
2941 | p->local->phone[phone->outgoing & 1] = n; | 2941 | p->local->phone[phone->outgoing & 1] = n; |
2942 | return 0; | 2942 | return 0; |
diff --git a/drivers/kvm/kvm_main.c b/drivers/kvm/kvm_main.c index 07ae280e8fe5..47c10b8f89b3 100644 --- a/drivers/kvm/kvm_main.c +++ b/drivers/kvm/kvm_main.c | |||
@@ -1188,8 +1188,7 @@ int emulate_invlpg(struct kvm_vcpu *vcpu, gva_t address) | |||
1188 | 1188 | ||
1189 | int emulate_clts(struct kvm_vcpu *vcpu) | 1189 | int emulate_clts(struct kvm_vcpu *vcpu) |
1190 | { | 1190 | { |
1191 | vcpu->cr0 &= ~X86_CR0_TS; | 1191 | kvm_x86_ops->set_cr0(vcpu, vcpu->cr0 & ~X86_CR0_TS); |
1192 | kvm_x86_ops->set_cr0(vcpu, vcpu->cr0); | ||
1193 | return X86EMUL_CONTINUE; | 1192 | return X86EMUL_CONTINUE; |
1194 | } | 1193 | } |
1195 | 1194 | ||
diff --git a/drivers/kvm/svm.c b/drivers/kvm/svm.c index 7a6eead63a6b..4e04e49a2f1c 100644 --- a/drivers/kvm/svm.c +++ b/drivers/kvm/svm.c | |||
@@ -663,6 +663,7 @@ static void svm_vcpu_put(struct kvm_vcpu *vcpu) | |||
663 | wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]); | 663 | wrmsrl(host_save_user_msrs[i], svm->host_user_msrs[i]); |
664 | 664 | ||
665 | rdtscll(vcpu->host_tsc); | 665 | rdtscll(vcpu->host_tsc); |
666 | kvm_put_guest_fpu(vcpu); | ||
666 | } | 667 | } |
667 | 668 | ||
668 | static void svm_vcpu_decache(struct kvm_vcpu *vcpu) | 669 | static void svm_vcpu_decache(struct kvm_vcpu *vcpu) |
diff --git a/drivers/kvm/x86_emulate.c b/drivers/kvm/x86_emulate.c index 33b181451557..bd46de6bf891 100644 --- a/drivers/kvm/x86_emulate.c +++ b/drivers/kvm/x86_emulate.c | |||
@@ -448,8 +448,7 @@ struct operand { | |||
448 | 448 | ||
449 | #define JMP_REL(rel) \ | 449 | #define JMP_REL(rel) \ |
450 | do { \ | 450 | do { \ |
451 | _eip += (int)(rel); \ | 451 | register_address_increment(_eip, rel); \ |
452 | _eip = ((op_bytes == 2) ? (uint16_t)_eip : (uint32_t)_eip); \ | ||
453 | } while (0) | 452 | } while (0) |
454 | 453 | ||
455 | /* | 454 | /* |
@@ -1147,7 +1146,7 @@ done_prefixes: | |||
1147 | } | 1146 | } |
1148 | register_address_increment(_regs[VCPU_REGS_RSP], | 1147 | register_address_increment(_regs[VCPU_REGS_RSP], |
1149 | -dst.bytes); | 1148 | -dst.bytes); |
1150 | if ((rc = ops->write_std( | 1149 | if ((rc = ops->write_emulated( |
1151 | register_address(ctxt->ss_base, | 1150 | register_address(ctxt->ss_base, |
1152 | _regs[VCPU_REGS_RSP]), | 1151 | _regs[VCPU_REGS_RSP]), |
1153 | &dst.val, dst.bytes, ctxt->vcpu)) != 0) | 1152 | &dst.val, dst.bytes, ctxt->vcpu)) != 0) |
@@ -1359,6 +1358,7 @@ special_insn: | |||
1359 | } | 1358 | } |
1360 | src.val = (unsigned long) _eip; | 1359 | src.val = (unsigned long) _eip; |
1361 | JMP_REL(rel); | 1360 | JMP_REL(rel); |
1361 | op_bytes = ad_bytes; | ||
1362 | goto push; | 1362 | goto push; |
1363 | } | 1363 | } |
1364 | case 0xe9: /* jmp rel */ | 1364 | case 0xe9: /* jmp rel */ |
diff --git a/drivers/lguest/lguest_device.c b/drivers/lguest/lguest_device.c index 66f38722253a..e2eec38c83c2 100644 --- a/drivers/lguest/lguest_device.c +++ b/drivers/lguest/lguest_device.c | |||
@@ -247,6 +247,8 @@ static void lg_del_vq(struct virtqueue *vq) | |||
247 | { | 247 | { |
248 | struct lguest_vq_info *lvq = vq->priv; | 248 | struct lguest_vq_info *lvq = vq->priv; |
249 | 249 | ||
250 | /* Release the interrupt */ | ||
251 | free_irq(lvq->config.irq, vq); | ||
250 | /* Tell virtio_ring.c to free the virtqueue. */ | 252 | /* Tell virtio_ring.c to free the virtqueue. */ |
251 | vring_del_virtqueue(vq); | 253 | vring_del_virtqueue(vq); |
252 | /* Unmap the pages containing the ring. */ | 254 | /* Unmap the pages containing the ring. */ |
diff --git a/drivers/mfd/sm501.c b/drivers/mfd/sm501.c index 8135e4c3bf47..afd82966f9a0 100644 --- a/drivers/mfd/sm501.c +++ b/drivers/mfd/sm501.c | |||
@@ -156,7 +156,7 @@ static void sm501_dump_clk(struct sm501_devdata *sm) | |||
156 | 156 | ||
157 | dev_dbg(sm->dev, "PM0[%c]: " | 157 | dev_dbg(sm->dev, "PM0[%c]: " |
158 | "P2 %ld.%ld MHz (%ld), V2 %ld.%ld (%ld), " | 158 | "P2 %ld.%ld MHz (%ld), V2 %ld.%ld (%ld), " |
159 | x "M %ld.%ld (%ld), MX1 %ld.%ld (%ld)\n", | 159 | "M %ld.%ld (%ld), MX1 %ld.%ld (%ld)\n", |
160 | (pmc & 3 ) == 0 ? '*' : '-', | 160 | (pmc & 3 ) == 0 ? '*' : '-', |
161 | fmt_freq(decode_div(pll2, pm0, 24, 1<<29, 31, px_div)), | 161 | fmt_freq(decode_div(pll2, pm0, 24, 1<<29, 31, px_div)), |
162 | fmt_freq(decode_div(pll2, pm0, 16, 1<<20, 15, misc_div)), | 162 | fmt_freq(decode_div(pll2, pm0, 16, 1<<20, 15, misc_div)), |
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c index bb13858f60a1..b0f68031b49d 100644 --- a/drivers/misc/sony-laptop.c +++ b/drivers/misc/sony-laptop.c | |||
@@ -338,7 +338,7 @@ static void sony_laptop_report_input_event(u8 event) | |||
338 | dprintk("unknown input event %.2x\n", event); | 338 | dprintk("unknown input event %.2x\n", event); |
339 | } | 339 | } |
340 | 340 | ||
341 | static int sony_laptop_setup_input(void) | 341 | static int sony_laptop_setup_input(struct acpi_device *acpi_device) |
342 | { | 342 | { |
343 | struct input_dev *jog_dev; | 343 | struct input_dev *jog_dev; |
344 | struct input_dev *key_dev; | 344 | struct input_dev *key_dev; |
@@ -379,6 +379,7 @@ static int sony_laptop_setup_input(void) | |||
379 | key_dev->name = "Sony Vaio Keys"; | 379 | key_dev->name = "Sony Vaio Keys"; |
380 | key_dev->id.bustype = BUS_ISA; | 380 | key_dev->id.bustype = BUS_ISA; |
381 | key_dev->id.vendor = PCI_VENDOR_ID_SONY; | 381 | key_dev->id.vendor = PCI_VENDOR_ID_SONY; |
382 | key_dev->dev.parent = &acpi_device->dev; | ||
382 | 383 | ||
383 | /* Initialize the Input Drivers: special keys */ | 384 | /* Initialize the Input Drivers: special keys */ |
384 | set_bit(EV_KEY, key_dev->evbit); | 385 | set_bit(EV_KEY, key_dev->evbit); |
@@ -410,6 +411,7 @@ static int sony_laptop_setup_input(void) | |||
410 | jog_dev->name = "Sony Vaio Jogdial"; | 411 | jog_dev->name = "Sony Vaio Jogdial"; |
411 | jog_dev->id.bustype = BUS_ISA; | 412 | jog_dev->id.bustype = BUS_ISA; |
412 | jog_dev->id.vendor = PCI_VENDOR_ID_SONY; | 413 | jog_dev->id.vendor = PCI_VENDOR_ID_SONY; |
414 | key_dev->dev.parent = &acpi_device->dev; | ||
413 | 415 | ||
414 | jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); | 416 | jog_dev->evbit[0] = BIT_MASK(EV_KEY) | BIT_MASK(EV_REL); |
415 | jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE); | 417 | jog_dev->keybit[BIT_WORD(BTN_MOUSE)] = BIT_MASK(BTN_MIDDLE); |
@@ -1006,7 +1008,7 @@ static int sony_nc_add(struct acpi_device *device) | |||
1006 | } | 1008 | } |
1007 | 1009 | ||
1008 | /* setup input devices and helper fifo */ | 1010 | /* setup input devices and helper fifo */ |
1009 | result = sony_laptop_setup_input(); | 1011 | result = sony_laptop_setup_input(device); |
1010 | if (result) { | 1012 | if (result) { |
1011 | printk(KERN_ERR DRV_PFX | 1013 | printk(KERN_ERR DRV_PFX |
1012 | "Unabe to create input devices.\n"); | 1014 | "Unabe to create input devices.\n"); |
@@ -1034,7 +1036,7 @@ static int sony_nc_add(struct acpi_device *device) | |||
1034 | sony_backlight_device->props.brightness = | 1036 | sony_backlight_device->props.brightness = |
1035 | sony_backlight_get_brightness | 1037 | sony_backlight_get_brightness |
1036 | (sony_backlight_device); | 1038 | (sony_backlight_device); |
1037 | sony_backlight_device->props.max_brightness = | 1039 | sony_backlight_device->props.max_brightness = |
1038 | SONY_MAX_BRIGHTNESS - 1; | 1040 | SONY_MAX_BRIGHTNESS - 1; |
1039 | } | 1041 | } |
1040 | 1042 | ||
@@ -2453,7 +2455,7 @@ static int sony_pic_add(struct acpi_device *device) | |||
2453 | } | 2455 | } |
2454 | 2456 | ||
2455 | /* setup input devices and helper fifo */ | 2457 | /* setup input devices and helper fifo */ |
2456 | result = sony_laptop_setup_input(); | 2458 | result = sony_laptop_setup_input(device); |
2457 | if (result) { | 2459 | if (result) { |
2458 | printk(KERN_ERR DRV_PFX | 2460 | printk(KERN_ERR DRV_PFX |
2459 | "Unabe to create input devices.\n"); | 2461 | "Unabe to create input devices.\n"); |
diff --git a/drivers/misc/thinkpad_acpi.c b/drivers/misc/thinkpad_acpi.c index e953276664a0..ab23a3221585 100644 --- a/drivers/misc/thinkpad_acpi.c +++ b/drivers/misc/thinkpad_acpi.c | |||
@@ -21,7 +21,7 @@ | |||
21 | * 02110-1301, USA. | 21 | * 02110-1301, USA. |
22 | */ | 22 | */ |
23 | 23 | ||
24 | #define IBM_VERSION "0.16" | 24 | #define IBM_VERSION "0.17" |
25 | #define TPACPI_SYSFS_VERSION 0x020000 | 25 | #define TPACPI_SYSFS_VERSION 0x020000 |
26 | 26 | ||
27 | /* | 27 | /* |
@@ -964,15 +964,15 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
964 | KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */ | 964 | KEY_UNKNOWN, /* 0x0C: FN+BACKSPACE */ |
965 | KEY_UNKNOWN, /* 0x0D: FN+INSERT */ | 965 | KEY_UNKNOWN, /* 0x0D: FN+INSERT */ |
966 | KEY_UNKNOWN, /* 0x0E: FN+DELETE */ | 966 | KEY_UNKNOWN, /* 0x0E: FN+DELETE */ |
967 | KEY_BRIGHTNESSUP, /* 0x0F: FN+HOME (brightness up) */ | 967 | KEY_RESERVED, /* 0x0F: FN+HOME (brightness up) */ |
968 | /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */ | 968 | /* Scan codes 0x10 to 0x1F: Extended ACPI HKEY hot keys */ |
969 | KEY_BRIGHTNESSDOWN, /* 0x10: FN+END (brightness down) */ | 969 | KEY_RESERVED, /* 0x10: FN+END (brightness down) */ |
970 | KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ | 970 | KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ |
971 | KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ | 971 | KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ |
972 | KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ | 972 | KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ |
973 | KEY_VOLUMEUP, /* 0x14: VOLUME UP */ | 973 | KEY_RESERVED, /* 0x14: VOLUME UP */ |
974 | KEY_VOLUMEDOWN, /* 0x15: VOLUME DOWN */ | 974 | KEY_RESERVED, /* 0x15: VOLUME DOWN */ |
975 | KEY_MUTE, /* 0x16: MUTE */ | 975 | KEY_RESERVED, /* 0x16: MUTE */ |
976 | KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ | 976 | KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ |
977 | /* (assignments unknown, please report if found) */ | 977 | /* (assignments unknown, please report if found) */ |
978 | KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, | 978 | KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, |
@@ -993,9 +993,9 @@ static int __init hotkey_init(struct ibm_init_struct *iibm) | |||
993 | KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ | 993 | KEY_RESERVED, /* 0x11: FN+PGUP (thinklight toggle) */ |
994 | KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ | 994 | KEY_UNKNOWN, /* 0x12: FN+PGDOWN */ |
995 | KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ | 995 | KEY_ZOOM, /* 0x13: FN+SPACE (zoom) */ |
996 | KEY_VOLUMEUP, /* 0x14: VOLUME UP */ | 996 | KEY_RESERVED, /* 0x14: VOLUME UP */ |
997 | KEY_VOLUMEDOWN, /* 0x15: VOLUME DOWN */ | 997 | KEY_RESERVED, /* 0x15: VOLUME DOWN */ |
998 | KEY_MUTE, /* 0x16: MUTE */ | 998 | KEY_RESERVED, /* 0x16: MUTE */ |
999 | KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ | 999 | KEY_VENDOR, /* 0x17: Thinkpad/AccessIBM/Lenovo */ |
1000 | /* (assignments unknown, please report if found) */ | 1000 | /* (assignments unknown, please report if found) */ |
1001 | KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, | 1001 | KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, KEY_UNKNOWN, |
@@ -1342,9 +1342,8 @@ static int hotkey_read(char *p) | |||
1342 | return len; | 1342 | return len; |
1343 | } | 1343 | } |
1344 | 1344 | ||
1345 | res = mutex_lock_interruptible(&hotkey_mutex); | 1345 | if (mutex_lock_interruptible(&hotkey_mutex)) |
1346 | if (res < 0) | 1346 | return -ERESTARTSYS; |
1347 | return res; | ||
1348 | res = hotkey_get(&status, &mask); | 1347 | res = hotkey_get(&status, &mask); |
1349 | mutex_unlock(&hotkey_mutex); | 1348 | mutex_unlock(&hotkey_mutex); |
1350 | if (res) | 1349 | if (res) |
@@ -1373,9 +1372,8 @@ static int hotkey_write(char *buf) | |||
1373 | if (!tp_features.hotkey) | 1372 | if (!tp_features.hotkey) |
1374 | return -ENODEV; | 1373 | return -ENODEV; |
1375 | 1374 | ||
1376 | res = mutex_lock_interruptible(&hotkey_mutex); | 1375 | if (mutex_lock_interruptible(&hotkey_mutex)) |
1377 | if (res < 0) | 1376 | return -ERESTARTSYS; |
1378 | return res; | ||
1379 | 1377 | ||
1380 | res = hotkey_get(&status, &mask); | 1378 | res = hotkey_get(&status, &mask); |
1381 | if (res) | 1379 | if (res) |
@@ -3114,6 +3112,99 @@ static struct backlight_ops ibm_backlight_data = { | |||
3114 | 3112 | ||
3115 | static struct mutex brightness_mutex; | 3113 | static struct mutex brightness_mutex; |
3116 | 3114 | ||
3115 | static int __init tpacpi_query_bcll_levels(acpi_handle handle) | ||
3116 | { | ||
3117 | struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; | ||
3118 | union acpi_object *obj; | ||
3119 | int rc; | ||
3120 | |||
3121 | if (ACPI_SUCCESS(acpi_evaluate_object(handle, NULL, NULL, &buffer))) { | ||
3122 | obj = (union acpi_object *)buffer.pointer; | ||
3123 | if (!obj || (obj->type != ACPI_TYPE_PACKAGE)) { | ||
3124 | printk(IBM_ERR "Unknown BCLL data, " | ||
3125 | "please report this to %s\n", IBM_MAIL); | ||
3126 | rc = 0; | ||
3127 | } else { | ||
3128 | rc = obj->package.count; | ||
3129 | } | ||
3130 | } else { | ||
3131 | return 0; | ||
3132 | } | ||
3133 | |||
3134 | kfree(buffer.pointer); | ||
3135 | return rc; | ||
3136 | } | ||
3137 | |||
3138 | static acpi_status __init brightness_find_bcll(acpi_handle handle, u32 lvl, | ||
3139 | void *context, void **rv) | ||
3140 | { | ||
3141 | char name[ACPI_PATH_SEGMENT_LENGTH]; | ||
3142 | struct acpi_buffer buffer = { sizeof(name), &name }; | ||
3143 | |||
3144 | if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) && | ||
3145 | !strncmp("BCLL", name, sizeof(name) - 1)) { | ||
3146 | if (tpacpi_query_bcll_levels(handle) == 16) { | ||
3147 | *rv = handle; | ||
3148 | return AE_CTRL_TERMINATE; | ||
3149 | } else { | ||
3150 | return AE_OK; | ||
3151 | } | ||
3152 | } else { | ||
3153 | return AE_OK; | ||
3154 | } | ||
3155 | } | ||
3156 | |||
3157 | static int __init brightness_check_levels(void) | ||
3158 | { | ||
3159 | int status; | ||
3160 | void *found_node = NULL; | ||
3161 | |||
3162 | if (!vid_handle) { | ||
3163 | IBM_ACPIHANDLE_INIT(vid); | ||
3164 | } | ||
3165 | if (!vid_handle) | ||
3166 | return 0; | ||
3167 | |||
3168 | /* Search for a BCLL package with 16 levels */ | ||
3169 | status = acpi_walk_namespace(ACPI_TYPE_PACKAGE, vid_handle, 3, | ||
3170 | brightness_find_bcll, NULL, &found_node); | ||
3171 | |||
3172 | return (ACPI_SUCCESS(status) && found_node != NULL); | ||
3173 | } | ||
3174 | |||
3175 | static acpi_status __init brightness_find_bcl(acpi_handle handle, u32 lvl, | ||
3176 | void *context, void **rv) | ||
3177 | { | ||
3178 | char name[ACPI_PATH_SEGMENT_LENGTH]; | ||
3179 | struct acpi_buffer buffer = { sizeof(name), &name }; | ||
3180 | |||
3181 | if (ACPI_SUCCESS(acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer)) && | ||
3182 | !strncmp("_BCL", name, sizeof(name) - 1)) { | ||
3183 | *rv = handle; | ||
3184 | return AE_CTRL_TERMINATE; | ||
3185 | } else { | ||
3186 | return AE_OK; | ||
3187 | } | ||
3188 | } | ||
3189 | |||
3190 | static int __init brightness_check_std_acpi_support(void) | ||
3191 | { | ||
3192 | int status; | ||
3193 | void *found_node = NULL; | ||
3194 | |||
3195 | if (!vid_handle) { | ||
3196 | IBM_ACPIHANDLE_INIT(vid); | ||
3197 | } | ||
3198 | if (!vid_handle) | ||
3199 | return 0; | ||
3200 | |||
3201 | /* Search for a _BCL method, but don't execute it */ | ||
3202 | status = acpi_walk_namespace(ACPI_TYPE_METHOD, vid_handle, 3, | ||
3203 | brightness_find_bcl, NULL, &found_node); | ||
3204 | |||
3205 | return (ACPI_SUCCESS(status) && found_node != NULL); | ||
3206 | } | ||
3207 | |||
3117 | static int __init brightness_init(struct ibm_init_struct *iibm) | 3208 | static int __init brightness_init(struct ibm_init_struct *iibm) |
3118 | { | 3209 | { |
3119 | int b; | 3210 | int b; |
@@ -3122,6 +3213,18 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
3122 | 3213 | ||
3123 | mutex_init(&brightness_mutex); | 3214 | mutex_init(&brightness_mutex); |
3124 | 3215 | ||
3216 | if (!brightness_enable) { | ||
3217 | dbg_printk(TPACPI_DBG_INIT, | ||
3218 | "brightness support disabled by module parameter\n"); | ||
3219 | return 1; | ||
3220 | } else if (brightness_enable > 1) { | ||
3221 | if (brightness_check_std_acpi_support()) { | ||
3222 | printk(IBM_NOTICE | ||
3223 | "standard ACPI backlight interface available, not loading native one...\n"); | ||
3224 | return 1; | ||
3225 | } | ||
3226 | } | ||
3227 | |||
3125 | if (!brightness_mode) { | 3228 | if (!brightness_mode) { |
3126 | if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) | 3229 | if (thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO) |
3127 | brightness_mode = 2; | 3230 | brightness_mode = 2; |
@@ -3135,10 +3238,17 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
3135 | if (brightness_mode > 3) | 3238 | if (brightness_mode > 3) |
3136 | return -EINVAL; | 3239 | return -EINVAL; |
3137 | 3240 | ||
3241 | tp_features.bright_16levels = | ||
3242 | thinkpad_id.vendor == PCI_VENDOR_ID_LENOVO && | ||
3243 | brightness_check_levels(); | ||
3244 | |||
3138 | b = brightness_get(NULL); | 3245 | b = brightness_get(NULL); |
3139 | if (b < 0) | 3246 | if (b < 0) |
3140 | return 1; | 3247 | return 1; |
3141 | 3248 | ||
3249 | if (tp_features.bright_16levels) | ||
3250 | printk(IBM_INFO "detected a 16-level brightness capable ThinkPad\n"); | ||
3251 | |||
3142 | ibm_backlight_device = backlight_device_register( | 3252 | ibm_backlight_device = backlight_device_register( |
3143 | TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, | 3253 | TPACPI_BACKLIGHT_DEV_NAME, NULL, NULL, |
3144 | &ibm_backlight_data); | 3254 | &ibm_backlight_data); |
@@ -3148,7 +3258,8 @@ static int __init brightness_init(struct ibm_init_struct *iibm) | |||
3148 | } | 3258 | } |
3149 | vdbg_printk(TPACPI_DBG_INIT, "brightness is supported\n"); | 3259 | vdbg_printk(TPACPI_DBG_INIT, "brightness is supported\n"); |
3150 | 3260 | ||
3151 | ibm_backlight_device->props.max_brightness = 7; | 3261 | ibm_backlight_device->props.max_brightness = |
3262 | (tp_features.bright_16levels)? 15 : 7; | ||
3152 | ibm_backlight_device->props.brightness = b; | 3263 | ibm_backlight_device->props.brightness = b; |
3153 | backlight_update_status(ibm_backlight_device); | 3264 | backlight_update_status(ibm_backlight_device); |
3154 | 3265 | ||
@@ -3167,6 +3278,8 @@ static void brightness_exit(void) | |||
3167 | 3278 | ||
3168 | static int brightness_update_status(struct backlight_device *bd) | 3279 | static int brightness_update_status(struct backlight_device *bd) |
3169 | { | 3280 | { |
3281 | /* it is the backlight class's job (caller) to handle | ||
3282 | * EINTR and other errors properly */ | ||
3170 | return brightness_set( | 3283 | return brightness_set( |
3171 | (bd->props.fb_blank == FB_BLANK_UNBLANK && | 3284 | (bd->props.fb_blank == FB_BLANK_UNBLANK && |
3172 | bd->props.power == FB_BLANK_UNBLANK) ? | 3285 | bd->props.power == FB_BLANK_UNBLANK) ? |
@@ -3184,13 +3297,14 @@ static int brightness_get(struct backlight_device *bd) | |||
3184 | if (brightness_mode & 1) { | 3297 | if (brightness_mode & 1) { |
3185 | if (!acpi_ec_read(brightness_offset, &lec)) | 3298 | if (!acpi_ec_read(brightness_offset, &lec)) |
3186 | return -EIO; | 3299 | return -EIO; |
3187 | lec &= 7; | 3300 | lec &= (tp_features.bright_16levels)? 0x0f : 0x07; |
3188 | level = lec; | 3301 | level = lec; |
3189 | }; | 3302 | }; |
3190 | if (brightness_mode & 2) { | 3303 | if (brightness_mode & 2) { |
3191 | lcmos = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS) | 3304 | lcmos = (nvram_read_byte(TP_NVRAM_ADDR_BRIGHTNESS) |
3192 | & TP_NVRAM_MASK_LEVEL_BRIGHTNESS) | 3305 | & TP_NVRAM_MASK_LEVEL_BRIGHTNESS) |
3193 | >> TP_NVRAM_POS_LEVEL_BRIGHTNESS; | 3306 | >> TP_NVRAM_POS_LEVEL_BRIGHTNESS; |
3307 | lcmos &= (tp_features.bright_16levels)? 0x0f : 0x07; | ||
3194 | level = lcmos; | 3308 | level = lcmos; |
3195 | } | 3309 | } |
3196 | 3310 | ||
@@ -3206,12 +3320,13 @@ static int brightness_get(struct backlight_device *bd) | |||
3206 | return level; | 3320 | return level; |
3207 | } | 3321 | } |
3208 | 3322 | ||
3323 | /* May return EINTR which can always be mapped to ERESTARTSYS */ | ||
3209 | static int brightness_set(int value) | 3324 | static int brightness_set(int value) |
3210 | { | 3325 | { |
3211 | int cmos_cmd, inc, i, res; | 3326 | int cmos_cmd, inc, i, res; |
3212 | int current_value; | 3327 | int current_value; |
3213 | 3328 | ||
3214 | if (value > 7) | 3329 | if (value > ((tp_features.bright_16levels)? 15 : 7)) |
3215 | return -EINVAL; | 3330 | return -EINVAL; |
3216 | 3331 | ||
3217 | res = mutex_lock_interruptible(&brightness_mutex); | 3332 | res = mutex_lock_interruptible(&brightness_mutex); |
@@ -3227,7 +3342,7 @@ static int brightness_set(int value) | |||
3227 | cmos_cmd = value > current_value ? | 3342 | cmos_cmd = value > current_value ? |
3228 | TP_CMOS_BRIGHTNESS_UP : | 3343 | TP_CMOS_BRIGHTNESS_UP : |
3229 | TP_CMOS_BRIGHTNESS_DOWN; | 3344 | TP_CMOS_BRIGHTNESS_DOWN; |
3230 | inc = value > current_value ? 1 : -1; | 3345 | inc = (value > current_value)? 1 : -1; |
3231 | 3346 | ||
3232 | res = 0; | 3347 | res = 0; |
3233 | for (i = current_value; i != value; i += inc) { | 3348 | for (i = current_value; i != value; i += inc) { |
@@ -3256,10 +3371,11 @@ static int brightness_read(char *p) | |||
3256 | if ((level = brightness_get(NULL)) < 0) { | 3371 | if ((level = brightness_get(NULL)) < 0) { |
3257 | len += sprintf(p + len, "level:\t\tunreadable\n"); | 3372 | len += sprintf(p + len, "level:\t\tunreadable\n"); |
3258 | } else { | 3373 | } else { |
3259 | len += sprintf(p + len, "level:\t\t%d\n", level & 0x7); | 3374 | len += sprintf(p + len, "level:\t\t%d\n", level); |
3260 | len += sprintf(p + len, "commands:\tup, down\n"); | 3375 | len += sprintf(p + len, "commands:\tup, down\n"); |
3261 | len += sprintf(p + len, "commands:\tlevel <level>" | 3376 | len += sprintf(p + len, "commands:\tlevel <level>" |
3262 | " (<level> is 0-7)\n"); | 3377 | " (<level> is 0-%d)\n", |
3378 | (tp_features.bright_16levels) ? 15 : 7); | ||
3263 | } | 3379 | } |
3264 | 3380 | ||
3265 | return len; | 3381 | return len; |
@@ -3268,28 +3384,34 @@ static int brightness_read(char *p) | |||
3268 | static int brightness_write(char *buf) | 3384 | static int brightness_write(char *buf) |
3269 | { | 3385 | { |
3270 | int level; | 3386 | int level; |
3271 | int new_level; | 3387 | int rc; |
3272 | char *cmd; | 3388 | char *cmd; |
3389 | int max_level = (tp_features.bright_16levels) ? 15 : 7; | ||
3273 | 3390 | ||
3274 | while ((cmd = next_cmd(&buf))) { | 3391 | level = brightness_get(NULL); |
3275 | if ((level = brightness_get(NULL)) < 0) | 3392 | if (level < 0) |
3276 | return level; | 3393 | return level; |
3277 | level &= 7; | ||
3278 | 3394 | ||
3395 | while ((cmd = next_cmd(&buf))) { | ||
3279 | if (strlencmp(cmd, "up") == 0) { | 3396 | if (strlencmp(cmd, "up") == 0) { |
3280 | new_level = level == 7 ? 7 : level + 1; | 3397 | if (level < max_level) |
3398 | level++; | ||
3281 | } else if (strlencmp(cmd, "down") == 0) { | 3399 | } else if (strlencmp(cmd, "down") == 0) { |
3282 | new_level = level == 0 ? 0 : level - 1; | 3400 | if (level > 0) |
3283 | } else if (sscanf(cmd, "level %d", &new_level) == 1 && | 3401 | level--; |
3284 | new_level >= 0 && new_level <= 7) { | 3402 | } else if (sscanf(cmd, "level %d", &level) == 1 && |
3285 | /* new_level set */ | 3403 | level >= 0 && level <= max_level) { |
3404 | /* new level set */ | ||
3286 | } else | 3405 | } else |
3287 | return -EINVAL; | 3406 | return -EINVAL; |
3288 | |||
3289 | brightness_set(new_level); | ||
3290 | } | 3407 | } |
3291 | 3408 | ||
3292 | return 0; | 3409 | /* |
3410 | * Now we know what the final level should be, so we try to set it. | ||
3411 | * Doing it this way makes the syscall restartable in case of EINTR | ||
3412 | */ | ||
3413 | rc = brightness_set(level); | ||
3414 | return (rc == -EINTR)? ERESTARTSYS : rc; | ||
3293 | } | 3415 | } |
3294 | 3416 | ||
3295 | static struct ibm_struct brightness_driver_data = { | 3417 | static struct ibm_struct brightness_driver_data = { |
@@ -3652,9 +3774,8 @@ static ssize_t fan_pwm1_store(struct device *dev, | |||
3652 | /* scale down from 0-255 to 0-7 */ | 3774 | /* scale down from 0-255 to 0-7 */ |
3653 | newlevel = (s >> 5) & 0x07; | 3775 | newlevel = (s >> 5) & 0x07; |
3654 | 3776 | ||
3655 | rc = mutex_lock_interruptible(&fan_mutex); | 3777 | if (mutex_lock_interruptible(&fan_mutex)) |
3656 | if (rc < 0) | 3778 | return -ERESTARTSYS; |
3657 | return rc; | ||
3658 | 3779 | ||
3659 | rc = fan_get_status(&status); | 3780 | rc = fan_get_status(&status); |
3660 | if (!rc && (status & | 3781 | if (!rc && (status & |
@@ -3904,9 +4025,8 @@ static int fan_get_status_safe(u8 *status) | |||
3904 | int rc; | 4025 | int rc; |
3905 | u8 s; | 4026 | u8 s; |
3906 | 4027 | ||
3907 | rc = mutex_lock_interruptible(&fan_mutex); | 4028 | if (mutex_lock_interruptible(&fan_mutex)) |
3908 | if (rc < 0) | 4029 | return -ERESTARTSYS; |
3909 | return rc; | ||
3910 | rc = fan_get_status(&s); | 4030 | rc = fan_get_status(&s); |
3911 | if (!rc) | 4031 | if (!rc) |
3912 | fan_update_desired_level(s); | 4032 | fan_update_desired_level(s); |
@@ -4040,9 +4160,8 @@ static int fan_set_level_safe(int level) | |||
4040 | if (!fan_control_allowed) | 4160 | if (!fan_control_allowed) |
4041 | return -EPERM; | 4161 | return -EPERM; |
4042 | 4162 | ||
4043 | rc = mutex_lock_interruptible(&fan_mutex); | 4163 | if (mutex_lock_interruptible(&fan_mutex)) |
4044 | if (rc < 0) | 4164 | return -ERESTARTSYS; |
4045 | return rc; | ||
4046 | 4165 | ||
4047 | if (level == TPACPI_FAN_LAST_LEVEL) | 4166 | if (level == TPACPI_FAN_LAST_LEVEL) |
4048 | level = fan_control_desired_level; | 4167 | level = fan_control_desired_level; |
@@ -4063,9 +4182,8 @@ static int fan_set_enable(void) | |||
4063 | if (!fan_control_allowed) | 4182 | if (!fan_control_allowed) |
4064 | return -EPERM; | 4183 | return -EPERM; |
4065 | 4184 | ||
4066 | rc = mutex_lock_interruptible(&fan_mutex); | 4185 | if (mutex_lock_interruptible(&fan_mutex)) |
4067 | if (rc < 0) | 4186 | return -ERESTARTSYS; |
4068 | return rc; | ||
4069 | 4187 | ||
4070 | switch (fan_control_access_mode) { | 4188 | switch (fan_control_access_mode) { |
4071 | case TPACPI_FAN_WR_ACPI_FANS: | 4189 | case TPACPI_FAN_WR_ACPI_FANS: |
@@ -4119,9 +4237,8 @@ static int fan_set_disable(void) | |||
4119 | if (!fan_control_allowed) | 4237 | if (!fan_control_allowed) |
4120 | return -EPERM; | 4238 | return -EPERM; |
4121 | 4239 | ||
4122 | rc = mutex_lock_interruptible(&fan_mutex); | 4240 | if (mutex_lock_interruptible(&fan_mutex)) |
4123 | if (rc < 0) | 4241 | return -ERESTARTSYS; |
4124 | return rc; | ||
4125 | 4242 | ||
4126 | rc = 0; | 4243 | rc = 0; |
4127 | switch (fan_control_access_mode) { | 4244 | switch (fan_control_access_mode) { |
@@ -4158,9 +4275,8 @@ static int fan_set_speed(int speed) | |||
4158 | if (!fan_control_allowed) | 4275 | if (!fan_control_allowed) |
4159 | return -EPERM; | 4276 | return -EPERM; |
4160 | 4277 | ||
4161 | rc = mutex_lock_interruptible(&fan_mutex); | 4278 | if (mutex_lock_interruptible(&fan_mutex)) |
4162 | if (rc < 0) | 4279 | return -ERESTARTSYS; |
4163 | return rc; | ||
4164 | 4280 | ||
4165 | rc = 0; | 4281 | rc = 0; |
4166 | switch (fan_control_access_mode) { | 4282 | switch (fan_control_access_mode) { |
@@ -4701,9 +4817,15 @@ static int __init set_ibm_param(const char *val, struct kernel_param *kp) | |||
4701 | unsigned int i; | 4817 | unsigned int i; |
4702 | struct ibm_struct *ibm; | 4818 | struct ibm_struct *ibm; |
4703 | 4819 | ||
4820 | if (!kp || !kp->name || !val) | ||
4821 | return -EINVAL; | ||
4822 | |||
4704 | for (i = 0; i < ARRAY_SIZE(ibms_init); i++) { | 4823 | for (i = 0; i < ARRAY_SIZE(ibms_init); i++) { |
4705 | ibm = ibms_init[i].data; | 4824 | ibm = ibms_init[i].data; |
4706 | BUG_ON(ibm == NULL); | 4825 | WARN_ON(ibm == NULL); |
4826 | |||
4827 | if (!ibm || !ibm->name) | ||
4828 | continue; | ||
4707 | 4829 | ||
4708 | if (strcmp(ibm->name, kp->name) == 0 && ibm->write) { | 4830 | if (strcmp(ibm->name, kp->name) == 0 && ibm->write) { |
4709 | if (strlen(val) > sizeof(ibms_init[i].param) - 2) | 4831 | if (strlen(val) > sizeof(ibms_init[i].param) - 2) |
@@ -4732,6 +4854,9 @@ module_param_named(fan_control, fan_control_allowed, bool, 0); | |||
4732 | static int brightness_mode; | 4854 | static int brightness_mode; |
4733 | module_param_named(brightness_mode, brightness_mode, int, 0); | 4855 | module_param_named(brightness_mode, brightness_mode, int, 0); |
4734 | 4856 | ||
4857 | static unsigned int brightness_enable = 2; /* 2 = auto, 0 = no, 1 = yes */ | ||
4858 | module_param(brightness_enable, uint, 0); | ||
4859 | |||
4735 | static unsigned int hotkey_report_mode; | 4860 | static unsigned int hotkey_report_mode; |
4736 | module_param(hotkey_report_mode, uint, 0); | 4861 | module_param(hotkey_report_mode, uint, 0); |
4737 | 4862 | ||
diff --git a/drivers/misc/thinkpad_acpi.h b/drivers/misc/thinkpad_acpi.h index 3abcc8120634..8fba2bbe345e 100644 --- a/drivers/misc/thinkpad_acpi.h +++ b/drivers/misc/thinkpad_acpi.h | |||
@@ -84,7 +84,7 @@ | |||
84 | 84 | ||
85 | /* ThinkPad CMOS NVRAM constants */ | 85 | /* ThinkPad CMOS NVRAM constants */ |
86 | #define TP_NVRAM_ADDR_BRIGHTNESS 0x5e | 86 | #define TP_NVRAM_ADDR_BRIGHTNESS 0x5e |
87 | #define TP_NVRAM_MASK_LEVEL_BRIGHTNESS 0x07 | 87 | #define TP_NVRAM_MASK_LEVEL_BRIGHTNESS 0x0f |
88 | #define TP_NVRAM_POS_LEVEL_BRIGHTNESS 0 | 88 | #define TP_NVRAM_POS_LEVEL_BRIGHTNESS 0 |
89 | 89 | ||
90 | #define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off") | 90 | #define onoff(status,bit) ((status) & (1 << (bit)) ? "on" : "off") |
@@ -246,6 +246,7 @@ static struct { | |||
246 | u32 hotkey_wlsw:1; | 246 | u32 hotkey_wlsw:1; |
247 | u32 light:1; | 247 | u32 light:1; |
248 | u32 light_status:1; | 248 | u32 light_status:1; |
249 | u32 bright_16levels:1; | ||
249 | u32 wan:1; | 250 | u32 wan:1; |
250 | u32 fan_ctrl_status_undef:1; | 251 | u32 fan_ctrl_status_undef:1; |
251 | u32 input_device_registered:1; | 252 | u32 input_device_registered:1; |
@@ -338,6 +339,7 @@ static int bluetooth_write(char *buf); | |||
338 | static struct backlight_device *ibm_backlight_device; | 339 | static struct backlight_device *ibm_backlight_device; |
339 | static int brightness_offset = 0x31; | 340 | static int brightness_offset = 0x31; |
340 | static int brightness_mode; | 341 | static int brightness_mode; |
342 | static unsigned int brightness_enable; /* 0 = no, 1 = yes, 2 = auto */ | ||
341 | 343 | ||
342 | static int brightness_init(struct ibm_init_struct *iibm); | 344 | static int brightness_init(struct ibm_init_struct *iibm); |
343 | static void brightness_exit(void); | 345 | static void brightness_exit(void); |
diff --git a/drivers/mmc/card/block.c b/drivers/mmc/card/block.c index e38d5a3b2a89..aeb32a93f6a0 100644 --- a/drivers/mmc/card/block.c +++ b/drivers/mmc/card/block.c | |||
@@ -44,6 +44,9 @@ | |||
44 | * max 8 partitions per card | 44 | * max 8 partitions per card |
45 | */ | 45 | */ |
46 | #define MMC_SHIFT 3 | 46 | #define MMC_SHIFT 3 |
47 | #define MMC_NUM_MINORS (256 >> MMC_SHIFT) | ||
48 | |||
49 | static unsigned long dev_use[MMC_NUM_MINORS/(8*sizeof(unsigned long))]; | ||
47 | 50 | ||
48 | /* | 51 | /* |
49 | * There is one mmc_blk_data per slot. | 52 | * There is one mmc_blk_data per slot. |
@@ -80,6 +83,9 @@ static void mmc_blk_put(struct mmc_blk_data *md) | |||
80 | mutex_lock(&open_lock); | 83 | mutex_lock(&open_lock); |
81 | md->usage--; | 84 | md->usage--; |
82 | if (md->usage == 0) { | 85 | if (md->usage == 0) { |
86 | int devidx = md->disk->first_minor >> MMC_SHIFT; | ||
87 | __clear_bit(devidx, dev_use); | ||
88 | |||
83 | put_disk(md->disk); | 89 | put_disk(md->disk); |
84 | kfree(md); | 90 | kfree(md); |
85 | } | 91 | } |
@@ -321,7 +327,13 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
321 | req->rq_disk->disk_name, err); | 327 | req->rq_disk->disk_name, err); |
322 | goto cmd_err; | 328 | goto cmd_err; |
323 | } | 329 | } |
324 | } while (!(cmd.resp[0] & R1_READY_FOR_DATA)); | 330 | /* |
331 | * Some cards mishandle the status bits, | ||
332 | * so make sure to check both the busy | ||
333 | * indication and the card state. | ||
334 | */ | ||
335 | } while (!(cmd.resp[0] & R1_READY_FOR_DATA) || | ||
336 | (R1_CURRENT_STATE(cmd.resp[0]) == 7)); | ||
325 | 337 | ||
326 | #if 0 | 338 | #if 0 |
327 | if (cmd.resp[0] & ~0x00000900) | 339 | if (cmd.resp[0] & ~0x00000900) |
@@ -400,9 +412,6 @@ static int mmc_blk_issue_rq(struct mmc_queue *mq, struct request *req) | |||
400 | return 0; | 412 | return 0; |
401 | } | 413 | } |
402 | 414 | ||
403 | #define MMC_NUM_MINORS (256 >> MMC_SHIFT) | ||
404 | |||
405 | static unsigned long dev_use[MMC_NUM_MINORS/(8*sizeof(unsigned long))]; | ||
406 | 415 | ||
407 | static inline int mmc_blk_readonly(struct mmc_card *card) | 416 | static inline int mmc_blk_readonly(struct mmc_card *card) |
408 | { | 417 | { |
@@ -568,17 +577,12 @@ static void mmc_blk_remove(struct mmc_card *card) | |||
568 | struct mmc_blk_data *md = mmc_get_drvdata(card); | 577 | struct mmc_blk_data *md = mmc_get_drvdata(card); |
569 | 578 | ||
570 | if (md) { | 579 | if (md) { |
571 | int devidx; | ||
572 | |||
573 | /* Stop new requests from getting into the queue */ | 580 | /* Stop new requests from getting into the queue */ |
574 | del_gendisk(md->disk); | 581 | del_gendisk(md->disk); |
575 | 582 | ||
576 | /* Then flush out any already in there */ | 583 | /* Then flush out any already in there */ |
577 | mmc_cleanup_queue(&md->queue); | 584 | mmc_cleanup_queue(&md->queue); |
578 | 585 | ||
579 | devidx = md->disk->first_minor >> MMC_SHIFT; | ||
580 | __clear_bit(devidx, dev_use); | ||
581 | |||
582 | mmc_blk_put(md); | 586 | mmc_blk_put(md); |
583 | } | 587 | } |
584 | mmc_set_drvdata(card, NULL); | 588 | mmc_set_drvdata(card, NULL); |
diff --git a/drivers/mmc/card/queue.c b/drivers/mmc/card/queue.c index 1b9c9b6da5b7..30cd13b13ac3 100644 --- a/drivers/mmc/card/queue.c +++ b/drivers/mmc/card/queue.c | |||
@@ -180,12 +180,13 @@ int mmc_init_queue(struct mmc_queue *mq, struct mmc_card *card, spinlock_t *lock | |||
180 | blk_queue_max_hw_segments(mq->queue, host->max_hw_segs); | 180 | blk_queue_max_hw_segments(mq->queue, host->max_hw_segs); |
181 | blk_queue_max_segment_size(mq->queue, host->max_seg_size); | 181 | blk_queue_max_segment_size(mq->queue, host->max_seg_size); |
182 | 182 | ||
183 | mq->sg = kzalloc(sizeof(struct scatterlist) * | 183 | mq->sg = kmalloc(sizeof(struct scatterlist) * |
184 | host->max_phys_segs, GFP_KERNEL); | 184 | host->max_phys_segs, GFP_KERNEL); |
185 | if (!mq->sg) { | 185 | if (!mq->sg) { |
186 | ret = -ENOMEM; | 186 | ret = -ENOMEM; |
187 | goto cleanup_queue; | 187 | goto cleanup_queue; |
188 | } | 188 | } |
189 | sg_init_table(mq->sg, host->max_phys_segs); | ||
189 | } | 190 | } |
190 | 191 | ||
191 | init_MUTEX(&mq->thread_sem); | 192 | init_MUTEX(&mq->thread_sem); |
diff --git a/drivers/mmc/card/sdio_uart.c b/drivers/mmc/card/sdio_uart.c index d552de683110..eeea84c309e6 100644 --- a/drivers/mmc/card/sdio_uart.c +++ b/drivers/mmc/card/sdio_uart.c | |||
@@ -386,7 +386,7 @@ static void sdio_uart_stop_rx(struct sdio_uart_port *port) | |||
386 | sdio_out(port, UART_IER, port->ier); | 386 | sdio_out(port, UART_IER, port->ier); |
387 | } | 387 | } |
388 | 388 | ||
389 | static void sdio_uart_receive_chars(struct sdio_uart_port *port, int *status) | 389 | static void sdio_uart_receive_chars(struct sdio_uart_port *port, unsigned int *status) |
390 | { | 390 | { |
391 | struct tty_struct *tty = port->tty; | 391 | struct tty_struct *tty = port->tty; |
392 | unsigned int ch, flag; | 392 | unsigned int ch, flag; |
diff --git a/drivers/mmc/host/tifm_sd.c b/drivers/mmc/host/tifm_sd.c index c11a3d256051..20d5c7bd940a 100644 --- a/drivers/mmc/host/tifm_sd.c +++ b/drivers/mmc/host/tifm_sd.c | |||
@@ -16,7 +16,6 @@ | |||
16 | #include <linux/mmc/host.h> | 16 | #include <linux/mmc/host.h> |
17 | #include <linux/highmem.h> | 17 | #include <linux/highmem.h> |
18 | #include <linux/scatterlist.h> | 18 | #include <linux/scatterlist.h> |
19 | #include <linux/log2.h> | ||
20 | #include <asm/io.h> | 19 | #include <asm/io.h> |
21 | 20 | ||
22 | #define DRIVER_NAME "tifm_sd" | 21 | #define DRIVER_NAME "tifm_sd" |
@@ -638,17 +637,15 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
638 | goto err_out; | 637 | goto err_out; |
639 | } | 638 | } |
640 | 639 | ||
641 | if (mrq->data && !is_power_of_2(mrq->data->blksz)) { | ||
642 | printk(KERN_ERR "%s: Unsupported block size (%d bytes)\n", | ||
643 | sock->dev.bus_id, mrq->data->blksz); | ||
644 | mrq->cmd->error = -EINVAL; | ||
645 | goto err_out; | ||
646 | } | ||
647 | |||
648 | host->cmd_flags = 0; | 640 | host->cmd_flags = 0; |
649 | host->block_pos = 0; | 641 | host->block_pos = 0; |
650 | host->sg_pos = 0; | 642 | host->sg_pos = 0; |
651 | 643 | ||
644 | if (mrq->data && !is_power_of_2(mrq->data->blksz)) | ||
645 | host->no_dma = 1; | ||
646 | else | ||
647 | host->no_dma = no_dma ? 1 : 0; | ||
648 | |||
652 | if (r_data) { | 649 | if (r_data) { |
653 | tifm_sd_set_data_timeout(host, r_data); | 650 | tifm_sd_set_data_timeout(host, r_data); |
654 | 651 | ||
@@ -676,7 +673,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
676 | : PCI_DMA_FROMDEVICE)) { | 673 | : PCI_DMA_FROMDEVICE)) { |
677 | printk(KERN_ERR "%s : scatterlist map failed\n", | 674 | printk(KERN_ERR "%s : scatterlist map failed\n", |
678 | sock->dev.bus_id); | 675 | sock->dev.bus_id); |
679 | spin_unlock_irqrestore(&sock->lock, flags); | 676 | mrq->cmd->error = -ENOMEM; |
680 | goto err_out; | 677 | goto err_out; |
681 | } | 678 | } |
682 | host->sg_len = tifm_map_sg(sock, r_data->sg, | 679 | host->sg_len = tifm_map_sg(sock, r_data->sg, |
@@ -692,7 +689,7 @@ static void tifm_sd_request(struct mmc_host *mmc, struct mmc_request *mrq) | |||
692 | r_data->flags & MMC_DATA_WRITE | 689 | r_data->flags & MMC_DATA_WRITE |
693 | ? PCI_DMA_TODEVICE | 690 | ? PCI_DMA_TODEVICE |
694 | : PCI_DMA_FROMDEVICE); | 691 | : PCI_DMA_FROMDEVICE); |
695 | spin_unlock_irqrestore(&sock->lock, flags); | 692 | mrq->cmd->error = -ENOMEM; |
696 | goto err_out; | 693 | goto err_out; |
697 | } | 694 | } |
698 | 695 | ||
@@ -966,7 +963,6 @@ static int tifm_sd_probe(struct tifm_dev *sock) | |||
966 | return -ENOMEM; | 963 | return -ENOMEM; |
967 | 964 | ||
968 | host = mmc_priv(mmc); | 965 | host = mmc_priv(mmc); |
969 | host->no_dma = no_dma; | ||
970 | tifm_set_drvdata(sock, mmc); | 966 | tifm_set_drvdata(sock, mmc); |
971 | host->dev = sock; | 967 | host->dev = sock; |
972 | host->timeout_jiffies = msecs_to_jiffies(1000); | 968 | host->timeout_jiffies = msecs_to_jiffies(1000); |
diff --git a/drivers/net/bfin_mac.c b/drivers/net/bfin_mac.c index f0f851693897..eb971755a3ff 100644 --- a/drivers/net/bfin_mac.c +++ b/drivers/net/bfin_mac.c | |||
@@ -924,7 +924,7 @@ static int __init bf537mac_probe(struct net_device *dev) | |||
924 | if (!is_valid_ether_addr(dev->dev_addr)) { | 924 | if (!is_valid_ether_addr(dev->dev_addr)) { |
925 | /* Grab the MAC from the board somehow - this is done in the | 925 | /* Grab the MAC from the board somehow - this is done in the |
926 | arch/blackfin/mach-bf537/boards/eth_mac.c */ | 926 | arch/blackfin/mach-bf537/boards/eth_mac.c */ |
927 | get_bf537_ether_addr(dev->dev_addr); | 927 | bfin_get_ether_addr(dev->dev_addr); |
928 | } | 928 | } |
929 | 929 | ||
930 | /* If still not valid, get a random one */ | 930 | /* If still not valid, get a random one */ |
diff --git a/drivers/net/bfin_mac.h b/drivers/net/bfin_mac.h index 3a107ad75381..5970ea7142cd 100644 --- a/drivers/net/bfin_mac.h +++ b/drivers/net/bfin_mac.h | |||
@@ -92,4 +92,4 @@ struct bf537mac_local { | |||
92 | struct mii_bus mii_bus; | 92 | struct mii_bus mii_bus; |
93 | }; | 93 | }; |
94 | 94 | ||
95 | extern void get_bf537_ether_addr(char *addr); | 95 | extern void bfin_get_ether_addr(char *addr); |
diff --git a/drivers/net/mlx4/qp.c b/drivers/net/mlx4/qp.c index 42b47639c81c..fa24e6597591 100644 --- a/drivers/net/mlx4/qp.c +++ b/drivers/net/mlx4/qp.c | |||
@@ -113,7 +113,7 @@ int mlx4_qp_modify(struct mlx4_dev *dev, struct mlx4_mtt *mtt, | |||
113 | struct mlx4_cmd_mailbox *mailbox; | 113 | struct mlx4_cmd_mailbox *mailbox; |
114 | int ret = 0; | 114 | int ret = 0; |
115 | 115 | ||
116 | if (cur_state >= MLX4_QP_NUM_STATE || cur_state >= MLX4_QP_NUM_STATE || | 116 | if (cur_state >= MLX4_QP_NUM_STATE || new_state >= MLX4_QP_NUM_STATE || |
117 | !op[cur_state][new_state]) | 117 | !op[cur_state][new_state]) |
118 | return -EINVAL; | 118 | return -EINVAL; |
119 | 119 | ||
diff --git a/drivers/net/plip.c b/drivers/net/plip.c index 5071fcd8a0bd..57c98669984d 100644 --- a/drivers/net/plip.c +++ b/drivers/net/plip.c | |||
@@ -663,7 +663,7 @@ plip_receive_packet(struct net_device *dev, struct net_local *nl, | |||
663 | case PLIP_PK_DONE: | 663 | case PLIP_PK_DONE: |
664 | /* Inform the upper layer for the arrival of a packet. */ | 664 | /* Inform the upper layer for the arrival of a packet. */ |
665 | rcv->skb->protocol=plip_type_trans(rcv->skb, dev); | 665 | rcv->skb->protocol=plip_type_trans(rcv->skb, dev); |
666 | netif_rx(rcv->skb); | 666 | netif_rx_ni(rcv->skb); |
667 | dev->last_rx = jiffies; | 667 | dev->last_rx = jiffies; |
668 | dev->stats.rx_bytes += rcv->length.h; | 668 | dev->stats.rx_bytes += rcv->length.h; |
669 | dev->stats.rx_packets++; | 669 | dev->stats.rx_packets++; |
@@ -1269,7 +1269,7 @@ static void plip_attach (struct parport *port) | |||
1269 | 1269 | ||
1270 | nl = netdev_priv(dev); | 1270 | nl = netdev_priv(dev); |
1271 | nl->dev = dev; | 1271 | nl->dev = dev; |
1272 | nl->pardev = parport_register_device(port, name, plip_preempt, | 1272 | nl->pardev = parport_register_device(port, dev->name, plip_preempt, |
1273 | plip_wakeup, plip_interrupt, | 1273 | plip_wakeup, plip_interrupt, |
1274 | 0, dev); | 1274 | 0, dev); |
1275 | 1275 | ||
diff --git a/drivers/net/virtio_net.c b/drivers/net/virtio_net.c index a75be57fb209..5413dbf3d4ac 100644 --- a/drivers/net/virtio_net.c +++ b/drivers/net/virtio_net.c | |||
@@ -198,8 +198,8 @@ again: | |||
198 | if (vi->num < vi->max / 2) | 198 | if (vi->num < vi->max / 2) |
199 | try_fill_recv(vi); | 199 | try_fill_recv(vi); |
200 | 200 | ||
201 | /* All done? */ | 201 | /* Out of packets? */ |
202 | if (!skb) { | 202 | if (received < budget) { |
203 | netif_rx_complete(vi->dev, napi); | 203 | netif_rx_complete(vi->dev, napi); |
204 | if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq)) | 204 | if (unlikely(!vi->rvq->vq_ops->restart(vi->rvq)) |
205 | && netif_rx_reschedule(vi->dev, napi)) | 205 | && netif_rx_reschedule(vi->dev, napi)) |
@@ -404,8 +404,12 @@ free: | |||
404 | 404 | ||
405 | static void virtnet_remove(struct virtio_device *vdev) | 405 | static void virtnet_remove(struct virtio_device *vdev) |
406 | { | 406 | { |
407 | unregister_netdev(vdev->priv); | 407 | struct virtnet_info *vi = vdev->priv; |
408 | free_netdev(vdev->priv); | 408 | |
409 | vdev->config->del_vq(vi->svq); | ||
410 | vdev->config->del_vq(vi->rvq); | ||
411 | unregister_netdev(vi->dev); | ||
412 | free_netdev(vi->dev); | ||
409 | } | 413 | } |
410 | 414 | ||
411 | static struct virtio_device_id id_table[] = { | 415 | static struct virtio_device_id id_table[] = { |
diff --git a/drivers/net/wireless/rt2x00/rt2500usb.c b/drivers/net/wireless/rt2x00/rt2500usb.c index 277a020b35e9..50775f9234cc 100644 --- a/drivers/net/wireless/rt2x00/rt2500usb.c +++ b/drivers/net/wireless/rt2x00/rt2500usb.c | |||
@@ -1032,7 +1032,7 @@ static void rt2500usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1032 | } | 1032 | } |
1033 | 1033 | ||
1034 | static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | 1034 | static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, |
1035 | int maxpacket, struct sk_buff *skb) | 1035 | struct sk_buff *skb) |
1036 | { | 1036 | { |
1037 | int length; | 1037 | int length; |
1038 | 1038 | ||
@@ -1041,7 +1041,7 @@ static int rt2500usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | |||
1041 | * but it must _not_ be a multiple of the USB packet size. | 1041 | * but it must _not_ be a multiple of the USB packet size. |
1042 | */ | 1042 | */ |
1043 | length = roundup(skb->len, 2); | 1043 | length = roundup(skb->len, 2); |
1044 | length += (2 * !(length % maxpacket)); | 1044 | length += (2 * !(length % rt2x00dev->usb_maxpacket)); |
1045 | 1045 | ||
1046 | return length; | 1046 | return length; |
1047 | } | 1047 | } |
@@ -1643,7 +1643,6 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw, | |||
1643 | struct data_entry *beacon; | 1643 | struct data_entry *beacon; |
1644 | struct data_entry *guardian; | 1644 | struct data_entry *guardian; |
1645 | int pipe = usb_sndbulkpipe(usb_dev, 1); | 1645 | int pipe = usb_sndbulkpipe(usb_dev, 1); |
1646 | int max_packet = usb_maxpacket(usb_dev, pipe, 1); | ||
1647 | int length; | 1646 | int length; |
1648 | 1647 | ||
1649 | /* | 1648 | /* |
@@ -1672,7 +1671,7 @@ static int rt2500usb_beacon_update(struct ieee80211_hw *hw, | |||
1672 | ring->desc_size), | 1671 | ring->desc_size), |
1673 | skb->len - ring->desc_size, control); | 1672 | skb->len - ring->desc_size, control); |
1674 | 1673 | ||
1675 | length = rt2500usb_get_tx_data_len(rt2x00dev, max_packet, skb); | 1674 | length = rt2500usb_get_tx_data_len(rt2x00dev, skb); |
1676 | 1675 | ||
1677 | usb_fill_bulk_urb(beacon->priv, usb_dev, pipe, | 1676 | usb_fill_bulk_urb(beacon->priv, usb_dev, pipe, |
1678 | skb->data, length, rt2500usb_beacondone, beacon); | 1677 | skb->data, length, rt2500usb_beacondone, beacon); |
diff --git a/drivers/net/wireless/rt2x00/rt2x00.h b/drivers/net/wireless/rt2x00/rt2x00.h index d1ad5251a77a..c8f16f161c28 100644 --- a/drivers/net/wireless/rt2x00/rt2x00.h +++ b/drivers/net/wireless/rt2x00/rt2x00.h | |||
@@ -418,7 +418,7 @@ struct rt2x00lib_ops { | |||
418 | int (*write_tx_data) (struct rt2x00_dev *rt2x00dev, | 418 | int (*write_tx_data) (struct rt2x00_dev *rt2x00dev, |
419 | struct data_ring *ring, struct sk_buff *skb, | 419 | struct data_ring *ring, struct sk_buff *skb, |
420 | struct ieee80211_tx_control *control); | 420 | struct ieee80211_tx_control *control); |
421 | int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev, int maxpacket, | 421 | int (*get_tx_data_len) (struct rt2x00_dev *rt2x00dev, |
422 | struct sk_buff *skb); | 422 | struct sk_buff *skb); |
423 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, | 423 | void (*kick_tx_queue) (struct rt2x00_dev *rt2x00dev, |
424 | unsigned int queue); | 424 | unsigned int queue); |
@@ -599,6 +599,11 @@ struct rt2x00_dev { | |||
599 | u32 *rf; | 599 | u32 *rf; |
600 | 600 | ||
601 | /* | 601 | /* |
602 | * USB Max frame size (for rt2500usb & rt73usb). | ||
603 | */ | ||
604 | u16 usb_maxpacket; | ||
605 | |||
606 | /* | ||
602 | * Current TX power value. | 607 | * Current TX power value. |
603 | */ | 608 | */ |
604 | u16 tx_power; | 609 | u16 tx_power; |
diff --git a/drivers/net/wireless/rt2x00/rt2x00usb.c b/drivers/net/wireless/rt2x00/rt2x00usb.c index 73cc726c4046..1f5675dd329f 100644 --- a/drivers/net/wireless/rt2x00/rt2x00usb.c +++ b/drivers/net/wireless/rt2x00/rt2x00usb.c | |||
@@ -159,7 +159,6 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
159 | interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); | 159 | interface_to_usbdev(rt2x00dev_usb(rt2x00dev)); |
160 | struct data_entry *entry = rt2x00_get_data_entry(ring); | 160 | struct data_entry *entry = rt2x00_get_data_entry(ring); |
161 | int pipe = usb_sndbulkpipe(usb_dev, 1); | 161 | int pipe = usb_sndbulkpipe(usb_dev, 1); |
162 | int max_packet = usb_maxpacket(usb_dev, pipe, 1); | ||
163 | u32 length; | 162 | u32 length; |
164 | 163 | ||
165 | if (rt2x00_ring_full(ring)) { | 164 | if (rt2x00_ring_full(ring)) { |
@@ -194,8 +193,7 @@ int rt2x00usb_write_tx_data(struct rt2x00_dev *rt2x00dev, | |||
194 | * length of the data to usb_fill_bulk_urb. Pass the skb | 193 | * length of the data to usb_fill_bulk_urb. Pass the skb |
195 | * to the driver to determine what the length should be. | 194 | * to the driver to determine what the length should be. |
196 | */ | 195 | */ |
197 | length = rt2x00dev->ops->lib->get_tx_data_len(rt2x00dev, | 196 | length = rt2x00dev->ops->lib->get_tx_data_len(rt2x00dev, skb); |
198 | max_packet, skb); | ||
199 | 197 | ||
200 | /* | 198 | /* |
201 | * Initialize URB and send the frame to the device. | 199 | * Initialize URB and send the frame to the device. |
@@ -490,6 +488,11 @@ int rt2x00usb_probe(struct usb_interface *usb_intf, | |||
490 | rt2x00dev->ops = ops; | 488 | rt2x00dev->ops = ops; |
491 | rt2x00dev->hw = hw; | 489 | rt2x00dev->hw = hw; |
492 | 490 | ||
491 | rt2x00dev->usb_maxpacket = | ||
492 | usb_maxpacket(usb_dev, usb_sndbulkpipe(usb_dev, 1), 1); | ||
493 | if (!rt2x00dev->usb_maxpacket) | ||
494 | rt2x00dev->usb_maxpacket = 1; | ||
495 | |||
493 | retval = rt2x00usb_alloc_reg(rt2x00dev); | 496 | retval = rt2x00usb_alloc_reg(rt2x00dev); |
494 | if (retval) | 497 | if (retval) |
495 | goto exit_free_device; | 498 | goto exit_free_device; |
diff --git a/drivers/net/wireless/rt2x00/rt73usb.c b/drivers/net/wireless/rt2x00/rt73usb.c index dc640bf6b5eb..c0671c2e6e73 100644 --- a/drivers/net/wireless/rt2x00/rt73usb.c +++ b/drivers/net/wireless/rt2x00/rt73usb.c | |||
@@ -1251,7 +1251,7 @@ static void rt73usb_write_tx_desc(struct rt2x00_dev *rt2x00dev, | |||
1251 | } | 1251 | } |
1252 | 1252 | ||
1253 | static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | 1253 | static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, |
1254 | int maxpacket, struct sk_buff *skb) | 1254 | struct sk_buff *skb) |
1255 | { | 1255 | { |
1256 | int length; | 1256 | int length; |
1257 | 1257 | ||
@@ -1260,7 +1260,7 @@ static int rt73usb_get_tx_data_len(struct rt2x00_dev *rt2x00dev, | |||
1260 | * but it must _not_ be a multiple of the USB packet size. | 1260 | * but it must _not_ be a multiple of the USB packet size. |
1261 | */ | 1261 | */ |
1262 | length = roundup(skb->len, 4); | 1262 | length = roundup(skb->len, 4); |
1263 | length += (4 * !(length % maxpacket)); | 1263 | length += (4 * !(length % rt2x00dev->usb_maxpacket)); |
1264 | 1264 | ||
1265 | return length; | 1265 | return length; |
1266 | } | 1266 | } |
diff --git a/drivers/pci/hotplug/acpiphp.h b/drivers/pci/hotplug/acpiphp.h index f6cc0c5b5657..1ef417cca2db 100644 --- a/drivers/pci/hotplug/acpiphp.h +++ b/drivers/pci/hotplug/acpiphp.h | |||
@@ -66,7 +66,7 @@ struct slot { | |||
66 | char name[SLOT_NAME_SIZE]; | 66 | char name[SLOT_NAME_SIZE]; |
67 | }; | 67 | }; |
68 | 68 | ||
69 | /** | 69 | /* |
70 | * struct acpiphp_bridge - PCI bridge information | 70 | * struct acpiphp_bridge - PCI bridge information |
71 | * | 71 | * |
72 | * for each bridge device in ACPI namespace | 72 | * for each bridge device in ACPI namespace |
@@ -97,7 +97,7 @@ struct acpiphp_bridge { | |||
97 | }; | 97 | }; |
98 | 98 | ||
99 | 99 | ||
100 | /** | 100 | /* |
101 | * struct acpiphp_slot - PCI slot information | 101 | * struct acpiphp_slot - PCI slot information |
102 | * | 102 | * |
103 | * PCI slot information for each *physical* PCI slot | 103 | * PCI slot information for each *physical* PCI slot |
@@ -118,7 +118,7 @@ struct acpiphp_slot { | |||
118 | }; | 118 | }; |
119 | 119 | ||
120 | 120 | ||
121 | /** | 121 | /* |
122 | * struct acpiphp_func - PCI function information | 122 | * struct acpiphp_func - PCI function information |
123 | * | 123 | * |
124 | * PCI function information for each object in ACPI namespace | 124 | * PCI function information for each object in ACPI namespace |
@@ -137,7 +137,7 @@ struct acpiphp_func { | |||
137 | u32 flags; /* see below */ | 137 | u32 flags; /* see below */ |
138 | }; | 138 | }; |
139 | 139 | ||
140 | /** | 140 | /* |
141 | * struct acpiphp_attention_info - device specific attention registration | 141 | * struct acpiphp_attention_info - device specific attention registration |
142 | * | 142 | * |
143 | * ACPI has no generic method of setting/getting attention status | 143 | * ACPI has no generic method of setting/getting attention status |
diff --git a/drivers/pci/hotplug/acpiphp_core.c b/drivers/pci/hotplug/acpiphp_core.c index a0ca63adad5a..c8c263875c21 100644 --- a/drivers/pci/hotplug/acpiphp_core.c +++ b/drivers/pci/hotplug/acpiphp_core.c | |||
@@ -91,10 +91,10 @@ static struct hotplug_slot_ops acpi_hotplug_slot_ops = { | |||
91 | * acpiphp_register_attention - set attention LED callback | 91 | * acpiphp_register_attention - set attention LED callback |
92 | * @info: must be completely filled with LED callbacks | 92 | * @info: must be completely filled with LED callbacks |
93 | * | 93 | * |
94 | * Description: this is used to register a hardware specific ACPI | 94 | * Description: This is used to register a hardware specific ACPI |
95 | * driver that manipulates the attention LED. All the fields in | 95 | * driver that manipulates the attention LED. All the fields in |
96 | * info must be set. | 96 | * info must be set. |
97 | **/ | 97 | */ |
98 | int acpiphp_register_attention(struct acpiphp_attention_info *info) | 98 | int acpiphp_register_attention(struct acpiphp_attention_info *info) |
99 | { | 99 | { |
100 | int retval = -EINVAL; | 100 | int retval = -EINVAL; |
@@ -112,10 +112,10 @@ int acpiphp_register_attention(struct acpiphp_attention_info *info) | |||
112 | * acpiphp_unregister_attention - unset attention LED callback | 112 | * acpiphp_unregister_attention - unset attention LED callback |
113 | * @info: must match the pointer used to register | 113 | * @info: must match the pointer used to register |
114 | * | 114 | * |
115 | * Description: this is used to un-register a hardware specific acpi | 115 | * Description: This is used to un-register a hardware specific acpi |
116 | * driver that manipulates the attention LED. The pointer to the | 116 | * driver that manipulates the attention LED. The pointer to the |
117 | * info struct must be the same as the one used to set it. | 117 | * info struct must be the same as the one used to set it. |
118 | **/ | 118 | */ |
119 | int acpiphp_unregister_attention(struct acpiphp_attention_info *info) | 119 | int acpiphp_unregister_attention(struct acpiphp_attention_info *info) |
120 | { | 120 | { |
121 | int retval = -EINVAL; | 121 | int retval = -EINVAL; |
@@ -133,7 +133,6 @@ int acpiphp_unregister_attention(struct acpiphp_attention_info *info) | |||
133 | * @hotplug_slot: slot to enable | 133 | * @hotplug_slot: slot to enable |
134 | * | 134 | * |
135 | * Actual tasks are done in acpiphp_enable_slot() | 135 | * Actual tasks are done in acpiphp_enable_slot() |
136 | * | ||
137 | */ | 136 | */ |
138 | static int enable_slot(struct hotplug_slot *hotplug_slot) | 137 | static int enable_slot(struct hotplug_slot *hotplug_slot) |
139 | { | 138 | { |
@@ -151,7 +150,6 @@ static int enable_slot(struct hotplug_slot *hotplug_slot) | |||
151 | * @hotplug_slot: slot to disable | 150 | * @hotplug_slot: slot to disable |
152 | * | 151 | * |
153 | * Actual tasks are done in acpiphp_disable_slot() | 152 | * Actual tasks are done in acpiphp_disable_slot() |
154 | * | ||
155 | */ | 153 | */ |
156 | static int disable_slot(struct hotplug_slot *hotplug_slot) | 154 | static int disable_slot(struct hotplug_slot *hotplug_slot) |
157 | { | 155 | { |
@@ -168,15 +166,15 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
168 | } | 166 | } |
169 | 167 | ||
170 | 168 | ||
171 | /** | 169 | /** |
172 | * set_attention_status - set attention LED | 170 | * set_attention_status - set attention LED |
173 | * @hotplug_slot: slot to set attention LED on | 171 | * @hotplug_slot: slot to set attention LED on |
174 | * @status: value to set attention LED to (0 or 1) | 172 | * @status: value to set attention LED to (0 or 1) |
175 | * | 173 | * |
176 | * attention status LED, so we use a callback that | 174 | * attention status LED, so we use a callback that |
177 | * was registered with us. This allows hardware specific | 175 | * was registered with us. This allows hardware specific |
178 | * ACPI implementations to blink the light for us. | 176 | * ACPI implementations to blink the light for us. |
179 | **/ | 177 | */ |
180 | static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) | 178 | static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 status) |
181 | { | 179 | { |
182 | int retval = -ENODEV; | 180 | int retval = -ENODEV; |
@@ -199,7 +197,6 @@ static int disable_slot(struct hotplug_slot *hotplug_slot) | |||
199 | * | 197 | * |
200 | * Some platforms may not implement _STA method properly. | 198 | * Some platforms may not implement _STA method properly. |
201 | * In that case, the value returned may not be reliable. | 199 | * In that case, the value returned may not be reliable. |
202 | * | ||
203 | */ | 200 | */ |
204 | static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | 201 | static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) |
205 | { | 202 | { |
@@ -213,7 +210,7 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
213 | } | 210 | } |
214 | 211 | ||
215 | 212 | ||
216 | /** | 213 | /** |
217 | * get_attention_status - get attention LED status | 214 | * get_attention_status - get attention LED status |
218 | * @hotplug_slot: slot to get status from | 215 | * @hotplug_slot: slot to get status from |
219 | * @value: returns with value of attention LED | 216 | * @value: returns with value of attention LED |
@@ -221,8 +218,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
221 | * ACPI doesn't have known method to determine the state | 218 | * ACPI doesn't have known method to determine the state |
222 | * of the attention status LED, so we use a callback that | 219 | * of the attention status LED, so we use a callback that |
223 | * was registered with us. This allows hardware specific | 220 | * was registered with us. This allows hardware specific |
224 | * ACPI implementations to determine its state | 221 | * ACPI implementations to determine its state. |
225 | **/ | 222 | */ |
226 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) | 223 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) |
227 | { | 224 | { |
228 | int retval = -EINVAL; | 225 | int retval = -EINVAL; |
@@ -244,8 +241,7 @@ static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
244 | * @value: pointer to store status | 241 | * @value: pointer to store status |
245 | * | 242 | * |
246 | * ACPI doesn't provide any formal means to access latch status. | 243 | * ACPI doesn't provide any formal means to access latch status. |
247 | * Instead, we fake latch status from _STA | 244 | * Instead, we fake latch status from _STA. |
248 | * | ||
249 | */ | 245 | */ |
250 | static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) | 246 | static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) |
251 | { | 247 | { |
@@ -265,8 +261,7 @@ static int get_latch_status(struct hotplug_slot *hotplug_slot, u8 *value) | |||
265 | * @value: pointer to store status | 261 | * @value: pointer to store status |
266 | * | 262 | * |
267 | * ACPI doesn't provide any formal means to access adapter status. | 263 | * ACPI doesn't provide any formal means to access adapter status. |
268 | * Instead, we fake adapter status from _STA | 264 | * Instead, we fake adapter status from _STA. |
269 | * | ||
270 | */ | 265 | */ |
271 | static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) | 266 | static int get_adapter_status(struct hotplug_slot *hotplug_slot, u8 *value) |
272 | { | 267 | { |
diff --git a/drivers/pci/hotplug/acpiphp_glue.c b/drivers/pci/hotplug/acpiphp_glue.c index 1e125b56c9a9..ff1b1c71291a 100644 --- a/drivers/pci/hotplug/acpiphp_glue.c +++ b/drivers/pci/hotplug/acpiphp_glue.c | |||
@@ -82,7 +82,6 @@ static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *contex | |||
82 | * 2. has _PS0 method | 82 | * 2. has _PS0 method |
83 | * 3. has _PS3 method | 83 | * 3. has _PS3 method |
84 | * 4. .. | 84 | * 4. .. |
85 | * | ||
86 | */ | 85 | */ |
87 | static int is_ejectable(acpi_handle handle) | 86 | static int is_ejectable(acpi_handle handle) |
88 | { | 87 | { |
@@ -986,10 +985,8 @@ static int power_off_slot(struct acpiphp_slot *slot) | |||
986 | 985 | ||
987 | 986 | ||
988 | /** | 987 | /** |
989 | * acpiphp_max_busnr - return the highest reserved bus number under | 988 | * acpiphp_max_busnr - return the highest reserved bus number under the given bus. |
990 | * the given bus. | ||
991 | * @bus: bus to start search with | 989 | * @bus: bus to start search with |
992 | * | ||
993 | */ | 990 | */ |
994 | static unsigned char acpiphp_max_busnr(struct pci_bus *bus) | 991 | static unsigned char acpiphp_max_busnr(struct pci_bus *bus) |
995 | { | 992 | { |
@@ -1018,7 +1015,6 @@ static unsigned char acpiphp_max_busnr(struct pci_bus *bus) | |||
1018 | /** | 1015 | /** |
1019 | * acpiphp_bus_add - add a new bus to acpi subsystem | 1016 | * acpiphp_bus_add - add a new bus to acpi subsystem |
1020 | * @func: acpiphp_func of the bridge | 1017 | * @func: acpiphp_func of the bridge |
1021 | * | ||
1022 | */ | 1018 | */ |
1023 | static int acpiphp_bus_add(struct acpiphp_func *func) | 1019 | static int acpiphp_bus_add(struct acpiphp_func *func) |
1024 | { | 1020 | { |
@@ -1063,7 +1059,6 @@ acpiphp_bus_add_out: | |||
1063 | /** | 1059 | /** |
1064 | * acpiphp_bus_trim - trim a bus from acpi subsystem | 1060 | * acpiphp_bus_trim - trim a bus from acpi subsystem |
1065 | * @handle: handle to acpi namespace | 1061 | * @handle: handle to acpi namespace |
1066 | * | ||
1067 | */ | 1062 | */ |
1068 | static int acpiphp_bus_trim(acpi_handle handle) | 1063 | static int acpiphp_bus_trim(acpi_handle handle) |
1069 | { | 1064 | { |
@@ -1089,7 +1084,6 @@ static int acpiphp_bus_trim(acpi_handle handle) | |||
1089 | * | 1084 | * |
1090 | * This function should be called per *physical slot*, | 1085 | * This function should be called per *physical slot*, |
1091 | * not per each slot object in ACPI namespace. | 1086 | * not per each slot object in ACPI namespace. |
1092 | * | ||
1093 | */ | 1087 | */ |
1094 | static int enable_device(struct acpiphp_slot *slot) | 1088 | static int enable_device(struct acpiphp_slot *slot) |
1095 | { | 1089 | { |
@@ -1185,6 +1179,7 @@ static void disable_bridges(struct pci_bus *bus) | |||
1185 | 1179 | ||
1186 | /** | 1180 | /** |
1187 | * disable_device - disable a slot | 1181 | * disable_device - disable a slot |
1182 | * @slot: ACPI PHP slot | ||
1188 | */ | 1183 | */ |
1189 | static int disable_device(struct acpiphp_slot *slot) | 1184 | static int disable_device(struct acpiphp_slot *slot) |
1190 | { | 1185 | { |
@@ -1240,14 +1235,15 @@ static int disable_device(struct acpiphp_slot *slot) | |||
1240 | 1235 | ||
1241 | /** | 1236 | /** |
1242 | * get_slot_status - get ACPI slot status | 1237 | * get_slot_status - get ACPI slot status |
1238 | * @slot: ACPI PHP slot | ||
1243 | * | 1239 | * |
1244 | * if a slot has _STA for each function and if any one of them | 1240 | * If a slot has _STA for each function and if any one of them |
1245 | * returned non-zero status, return it | 1241 | * returned non-zero status, return it. |
1246 | * | 1242 | * |
1247 | * if a slot doesn't have _STA and if any one of its functions' | 1243 | * If a slot doesn't have _STA and if any one of its functions' |
1248 | * configuration space is configured, return 0x0f as a _STA | 1244 | * configuration space is configured, return 0x0f as a _STA. |
1249 | * | 1245 | * |
1250 | * otherwise return 0 | 1246 | * Otherwise return 0. |
1251 | */ | 1247 | */ |
1252 | static unsigned int get_slot_status(struct acpiphp_slot *slot) | 1248 | static unsigned int get_slot_status(struct acpiphp_slot *slot) |
1253 | { | 1249 | { |
@@ -1281,6 +1277,7 @@ static unsigned int get_slot_status(struct acpiphp_slot *slot) | |||
1281 | 1277 | ||
1282 | /** | 1278 | /** |
1283 | * acpiphp_eject_slot - physically eject the slot | 1279 | * acpiphp_eject_slot - physically eject the slot |
1280 | * @slot: ACPI PHP slot | ||
1284 | */ | 1281 | */ |
1285 | int acpiphp_eject_slot(struct acpiphp_slot *slot) | 1282 | int acpiphp_eject_slot(struct acpiphp_slot *slot) |
1286 | { | 1283 | { |
@@ -1314,6 +1311,7 @@ int acpiphp_eject_slot(struct acpiphp_slot *slot) | |||
1314 | 1311 | ||
1315 | /** | 1312 | /** |
1316 | * acpiphp_check_bridge - re-enumerate devices | 1313 | * acpiphp_check_bridge - re-enumerate devices |
1314 | * @bridge: where to begin re-enumeration | ||
1317 | * | 1315 | * |
1318 | * Iterate over all slots under this bridge and make sure that if a | 1316 | * Iterate over all slots under this bridge and make sure that if a |
1319 | * card is present they are enabled, and if not they are disabled. | 1317 | * card is present they are enabled, and if not they are disabled. |
@@ -1538,13 +1536,11 @@ check_sub_bridges(acpi_handle handle, u32 lvl, void *context, void **rv) | |||
1538 | 1536 | ||
1539 | /** | 1537 | /** |
1540 | * handle_hotplug_event_bridge - handle ACPI event on bridges | 1538 | * handle_hotplug_event_bridge - handle ACPI event on bridges |
1541 | * | ||
1542 | * @handle: Notify()'ed acpi_handle | 1539 | * @handle: Notify()'ed acpi_handle |
1543 | * @type: Notify code | 1540 | * @type: Notify code |
1544 | * @context: pointer to acpiphp_bridge structure | 1541 | * @context: pointer to acpiphp_bridge structure |
1545 | * | 1542 | * |
1546 | * handles ACPI event notification on {host,p2p} bridges | 1543 | * Handles ACPI event notification on {host,p2p} bridges. |
1547 | * | ||
1548 | */ | 1544 | */ |
1549 | static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *context) | 1545 | static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *context) |
1550 | { | 1546 | { |
@@ -1634,13 +1630,11 @@ static void handle_hotplug_event_bridge(acpi_handle handle, u32 type, void *cont | |||
1634 | 1630 | ||
1635 | /** | 1631 | /** |
1636 | * handle_hotplug_event_func - handle ACPI event on functions (i.e. slots) | 1632 | * handle_hotplug_event_func - handle ACPI event on functions (i.e. slots) |
1637 | * | ||
1638 | * @handle: Notify()'ed acpi_handle | 1633 | * @handle: Notify()'ed acpi_handle |
1639 | * @type: Notify code | 1634 | * @type: Notify code |
1640 | * @context: pointer to acpiphp_func structure | 1635 | * @context: pointer to acpiphp_func structure |
1641 | * | 1636 | * |
1642 | * handles ACPI event notification on slots | 1637 | * Handles ACPI event notification on slots. |
1643 | * | ||
1644 | */ | 1638 | */ |
1645 | static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context) | 1639 | static void handle_hotplug_event_func(acpi_handle handle, u32 type, void *context) |
1646 | { | 1640 | { |
@@ -1705,7 +1699,6 @@ static struct acpi_pci_driver acpi_pci_hp_driver = { | |||
1705 | 1699 | ||
1706 | /** | 1700 | /** |
1707 | * acpiphp_glue_init - initializes all PCI hotplug - ACPI glue data structures | 1701 | * acpiphp_glue_init - initializes all PCI hotplug - ACPI glue data structures |
1708 | * | ||
1709 | */ | 1702 | */ |
1710 | int __init acpiphp_glue_init(void) | 1703 | int __init acpiphp_glue_init(void) |
1711 | { | 1704 | { |
@@ -1726,7 +1719,7 @@ int __init acpiphp_glue_init(void) | |||
1726 | /** | 1719 | /** |
1727 | * acpiphp_glue_exit - terminates all PCI hotplug - ACPI glue data structures | 1720 | * acpiphp_glue_exit - terminates all PCI hotplug - ACPI glue data structures |
1728 | * | 1721 | * |
1729 | * This function frees all data allocated in acpiphp_glue_init() | 1722 | * This function frees all data allocated in acpiphp_glue_init(). |
1730 | */ | 1723 | */ |
1731 | void acpiphp_glue_exit(void) | 1724 | void acpiphp_glue_exit(void) |
1732 | { | 1725 | { |
@@ -1760,7 +1753,6 @@ int __init acpiphp_get_num_slots(void) | |||
1760 | * acpiphp_for_each_slot - call function for each slot | 1753 | * acpiphp_for_each_slot - call function for each slot |
1761 | * @fn: callback function | 1754 | * @fn: callback function |
1762 | * @data: context to be passed to callback function | 1755 | * @data: context to be passed to callback function |
1763 | * | ||
1764 | */ | 1756 | */ |
1765 | static int acpiphp_for_each_slot(acpiphp_callback fn, void *data) | 1757 | static int acpiphp_for_each_slot(acpiphp_callback fn, void *data) |
1766 | { | 1758 | { |
@@ -1786,6 +1778,7 @@ static int acpiphp_for_each_slot(acpiphp_callback fn, void *data) | |||
1786 | 1778 | ||
1787 | /** | 1779 | /** |
1788 | * acpiphp_enable_slot - power on slot | 1780 | * acpiphp_enable_slot - power on slot |
1781 | * @slot: ACPI PHP slot | ||
1789 | */ | 1782 | */ |
1790 | int acpiphp_enable_slot(struct acpiphp_slot *slot) | 1783 | int acpiphp_enable_slot(struct acpiphp_slot *slot) |
1791 | { | 1784 | { |
@@ -1815,6 +1808,7 @@ int acpiphp_enable_slot(struct acpiphp_slot *slot) | |||
1815 | 1808 | ||
1816 | /** | 1809 | /** |
1817 | * acpiphp_disable_slot - power off slot | 1810 | * acpiphp_disable_slot - power off slot |
1811 | * @slot: ACPI PHP slot | ||
1818 | */ | 1812 | */ |
1819 | int acpiphp_disable_slot(struct acpiphp_slot *slot) | 1813 | int acpiphp_disable_slot(struct acpiphp_slot *slot) |
1820 | { | 1814 | { |
diff --git a/drivers/pci/hotplug/acpiphp_ibm.c b/drivers/pci/hotplug/acpiphp_ibm.c index 56829f82be4a..47d26b65e99a 100644 --- a/drivers/pci/hotplug/acpiphp_ibm.c +++ b/drivers/pci/hotplug/acpiphp_ibm.c | |||
@@ -134,11 +134,11 @@ static struct acpiphp_attention_info ibm_attention_info = | |||
134 | * ibm_slot_from_id - workaround for bad ibm hardware | 134 | * ibm_slot_from_id - workaround for bad ibm hardware |
135 | * @id: the slot number that linux refers to the slot by | 135 | * @id: the slot number that linux refers to the slot by |
136 | * | 136 | * |
137 | * Description: this method returns the aCPI slot descriptor | 137 | * Description: This method returns the aCPI slot descriptor |
138 | * corresponding to the Linux slot number. This descriptor | 138 | * corresponding to the Linux slot number. This descriptor |
139 | * has info about the aPCI slot id and attention status. | 139 | * has info about the aPCI slot id and attention status. |
140 | * This descriptor must be freed using kfree when done. | 140 | * This descriptor must be freed using kfree when done. |
141 | **/ | 141 | */ |
142 | static union apci_descriptor *ibm_slot_from_id(int id) | 142 | static union apci_descriptor *ibm_slot_from_id(int id) |
143 | { | 143 | { |
144 | int ind = 0, size; | 144 | int ind = 0, size; |
@@ -173,9 +173,9 @@ ibm_slot_done: | |||
173 | * @slot: the hotplug_slot to work with | 173 | * @slot: the hotplug_slot to work with |
174 | * @status: what to set the LED to (0 or 1) | 174 | * @status: what to set the LED to (0 or 1) |
175 | * | 175 | * |
176 | * Description: this method is registered with the acpiphp module as a | 176 | * Description: This method is registered with the acpiphp module as a |
177 | * callback to do the device specific task of setting the LED status | 177 | * callback to do the device specific task of setting the LED status. |
178 | **/ | 178 | */ |
179 | static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status) | 179 | static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status) |
180 | { | 180 | { |
181 | union acpi_object args[2]; | 181 | union acpi_object args[2]; |
@@ -213,13 +213,13 @@ static int ibm_set_attention_status(struct hotplug_slot *slot, u8 status) | |||
213 | * @slot: the hotplug_slot to work with | 213 | * @slot: the hotplug_slot to work with |
214 | * @status: returns what the LED is set to (0 or 1) | 214 | * @status: returns what the LED is set to (0 or 1) |
215 | * | 215 | * |
216 | * Description: this method is registered with the acpiphp module as a | 216 | * Description: This method is registered with the acpiphp module as a |
217 | * callback to do the device specific task of getting the LED status | 217 | * callback to do the device specific task of getting the LED status. |
218 | * | 218 | * |
219 | * Because there is no direct method of getting the LED status directly | 219 | * Because there is no direct method of getting the LED status directly |
220 | * from an ACPI call, we read the aPCI table and parse out our | 220 | * from an ACPI call, we read the aPCI table and parse out our |
221 | * slot descriptor to read the status from that. | 221 | * slot descriptor to read the status from that. |
222 | **/ | 222 | */ |
223 | static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status) | 223 | static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status) |
224 | { | 224 | { |
225 | union apci_descriptor *ibm_slot; | 225 | union apci_descriptor *ibm_slot; |
@@ -245,8 +245,8 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status) | |||
245 | * @event: the event info (device specific) | 245 | * @event: the event info (device specific) |
246 | * @context: passed context (our notification struct) | 246 | * @context: passed context (our notification struct) |
247 | * | 247 | * |
248 | * Description: this method is registered as a callback with the ACPI | 248 | * Description: This method is registered as a callback with the ACPI |
249 | * subsystem it is called when this device has an event to notify the OS of | 249 | * subsystem it is called when this device has an event to notify the OS of. |
250 | * | 250 | * |
251 | * The events actually come from the device as two events that get | 251 | * The events actually come from the device as two events that get |
252 | * synthesized into one event with data by this function. The event | 252 | * synthesized into one event with data by this function. The event |
@@ -256,7 +256,7 @@ static int ibm_get_attention_status(struct hotplug_slot *slot, u8 *status) | |||
256 | * From section 5.6.2.2 of the ACPI 2.0 spec, I understand that the OSPM will | 256 | * From section 5.6.2.2 of the ACPI 2.0 spec, I understand that the OSPM will |
257 | * only re-enable the interrupt that causes this event AFTER this method | 257 | * only re-enable the interrupt that causes this event AFTER this method |
258 | * has returned, thereby enforcing serial access for the notification struct. | 258 | * has returned, thereby enforcing serial access for the notification struct. |
259 | **/ | 259 | */ |
260 | static void ibm_handle_events(acpi_handle handle, u32 event, void *context) | 260 | static void ibm_handle_events(acpi_handle handle, u32 event, void *context) |
261 | { | 261 | { |
262 | u8 detail = event & 0x0f; | 262 | u8 detail = event & 0x0f; |
@@ -279,16 +279,16 @@ static void ibm_handle_events(acpi_handle handle, u32 event, void *context) | |||
279 | * ibm_get_table_from_acpi - reads the APLS buffer from ACPI | 279 | * ibm_get_table_from_acpi - reads the APLS buffer from ACPI |
280 | * @bufp: address to pointer to allocate for the table | 280 | * @bufp: address to pointer to allocate for the table |
281 | * | 281 | * |
282 | * Description: this method reads the APLS buffer in from ACPI and | 282 | * Description: This method reads the APLS buffer in from ACPI and |
283 | * stores the "stripped" table into a single buffer | 283 | * stores the "stripped" table into a single buffer |
284 | * it allocates and passes the address back in bufp | 284 | * it allocates and passes the address back in bufp. |
285 | * | 285 | * |
286 | * If NULL is passed in as buffer, this method only calculates | 286 | * If NULL is passed in as buffer, this method only calculates |
287 | * the size of the table and returns that without filling | 287 | * the size of the table and returns that without filling |
288 | * in the buffer | 288 | * in the buffer. |
289 | * | 289 | * |
290 | * returns < 0 on error or the size of the table on success | 290 | * Returns < 0 on error or the size of the table on success. |
291 | **/ | 291 | */ |
292 | static int ibm_get_table_from_acpi(char **bufp) | 292 | static int ibm_get_table_from_acpi(char **bufp) |
293 | { | 293 | { |
294 | union acpi_object *package; | 294 | union acpi_object *package; |
@@ -349,17 +349,18 @@ read_table_done: | |||
349 | /** | 349 | /** |
350 | * ibm_read_apci_table - callback for the sysfs apci_table file | 350 | * ibm_read_apci_table - callback for the sysfs apci_table file |
351 | * @kobj: the kobject this binary attribute is a part of | 351 | * @kobj: the kobject this binary attribute is a part of |
352 | * @bin_attr: struct bin_attribute for this file | ||
352 | * @buffer: the kernel space buffer to fill | 353 | * @buffer: the kernel space buffer to fill |
353 | * @pos: the offset into the file | 354 | * @pos: the offset into the file |
354 | * @size: the number of bytes requested | 355 | * @size: the number of bytes requested |
355 | * | 356 | * |
356 | * Description: gets registered with sysfs as the reader callback | 357 | * Description: Gets registered with sysfs as the reader callback |
357 | * to be executed when /sys/bus/pci/slots/apci_table gets read | 358 | * to be executed when /sys/bus/pci/slots/apci_table gets read. |
358 | * | 359 | * |
359 | * Since we don't get notified on open and close for this file, | 360 | * Since we don't get notified on open and close for this file, |
360 | * things get really tricky here... | 361 | * things get really tricky here... |
361 | * our solution is to only allow reading the table in all at once | 362 | * our solution is to only allow reading the table in all at once. |
362 | **/ | 363 | */ |
363 | static ssize_t ibm_read_apci_table(struct kobject *kobj, | 364 | static ssize_t ibm_read_apci_table(struct kobject *kobj, |
364 | struct bin_attribute *bin_attr, | 365 | struct bin_attribute *bin_attr, |
365 | char *buffer, loff_t pos, size_t size) | 366 | char *buffer, loff_t pos, size_t size) |
@@ -385,10 +386,10 @@ static ssize_t ibm_read_apci_table(struct kobject *kobj, | |||
385 | * @context: a pointer to our handle to fill when we find the device | 386 | * @context: a pointer to our handle to fill when we find the device |
386 | * @rv: a return value to fill if desired | 387 | * @rv: a return value to fill if desired |
387 | * | 388 | * |
388 | * Description: used as a callback when calling acpi_walk_namespace | 389 | * Description: Used as a callback when calling acpi_walk_namespace |
389 | * to find our device. When this method returns non-zero | 390 | * to find our device. When this method returns non-zero |
390 | * acpi_walk_namespace quits its search and returns our value | 391 | * acpi_walk_namespace quits its search and returns our value. |
391 | **/ | 392 | */ |
392 | static acpi_status __init ibm_find_acpi_device(acpi_handle handle, | 393 | static acpi_status __init ibm_find_acpi_device(acpi_handle handle, |
393 | u32 lvl, void *context, void **rv) | 394 | u32 lvl, void *context, void **rv) |
394 | { | 395 | { |
diff --git a/drivers/pci/hotplug/cpqphp_core.c b/drivers/pci/hotplug/cpqphp_core.c index a96b739b2d35..74178875b949 100644 --- a/drivers/pci/hotplug/cpqphp_core.c +++ b/drivers/pci/hotplug/cpqphp_core.c | |||
@@ -117,12 +117,10 @@ static inline int is_slot66mhz(struct slot *slot) | |||
117 | 117 | ||
118 | /** | 118 | /** |
119 | * detect_SMBIOS_pointer - find the System Management BIOS Table in mem region. | 119 | * detect_SMBIOS_pointer - find the System Management BIOS Table in mem region. |
120 | * | ||
121 | * @begin: begin pointer for region to be scanned. | 120 | * @begin: begin pointer for region to be scanned. |
122 | * @end: end pointer for region to be scanned. | 121 | * @end: end pointer for region to be scanned. |
123 | * | 122 | * |
124 | * Returns pointer to the head of the SMBIOS tables (or NULL) | 123 | * Returns pointer to the head of the SMBIOS tables (or %NULL). |
125 | * | ||
126 | */ | 124 | */ |
127 | static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end) | 125 | static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *end) |
128 | { | 126 | { |
@@ -157,9 +155,9 @@ static void __iomem * detect_SMBIOS_pointer(void __iomem *begin, void __iomem *e | |||
157 | 155 | ||
158 | /** | 156 | /** |
159 | * init_SERR - Initializes the per slot SERR generation. | 157 | * init_SERR - Initializes the per slot SERR generation. |
158 | * @ctrl: controller to use | ||
160 | * | 159 | * |
161 | * For unexpected switch opens | 160 | * For unexpected switch opens |
162 | * | ||
163 | */ | 161 | */ |
164 | static int init_SERR(struct controller * ctrl) | 162 | static int init_SERR(struct controller * ctrl) |
165 | { | 163 | { |
@@ -224,14 +222,15 @@ static int pci_print_IRQ_route (void) | |||
224 | 222 | ||
225 | /** | 223 | /** |
226 | * get_subsequent_smbios_entry: get the next entry from bios table. | 224 | * get_subsequent_smbios_entry: get the next entry from bios table. |
227 | * | 225 | * @smbios_start: where to start in the SMBIOS table |
228 | * Gets the first entry if previous == NULL | 226 | * @smbios_table: location of the SMBIOS table |
229 | * Otherwise, returns the next entry | ||
230 | * Uses global SMBIOS Table pointer | ||
231 | * | ||
232 | * @curr: %NULL or pointer to previously returned structure | 227 | * @curr: %NULL or pointer to previously returned structure |
233 | * | 228 | * |
234 | * returns a pointer to an SMBIOS structure or NULL if none found | 229 | * Gets the first entry if previous == NULL; |
230 | * otherwise, returns the next entry. | ||
231 | * Uses global SMBIOS Table pointer. | ||
232 | * | ||
233 | * Returns a pointer to an SMBIOS structure or NULL if none found. | ||
235 | */ | 234 | */ |
236 | static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start, | 235 | static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start, |
237 | void __iomem *smbios_table, | 236 | void __iomem *smbios_table, |
@@ -272,17 +271,18 @@ static void __iomem *get_subsequent_smbios_entry(void __iomem *smbios_start, | |||
272 | 271 | ||
273 | 272 | ||
274 | /** | 273 | /** |
275 | * get_SMBIOS_entry | 274 | * get_SMBIOS_entry - return the requested SMBIOS entry or %NULL |
276 | * | 275 | * @smbios_start: where to start in the SMBIOS table |
277 | * @type:SMBIOS structure type to be returned | 276 | * @smbios_table: location of the SMBIOS table |
277 | * @type: SMBIOS structure type to be returned | ||
278 | * @previous: %NULL or pointer to previously returned structure | 278 | * @previous: %NULL or pointer to previously returned structure |
279 | * | 279 | * |
280 | * Gets the first entry of the specified type if previous == NULL | 280 | * Gets the first entry of the specified type if previous == %NULL; |
281 | * Otherwise, returns the next entry of the given type. | 281 | * Otherwise, returns the next entry of the given type. |
282 | * Uses global SMBIOS Table pointer | 282 | * Uses global SMBIOS Table pointer. |
283 | * Uses get_subsequent_smbios_entry | 283 | * Uses get_subsequent_smbios_entry. |
284 | * | 284 | * |
285 | * returns a pointer to an SMBIOS structure or %NULL if none found | 285 | * Returns a pointer to an SMBIOS structure or %NULL if none found. |
286 | */ | 286 | */ |
287 | static void __iomem *get_SMBIOS_entry(void __iomem *smbios_start, | 287 | static void __iomem *get_SMBIOS_entry(void __iomem *smbios_start, |
288 | void __iomem *smbios_table, | 288 | void __iomem *smbios_table, |
@@ -581,7 +581,9 @@ get_slot_mapping(struct pci_bus *bus, u8 bus_num, u8 dev_num, u8 *slot) | |||
581 | 581 | ||
582 | /** | 582 | /** |
583 | * cpqhp_set_attention_status - Turns the Amber LED for a slot on or off | 583 | * cpqhp_set_attention_status - Turns the Amber LED for a slot on or off |
584 | * | 584 | * @ctrl: struct controller to use |
585 | * @func: PCI device/function info | ||
586 | * @status: LED control flag: 1 = LED on, 0 = LED off | ||
585 | */ | 587 | */ |
586 | static int | 588 | static int |
587 | cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, | 589 | cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, |
@@ -621,7 +623,8 @@ cpqhp_set_attention_status(struct controller *ctrl, struct pci_func *func, | |||
621 | 623 | ||
622 | /** | 624 | /** |
623 | * set_attention_status - Turns the Amber LED for a slot on or off | 625 | * set_attention_status - Turns the Amber LED for a slot on or off |
624 | * | 626 | * @hotplug_slot: slot to change LED on |
627 | * @status: LED control flag | ||
625 | */ | 628 | */ |
626 | static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) | 629 | static int set_attention_status (struct hotplug_slot *hotplug_slot, u8 status) |
627 | { | 630 | { |
diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 856d57b4d604..4018420c6f95 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c | |||
@@ -123,7 +123,7 @@ static u8 handle_switch_change(u8 change, struct controller * ctrl) | |||
123 | } | 123 | } |
124 | 124 | ||
125 | /** | 125 | /** |
126 | * cpqhp_find_slot: find the struct slot of given device | 126 | * cpqhp_find_slot - find the struct slot of given device |
127 | * @ctrl: scan lots of this controller | 127 | * @ctrl: scan lots of this controller |
128 | * @device: the device id to find | 128 | * @device: the device id to find |
129 | */ | 129 | */ |
@@ -305,9 +305,8 @@ static u8 handle_power_fault(u8 change, struct controller * ctrl) | |||
305 | 305 | ||
306 | 306 | ||
307 | /** | 307 | /** |
308 | * sort_by_size: sort nodes on the list by their length, smallest first. | 308 | * sort_by_size - sort nodes on the list by their length, smallest first. |
309 | * @head: list to sort | 309 | * @head: list to sort |
310 | * | ||
311 | */ | 310 | */ |
312 | static int sort_by_size(struct pci_resource **head) | 311 | static int sort_by_size(struct pci_resource **head) |
313 | { | 312 | { |
@@ -354,9 +353,8 @@ static int sort_by_size(struct pci_resource **head) | |||
354 | 353 | ||
355 | 354 | ||
356 | /** | 355 | /** |
357 | * sort_by_max_size: sort nodes on the list by their length, largest first. | 356 | * sort_by_max_size - sort nodes on the list by their length, largest first. |
358 | * @head: list to sort | 357 | * @head: list to sort |
359 | * | ||
360 | */ | 358 | */ |
361 | static int sort_by_max_size(struct pci_resource **head) | 359 | static int sort_by_max_size(struct pci_resource **head) |
362 | { | 360 | { |
@@ -403,8 +401,10 @@ static int sort_by_max_size(struct pci_resource **head) | |||
403 | 401 | ||
404 | 402 | ||
405 | /** | 403 | /** |
406 | * do_pre_bridge_resource_split: find node of resources that are unused | 404 | * do_pre_bridge_resource_split - find node of resources that are unused |
407 | * | 405 | * @head: new list head |
406 | * @orig_head: original list head | ||
407 | * @alignment: max node size (?) | ||
408 | */ | 408 | */ |
409 | static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **head, | 409 | static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **head, |
410 | struct pci_resource **orig_head, u32 alignment) | 410 | struct pci_resource **orig_head, u32 alignment) |
@@ -477,8 +477,9 @@ static struct pci_resource *do_pre_bridge_resource_split(struct pci_resource **h | |||
477 | 477 | ||
478 | 478 | ||
479 | /** | 479 | /** |
480 | * do_bridge_resource_split: find one node of resources that aren't in use | 480 | * do_bridge_resource_split - find one node of resources that aren't in use |
481 | * | 481 | * @head: list head |
482 | * @alignment: max node size (?) | ||
482 | */ | 483 | */ |
483 | static struct pci_resource *do_bridge_resource_split(struct pci_resource **head, u32 alignment) | 484 | static struct pci_resource *do_bridge_resource_split(struct pci_resource **head, u32 alignment) |
484 | { | 485 | { |
@@ -525,14 +526,13 @@ error: | |||
525 | 526 | ||
526 | 527 | ||
527 | /** | 528 | /** |
528 | * get_io_resource: find first node of given size not in ISA aliasing window. | 529 | * get_io_resource - find first node of given size not in ISA aliasing window. |
529 | * @head: list to search | 530 | * @head: list to search |
530 | * @size: size of node to find, must be a power of two. | 531 | * @size: size of node to find, must be a power of two. |
531 | * | 532 | * |
532 | * Description: this function sorts the resource list by size and then returns | 533 | * Description: This function sorts the resource list by size and then returns |
533 | * returns the first node of "size" length that is not in the ISA aliasing | 534 | * returns the first node of "size" length that is not in the ISA aliasing |
534 | * window. If it finds a node larger than "size" it will split it up. | 535 | * window. If it finds a node larger than "size" it will split it up. |
535 | * | ||
536 | */ | 536 | */ |
537 | static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size) | 537 | static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size) |
538 | { | 538 | { |
@@ -620,7 +620,7 @@ static struct pci_resource *get_io_resource(struct pci_resource **head, u32 size | |||
620 | 620 | ||
621 | 621 | ||
622 | /** | 622 | /** |
623 | * get_max_resource: get largest node which has at least the given size. | 623 | * get_max_resource - get largest node which has at least the given size. |
624 | * @head: the list to search the node in | 624 | * @head: the list to search the node in |
625 | * @size: the minimum size of the node to find | 625 | * @size: the minimum size of the node to find |
626 | * | 626 | * |
@@ -712,7 +712,7 @@ static struct pci_resource *get_max_resource(struct pci_resource **head, u32 siz | |||
712 | 712 | ||
713 | 713 | ||
714 | /** | 714 | /** |
715 | * get_resource: find resource of given size and split up larger ones. | 715 | * get_resource - find resource of given size and split up larger ones. |
716 | * @head: the list to search for resources | 716 | * @head: the list to search for resources |
717 | * @size: the size limit to use | 717 | * @size: the size limit to use |
718 | * | 718 | * |
@@ -804,14 +804,14 @@ static struct pci_resource *get_resource(struct pci_resource **head, u32 size) | |||
804 | 804 | ||
805 | 805 | ||
806 | /** | 806 | /** |
807 | * cpqhp_resource_sort_and_combine: sort nodes by base addresses and clean up. | 807 | * cpqhp_resource_sort_and_combine - sort nodes by base addresses and clean up |
808 | * @head: the list to sort and clean up | 808 | * @head: the list to sort and clean up |
809 | * | 809 | * |
810 | * Description: Sorts all of the nodes in the list in ascending order by | 810 | * Description: Sorts all of the nodes in the list in ascending order by |
811 | * their base addresses. Also does garbage collection by | 811 | * their base addresses. Also does garbage collection by |
812 | * combining adjacent nodes. | 812 | * combining adjacent nodes. |
813 | * | 813 | * |
814 | * returns 0 if success | 814 | * Returns %0 if success. |
815 | */ | 815 | */ |
816 | int cpqhp_resource_sort_and_combine(struct pci_resource **head) | 816 | int cpqhp_resource_sort_and_combine(struct pci_resource **head) |
817 | { | 817 | { |
@@ -951,9 +951,9 @@ irqreturn_t cpqhp_ctrl_intr(int IRQ, void *data) | |||
951 | 951 | ||
952 | /** | 952 | /** |
953 | * cpqhp_slot_create - Creates a node and adds it to the proper bus. | 953 | * cpqhp_slot_create - Creates a node and adds it to the proper bus. |
954 | * @busnumber - bus where new node is to be located | 954 | * @busnumber: bus where new node is to be located |
955 | * | 955 | * |
956 | * Returns pointer to the new node or NULL if unsuccessful | 956 | * Returns pointer to the new node or %NULL if unsuccessful. |
957 | */ | 957 | */ |
958 | struct pci_func *cpqhp_slot_create(u8 busnumber) | 958 | struct pci_func *cpqhp_slot_create(u8 busnumber) |
959 | { | 959 | { |
@@ -986,7 +986,7 @@ struct pci_func *cpqhp_slot_create(u8 busnumber) | |||
986 | * slot_remove - Removes a node from the linked list of slots. | 986 | * slot_remove - Removes a node from the linked list of slots. |
987 | * @old_slot: slot to remove | 987 | * @old_slot: slot to remove |
988 | * | 988 | * |
989 | * Returns 0 if successful, !0 otherwise. | 989 | * Returns %0 if successful, !0 otherwise. |
990 | */ | 990 | */ |
991 | static int slot_remove(struct pci_func * old_slot) | 991 | static int slot_remove(struct pci_func * old_slot) |
992 | { | 992 | { |
@@ -1026,7 +1026,7 @@ static int slot_remove(struct pci_func * old_slot) | |||
1026 | * bridge_slot_remove - Removes a node from the linked list of slots. | 1026 | * bridge_slot_remove - Removes a node from the linked list of slots. |
1027 | * @bridge: bridge to remove | 1027 | * @bridge: bridge to remove |
1028 | * | 1028 | * |
1029 | * Returns 0 if successful, !0 otherwise. | 1029 | * Returns %0 if successful, !0 otherwise. |
1030 | */ | 1030 | */ |
1031 | static int bridge_slot_remove(struct pci_func *bridge) | 1031 | static int bridge_slot_remove(struct pci_func *bridge) |
1032 | { | 1032 | { |
@@ -1071,7 +1071,7 @@ out: | |||
1071 | * cpqhp_slot_find - Looks for a node by bus, and device, multiple functions accessed | 1071 | * cpqhp_slot_find - Looks for a node by bus, and device, multiple functions accessed |
1072 | * @bus: bus to find | 1072 | * @bus: bus to find |
1073 | * @device: device to find | 1073 | * @device: device to find |
1074 | * @index: is 0 for first function found, 1 for the second... | 1074 | * @index: is %0 for first function found, %1 for the second... |
1075 | * | 1075 | * |
1076 | * Returns pointer to the node if successful, %NULL otherwise. | 1076 | * Returns pointer to the node if successful, %NULL otherwise. |
1077 | */ | 1077 | */ |
@@ -1115,16 +1115,13 @@ static int is_bridge(struct pci_func * func) | |||
1115 | 1115 | ||
1116 | 1116 | ||
1117 | /** | 1117 | /** |
1118 | * set_controller_speed - set the frequency and/or mode of a specific | 1118 | * set_controller_speed - set the frequency and/or mode of a specific controller segment. |
1119 | * controller segment. | ||
1120 | * | ||
1121 | * @ctrl: controller to change frequency/mode for. | 1119 | * @ctrl: controller to change frequency/mode for. |
1122 | * @adapter_speed: the speed of the adapter we want to match. | 1120 | * @adapter_speed: the speed of the adapter we want to match. |
1123 | * @hp_slot: the slot number where the adapter is installed. | 1121 | * @hp_slot: the slot number where the adapter is installed. |
1124 | * | 1122 | * |
1125 | * Returns 0 if we successfully change frequency and/or mode to match the | 1123 | * Returns %0 if we successfully change frequency and/or mode to match the |
1126 | * adapter speed. | 1124 | * adapter speed. |
1127 | * | ||
1128 | */ | 1125 | */ |
1129 | static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_slot) | 1126 | static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_slot) |
1130 | { | 1127 | { |
@@ -1253,13 +1250,14 @@ static u8 set_controller_speed(struct controller *ctrl, u8 adapter_speed, u8 hp_ | |||
1253 | 1250 | ||
1254 | /** | 1251 | /** |
1255 | * board_replaced - Called after a board has been replaced in the system. | 1252 | * board_replaced - Called after a board has been replaced in the system. |
1253 | * @func: PCI device/function information | ||
1254 | * @ctrl: hotplug controller | ||
1256 | * | 1255 | * |
1257 | * This is only used if we don't have resources for hot add | 1256 | * This is only used if we don't have resources for hot add. |
1258 | * Turns power on for the board | 1257 | * Turns power on for the board. |
1259 | * Checks to see if board is the same | 1258 | * Checks to see if board is the same. |
1260 | * If board is same, reconfigures it | 1259 | * If board is same, reconfigures it. |
1261 | * If board isn't same, turns it back off. | 1260 | * If board isn't same, turns it back off. |
1262 | * | ||
1263 | */ | 1261 | */ |
1264 | static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | 1262 | static u32 board_replaced(struct pci_func *func, struct controller *ctrl) |
1265 | { | 1263 | { |
@@ -1403,10 +1401,11 @@ static u32 board_replaced(struct pci_func *func, struct controller *ctrl) | |||
1403 | 1401 | ||
1404 | /** | 1402 | /** |
1405 | * board_added - Called after a board has been added to the system. | 1403 | * board_added - Called after a board has been added to the system. |
1404 | * @func: PCI device/function info | ||
1405 | * @ctrl: hotplug controller | ||
1406 | * | 1406 | * |
1407 | * Turns power on for the board | 1407 | * Turns power on for the board. |
1408 | * Configures board | 1408 | * Configures board. |
1409 | * | ||
1410 | */ | 1409 | */ |
1411 | static u32 board_added(struct pci_func *func, struct controller *ctrl) | 1410 | static u32 board_added(struct pci_func *func, struct controller *ctrl) |
1412 | { | 1411 | { |
@@ -1607,8 +1606,10 @@ static u32 board_added(struct pci_func *func, struct controller *ctrl) | |||
1607 | 1606 | ||
1608 | 1607 | ||
1609 | /** | 1608 | /** |
1610 | * remove_board - Turns off slot and LED's | 1609 | * remove_board - Turns off slot and LEDs |
1611 | * | 1610 | * @func: PCI device/function info |
1611 | * @replace_flag: whether replacing or adding a new device | ||
1612 | * @ctrl: target controller | ||
1612 | */ | 1613 | */ |
1613 | static u32 remove_board(struct pci_func * func, u32 replace_flag, struct controller * ctrl) | 1614 | static u32 remove_board(struct pci_func * func, u32 replace_flag, struct controller * ctrl) |
1614 | { | 1615 | { |
@@ -1902,11 +1903,11 @@ static void interrupt_event_handler(struct controller *ctrl) | |||
1902 | 1903 | ||
1903 | 1904 | ||
1904 | /** | 1905 | /** |
1905 | * cpqhp_pushbutton_thread | 1906 | * cpqhp_pushbutton_thread - handle pushbutton events |
1907 | * @slot: target slot (struct) | ||
1906 | * | 1908 | * |
1907 | * Scheduled procedure to handle blocking stuff for the pushbuttons | 1909 | * Scheduled procedure to handle blocking stuff for the pushbuttons. |
1908 | * Handles all pending events and exits. | 1910 | * Handles all pending events and exits. |
1909 | * | ||
1910 | */ | 1911 | */ |
1911 | void cpqhp_pushbutton_thread(unsigned long slot) | 1912 | void cpqhp_pushbutton_thread(unsigned long slot) |
1912 | { | 1913 | { |
@@ -2137,9 +2138,10 @@ int cpqhp_process_SS(struct controller *ctrl, struct pci_func *func) | |||
2137 | } | 2138 | } |
2138 | 2139 | ||
2139 | /** | 2140 | /** |
2140 | * switch_leds: switch the leds, go from one site to the other. | 2141 | * switch_leds - switch the leds, go from one site to the other. |
2141 | * @ctrl: controller to use | 2142 | * @ctrl: controller to use |
2142 | * @num_of_slots: number of slots to use | 2143 | * @num_of_slots: number of slots to use |
2144 | * @work_LED: LED control value | ||
2143 | * @direction: 1 to start from the left side, 0 to start right. | 2145 | * @direction: 1 to start from the left side, 0 to start right. |
2144 | */ | 2146 | */ |
2145 | static void switch_leds(struct controller *ctrl, const int num_of_slots, | 2147 | static void switch_leds(struct controller *ctrl, const int num_of_slots, |
@@ -2165,11 +2167,11 @@ static void switch_leds(struct controller *ctrl, const int num_of_slots, | |||
2165 | } | 2167 | } |
2166 | 2168 | ||
2167 | /** | 2169 | /** |
2168 | * hardware_test - runs hardware tests | 2170 | * cpqhp_hardware_test - runs hardware tests |
2171 | * @ctrl: target controller | ||
2172 | * @test_num: the number written to the "test" file in sysfs. | ||
2169 | * | 2173 | * |
2170 | * For hot plug ctrl folks to play with. | 2174 | * For hot plug ctrl folks to play with. |
2171 | * test_num is the number written to the "test" file in sysfs | ||
2172 | * | ||
2173 | */ | 2175 | */ |
2174 | int cpqhp_hardware_test(struct controller *ctrl, int test_num) | 2176 | int cpqhp_hardware_test(struct controller *ctrl, int test_num) |
2175 | { | 2177 | { |
@@ -2249,14 +2251,12 @@ int cpqhp_hardware_test(struct controller *ctrl, int test_num) | |||
2249 | 2251 | ||
2250 | /** | 2252 | /** |
2251 | * configure_new_device - Configures the PCI header information of one board. | 2253 | * configure_new_device - Configures the PCI header information of one board. |
2252 | * | ||
2253 | * @ctrl: pointer to controller structure | 2254 | * @ctrl: pointer to controller structure |
2254 | * @func: pointer to function structure | 2255 | * @func: pointer to function structure |
2255 | * @behind_bridge: 1 if this is a recursive call, 0 if not | 2256 | * @behind_bridge: 1 if this is a recursive call, 0 if not |
2256 | * @resources: pointer to set of resource lists | 2257 | * @resources: pointer to set of resource lists |
2257 | * | 2258 | * |
2258 | * Returns 0 if success | 2259 | * Returns 0 if success. |
2259 | * | ||
2260 | */ | 2260 | */ |
2261 | static u32 configure_new_device(struct controller * ctrl, struct pci_func * func, | 2261 | static u32 configure_new_device(struct controller * ctrl, struct pci_func * func, |
2262 | u8 behind_bridge, struct resource_lists * resources) | 2262 | u8 behind_bridge, struct resource_lists * resources) |
@@ -2346,15 +2346,13 @@ static u32 configure_new_device(struct controller * ctrl, struct pci_func * func | |||
2346 | 2346 | ||
2347 | /** | 2347 | /** |
2348 | * configure_new_function - Configures the PCI header information of one device | 2348 | * configure_new_function - Configures the PCI header information of one device |
2349 | * | ||
2350 | * @ctrl: pointer to controller structure | 2349 | * @ctrl: pointer to controller structure |
2351 | * @func: pointer to function structure | 2350 | * @func: pointer to function structure |
2352 | * @behind_bridge: 1 if this is a recursive call, 0 if not | 2351 | * @behind_bridge: 1 if this is a recursive call, 0 if not |
2353 | * @resources: pointer to set of resource lists | 2352 | * @resources: pointer to set of resource lists |
2354 | * | 2353 | * |
2355 | * Calls itself recursively for bridged devices. | 2354 | * Calls itself recursively for bridged devices. |
2356 | * Returns 0 if success | 2355 | * Returns 0 if success. |
2357 | * | ||
2358 | */ | 2356 | */ |
2359 | static int configure_new_function(struct controller *ctrl, struct pci_func *func, | 2357 | static int configure_new_function(struct controller *ctrl, struct pci_func *func, |
2360 | u8 behind_bridge, | 2358 | u8 behind_bridge, |
diff --git a/drivers/pci/hotplug/fakephp.c b/drivers/pci/hotplug/fakephp.c index 027f6865d7e3..d7a293e3faf5 100644 --- a/drivers/pci/hotplug/fakephp.c +++ b/drivers/pci/hotplug/fakephp.c | |||
@@ -165,11 +165,11 @@ static void remove_slot(struct dummy_slot *dslot) | |||
165 | } | 165 | } |
166 | 166 | ||
167 | /** | 167 | /** |
168 | * Rescan slot. | 168 | * pci_rescan_slot - Rescan slot |
169 | * Tries hard not to re-enable already existing devices | 169 | * @temp: Device template. Should be set: bus and devfn. |
170 | * also handles scanning of subfunctions | ||
171 | * | 170 | * |
172 | * @param temp Device template. Should be set: bus and devfn. | 171 | * Tries hard not to re-enable already existing devices; |
172 | * also handles scanning of subfunctions. | ||
173 | */ | 173 | */ |
174 | static void pci_rescan_slot(struct pci_dev *temp) | 174 | static void pci_rescan_slot(struct pci_dev *temp) |
175 | { | 175 | { |
@@ -229,10 +229,10 @@ static void pci_rescan_slot(struct pci_dev *temp) | |||
229 | 229 | ||
230 | 230 | ||
231 | /** | 231 | /** |
232 | * Rescan PCI bus. | 232 | * pci_rescan_bus - Rescan PCI bus |
233 | * call pci_rescan_slot for each possible function of the bus | 233 | * @bus: the PCI bus to rescan |
234 | * | 234 | * |
235 | * @param bus | 235 | * Call pci_rescan_slot for each possible function of the bus. |
236 | */ | 236 | */ |
237 | static void pci_rescan_bus(const struct pci_bus *bus) | 237 | static void pci_rescan_bus(const struct pci_bus *bus) |
238 | { | 238 | { |
diff --git a/drivers/pci/hotplug/pciehp_ctrl.c b/drivers/pci/hotplug/pciehp_ctrl.c index c8cb49c5a752..f1e0966cee95 100644 --- a/drivers/pci/hotplug/pciehp_ctrl.c +++ b/drivers/pci/hotplug/pciehp_ctrl.c | |||
@@ -208,10 +208,10 @@ static void set_slot_off(struct controller *ctrl, struct slot * pslot) | |||
208 | 208 | ||
209 | /** | 209 | /** |
210 | * board_added - Called after a board has been added to the system. | 210 | * board_added - Called after a board has been added to the system. |
211 | * @p_slot: &slot where board is added | ||
211 | * | 212 | * |
212 | * Turns power on for the board | 213 | * Turns power on for the board. |
213 | * Configures board | 214 | * Configures board. |
214 | * | ||
215 | */ | 215 | */ |
216 | static int board_added(struct slot *p_slot) | 216 | static int board_added(struct slot *p_slot) |
217 | { | 217 | { |
@@ -276,8 +276,8 @@ err_exit: | |||
276 | } | 276 | } |
277 | 277 | ||
278 | /** | 278 | /** |
279 | * remove_board - Turns off slot and LED's | 279 | * remove_board - Turns off slot and LEDs |
280 | * | 280 | * @p_slot: slot where board is being removed |
281 | */ | 281 | */ |
282 | static int remove_board(struct slot *p_slot) | 282 | static int remove_board(struct slot *p_slot) |
283 | { | 283 | { |
@@ -319,11 +319,11 @@ struct power_work_info { | |||
319 | }; | 319 | }; |
320 | 320 | ||
321 | /** | 321 | /** |
322 | * pciehp_pushbutton_thread | 322 | * pciehp_power_thread - handle pushbutton events |
323 | * @work: &struct work_struct describing work to be done | ||
323 | * | 324 | * |
324 | * Scheduled procedure to handle blocking stuff for the pushbuttons | 325 | * Scheduled procedure to handle blocking stuff for the pushbuttons. |
325 | * Handles all pending events and exits. | 326 | * Handles all pending events and exits. |
326 | * | ||
327 | */ | 327 | */ |
328 | static void pciehp_power_thread(struct work_struct *work) | 328 | static void pciehp_power_thread(struct work_struct *work) |
329 | { | 329 | { |
diff --git a/drivers/pci/hotplug/rpadlpar_core.c b/drivers/pci/hotplug/rpadlpar_core.c index deb6b5e35feb..b169b0e2647f 100644 --- a/drivers/pci/hotplug/rpadlpar_core.c +++ b/drivers/pci/hotplug/rpadlpar_core.c | |||
@@ -100,6 +100,7 @@ static struct device_node *find_dlpar_node(char *drc_name, int *node_type) | |||
100 | 100 | ||
101 | /** | 101 | /** |
102 | * find_php_slot - return hotplug slot structure for device node | 102 | * find_php_slot - return hotplug slot structure for device node |
103 | * @dn: target &device_node | ||
103 | * | 104 | * |
104 | * This routine will return the hotplug slot structure | 105 | * This routine will return the hotplug slot structure |
105 | * for a given device node. Note that built-in PCI slots | 106 | * for a given device node. Note that built-in PCI slots |
@@ -293,9 +294,8 @@ static int dlpar_add_vio_slot(char *drc_name, struct device_node *dn) | |||
293 | * dlpar_add_slot - DLPAR add an I/O Slot | 294 | * dlpar_add_slot - DLPAR add an I/O Slot |
294 | * @drc_name: drc-name of newly added slot | 295 | * @drc_name: drc-name of newly added slot |
295 | * | 296 | * |
296 | * Make the hotplug module and the kernel aware | 297 | * Make the hotplug module and the kernel aware of a newly added I/O Slot. |
297 | * of a newly added I/O Slot. | 298 | * Return Codes: |
298 | * Return Codes - | ||
299 | * 0 Success | 299 | * 0 Success |
300 | * -ENODEV Not a valid drc_name | 300 | * -ENODEV Not a valid drc_name |
301 | * -EINVAL Slot already added | 301 | * -EINVAL Slot already added |
@@ -339,9 +339,9 @@ exit: | |||
339 | /** | 339 | /** |
340 | * dlpar_remove_vio_slot - DLPAR remove a virtual I/O Slot | 340 | * dlpar_remove_vio_slot - DLPAR remove a virtual I/O Slot |
341 | * @drc_name: drc-name of newly added slot | 341 | * @drc_name: drc-name of newly added slot |
342 | * @dn: &device_node | ||
342 | * | 343 | * |
343 | * Remove the kernel and hotplug representations | 344 | * Remove the kernel and hotplug representations of an I/O Slot. |
344 | * of an I/O Slot. | ||
345 | * Return Codes: | 345 | * Return Codes: |
346 | * 0 Success | 346 | * 0 Success |
347 | * -EINVAL Vio dev doesn't exist | 347 | * -EINVAL Vio dev doesn't exist |
@@ -359,11 +359,11 @@ static int dlpar_remove_vio_slot(char *drc_name, struct device_node *dn) | |||
359 | } | 359 | } |
360 | 360 | ||
361 | /** | 361 | /** |
362 | * dlpar_remove_slot - DLPAR remove a PCI I/O Slot | 362 | * dlpar_remove_pci_slot - DLPAR remove a PCI I/O Slot |
363 | * @drc_name: drc-name of newly added slot | 363 | * @drc_name: drc-name of newly added slot |
364 | * @dn: &device_node | ||
364 | * | 365 | * |
365 | * Remove the kernel and hotplug representations | 366 | * Remove the kernel and hotplug representations of a PCI I/O Slot. |
366 | * of a PCI I/O Slot. | ||
367 | * Return Codes: | 367 | * Return Codes: |
368 | * 0 Success | 368 | * 0 Success |
369 | * -ENODEV Not a valid drc_name | 369 | * -ENODEV Not a valid drc_name |
@@ -405,8 +405,7 @@ int dlpar_remove_pci_slot(char *drc_name, struct device_node *dn) | |||
405 | * dlpar_remove_slot - DLPAR remove an I/O Slot | 405 | * dlpar_remove_slot - DLPAR remove an I/O Slot |
406 | * @drc_name: drc-name of newly added slot | 406 | * @drc_name: drc-name of newly added slot |
407 | * | 407 | * |
408 | * Remove the kernel and hotplug representations | 408 | * Remove the kernel and hotplug representations of an I/O Slot. |
409 | * of an I/O Slot. | ||
410 | * Return Codes: | 409 | * Return Codes: |
411 | * 0 Success | 410 | * 0 Success |
412 | * -ENODEV Not a valid drc_name | 411 | * -ENODEV Not a valid drc_name |
diff --git a/drivers/pci/hotplug/rpaphp_core.c b/drivers/pci/hotplug/rpaphp_core.c index 458c08ef2654..58f1a9927709 100644 --- a/drivers/pci/hotplug/rpaphp_core.c +++ b/drivers/pci/hotplug/rpaphp_core.c | |||
@@ -54,10 +54,12 @@ module_param(debug, bool, 0644); | |||
54 | 54 | ||
55 | /** | 55 | /** |
56 | * set_attention_status - set attention LED | 56 | * set_attention_status - set attention LED |
57 | * @hotplug_slot: target &hotplug_slot | ||
58 | * @value: LED control value | ||
59 | * | ||
57 | * echo 0 > attention -- set LED OFF | 60 | * echo 0 > attention -- set LED OFF |
58 | * echo 1 > attention -- set LED ON | 61 | * echo 1 > attention -- set LED ON |
59 | * echo 2 > attention -- set LED ID(identify, light is blinking) | 62 | * echo 2 > attention -- set LED ID(identify, light is blinking) |
60 | * | ||
61 | */ | 63 | */ |
62 | static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value) | 64 | static int set_attention_status(struct hotplug_slot *hotplug_slot, u8 value) |
63 | { | 65 | { |
@@ -99,6 +101,8 @@ static int get_power_status(struct hotplug_slot *hotplug_slot, u8 * value) | |||
99 | 101 | ||
100 | /** | 102 | /** |
101 | * get_attention_status - get attention LED status | 103 | * get_attention_status - get attention LED status |
104 | * @hotplug_slot: slot to get status | ||
105 | * @value: pointer to store status | ||
102 | */ | 106 | */ |
103 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) | 107 | static int get_attention_status(struct hotplug_slot *hotplug_slot, u8 * value) |
104 | { | 108 | { |
@@ -254,6 +258,11 @@ static int is_php_type(char *drc_type) | |||
254 | 258 | ||
255 | /** | 259 | /** |
256 | * is_php_dn() - return 1 if this is a hotpluggable pci slot, else 0 | 260 | * is_php_dn() - return 1 if this is a hotpluggable pci slot, else 0 |
261 | * @dn: target &device_node | ||
262 | * @indexes: passed to get_children_props() | ||
263 | * @names: passed to get_children_props() | ||
264 | * @types: returned from get_children_props() | ||
265 | * @power_domains: | ||
257 | * | 266 | * |
258 | * This routine will return true only if the device node is | 267 | * This routine will return true only if the device node is |
259 | * a hotpluggable slot. This routine will return false | 268 | * a hotpluggable slot. This routine will return false |
@@ -279,7 +288,7 @@ static int is_php_dn(struct device_node *dn, const int **indexes, | |||
279 | 288 | ||
280 | /** | 289 | /** |
281 | * rpaphp_add_slot -- declare a hotplug slot to the hotplug subsystem. | 290 | * rpaphp_add_slot -- declare a hotplug slot to the hotplug subsystem. |
282 | * @dn device node of slot | 291 | * @dn: device node of slot |
283 | * | 292 | * |
284 | * This subroutine will register a hotplugable slot with the | 293 | * This subroutine will register a hotplugable slot with the |
285 | * PCI hotplug infrastructure. This routine is typicaly called | 294 | * PCI hotplug infrastructure. This routine is typicaly called |
@@ -291,7 +300,7 @@ static int is_php_dn(struct device_node *dn, const int **indexes, | |||
291 | * routine will just return without doing anything, since embedded | 300 | * routine will just return without doing anything, since embedded |
292 | * slots cannot be hotplugged. | 301 | * slots cannot be hotplugged. |
293 | * | 302 | * |
294 | * To remove a slot, it suffices to call rpaphp_deregister_slot() | 303 | * To remove a slot, it suffices to call rpaphp_deregister_slot(). |
295 | */ | 304 | */ |
296 | int rpaphp_add_slot(struct device_node *dn) | 305 | int rpaphp_add_slot(struct device_node *dn) |
297 | { | 306 | { |
diff --git a/drivers/pci/hotplug/rpaphp_pci.c b/drivers/pci/hotplug/rpaphp_pci.c index 54ca8650d511..0de84533cd80 100644 --- a/drivers/pci/hotplug/rpaphp_pci.c +++ b/drivers/pci/hotplug/rpaphp_pci.c | |||
@@ -79,6 +79,7 @@ static void set_slot_name(struct slot *slot) | |||
79 | 79 | ||
80 | /** | 80 | /** |
81 | * rpaphp_enable_slot - record slot state, config pci device | 81 | * rpaphp_enable_slot - record slot state, config pci device |
82 | * @slot: target &slot | ||
82 | * | 83 | * |
83 | * Initialize values in the slot, and the hotplug_slot info | 84 | * Initialize values in the slot, and the hotplug_slot info |
84 | * structures to indicate if there is a pci card plugged into | 85 | * structures to indicate if there is a pci card plugged into |
diff --git a/drivers/pci/hotplug/shpchp_ctrl.c b/drivers/pci/hotplug/shpchp_ctrl.c index d2fc35598cdd..eb5cac6f08ae 100644 --- a/drivers/pci/hotplug/shpchp_ctrl.c +++ b/drivers/pci/hotplug/shpchp_ctrl.c | |||
@@ -231,10 +231,10 @@ static int fix_bus_speed(struct controller *ctrl, struct slot *pslot, | |||
231 | 231 | ||
232 | /** | 232 | /** |
233 | * board_added - Called after a board has been added to the system. | 233 | * board_added - Called after a board has been added to the system. |
234 | * @p_slot: target &slot | ||
234 | * | 235 | * |
235 | * Turns power on for the board | 236 | * Turns power on for the board. |
236 | * Configures board | 237 | * Configures board. |
237 | * | ||
238 | */ | 238 | */ |
239 | static int board_added(struct slot *p_slot) | 239 | static int board_added(struct slot *p_slot) |
240 | { | 240 | { |
@@ -350,8 +350,8 @@ err_exit: | |||
350 | 350 | ||
351 | 351 | ||
352 | /** | 352 | /** |
353 | * remove_board - Turns off slot and LED's | 353 | * remove_board - Turns off slot and LEDs |
354 | * | 354 | * @p_slot: target &slot |
355 | */ | 355 | */ |
356 | static int remove_board(struct slot *p_slot) | 356 | static int remove_board(struct slot *p_slot) |
357 | { | 357 | { |
@@ -397,11 +397,11 @@ struct pushbutton_work_info { | |||
397 | }; | 397 | }; |
398 | 398 | ||
399 | /** | 399 | /** |
400 | * shpchp_pushbutton_thread | 400 | * shpchp_pushbutton_thread - handle pushbutton events |
401 | * @work: &struct work_struct to be handled | ||
401 | * | 402 | * |
402 | * Scheduled procedure to handle blocking stuff for the pushbuttons | 403 | * Scheduled procedure to handle blocking stuff for the pushbuttons. |
403 | * Handles all pending events and exits. | 404 | * Handles all pending events and exits. |
404 | * | ||
405 | */ | 405 | */ |
406 | static void shpchp_pushbutton_thread(struct work_struct *work) | 406 | static void shpchp_pushbutton_thread(struct work_struct *work) |
407 | { | 407 | { |
diff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c index 1b7b2812bf2d..7d1877341aad 100644 --- a/drivers/pci/pci-sysfs.c +++ b/drivers/pci/pci-sysfs.c | |||
@@ -702,8 +702,10 @@ static int __init pci_sysfs_init(void) | |||
702 | sysfs_initialized = 1; | 702 | sysfs_initialized = 1; |
703 | for_each_pci_dev(pdev) { | 703 | for_each_pci_dev(pdev) { |
704 | retval = pci_create_sysfs_dev_files(pdev); | 704 | retval = pci_create_sysfs_dev_files(pdev); |
705 | if (retval) | 705 | if (retval) { |
706 | pci_dev_put(pdev); | ||
706 | return retval; | 707 | return retval; |
708 | } | ||
707 | } | 709 | } |
708 | 710 | ||
709 | return 0; | 711 | return 0; |
diff --git a/drivers/pci/pcie/aer/aerdrv_core.c b/drivers/pci/pcie/aer/aerdrv_core.c index 92a8469b21ba..3c0d8d138f5a 100644 --- a/drivers/pci/pcie/aer/aerdrv_core.c +++ b/drivers/pci/pcie/aer/aerdrv_core.c | |||
@@ -168,11 +168,11 @@ static int find_device_iter(struct device *device, void *data) | |||
168 | 168 | ||
169 | /** | 169 | /** |
170 | * find_source_device - search through device hierarchy for source device | 170 | * find_source_device - search through device hierarchy for source device |
171 | * @p_dev: pointer to Root Port pci_dev data structure | 171 | * @parent: pointer to Root Port pci_dev data structure |
172 | * @id: device ID of agent who sends an error message to this Root Port | 172 | * @id: device ID of agent who sends an error message to this Root Port |
173 | * | 173 | * |
174 | * Invoked when error is detected at the Root Port. | 174 | * Invoked when error is detected at the Root Port. |
175 | **/ | 175 | */ |
176 | static struct device* find_source_device(struct pci_dev *parent, u16 id) | 176 | static struct device* find_source_device(struct pci_dev *parent, u16 id) |
177 | { | 177 | { |
178 | struct pci_dev *dev = parent; | 178 | struct pci_dev *dev = parent; |
@@ -286,14 +286,15 @@ static void report_resume(struct pci_dev *dev, void *data) | |||
286 | 286 | ||
287 | /** | 287 | /** |
288 | * broadcast_error_message - handle message broadcast to downstream drivers | 288 | * broadcast_error_message - handle message broadcast to downstream drivers |
289 | * @device: pointer to from where in a hierarchy message is broadcasted down | 289 | * @dev: pointer to from where in a hierarchy message is broadcasted down |
290 | * @api: callback to be broadcasted | ||
291 | * @state: error state | 290 | * @state: error state |
291 | * @error_mesg: message to print | ||
292 | * @cb: callback to be broadcasted | ||
292 | * | 293 | * |
293 | * Invoked during error recovery process. Once being invoked, the content | 294 | * Invoked during error recovery process. Once being invoked, the content |
294 | * of error severity will be broadcasted to all downstream drivers in a | 295 | * of error severity will be broadcasted to all downstream drivers in a |
295 | * hierarchy in question. | 296 | * hierarchy in question. |
296 | **/ | 297 | */ |
297 | static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, | 298 | static pci_ers_result_t broadcast_error_message(struct pci_dev *dev, |
298 | enum pci_channel_state state, | 299 | enum pci_channel_state state, |
299 | char *error_mesg, | 300 | char *error_mesg, |
@@ -428,7 +429,7 @@ static pci_ers_result_t reset_link(struct pcie_device *aerdev, | |||
428 | * Invoked when an error is nonfatal/fatal. Once being invoked, broadcast | 429 | * Invoked when an error is nonfatal/fatal. Once being invoked, broadcast |
429 | * error detected message to all downstream drivers within a hierarchy in | 430 | * error detected message to all downstream drivers within a hierarchy in |
430 | * question and return the returned code. | 431 | * question and return the returned code. |
431 | **/ | 432 | */ |
432 | static pci_ers_result_t do_recovery(struct pcie_device *aerdev, | 433 | static pci_ers_result_t do_recovery(struct pcie_device *aerdev, |
433 | struct pci_dev *dev, | 434 | struct pci_dev *dev, |
434 | int severity) | 435 | int severity) |
@@ -488,7 +489,7 @@ static pci_ers_result_t do_recovery(struct pcie_device *aerdev, | |||
488 | * @info: comprehensive error information | 489 | * @info: comprehensive error information |
489 | * | 490 | * |
490 | * Invoked when an error being detected by Root Port. | 491 | * Invoked when an error being detected by Root Port. |
491 | **/ | 492 | */ |
492 | static void handle_error_source(struct pcie_device * aerdev, | 493 | static void handle_error_source(struct pcie_device * aerdev, |
493 | struct pci_dev *dev, | 494 | struct pci_dev *dev, |
494 | struct aer_err_info info) | 495 | struct aer_err_info info) |
@@ -521,7 +522,7 @@ static void handle_error_source(struct pcie_device * aerdev, | |||
521 | * @rpc: pointer to a Root Port data structure | 522 | * @rpc: pointer to a Root Port data structure |
522 | * | 523 | * |
523 | * Invoked when PCIE bus loads AER service driver. | 524 | * Invoked when PCIE bus loads AER service driver. |
524 | **/ | 525 | */ |
525 | void aer_enable_rootport(struct aer_rpc *rpc) | 526 | void aer_enable_rootport(struct aer_rpc *rpc) |
526 | { | 527 | { |
527 | struct pci_dev *pdev = rpc->rpd->port; | 528 | struct pci_dev *pdev = rpc->rpd->port; |
@@ -569,7 +570,7 @@ void aer_enable_rootport(struct aer_rpc *rpc) | |||
569 | * @rpc: pointer to a Root Port data structure | 570 | * @rpc: pointer to a Root Port data structure |
570 | * | 571 | * |
571 | * Invoked when PCIE bus unloads AER service driver. | 572 | * Invoked when PCIE bus unloads AER service driver. |
572 | **/ | 573 | */ |
573 | static void disable_root_aer(struct aer_rpc *rpc) | 574 | static void disable_root_aer(struct aer_rpc *rpc) |
574 | { | 575 | { |
575 | struct pci_dev *pdev = rpc->rpd->port; | 576 | struct pci_dev *pdev = rpc->rpd->port; |
@@ -590,7 +591,7 @@ static void disable_root_aer(struct aer_rpc *rpc) | |||
590 | * @rpc: pointer to the root port which holds an error | 591 | * @rpc: pointer to the root port which holds an error |
591 | * | 592 | * |
592 | * Invoked by DPC handler to consume an error. | 593 | * Invoked by DPC handler to consume an error. |
593 | **/ | 594 | */ |
594 | static struct aer_err_source* get_e_source(struct aer_rpc *rpc) | 595 | static struct aer_err_source* get_e_source(struct aer_rpc *rpc) |
595 | { | 596 | { |
596 | struct aer_err_source *e_source; | 597 | struct aer_err_source *e_source; |
@@ -655,7 +656,7 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info) | |||
655 | * aer_isr_one_error - consume an error detected by root port | 656 | * aer_isr_one_error - consume an error detected by root port |
656 | * @p_device: pointer to error root port service device | 657 | * @p_device: pointer to error root port service device |
657 | * @e_src: pointer to an error source | 658 | * @e_src: pointer to an error source |
658 | **/ | 659 | */ |
659 | static void aer_isr_one_error(struct pcie_device *p_device, | 660 | static void aer_isr_one_error(struct pcie_device *p_device, |
660 | struct aer_err_source *e_src) | 661 | struct aer_err_source *e_src) |
661 | { | 662 | { |
@@ -706,7 +707,7 @@ static void aer_isr_one_error(struct pcie_device *p_device, | |||
706 | * @work: definition of this work item | 707 | * @work: definition of this work item |
707 | * | 708 | * |
708 | * Invoked, as DPC, when root port records new detected error | 709 | * Invoked, as DPC, when root port records new detected error |
709 | **/ | 710 | */ |
710 | void aer_isr(struct work_struct *work) | 711 | void aer_isr(struct work_struct *work) |
711 | { | 712 | { |
712 | struct aer_rpc *rpc = container_of(work, struct aer_rpc, dpc_handler); | 713 | struct aer_rpc *rpc = container_of(work, struct aer_rpc, dpc_handler); |
@@ -729,7 +730,7 @@ void aer_isr(struct work_struct *work) | |||
729 | * @rpc: pointer to a root port device being deleted | 730 | * @rpc: pointer to a root port device being deleted |
730 | * | 731 | * |
731 | * Invoked when AER service unloaded on a specific Root Port | 732 | * Invoked when AER service unloaded on a specific Root Port |
732 | **/ | 733 | */ |
733 | void aer_delete_rootport(struct aer_rpc *rpc) | 734 | void aer_delete_rootport(struct aer_rpc *rpc) |
734 | { | 735 | { |
735 | /* Disable root port AER itself */ | 736 | /* Disable root port AER itself */ |
@@ -743,7 +744,7 @@ void aer_delete_rootport(struct aer_rpc *rpc) | |||
743 | * @dev: pointer to AER pcie device | 744 | * @dev: pointer to AER pcie device |
744 | * | 745 | * |
745 | * Invoked when AER service driver is loaded. | 746 | * Invoked when AER service driver is loaded. |
746 | **/ | 747 | */ |
747 | int aer_init(struct pcie_device *dev) | 748 | int aer_init(struct pcie_device *dev) |
748 | { | 749 | { |
749 | if (aer_osc_setup(dev) && !forceload) | 750 | if (aer_osc_setup(dev) && !forceload) |
diff --git a/drivers/pci/pcie/portdrv_pci.c b/drivers/pci/pcie/portdrv_pci.c index df383645e366..26057f98f72e 100644 --- a/drivers/pci/pcie/portdrv_pci.c +++ b/drivers/pci/pcie/portdrv_pci.c | |||
@@ -217,7 +217,7 @@ static int slot_reset_iter(struct device *device, void *data) | |||
217 | 217 | ||
218 | static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev) | 218 | static pci_ers_result_t pcie_portdrv_slot_reset(struct pci_dev *dev) |
219 | { | 219 | { |
220 | pci_ers_result_t status; | 220 | pci_ers_result_t status = PCI_ERS_RESULT_NONE; |
221 | int retval; | 221 | int retval; |
222 | 222 | ||
223 | /* If fatal, restore cfg space for possible link reset at upstream */ | 223 | /* If fatal, restore cfg space for possible link reset at upstream */ |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index cd0a204d96d1..3c5eb374adf8 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -75,6 +75,7 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, | |||
75 | { | 75 | { |
76 | int i = 0; | 76 | int i = 0; |
77 | int irq; | 77 | int irq; |
78 | int p, t; | ||
78 | 79 | ||
79 | if (!valid_IRQ(gsi)) | 80 | if (!valid_IRQ(gsi)) |
80 | return; | 81 | return; |
@@ -82,18 +83,27 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, | |||
82 | while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && | 83 | while (!(res->irq_resource[i].flags & IORESOURCE_UNSET) && |
83 | i < PNP_MAX_IRQ) | 84 | i < PNP_MAX_IRQ) |
84 | i++; | 85 | i++; |
85 | if (i >= PNP_MAX_IRQ) | 86 | if (i >= PNP_MAX_IRQ) { |
87 | printk(KERN_ERR "pnpacpi: exceeded the max number of IRQ " | ||
88 | "resources: %d \n", PNP_MAX_IRQ); | ||
86 | return; | 89 | return; |
87 | |||
88 | #ifdef CONFIG_X86 | ||
89 | if (gsi < 16 && (triggering != ACPI_EDGE_SENSITIVE || | ||
90 | polarity != ACPI_ACTIVE_HIGH)) { | ||
91 | pnp_warn("BIOS BUG: legacy PNP IRQ %d should be edge trigger, " | ||
92 | "active high", gsi); | ||
93 | triggering = ACPI_EDGE_SENSITIVE; | ||
94 | polarity = ACPI_ACTIVE_HIGH; | ||
95 | } | 90 | } |
96 | #endif | 91 | /* |
92 | * in IO-APIC mode, use overrided attribute. Two reasons: | ||
93 | * 1. BIOS bug in DSDT | ||
94 | * 2. BIOS uses IO-APIC mode Interrupt Source Override | ||
95 | */ | ||
96 | if (!acpi_get_override_irq(gsi, &t, &p)) { | ||
97 | t = t ? ACPI_LEVEL_SENSITIVE : ACPI_EDGE_SENSITIVE; | ||
98 | p = p ? ACPI_ACTIVE_LOW : ACPI_ACTIVE_HIGH; | ||
99 | |||
100 | if (triggering != t || polarity != p) { | ||
101 | pnp_warn("IRQ %d override to %s, %s", | ||
102 | gsi, t ? "edge":"level", p ? "low":"high"); | ||
103 | triggering = t; | ||
104 | polarity = p; | ||
105 | } | ||
106 | } | ||
97 | 107 | ||
98 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag | 108 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag |
99 | res->irq_resource[i].flags |= irq_flags(triggering, polarity); | 109 | res->irq_resource[i].flags |= irq_flags(triggering, polarity); |
@@ -173,6 +183,9 @@ static void pnpacpi_parse_allocated_dmaresource(struct pnp_resource_table *res, | |||
173 | } | 183 | } |
174 | res->dma_resource[i].start = dma; | 184 | res->dma_resource[i].start = dma; |
175 | res->dma_resource[i].end = dma; | 185 | res->dma_resource[i].end = dma; |
186 | } else { | ||
187 | printk(KERN_ERR "pnpacpi: exceeded the max number of DMA " | ||
188 | "resources: %d \n", PNP_MAX_DMA); | ||
176 | } | 189 | } |
177 | } | 190 | } |
178 | 191 | ||
@@ -194,6 +207,9 @@ static void pnpacpi_parse_allocated_ioresource(struct pnp_resource_table *res, | |||
194 | } | 207 | } |
195 | res->port_resource[i].start = io; | 208 | res->port_resource[i].start = io; |
196 | res->port_resource[i].end = io + len - 1; | 209 | res->port_resource[i].end = io + len - 1; |
210 | } else { | ||
211 | printk(KERN_ERR "pnpacpi: exceeded the max number of IO " | ||
212 | "resources: %d \n", PNP_MAX_PORT); | ||
197 | } | 213 | } |
198 | } | 214 | } |
199 | 215 | ||
@@ -217,6 +233,9 @@ static void pnpacpi_parse_allocated_memresource(struct pnp_resource_table *res, | |||
217 | 233 | ||
218 | res->mem_resource[i].start = mem; | 234 | res->mem_resource[i].start = mem; |
219 | res->mem_resource[i].end = mem + len - 1; | 235 | res->mem_resource[i].end = mem + len - 1; |
236 | } else { | ||
237 | printk(KERN_ERR "pnpacpi: exceeded the max number of mem " | ||
238 | "resources: %d\n", PNP_MAX_MEM); | ||
220 | } | 239 | } |
221 | } | 240 | } |
222 | 241 | ||
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index 41d73a5e9312..e50ebcffb962 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
@@ -367,8 +367,10 @@ int pnp_check_irq(struct pnp_dev *dev, int idx) | |||
367 | { | 367 | { |
368 | struct pci_dev *pci = NULL; | 368 | struct pci_dev *pci = NULL; |
369 | for_each_pci_dev(pci) { | 369 | for_each_pci_dev(pci) { |
370 | if (pci->irq == *irq) | 370 | if (pci->irq == *irq) { |
371 | pci_dev_put(pci); | ||
371 | return 0; | 372 | return 0; |
373 | } | ||
372 | } | 374 | } |
373 | } | 375 | } |
374 | #endif | 376 | #endif |
diff --git a/drivers/ps3/Makefile b/drivers/ps3/Makefile index 746031de2195..1f5a2d33bf5b 100644 --- a/drivers/ps3/Makefile +++ b/drivers/ps3/Makefile | |||
@@ -1,6 +1,6 @@ | |||
1 | obj-$(CONFIG_PS3_VUART) += vuart.o | 1 | obj-$(CONFIG_PS3_VUART) += ps3-vuart.o |
2 | obj-$(CONFIG_PS3_PS3AV) += ps3av_mod.o | 2 | obj-$(CONFIG_PS3_PS3AV) += ps3av_mod.o |
3 | ps3av_mod-objs += ps3av.o ps3av_cmd.o | 3 | ps3av_mod-objs += ps3av.o ps3av_cmd.o |
4 | obj-$(CONFIG_PPC_PS3) += sys-manager-core.o | 4 | obj-$(CONFIG_PPC_PS3) += sys-manager-core.o |
5 | obj-$(CONFIG_PS3_SYS_MANAGER) += sys-manager.o | 5 | obj-$(CONFIG_PS3_SYS_MANAGER) += ps3-sys-manager.o |
6 | obj-$(CONFIG_PS3_STORAGE) += ps3stor_lib.o | 6 | obj-$(CONFIG_PS3_STORAGE) += ps3stor_lib.o |
diff --git a/drivers/ps3/sys-manager.c b/drivers/ps3/ps3-sys-manager.c index 8461b08ab9fb..8461b08ab9fb 100644 --- a/drivers/ps3/sys-manager.c +++ b/drivers/ps3/ps3-sys-manager.c | |||
diff --git a/drivers/ps3/vuart.c b/drivers/ps3/ps3-vuart.c index 9dea585ef806..9dea585ef806 100644 --- a/drivers/ps3/vuart.c +++ b/drivers/ps3/ps3-vuart.c | |||
diff --git a/drivers/rtc/Kconfig b/drivers/rtc/Kconfig index e5cdc0294aaa..1e6715ec51ef 100644 --- a/drivers/rtc/Kconfig +++ b/drivers/rtc/Kconfig | |||
@@ -447,7 +447,7 @@ config RTC_DRV_AT91RM9200 | |||
447 | 447 | ||
448 | config RTC_DRV_BFIN | 448 | config RTC_DRV_BFIN |
449 | tristate "Blackfin On-Chip RTC" | 449 | tristate "Blackfin On-Chip RTC" |
450 | depends on BFIN | 450 | depends on BLACKFIN |
451 | help | 451 | help |
452 | If you say yes here you will get support for the | 452 | If you say yes here you will get support for the |
453 | Blackfin On-Chip Real Time Clock. | 453 | Blackfin On-Chip Real Time Clock. |
diff --git a/drivers/rtc/interface.c b/drivers/rtc/interface.c index de0da545c7a1..a4f56e95cf96 100644 --- a/drivers/rtc/interface.c +++ b/drivers/rtc/interface.c | |||
@@ -293,7 +293,7 @@ int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task) | |||
293 | return -EINVAL; | 293 | return -EINVAL; |
294 | 294 | ||
295 | /* Cannot register while the char dev is in use */ | 295 | /* Cannot register while the char dev is in use */ |
296 | if (!(mutex_trylock(&rtc->char_lock))) | 296 | if (test_and_set_bit(RTC_DEV_BUSY, &rtc->flags)) |
297 | return -EBUSY; | 297 | return -EBUSY; |
298 | 298 | ||
299 | spin_lock_irq(&rtc->irq_task_lock); | 299 | spin_lock_irq(&rtc->irq_task_lock); |
@@ -303,7 +303,7 @@ int rtc_irq_register(struct rtc_device *rtc, struct rtc_task *task) | |||
303 | } | 303 | } |
304 | spin_unlock_irq(&rtc->irq_task_lock); | 304 | spin_unlock_irq(&rtc->irq_task_lock); |
305 | 305 | ||
306 | mutex_unlock(&rtc->char_lock); | 306 | clear_bit(RTC_DEV_BUSY, &rtc->flags); |
307 | 307 | ||
308 | return retval; | 308 | return retval; |
309 | } | 309 | } |
diff --git a/drivers/rtc/rtc-dev.c b/drivers/rtc/rtc-dev.c index 814583bd2fe7..ae1bf177d625 100644 --- a/drivers/rtc/rtc-dev.c +++ b/drivers/rtc/rtc-dev.c | |||
@@ -26,10 +26,7 @@ static int rtc_dev_open(struct inode *inode, struct file *file) | |||
26 | struct rtc_device, char_dev); | 26 | struct rtc_device, char_dev); |
27 | const struct rtc_class_ops *ops = rtc->ops; | 27 | const struct rtc_class_ops *ops = rtc->ops; |
28 | 28 | ||
29 | /* We keep the lock as long as the device is in use | 29 | if (test_and_set_bit(RTC_DEV_BUSY, &rtc->flags)) |
30 | * and return immediately if busy | ||
31 | */ | ||
32 | if (!(mutex_trylock(&rtc->char_lock))) | ||
33 | return -EBUSY; | 30 | return -EBUSY; |
34 | 31 | ||
35 | file->private_data = rtc; | 32 | file->private_data = rtc; |
@@ -43,8 +40,8 @@ static int rtc_dev_open(struct inode *inode, struct file *file) | |||
43 | return 0; | 40 | return 0; |
44 | } | 41 | } |
45 | 42 | ||
46 | /* something has gone wrong, release the lock */ | 43 | /* something has gone wrong */ |
47 | mutex_unlock(&rtc->char_lock); | 44 | clear_bit(RTC_DEV_BUSY, &rtc->flags); |
48 | return err; | 45 | return err; |
49 | } | 46 | } |
50 | 47 | ||
@@ -405,7 +402,7 @@ static int rtc_dev_release(struct inode *inode, struct file *file) | |||
405 | if (rtc->ops->release) | 402 | if (rtc->ops->release) |
406 | rtc->ops->release(rtc->dev.parent); | 403 | rtc->ops->release(rtc->dev.parent); |
407 | 404 | ||
408 | mutex_unlock(&rtc->char_lock); | 405 | clear_bit(RTC_DEV_BUSY, &rtc->flags); |
409 | return 0; | 406 | return 0; |
410 | } | 407 | } |
411 | 408 | ||
@@ -440,7 +437,6 @@ void rtc_dev_prepare(struct rtc_device *rtc) | |||
440 | 437 | ||
441 | rtc->dev.devt = MKDEV(MAJOR(rtc_devt), rtc->id); | 438 | rtc->dev.devt = MKDEV(MAJOR(rtc_devt), rtc->id); |
442 | 439 | ||
443 | mutex_init(&rtc->char_lock); | ||
444 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL | 440 | #ifdef CONFIG_RTC_INTF_DEV_UIE_EMUL |
445 | INIT_WORK(&rtc->uie_task, rtc_uie_task); | 441 | INIT_WORK(&rtc->uie_task, rtc_uie_task); |
446 | setup_timer(&rtc->uie_timer, rtc_uie_timer, (unsigned long)rtc); | 442 | setup_timer(&rtc->uie_timer, rtc_uie_timer, (unsigned long)rtc); |
diff --git a/drivers/s390/cio/css.c b/drivers/s390/cio/css.c index 838f7ac0dc32..6db31089d2d7 100644 --- a/drivers/s390/cio/css.c +++ b/drivers/s390/cio/css.c | |||
@@ -483,7 +483,7 @@ static DECLARE_WORK(css_reprobe_work, reprobe_all); | |||
483 | void css_schedule_reprobe(void) | 483 | void css_schedule_reprobe(void) |
484 | { | 484 | { |
485 | need_reprobe = 1; | 485 | need_reprobe = 1; |
486 | queue_work(ccw_device_work, &css_reprobe_work); | 486 | queue_work(slow_path_wq, &css_reprobe_work); |
487 | } | 487 | } |
488 | 488 | ||
489 | EXPORT_SYMBOL_GPL(css_schedule_reprobe); | 489 | EXPORT_SYMBOL_GPL(css_schedule_reprobe); |
diff --git a/drivers/s390/cio/device_fsm.c b/drivers/s390/cio/device_fsm.c index 8867443b8060..bfad421cda66 100644 --- a/drivers/s390/cio/device_fsm.c +++ b/drivers/s390/cio/device_fsm.c | |||
@@ -1034,7 +1034,7 @@ device_trigger_reprobe(struct subchannel *sch) | |||
1034 | if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) { | 1034 | if (sch->schib.pmcw.dev != cdev->private->dev_id.devno) { |
1035 | PREPARE_WORK(&cdev->private->kick_work, | 1035 | PREPARE_WORK(&cdev->private->kick_work, |
1036 | ccw_device_move_to_orphanage); | 1036 | ccw_device_move_to_orphanage); |
1037 | queue_work(ccw_device_work, &cdev->private->kick_work); | 1037 | queue_work(slow_path_wq, &cdev->private->kick_work); |
1038 | } else | 1038 | } else |
1039 | ccw_device_start_id(cdev, 0); | 1039 | ccw_device_start_id(cdev, 0); |
1040 | } | 1040 | } |
diff --git a/drivers/s390/cio/device_id.c b/drivers/s390/cio/device_id.c index f232832f2b22..2f6bf462425e 100644 --- a/drivers/s390/cio/device_id.c +++ b/drivers/s390/cio/device_id.c | |||
@@ -113,19 +113,10 @@ __ccw_device_sense_id_start(struct ccw_device *cdev) | |||
113 | { | 113 | { |
114 | struct subchannel *sch; | 114 | struct subchannel *sch; |
115 | struct ccw1 *ccw; | 115 | struct ccw1 *ccw; |
116 | int ret; | ||
117 | 116 | ||
118 | sch = to_subchannel(cdev->dev.parent); | 117 | sch = to_subchannel(cdev->dev.parent); |
119 | /* Setup sense channel program. */ | 118 | /* Setup sense channel program. */ |
120 | ccw = cdev->private->iccws; | 119 | ccw = cdev->private->iccws; |
121 | if (sch->schib.pmcw.pim != 0x80) { | ||
122 | /* more than one path installed. */ | ||
123 | ccw->cmd_code = CCW_CMD_SUSPEND_RECONN; | ||
124 | ccw->cda = 0; | ||
125 | ccw->count = 0; | ||
126 | ccw->flags = CCW_FLAG_SLI | CCW_FLAG_CC; | ||
127 | ccw++; | ||
128 | } | ||
129 | ccw->cmd_code = CCW_CMD_SENSE_ID; | 120 | ccw->cmd_code = CCW_CMD_SENSE_ID; |
130 | ccw->cda = (__u32) __pa (&cdev->private->senseid); | 121 | ccw->cda = (__u32) __pa (&cdev->private->senseid); |
131 | ccw->count = sizeof (struct senseid); | 122 | ccw->count = sizeof (struct senseid); |
@@ -133,25 +124,9 @@ __ccw_device_sense_id_start(struct ccw_device *cdev) | |||
133 | 124 | ||
134 | /* Reset device status. */ | 125 | /* Reset device status. */ |
135 | memset(&cdev->private->irb, 0, sizeof(struct irb)); | 126 | memset(&cdev->private->irb, 0, sizeof(struct irb)); |
127 | cdev->private->flags.intretry = 0; | ||
136 | 128 | ||
137 | /* Try on every path. */ | 129 | return cio_start(sch, ccw, LPM_ANYPATH); |
138 | ret = -ENODEV; | ||
139 | while (cdev->private->imask != 0) { | ||
140 | if ((sch->opm & cdev->private->imask) != 0 && | ||
141 | cdev->private->iretry > 0) { | ||
142 | cdev->private->iretry--; | ||
143 | /* Reset internal retry indication. */ | ||
144 | cdev->private->flags.intretry = 0; | ||
145 | ret = cio_start (sch, cdev->private->iccws, | ||
146 | cdev->private->imask); | ||
147 | /* ret is 0, -EBUSY, -EACCES or -ENODEV */ | ||
148 | if (ret != -EACCES) | ||
149 | return ret; | ||
150 | } | ||
151 | cdev->private->imask >>= 1; | ||
152 | cdev->private->iretry = 5; | ||
153 | } | ||
154 | return ret; | ||
155 | } | 130 | } |
156 | 131 | ||
157 | void | 132 | void |
@@ -161,8 +136,7 @@ ccw_device_sense_id_start(struct ccw_device *cdev) | |||
161 | 136 | ||
162 | memset (&cdev->private->senseid, 0, sizeof (struct senseid)); | 137 | memset (&cdev->private->senseid, 0, sizeof (struct senseid)); |
163 | cdev->private->senseid.cu_type = 0xFFFF; | 138 | cdev->private->senseid.cu_type = 0xFFFF; |
164 | cdev->private->imask = 0x80; | 139 | cdev->private->iretry = 3; |
165 | cdev->private->iretry = 5; | ||
166 | ret = __ccw_device_sense_id_start(cdev); | 140 | ret = __ccw_device_sense_id_start(cdev); |
167 | if (ret && ret != -EBUSY) | 141 | if (ret && ret != -EBUSY) |
168 | ccw_device_sense_id_done(cdev, ret); | 142 | ccw_device_sense_id_done(cdev, ret); |
@@ -278,14 +252,13 @@ ccw_device_sense_id_irq(struct ccw_device *cdev, enum dev_event dev_event) | |||
278 | ccw_device_sense_id_done(cdev, ret); | 252 | ccw_device_sense_id_done(cdev, ret); |
279 | break; | 253 | break; |
280 | case -EACCES: /* channel is not operational. */ | 254 | case -EACCES: /* channel is not operational. */ |
281 | sch->lpm &= ~cdev->private->imask; | ||
282 | cdev->private->imask >>= 1; | ||
283 | cdev->private->iretry = 5; | ||
284 | /* fall through. */ | ||
285 | case -EAGAIN: /* try again. */ | 255 | case -EAGAIN: /* try again. */ |
286 | ret = __ccw_device_sense_id_start(cdev); | 256 | cdev->private->iretry--; |
287 | if (ret == 0 || ret == -EBUSY) | 257 | if (cdev->private->iretry > 0) { |
288 | break; | 258 | ret = __ccw_device_sense_id_start(cdev); |
259 | if (ret == 0 || ret == -EBUSY) | ||
260 | break; | ||
261 | } | ||
289 | /* fall through. */ | 262 | /* fall through. */ |
290 | default: /* Sense ID failed. Try asking VM. */ | 263 | default: /* Sense ID failed. Try asking VM. */ |
291 | if (MACHINE_IS_VM) { | 264 | if (MACHINE_IS_VM) { |
diff --git a/drivers/scsi/ide-scsi.c b/drivers/scsi/ide-scsi.c index 8d0244c2e7d4..7a835a35f21d 100644 --- a/drivers/scsi/ide-scsi.c +++ b/drivers/scsi/ide-scsi.c | |||
@@ -242,16 +242,6 @@ static void idescsi_output_buffers (ide_drive_t *drive, idescsi_pc_t *pc, unsign | |||
242 | } | 242 | } |
243 | } | 243 | } |
244 | 244 | ||
245 | static void hexdump(u8 *x, int len) | ||
246 | { | ||
247 | int i; | ||
248 | |||
249 | printk("[ "); | ||
250 | for (i = 0; i < len; i++) | ||
251 | printk("%x ", x[i]); | ||
252 | printk("]\n"); | ||
253 | } | ||
254 | |||
255 | static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command) | 245 | static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_command) |
256 | { | 246 | { |
257 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); | 247 | idescsi_scsi_t *scsi = drive_to_idescsi(drive); |
@@ -282,7 +272,8 @@ static int idescsi_check_condition(ide_drive_t *drive, struct request *failed_co | |||
282 | pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd; | 272 | pc->scsi_cmd = ((idescsi_pc_t *) failed_command->special)->scsi_cmd; |
283 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { | 273 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { |
284 | printk ("ide-scsi: %s: queue cmd = ", drive->name); | 274 | printk ("ide-scsi: %s: queue cmd = ", drive->name); |
285 | hexdump(pc->c, 6); | 275 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, pc->c, |
276 | 6, 0); | ||
286 | } | 277 | } |
287 | rq->rq_disk = scsi->disk; | 278 | rq->rq_disk = scsi->disk; |
288 | return ide_do_drive_cmd(drive, rq, ide_preempt); | 279 | return ide_do_drive_cmd(drive, rq, ide_preempt); |
@@ -337,7 +328,8 @@ static int idescsi_end_request (ide_drive_t *drive, int uptodate, int nrsecs) | |||
337 | idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer; | 328 | idescsi_pc_t *opc = (idescsi_pc_t *) rq->buffer; |
338 | if (log) { | 329 | if (log) { |
339 | printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number); | 330 | printk ("ide-scsi: %s: wrap up check %lu, rst = ", drive->name, opc->scsi_cmd->serial_number); |
340 | hexdump(pc->buffer,16); | 331 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, |
332 | pc->buffer, 16, 0); | ||
341 | } | 333 | } |
342 | memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE); | 334 | memcpy((void *) opc->scsi_cmd->sense_buffer, pc->buffer, SCSI_SENSE_BUFFERSIZE); |
343 | kfree(pc->buffer); | 335 | kfree(pc->buffer); |
@@ -816,10 +808,12 @@ static int idescsi_queue (struct scsi_cmnd *cmd, | |||
816 | 808 | ||
817 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { | 809 | if (test_bit(IDESCSI_LOG_CMD, &scsi->log)) { |
818 | printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number); | 810 | printk ("ide-scsi: %s: que %lu, cmd = ", drive->name, cmd->serial_number); |
819 | hexdump(cmd->cmnd, cmd->cmd_len); | 811 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, |
812 | cmd->cmnd, cmd->cmd_len, 0); | ||
820 | if (memcmp(pc->c, cmd->cmnd, cmd->cmd_len)) { | 813 | if (memcmp(pc->c, cmd->cmnd, cmd->cmd_len)) { |
821 | printk ("ide-scsi: %s: que %lu, tsl = ", drive->name, cmd->serial_number); | 814 | printk ("ide-scsi: %s: que %lu, tsl = ", drive->name, cmd->serial_number); |
822 | hexdump(pc->c, 12); | 815 | print_hex_dump(KERN_CONT, "", DUMP_PREFIX_NONE, 16, 1, |
816 | pc->c, 12, 0); | ||
823 | } | 817 | } |
824 | } | 818 | } |
825 | 819 | ||
diff --git a/drivers/scsi/zorro7xx.c b/drivers/scsi/zorro7xx.c index ac67394c7373..64d40a2d4d4d 100644 --- a/drivers/scsi/zorro7xx.c +++ b/drivers/scsi/zorro7xx.c | |||
@@ -13,7 +13,10 @@ | |||
13 | #include <linux/init.h> | 13 | #include <linux/init.h> |
14 | #include <linux/interrupt.h> | 14 | #include <linux/interrupt.h> |
15 | #include <linux/zorro.h> | 15 | #include <linux/zorro.h> |
16 | |||
17 | #include <asm/amigahw.h> | ||
16 | #include <asm/amigaints.h> | 18 | #include <asm/amigaints.h> |
19 | |||
17 | #include <scsi/scsi_host.h> | 20 | #include <scsi/scsi_host.h> |
18 | #include <scsi/scsi_transport_spi.h> | 21 | #include <scsi/scsi_transport_spi.h> |
19 | 22 | ||
diff --git a/drivers/serial/Kconfig b/drivers/serial/Kconfig index ed438bc7e98d..d7e1996e2fec 100644 --- a/drivers/serial/Kconfig +++ b/drivers/serial/Kconfig | |||
@@ -600,7 +600,7 @@ config SERIAL_SA1100_CONSOLE | |||
600 | 600 | ||
601 | config SERIAL_BFIN | 601 | config SERIAL_BFIN |
602 | tristate "Blackfin serial port support" | 602 | tristate "Blackfin serial port support" |
603 | depends on BFIN | 603 | depends on BLACKFIN |
604 | select SERIAL_CORE | 604 | select SERIAL_CORE |
605 | select SERIAL_BFIN_UART0 if (BF531 || BF532 || BF533 || BF561) | 605 | select SERIAL_BFIN_UART0 if (BF531 || BF532 || BF533 || BF561) |
606 | help | 606 | help |
diff --git a/drivers/serial/ip22zilog.c b/drivers/serial/ip22zilog.c index f3257f708ef9..9c95bc0398ad 100644 --- a/drivers/serial/ip22zilog.c +++ b/drivers/serial/ip22zilog.c | |||
@@ -45,8 +45,6 @@ | |||
45 | 45 | ||
46 | #include "ip22zilog.h" | 46 | #include "ip22zilog.h" |
47 | 47 | ||
48 | void ip22_do_break(void); | ||
49 | |||
50 | /* | 48 | /* |
51 | * On IP22 we need to delay after register accesses but we do not need to | 49 | * On IP22 we need to delay after register accesses but we do not need to |
52 | * flush writes. | 50 | * flush writes. |
@@ -81,12 +79,9 @@ struct uart_ip22zilog_port { | |||
81 | #define IP22ZILOG_FLAG_REGS_HELD 0x00000040 | 79 | #define IP22ZILOG_FLAG_REGS_HELD 0x00000040 |
82 | #define IP22ZILOG_FLAG_TX_STOPPED 0x00000080 | 80 | #define IP22ZILOG_FLAG_TX_STOPPED 0x00000080 |
83 | #define IP22ZILOG_FLAG_TX_ACTIVE 0x00000100 | 81 | #define IP22ZILOG_FLAG_TX_ACTIVE 0x00000100 |
82 | #define IP22ZILOG_FLAG_RESET_DONE 0x00000200 | ||
84 | 83 | ||
85 | unsigned int cflag; | 84 | unsigned int tty_break; |
86 | |||
87 | /* L1-A keyboard break state. */ | ||
88 | int kbd_id; | ||
89 | int l1_down; | ||
90 | 85 | ||
91 | unsigned char parity_mask; | 86 | unsigned char parity_mask; |
92 | unsigned char prev_status; | 87 | unsigned char prev_status; |
@@ -250,13 +245,26 @@ static void ip22zilog_maybe_update_regs(struct uart_ip22zilog_port *up, | |||
250 | } | 245 | } |
251 | } | 246 | } |
252 | 247 | ||
253 | static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up, | 248 | #define Rx_BRK 0x0100 /* BREAK event software flag. */ |
254 | struct zilog_channel *channel) | 249 | #define Rx_SYS 0x0200 /* SysRq event software flag. */ |
250 | |||
251 | static struct tty_struct *ip22zilog_receive_chars(struct uart_ip22zilog_port *up, | ||
252 | struct zilog_channel *channel) | ||
255 | { | 253 | { |
256 | struct tty_struct *tty = up->port.info->tty; /* XXX info==NULL? */ | 254 | struct tty_struct *tty; |
255 | unsigned char ch, flag; | ||
256 | unsigned int r1; | ||
257 | |||
258 | tty = NULL; | ||
259 | if (up->port.info != NULL && | ||
260 | up->port.info->tty != NULL) | ||
261 | tty = up->port.info->tty; | ||
257 | 262 | ||
258 | while (1) { | 263 | for (;;) { |
259 | unsigned char ch, r1, flag; | 264 | ch = readb(&channel->control); |
265 | ZSDELAY(); | ||
266 | if (!(ch & Rx_CH_AV)) | ||
267 | break; | ||
260 | 268 | ||
261 | r1 = read_zsreg(channel, R1); | 269 | r1 = read_zsreg(channel, R1); |
262 | if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) { | 270 | if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR)) { |
@@ -265,43 +273,26 @@ static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up, | |||
265 | ZS_WSYNC(channel); | 273 | ZS_WSYNC(channel); |
266 | } | 274 | } |
267 | 275 | ||
268 | ch = readb(&channel->control); | ||
269 | ZSDELAY(); | ||
270 | |||
271 | /* This funny hack depends upon BRK_ABRT not interfering | ||
272 | * with the other bits we care about in R1. | ||
273 | */ | ||
274 | if (ch & BRK_ABRT) | ||
275 | r1 |= BRK_ABRT; | ||
276 | |||
277 | ch = readb(&channel->data); | 276 | ch = readb(&channel->data); |
278 | ZSDELAY(); | 277 | ZSDELAY(); |
279 | 278 | ||
280 | ch &= up->parity_mask; | 279 | ch &= up->parity_mask; |
281 | 280 | ||
282 | if (ZS_IS_CONS(up) && (r1 & BRK_ABRT)) { | 281 | /* Handle the null char got when BREAK is removed. */ |
283 | /* Wait for BREAK to deassert to avoid potentially | 282 | if (!ch) |
284 | * confusing the PROM. | 283 | r1 |= up->tty_break; |
285 | */ | ||
286 | while (1) { | ||
287 | ch = readb(&channel->control); | ||
288 | ZSDELAY(); | ||
289 | if (!(ch & BRK_ABRT)) | ||
290 | break; | ||
291 | } | ||
292 | ip22_do_break(); | ||
293 | return; | ||
294 | } | ||
295 | 284 | ||
296 | /* A real serial line, record the character and status. */ | 285 | /* A real serial line, record the character and status. */ |
297 | flag = TTY_NORMAL; | 286 | flag = TTY_NORMAL; |
298 | up->port.icount.rx++; | 287 | up->port.icount.rx++; |
299 | if (r1 & (BRK_ABRT | PAR_ERR | Rx_OVR | CRC_ERR)) { | 288 | if (r1 & (PAR_ERR | Rx_OVR | CRC_ERR | Rx_SYS | Rx_BRK)) { |
300 | if (r1 & BRK_ABRT) { | 289 | up->tty_break = 0; |
301 | r1 &= ~(PAR_ERR | CRC_ERR); | 290 | |
291 | if (r1 & (Rx_SYS | Rx_BRK)) { | ||
302 | up->port.icount.brk++; | 292 | up->port.icount.brk++; |
303 | if (uart_handle_break(&up->port)) | 293 | if (r1 & Rx_SYS) |
304 | goto next_char; | 294 | continue; |
295 | r1 &= ~(PAR_ERR | CRC_ERR); | ||
305 | } | 296 | } |
306 | else if (r1 & PAR_ERR) | 297 | else if (r1 & PAR_ERR) |
307 | up->port.icount.parity++; | 298 | up->port.icount.parity++; |
@@ -310,30 +301,21 @@ static void ip22zilog_receive_chars(struct uart_ip22zilog_port *up, | |||
310 | if (r1 & Rx_OVR) | 301 | if (r1 & Rx_OVR) |
311 | up->port.icount.overrun++; | 302 | up->port.icount.overrun++; |
312 | r1 &= up->port.read_status_mask; | 303 | r1 &= up->port.read_status_mask; |
313 | if (r1 & BRK_ABRT) | 304 | if (r1 & Rx_BRK) |
314 | flag = TTY_BREAK; | 305 | flag = TTY_BREAK; |
315 | else if (r1 & PAR_ERR) | 306 | else if (r1 & PAR_ERR) |
316 | flag = TTY_PARITY; | 307 | flag = TTY_PARITY; |
317 | else if (r1 & CRC_ERR) | 308 | else if (r1 & CRC_ERR) |
318 | flag = TTY_FRAME; | 309 | flag = TTY_FRAME; |
319 | } | 310 | } |
320 | if (uart_handle_sysrq_char(&up->port, ch)) | ||
321 | goto next_char; | ||
322 | 311 | ||
323 | if (up->port.ignore_status_mask == 0xff || | 312 | if (uart_handle_sysrq_char(&up->port, ch)) |
324 | (r1 & up->port.ignore_status_mask) == 0) | 313 | continue; |
325 | tty_insert_flip_char(tty, ch, flag); | ||
326 | 314 | ||
327 | if (r1 & Rx_OVR) | 315 | if (tty) |
328 | tty_insert_flip_char(tty, 0, TTY_OVERRUN); | 316 | uart_insert_char(&up->port, r1, Rx_OVR, ch, flag); |
329 | next_char: | ||
330 | ch = readb(&channel->control); | ||
331 | ZSDELAY(); | ||
332 | if (!(ch & Rx_CH_AV)) | ||
333 | break; | ||
334 | } | 317 | } |
335 | 318 | return tty; | |
336 | tty_flip_buffer_push(tty); | ||
337 | } | 319 | } |
338 | 320 | ||
339 | static void ip22zilog_status_handle(struct uart_ip22zilog_port *up, | 321 | static void ip22zilog_status_handle(struct uart_ip22zilog_port *up, |
@@ -348,6 +330,15 @@ static void ip22zilog_status_handle(struct uart_ip22zilog_port *up, | |||
348 | ZSDELAY(); | 330 | ZSDELAY(); |
349 | ZS_WSYNC(channel); | 331 | ZS_WSYNC(channel); |
350 | 332 | ||
333 | if (up->curregs[R15] & BRKIE) { | ||
334 | if ((status & BRK_ABRT) && !(up->prev_status & BRK_ABRT)) { | ||
335 | if (uart_handle_break(&up->port)) | ||
336 | up->tty_break = Rx_SYS; | ||
337 | else | ||
338 | up->tty_break = Rx_BRK; | ||
339 | } | ||
340 | } | ||
341 | |||
351 | if (ZS_WANTS_MODEM_STATUS(up)) { | 342 | if (ZS_WANTS_MODEM_STATUS(up)) { |
352 | if (status & SYNC) | 343 | if (status & SYNC) |
353 | up->port.icount.dsr++; | 344 | up->port.icount.dsr++; |
@@ -356,10 +347,10 @@ static void ip22zilog_status_handle(struct uart_ip22zilog_port *up, | |||
356 | * But it does not tell us which bit has changed, we have to keep | 347 | * But it does not tell us which bit has changed, we have to keep |
357 | * track of this ourselves. | 348 | * track of this ourselves. |
358 | */ | 349 | */ |
359 | if ((status & DCD) ^ up->prev_status) | 350 | if ((status ^ up->prev_status) ^ DCD) |
360 | uart_handle_dcd_change(&up->port, | 351 | uart_handle_dcd_change(&up->port, |
361 | (status & DCD)); | 352 | (status & DCD)); |
362 | if ((status & CTS) ^ up->prev_status) | 353 | if ((status ^ up->prev_status) ^ CTS) |
363 | uart_handle_cts_change(&up->port, | 354 | uart_handle_cts_change(&up->port, |
364 | (status & CTS)); | 355 | (status & CTS)); |
365 | 356 | ||
@@ -447,19 +438,21 @@ static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id) | |||
447 | while (up) { | 438 | while (up) { |
448 | struct zilog_channel *channel | 439 | struct zilog_channel *channel |
449 | = ZILOG_CHANNEL_FROM_PORT(&up->port); | 440 | = ZILOG_CHANNEL_FROM_PORT(&up->port); |
441 | struct tty_struct *tty; | ||
450 | unsigned char r3; | 442 | unsigned char r3; |
451 | 443 | ||
452 | spin_lock(&up->port.lock); | 444 | spin_lock(&up->port.lock); |
453 | r3 = read_zsreg(channel, R3); | 445 | r3 = read_zsreg(channel, R3); |
454 | 446 | ||
455 | /* Channel A */ | 447 | /* Channel A */ |
448 | tty = NULL; | ||
456 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { | 449 | if (r3 & (CHAEXT | CHATxIP | CHARxIP)) { |
457 | writeb(RES_H_IUS, &channel->control); | 450 | writeb(RES_H_IUS, &channel->control); |
458 | ZSDELAY(); | 451 | ZSDELAY(); |
459 | ZS_WSYNC(channel); | 452 | ZS_WSYNC(channel); |
460 | 453 | ||
461 | if (r3 & CHARxIP) | 454 | if (r3 & CHARxIP) |
462 | ip22zilog_receive_chars(up, channel); | 455 | tty = ip22zilog_receive_chars(up, channel); |
463 | if (r3 & CHAEXT) | 456 | if (r3 & CHAEXT) |
464 | ip22zilog_status_handle(up, channel); | 457 | ip22zilog_status_handle(up, channel); |
465 | if (r3 & CHATxIP) | 458 | if (r3 & CHATxIP) |
@@ -467,18 +460,22 @@ static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id) | |||
467 | } | 460 | } |
468 | spin_unlock(&up->port.lock); | 461 | spin_unlock(&up->port.lock); |
469 | 462 | ||
463 | if (tty) | ||
464 | tty_flip_buffer_push(tty); | ||
465 | |||
470 | /* Channel B */ | 466 | /* Channel B */ |
471 | up = up->next; | 467 | up = up->next; |
472 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | 468 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); |
473 | 469 | ||
474 | spin_lock(&up->port.lock); | 470 | spin_lock(&up->port.lock); |
471 | tty = NULL; | ||
475 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { | 472 | if (r3 & (CHBEXT | CHBTxIP | CHBRxIP)) { |
476 | writeb(RES_H_IUS, &channel->control); | 473 | writeb(RES_H_IUS, &channel->control); |
477 | ZSDELAY(); | 474 | ZSDELAY(); |
478 | ZS_WSYNC(channel); | 475 | ZS_WSYNC(channel); |
479 | 476 | ||
480 | if (r3 & CHBRxIP) | 477 | if (r3 & CHBRxIP) |
481 | ip22zilog_receive_chars(up, channel); | 478 | tty = ip22zilog_receive_chars(up, channel); |
482 | if (r3 & CHBEXT) | 479 | if (r3 & CHBEXT) |
483 | ip22zilog_status_handle(up, channel); | 480 | ip22zilog_status_handle(up, channel); |
484 | if (r3 & CHBTxIP) | 481 | if (r3 & CHBTxIP) |
@@ -486,6 +483,9 @@ static irqreturn_t ip22zilog_interrupt(int irq, void *dev_id) | |||
486 | } | 483 | } |
487 | spin_unlock(&up->port.lock); | 484 | spin_unlock(&up->port.lock); |
488 | 485 | ||
486 | if (tty) | ||
487 | tty_flip_buffer_push(tty); | ||
488 | |||
489 | up = up->next; | 489 | up = up->next; |
490 | } | 490 | } |
491 | 491 | ||
@@ -681,11 +681,46 @@ static void ip22zilog_break_ctl(struct uart_port *port, int break_state) | |||
681 | spin_unlock_irqrestore(&port->lock, flags); | 681 | spin_unlock_irqrestore(&port->lock, flags); |
682 | } | 682 | } |
683 | 683 | ||
684 | static void __ip22zilog_reset(struct uart_ip22zilog_port *up) | ||
685 | { | ||
686 | struct zilog_channel *channel; | ||
687 | int i; | ||
688 | |||
689 | if (up->flags & IP22ZILOG_FLAG_RESET_DONE) | ||
690 | return; | ||
691 | |||
692 | /* Let pending transmits finish. */ | ||
693 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | ||
694 | for (i = 0; i < 1000; i++) { | ||
695 | unsigned char stat = read_zsreg(channel, R1); | ||
696 | if (stat & ALL_SNT) | ||
697 | break; | ||
698 | udelay(100); | ||
699 | } | ||
700 | |||
701 | if (!ZS_IS_CHANNEL_A(up)) { | ||
702 | up++; | ||
703 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | ||
704 | } | ||
705 | write_zsreg(channel, R9, FHWRES); | ||
706 | ZSDELAY_LONG(); | ||
707 | (void) read_zsreg(channel, R0); | ||
708 | |||
709 | up->flags |= IP22ZILOG_FLAG_RESET_DONE; | ||
710 | up->next->flags |= IP22ZILOG_FLAG_RESET_DONE; | ||
711 | } | ||
712 | |||
684 | static void __ip22zilog_startup(struct uart_ip22zilog_port *up) | 713 | static void __ip22zilog_startup(struct uart_ip22zilog_port *up) |
685 | { | 714 | { |
686 | struct zilog_channel *channel; | 715 | struct zilog_channel *channel; |
687 | 716 | ||
688 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | 717 | channel = ZILOG_CHANNEL_FROM_PORT(&up->port); |
718 | |||
719 | __ip22zilog_reset(up); | ||
720 | |||
721 | __load_zsregs(channel, up->curregs); | ||
722 | /* set master interrupt enable */ | ||
723 | write_zsreg(channel, R9, up->curregs[R9]); | ||
689 | up->prev_status = readb(&channel->control); | 724 | up->prev_status = readb(&channel->control); |
690 | 725 | ||
691 | /* Enable receiver and transmitter. */ | 726 | /* Enable receiver and transmitter. */ |
@@ -859,8 +894,6 @@ ip22zilog_set_termios(struct uart_port *port, struct ktermios *termios, | |||
859 | else | 894 | else |
860 | up->flags &= ~IP22ZILOG_FLAG_MODEM_STATUS; | 895 | up->flags &= ~IP22ZILOG_FLAG_MODEM_STATUS; |
861 | 896 | ||
862 | up->cflag = termios->c_cflag; | ||
863 | |||
864 | ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port)); | 897 | ip22zilog_maybe_update_regs(up, ZILOG_CHANNEL_FROM_PORT(port)); |
865 | uart_update_timeout(port, termios->c_cflag, baud); | 898 | uart_update_timeout(port, termios->c_cflag, baud); |
866 | 899 | ||
@@ -992,74 +1025,29 @@ ip22zilog_console_write(struct console *con, const char *s, unsigned int count) | |||
992 | spin_unlock_irqrestore(&up->port.lock, flags); | 1025 | spin_unlock_irqrestore(&up->port.lock, flags); |
993 | } | 1026 | } |
994 | 1027 | ||
995 | void | ||
996 | ip22serial_console_termios(struct console *con, char *options) | ||
997 | { | ||
998 | int baud = 9600, bits = 8, cflag; | ||
999 | int parity = 'n'; | ||
1000 | int flow = 'n'; | ||
1001 | |||
1002 | if (options) | ||
1003 | uart_parse_options(options, &baud, &parity, &bits, &flow); | ||
1004 | |||
1005 | cflag = CREAD | HUPCL | CLOCAL; | ||
1006 | |||
1007 | switch (baud) { | ||
1008 | case 150: cflag |= B150; break; | ||
1009 | case 300: cflag |= B300; break; | ||
1010 | case 600: cflag |= B600; break; | ||
1011 | case 1200: cflag |= B1200; break; | ||
1012 | case 2400: cflag |= B2400; break; | ||
1013 | case 4800: cflag |= B4800; break; | ||
1014 | case 9600: cflag |= B9600; break; | ||
1015 | case 19200: cflag |= B19200; break; | ||
1016 | case 38400: cflag |= B38400; break; | ||
1017 | default: baud = 9600; cflag |= B9600; break; | ||
1018 | } | ||
1019 | |||
1020 | con->cflag = cflag | CS8; /* 8N1 */ | ||
1021 | |||
1022 | uart_update_timeout(&ip22zilog_port_table[con->index].port, cflag, baud); | ||
1023 | } | ||
1024 | |||
1025 | static int __init ip22zilog_console_setup(struct console *con, char *options) | 1028 | static int __init ip22zilog_console_setup(struct console *con, char *options) |
1026 | { | 1029 | { |
1027 | struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index]; | 1030 | struct uart_ip22zilog_port *up = &ip22zilog_port_table[con->index]; |
1028 | unsigned long flags; | 1031 | unsigned long flags; |
1029 | int baud, brg; | 1032 | int baud = 9600, bits = 8; |
1030 | 1033 | int parity = 'n'; | |
1031 | printk("Console: ttyS%d (IP22-Zilog)\n", con->index); | 1034 | int flow = 'n'; |
1032 | 1035 | ||
1033 | /* Get firmware console settings. */ | 1036 | up->flags |= IP22ZILOG_FLAG_IS_CONS; |
1034 | ip22serial_console_termios(con, options); | ||
1035 | 1037 | ||
1036 | /* Firmware console speed is limited to 150-->38400 baud so | 1038 | printk(KERN_INFO "Console: ttyS%d (IP22-Zilog)\n", con->index); |
1037 | * this hackish cflag thing is OK. | ||
1038 | */ | ||
1039 | switch (con->cflag & CBAUD) { | ||
1040 | case B150: baud = 150; break; | ||
1041 | case B300: baud = 300; break; | ||
1042 | case B600: baud = 600; break; | ||
1043 | case B1200: baud = 1200; break; | ||
1044 | case B2400: baud = 2400; break; | ||
1045 | case B4800: baud = 4800; break; | ||
1046 | default: case B9600: baud = 9600; break; | ||
1047 | case B19200: baud = 19200; break; | ||
1048 | case B38400: baud = 38400; break; | ||
1049 | }; | ||
1050 | |||
1051 | brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR); | ||
1052 | 1039 | ||
1053 | spin_lock_irqsave(&up->port.lock, flags); | 1040 | spin_lock_irqsave(&up->port.lock, flags); |
1054 | 1041 | ||
1055 | up->curregs[R15] = BRKIE; | 1042 | up->curregs[R15] |= BRKIE; |
1056 | ip22zilog_convert_to_zs(up, con->cflag, 0, brg); | ||
1057 | 1043 | ||
1058 | __ip22zilog_startup(up); | 1044 | __ip22zilog_startup(up); |
1059 | 1045 | ||
1060 | spin_unlock_irqrestore(&up->port.lock, flags); | 1046 | spin_unlock_irqrestore(&up->port.lock, flags); |
1061 | 1047 | ||
1062 | return 0; | 1048 | if (options) |
1049 | uart_parse_options(options, &baud, &parity, &bits, &flow); | ||
1050 | return uart_set_options(&up->port, con, baud, parity, bits, flow); | ||
1063 | } | 1051 | } |
1064 | 1052 | ||
1065 | static struct uart_driver ip22zilog_reg; | 1053 | static struct uart_driver ip22zilog_reg; |
@@ -1140,25 +1128,10 @@ static void __init ip22zilog_prepare(void) | |||
1140 | up[(chip * 2) + 1].port.line = (chip * 2) + 1; | 1128 | up[(chip * 2) + 1].port.line = (chip * 2) + 1; |
1141 | up[(chip * 2) + 1].flags |= IP22ZILOG_FLAG_IS_CHANNEL_A; | 1129 | up[(chip * 2) + 1].flags |= IP22ZILOG_FLAG_IS_CHANNEL_A; |
1142 | } | 1130 | } |
1143 | } | ||
1144 | |||
1145 | static void __init ip22zilog_init_hw(void) | ||
1146 | { | ||
1147 | int i; | ||
1148 | |||
1149 | for (i = 0; i < NUM_CHANNELS; i++) { | ||
1150 | struct uart_ip22zilog_port *up = &ip22zilog_port_table[i]; | ||
1151 | struct zilog_channel *channel = ZILOG_CHANNEL_FROM_PORT(&up->port); | ||
1152 | unsigned long flags; | ||
1153 | int baud, brg; | ||
1154 | 1131 | ||
1155 | spin_lock_irqsave(&up->port.lock, flags); | 1132 | for (channel = 0; channel < NUM_CHANNELS; channel++) { |
1156 | 1133 | struct uart_ip22zilog_port *up = &ip22zilog_port_table[channel]; | |
1157 | if (ZS_IS_CHANNEL_A(up)) { | 1134 | int brg; |
1158 | write_zsreg(channel, R9, FHWRES); | ||
1159 | ZSDELAY_LONG(); | ||
1160 | (void) read_zsreg(channel, R0); | ||
1161 | } | ||
1162 | 1135 | ||
1163 | /* Normal serial TTY. */ | 1136 | /* Normal serial TTY. */ |
1164 | up->parity_mask = 0xff; | 1137 | up->parity_mask = 0xff; |
@@ -1169,16 +1142,10 @@ static void __init ip22zilog_init_hw(void) | |||
1169 | up->curregs[R9] = NV | MIE; | 1142 | up->curregs[R9] = NV | MIE; |
1170 | up->curregs[R10] = NRZ; | 1143 | up->curregs[R10] = NRZ; |
1171 | up->curregs[R11] = TCBR | RCBR; | 1144 | up->curregs[R11] = TCBR | RCBR; |
1172 | baud = 9600; | 1145 | brg = BPS_TO_BRG(9600, ZS_CLOCK / ZS_CLOCK_DIVISOR); |
1173 | brg = BPS_TO_BRG(baud, ZS_CLOCK / ZS_CLOCK_DIVISOR); | ||
1174 | up->curregs[R12] = (brg & 0xff); | 1146 | up->curregs[R12] = (brg & 0xff); |
1175 | up->curregs[R13] = (brg >> 8) & 0xff; | 1147 | up->curregs[R13] = (brg >> 8) & 0xff; |
1176 | up->curregs[R14] = BRENAB; | 1148 | up->curregs[R14] = BRENAB; |
1177 | __load_zsregs(channel, up->curregs); | ||
1178 | /* set master interrupt enable */ | ||
1179 | write_zsreg(channel, R9, up->curregs[R9]); | ||
1180 | |||
1181 | spin_unlock_irqrestore(&up->port.lock, flags); | ||
1182 | } | 1149 | } |
1183 | } | 1150 | } |
1184 | 1151 | ||
@@ -1195,8 +1162,6 @@ static int __init ip22zilog_ports_init(void) | |||
1195 | panic("IP22-Zilog: Unable to register zs interrupt handler.\n"); | 1162 | panic("IP22-Zilog: Unable to register zs interrupt handler.\n"); |
1196 | } | 1163 | } |
1197 | 1164 | ||
1198 | ip22zilog_init_hw(); | ||
1199 | |||
1200 | ret = uart_register_driver(&ip22zilog_reg); | 1165 | ret = uart_register_driver(&ip22zilog_reg); |
1201 | if (ret == 0) { | 1166 | if (ret == 0) { |
1202 | int i; | 1167 | int i; |
diff --git a/drivers/serial/pxa.c b/drivers/serial/pxa.c index af3a011b2b24..352fcb8926a6 100644 --- a/drivers/serial/pxa.c +++ b/drivers/serial/pxa.c | |||
@@ -585,11 +585,11 @@ serial_pxa_type(struct uart_port *port) | |||
585 | return up->name; | 585 | return up->name; |
586 | } | 586 | } |
587 | 587 | ||
588 | #ifdef CONFIG_SERIAL_PXA_CONSOLE | ||
589 | |||
590 | static struct uart_pxa_port *serial_pxa_ports[4]; | 588 | static struct uart_pxa_port *serial_pxa_ports[4]; |
591 | static struct uart_driver serial_pxa_reg; | 589 | static struct uart_driver serial_pxa_reg; |
592 | 590 | ||
591 | #ifdef CONFIG_SERIAL_PXA_CONSOLE | ||
592 | |||
593 | #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) | 593 | #define BOTH_EMPTY (UART_LSR_TEMT | UART_LSR_THRE) |
594 | 594 | ||
595 | /* | 595 | /* |
diff --git a/drivers/spi/Kconfig b/drivers/spi/Kconfig index a77ede598d34..abf05048c638 100644 --- a/drivers/spi/Kconfig +++ b/drivers/spi/Kconfig | |||
@@ -61,7 +61,7 @@ config SPI_ATMEL | |||
61 | 61 | ||
62 | config SPI_BFIN | 62 | config SPI_BFIN |
63 | tristate "SPI controller driver for ADI Blackfin5xx" | 63 | tristate "SPI controller driver for ADI Blackfin5xx" |
64 | depends on SPI_MASTER && BFIN | 64 | depends on SPI_MASTER && BLACKFIN |
65 | help | 65 | help |
66 | This is the SPI controller master driver for Blackfin 5xx processor. | 66 | This is the SPI controller master driver for Blackfin 5xx processor. |
67 | 67 | ||
diff --git a/drivers/spi/atmel_spi.c b/drivers/spi/atmel_spi.c index 0d342dcdd302..ff6a14bf1280 100644 --- a/drivers/spi/atmel_spi.c +++ b/drivers/spi/atmel_spi.c | |||
@@ -497,7 +497,7 @@ static int atmel_spi_setup(struct spi_device *spi) | |||
497 | /* chipselect must have been muxed as GPIO (e.g. in board setup) */ | 497 | /* chipselect must have been muxed as GPIO (e.g. in board setup) */ |
498 | npcs_pin = (unsigned int)spi->controller_data; | 498 | npcs_pin = (unsigned int)spi->controller_data; |
499 | if (!spi->controller_state) { | 499 | if (!spi->controller_state) { |
500 | ret = gpio_request(npcs_pin, "spi_npcs"); | 500 | ret = gpio_request(npcs_pin, spi->dev.bus_id); |
501 | if (ret) | 501 | if (ret) |
502 | return ret; | 502 | return ret; |
503 | spi->controller_state = (void *)npcs_pin; | 503 | spi->controller_state = (void *)npcs_pin; |
diff --git a/drivers/spi/spi_s3c24xx_gpio.c b/drivers/spi/spi_s3c24xx_gpio.c index 0fa25e2e80fe..109d82c1abc0 100644 --- a/drivers/spi/spi_s3c24xx_gpio.c +++ b/drivers/spi/spi_s3c24xx_gpio.c | |||
@@ -96,6 +96,7 @@ static void s3c2410_spigpio_chipselect(struct spi_device *dev, int value) | |||
96 | 96 | ||
97 | static int s3c2410_spigpio_probe(struct platform_device *dev) | 97 | static int s3c2410_spigpio_probe(struct platform_device *dev) |
98 | { | 98 | { |
99 | struct s3c2410_spigpio_info *info; | ||
99 | struct spi_master *master; | 100 | struct spi_master *master; |
100 | struct s3c2410_spigpio *sp; | 101 | struct s3c2410_spigpio *sp; |
101 | int ret; | 102 | int ret; |
@@ -113,10 +114,11 @@ static int s3c2410_spigpio_probe(struct platform_device *dev) | |||
113 | platform_set_drvdata(dev, sp); | 114 | platform_set_drvdata(dev, sp); |
114 | 115 | ||
115 | /* copy in the plkatform data */ | 116 | /* copy in the plkatform data */ |
116 | sp->info = dev->dev.platform_data; | 117 | info = sp->info = dev->dev.platform_data; |
117 | 118 | ||
118 | /* setup spi bitbang adaptor */ | 119 | /* setup spi bitbang adaptor */ |
119 | sp->bitbang.master = spi_master_get(master); | 120 | sp->bitbang.master = spi_master_get(master); |
121 | sp->bitbang.master->bus_num = info->bus_num; | ||
120 | sp->bitbang.chipselect = s3c2410_spigpio_chipselect; | 122 | sp->bitbang.chipselect = s3c2410_spigpio_chipselect; |
121 | 123 | ||
122 | sp->bitbang.txrx_word[SPI_MODE_0] = s3c2410_spigpio_txrx_mode0; | 124 | sp->bitbang.txrx_word[SPI_MODE_0] = s3c2410_spigpio_txrx_mode0; |
@@ -124,13 +126,18 @@ static int s3c2410_spigpio_probe(struct platform_device *dev) | |||
124 | sp->bitbang.txrx_word[SPI_MODE_2] = s3c2410_spigpio_txrx_mode2; | 126 | sp->bitbang.txrx_word[SPI_MODE_2] = s3c2410_spigpio_txrx_mode2; |
125 | sp->bitbang.txrx_word[SPI_MODE_3] = s3c2410_spigpio_txrx_mode3; | 127 | sp->bitbang.txrx_word[SPI_MODE_3] = s3c2410_spigpio_txrx_mode3; |
126 | 128 | ||
127 | /* set state of spi pins */ | 129 | /* set state of spi pins, always assume that the clock is |
128 | s3c2410_gpio_setpin(sp->info->pin_clk, 0); | 130 | * available, but do check the MOSI and MISO. */ |
129 | s3c2410_gpio_setpin(sp->info->pin_mosi, 0); | 131 | s3c2410_gpio_setpin(info->pin_clk, 0); |
132 | s3c2410_gpio_cfgpin(info->pin_clk, S3C2410_GPIO_OUTPUT); | ||
130 | 133 | ||
131 | s3c2410_gpio_cfgpin(sp->info->pin_clk, S3C2410_GPIO_OUTPUT); | 134 | if (info->pin_mosi < S3C2410_GPH10) { |
132 | s3c2410_gpio_cfgpin(sp->info->pin_mosi, S3C2410_GPIO_OUTPUT); | 135 | s3c2410_gpio_setpin(info->pin_mosi, 0); |
133 | s3c2410_gpio_cfgpin(sp->info->pin_miso, S3C2410_GPIO_INPUT); | 136 | s3c2410_gpio_cfgpin(info->pin_mosi, S3C2410_GPIO_OUTPUT); |
137 | } | ||
138 | |||
139 | if (info->pin_miso != S3C2410_GPA0 && info->pin_miso < S3C2410_GPH10) | ||
140 | s3c2410_gpio_cfgpin(info->pin_miso, S3C2410_GPIO_INPUT); | ||
134 | 141 | ||
135 | ret = spi_bitbang_start(&sp->bitbang); | 142 | ret = spi_bitbang_start(&sp->bitbang); |
136 | if (ret) | 143 | if (ret) |
diff --git a/drivers/usb/README b/drivers/usb/README index 3c8434128554..284f46b3e1cc 100644 --- a/drivers/usb/README +++ b/drivers/usb/README | |||
@@ -39,12 +39,12 @@ first subdirectory in the list below that it fits into. | |||
39 | 39 | ||
40 | image/ - This is for still image drivers, like scanners or | 40 | image/ - This is for still image drivers, like scanners or |
41 | digital cameras. | 41 | digital cameras. |
42 | input/ - This is for any driver that uses the input subsystem, | 42 | ../input/ - This is for any driver that uses the input subsystem, |
43 | like keyboard, mice, touchscreens, tablets, etc. | 43 | like keyboard, mice, touchscreens, tablets, etc. |
44 | media/ - This is for multimedia drivers, like video cameras, | 44 | ../media/ - This is for multimedia drivers, like video cameras, |
45 | radios, and any other drivers that talk to the v4l | 45 | radios, and any other drivers that talk to the v4l |
46 | subsystem. | 46 | subsystem. |
47 | net/ - This is for network drivers. | 47 | ../net/ - This is for network drivers. |
48 | serial/ - This is for USB to serial drivers. | 48 | serial/ - This is for USB to serial drivers. |
49 | storage/ - This is for USB mass-storage drivers. | 49 | storage/ - This is for USB mass-storage drivers. |
50 | class/ - This is for all USB device drivers that do not fit | 50 | class/ - This is for all USB device drivers that do not fit |
diff --git a/drivers/usb/core/driver.c b/drivers/usb/core/driver.c index 8586817698ad..c51f8e9312e0 100644 --- a/drivers/usb/core/driver.c +++ b/drivers/usb/core/driver.c | |||
@@ -585,9 +585,6 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
585 | { | 585 | { |
586 | struct usb_device *usb_dev; | 586 | struct usb_device *usb_dev; |
587 | 587 | ||
588 | if (!dev) | ||
589 | return -ENODEV; | ||
590 | |||
591 | /* driver is often null here; dev_dbg() would oops */ | 588 | /* driver is often null here; dev_dbg() would oops */ |
592 | pr_debug ("usb %s: uevent\n", dev->bus_id); | 589 | pr_debug ("usb %s: uevent\n", dev->bus_id); |
593 | 590 | ||
@@ -631,14 +628,6 @@ static int usb_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
631 | usb_dev->descriptor.bDeviceProtocol)) | 628 | usb_dev->descriptor.bDeviceProtocol)) |
632 | return -ENOMEM; | 629 | return -ENOMEM; |
633 | 630 | ||
634 | if (add_uevent_var(env, "BUSNUM=%03d", | ||
635 | usb_dev->bus->busnum)) | ||
636 | return -ENOMEM; | ||
637 | |||
638 | if (add_uevent_var(env, "DEVNUM=%03d", | ||
639 | usb_dev->devnum)) | ||
640 | return -ENOMEM; | ||
641 | |||
642 | return 0; | 631 | return 0; |
643 | } | 632 | } |
644 | 633 | ||
diff --git a/drivers/usb/core/hcd.c b/drivers/usb/core/hcd.c index fea8256a18d6..d5ed3fa9e304 100644 --- a/drivers/usb/core/hcd.c +++ b/drivers/usb/core/hcd.c | |||
@@ -1311,8 +1311,8 @@ void usb_hcd_flush_endpoint(struct usb_device *udev, | |||
1311 | hcd = bus_to_hcd(udev->bus); | 1311 | hcd = bus_to_hcd(udev->bus); |
1312 | 1312 | ||
1313 | /* No more submits can occur */ | 1313 | /* No more submits can occur */ |
1314 | rescan: | ||
1315 | spin_lock_irq(&hcd_urb_list_lock); | 1314 | spin_lock_irq(&hcd_urb_list_lock); |
1315 | rescan: | ||
1316 | list_for_each_entry (urb, &ep->urb_list, urb_list) { | 1316 | list_for_each_entry (urb, &ep->urb_list, urb_list) { |
1317 | int is_in; | 1317 | int is_in; |
1318 | 1318 | ||
@@ -1345,6 +1345,7 @@ rescan: | |||
1345 | usb_put_urb (urb); | 1345 | usb_put_urb (urb); |
1346 | 1346 | ||
1347 | /* list contents may have changed */ | 1347 | /* list contents may have changed */ |
1348 | spin_lock(&hcd_urb_list_lock); | ||
1348 | goto rescan; | 1349 | goto rescan; |
1349 | } | 1350 | } |
1350 | spin_unlock_irq(&hcd_urb_list_lock); | 1351 | spin_unlock_irq(&hcd_urb_list_lock); |
diff --git a/drivers/usb/core/hub.c b/drivers/usb/core/hub.c index 036c3dea855e..13b326a13377 100644 --- a/drivers/usb/core/hub.c +++ b/drivers/usb/core/hub.c | |||
@@ -335,7 +335,7 @@ static void kick_khubd(struct usb_hub *hub) | |||
335 | to_usb_interface(hub->intfdev)->pm_usage_cnt = 1; | 335 | to_usb_interface(hub->intfdev)->pm_usage_cnt = 1; |
336 | 336 | ||
337 | spin_lock_irqsave(&hub_event_lock, flags); | 337 | spin_lock_irqsave(&hub_event_lock, flags); |
338 | if (!hub->disconnected & list_empty(&hub->event_list)) { | 338 | if (!hub->disconnected && list_empty(&hub->event_list)) { |
339 | list_add_tail(&hub->event_list, &hub_event_list); | 339 | list_add_tail(&hub->event_list, &hub_event_list); |
340 | wake_up(&khubd_wait); | 340 | wake_up(&khubd_wait); |
341 | } | 341 | } |
diff --git a/drivers/usb/core/message.c b/drivers/usb/core/message.c index 316a746e0080..fcd40ecbeecc 100644 --- a/drivers/usb/core/message.c +++ b/drivers/usb/core/message.c | |||
@@ -1172,7 +1172,6 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1172 | struct usb_host_interface *alt; | 1172 | struct usb_host_interface *alt; |
1173 | int ret; | 1173 | int ret; |
1174 | int manual = 0; | 1174 | int manual = 0; |
1175 | int changed; | ||
1176 | 1175 | ||
1177 | if (dev->state == USB_STATE_SUSPENDED) | 1176 | if (dev->state == USB_STATE_SUSPENDED) |
1178 | return -EHOSTUNREACH; | 1177 | return -EHOSTUNREACH; |
@@ -1212,8 +1211,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1212 | */ | 1211 | */ |
1213 | 1212 | ||
1214 | /* prevent submissions using previous endpoint settings */ | 1213 | /* prevent submissions using previous endpoint settings */ |
1215 | changed = (iface->cur_altsetting != alt); | 1214 | if (iface->cur_altsetting != alt && device_is_registered(&iface->dev)) |
1216 | if (changed && device_is_registered(&iface->dev)) | ||
1217 | usb_remove_sysfs_intf_files(iface); | 1215 | usb_remove_sysfs_intf_files(iface); |
1218 | usb_disable_interface(dev, iface); | 1216 | usb_disable_interface(dev, iface); |
1219 | 1217 | ||
@@ -1250,7 +1248,7 @@ int usb_set_interface(struct usb_device *dev, int interface, int alternate) | |||
1250 | * (Likewise, EP0 never "halts" on well designed devices.) | 1248 | * (Likewise, EP0 never "halts" on well designed devices.) |
1251 | */ | 1249 | */ |
1252 | usb_enable_interface(dev, iface); | 1250 | usb_enable_interface(dev, iface); |
1253 | if (changed && device_is_registered(&iface->dev)) | 1251 | if (device_is_registered(&iface->dev)) |
1254 | usb_create_sysfs_intf_files(iface); | 1252 | usb_create_sysfs_intf_files(iface); |
1255 | 1253 | ||
1256 | return 0; | 1254 | return 0; |
@@ -1348,34 +1346,10 @@ static int usb_if_uevent(struct device *dev, struct kobj_uevent_env *env) | |||
1348 | struct usb_interface *intf; | 1346 | struct usb_interface *intf; |
1349 | struct usb_host_interface *alt; | 1347 | struct usb_host_interface *alt; |
1350 | 1348 | ||
1351 | if (!dev) | ||
1352 | return -ENODEV; | ||
1353 | |||
1354 | /* driver is often null here; dev_dbg() would oops */ | ||
1355 | pr_debug ("usb %s: uevent\n", dev->bus_id); | ||
1356 | |||
1357 | intf = to_usb_interface(dev); | 1349 | intf = to_usb_interface(dev); |
1358 | usb_dev = interface_to_usbdev(intf); | 1350 | usb_dev = interface_to_usbdev(intf); |
1359 | alt = intf->cur_altsetting; | 1351 | alt = intf->cur_altsetting; |
1360 | 1352 | ||
1361 | #ifdef CONFIG_USB_DEVICEFS | ||
1362 | if (add_uevent_var(env, "DEVICE=/proc/bus/usb/%03d/%03d", | ||
1363 | usb_dev->bus->busnum, usb_dev->devnum)) | ||
1364 | return -ENOMEM; | ||
1365 | #endif | ||
1366 | |||
1367 | if (add_uevent_var(env, "PRODUCT=%x/%x/%x", | ||
1368 | le16_to_cpu(usb_dev->descriptor.idVendor), | ||
1369 | le16_to_cpu(usb_dev->descriptor.idProduct), | ||
1370 | le16_to_cpu(usb_dev->descriptor.bcdDevice))) | ||
1371 | return -ENOMEM; | ||
1372 | |||
1373 | if (add_uevent_var(env, "TYPE=%d/%d/%d", | ||
1374 | usb_dev->descriptor.bDeviceClass, | ||
1375 | usb_dev->descriptor.bDeviceSubClass, | ||
1376 | usb_dev->descriptor.bDeviceProtocol)) | ||
1377 | return -ENOMEM; | ||
1378 | |||
1379 | if (add_uevent_var(env, "INTERFACE=%d/%d/%d", | 1353 | if (add_uevent_var(env, "INTERFACE=%d/%d/%d", |
1380 | alt->desc.bInterfaceClass, | 1354 | alt->desc.bInterfaceClass, |
1381 | alt->desc.bInterfaceSubClass, | 1355 | alt->desc.bInterfaceSubClass, |
@@ -1641,12 +1615,6 @@ free_interfaces: | |||
1641 | intf->dev.bus_id, ret); | 1615 | intf->dev.bus_id, ret); |
1642 | continue; | 1616 | continue; |
1643 | } | 1617 | } |
1644 | |||
1645 | /* The driver's probe method can call usb_set_interface(), | ||
1646 | * which would mean the interface's sysfs files are already | ||
1647 | * created. Just in case, we'll remove them first. | ||
1648 | */ | ||
1649 | usb_remove_sysfs_intf_files(intf); | ||
1650 | usb_create_sysfs_intf_files(intf); | 1618 | usb_create_sysfs_intf_files(intf); |
1651 | } | 1619 | } |
1652 | 1620 | ||
diff --git a/drivers/usb/core/sysfs.c b/drivers/usb/core/sysfs.c index b04afd06e502..32bd130b1eed 100644 --- a/drivers/usb/core/sysfs.c +++ b/drivers/usb/core/sysfs.c | |||
@@ -735,6 +735,8 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf) | |||
735 | struct usb_host_interface *alt = intf->cur_altsetting; | 735 | struct usb_host_interface *alt = intf->cur_altsetting; |
736 | int retval; | 736 | int retval; |
737 | 737 | ||
738 | if (intf->sysfs_files_created) | ||
739 | return 0; | ||
738 | retval = sysfs_create_group(&dev->kobj, &intf_attr_grp); | 740 | retval = sysfs_create_group(&dev->kobj, &intf_attr_grp); |
739 | if (retval) | 741 | if (retval) |
740 | return retval; | 742 | return retval; |
@@ -746,6 +748,7 @@ int usb_create_sysfs_intf_files(struct usb_interface *intf) | |||
746 | if (intf->intf_assoc) | 748 | if (intf->intf_assoc) |
747 | retval = sysfs_create_group(&dev->kobj, &intf_assoc_attr_grp); | 749 | retval = sysfs_create_group(&dev->kobj, &intf_assoc_attr_grp); |
748 | usb_create_intf_ep_files(intf, udev); | 750 | usb_create_intf_ep_files(intf, udev); |
751 | intf->sysfs_files_created = 1; | ||
749 | return 0; | 752 | return 0; |
750 | } | 753 | } |
751 | 754 | ||
@@ -753,8 +756,11 @@ void usb_remove_sysfs_intf_files(struct usb_interface *intf) | |||
753 | { | 756 | { |
754 | struct device *dev = &intf->dev; | 757 | struct device *dev = &intf->dev; |
755 | 758 | ||
759 | if (!intf->sysfs_files_created) | ||
760 | return; | ||
756 | usb_remove_intf_ep_files(intf); | 761 | usb_remove_intf_ep_files(intf); |
757 | device_remove_file(dev, &dev_attr_interface); | 762 | device_remove_file(dev, &dev_attr_interface); |
758 | sysfs_remove_group(&dev->kobj, &intf_attr_grp); | 763 | sysfs_remove_group(&dev->kobj, &intf_attr_grp); |
759 | sysfs_remove_group(&intf->dev.kobj, &intf_assoc_attr_grp); | 764 | sysfs_remove_group(&intf->dev.kobj, &intf_assoc_attr_grp); |
765 | intf->sysfs_files_created = 0; | ||
760 | } | 766 | } |
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index c4a6f1095b8b..8f142370103d 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -192,9 +192,34 @@ static void usb_release_dev(struct device *dev) | |||
192 | kfree(udev); | 192 | kfree(udev); |
193 | } | 193 | } |
194 | 194 | ||
195 | #ifdef CONFIG_HOTPLUG | ||
196 | static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
197 | { | ||
198 | struct usb_device *usb_dev; | ||
199 | |||
200 | usb_dev = to_usb_device(dev); | ||
201 | |||
202 | if (add_uevent_var(env, "BUSNUM=%03d", usb_dev->bus->busnum)) | ||
203 | return -ENOMEM; | ||
204 | |||
205 | if (add_uevent_var(env, "DEVNUM=%03d", usb_dev->devnum)) | ||
206 | return -ENOMEM; | ||
207 | |||
208 | return 0; | ||
209 | } | ||
210 | |||
211 | #else | ||
212 | |||
213 | static int usb_dev_uevent(struct device *dev, struct kobj_uevent_env *env) | ||
214 | { | ||
215 | return -ENODEV; | ||
216 | } | ||
217 | #endif /* CONFIG_HOTPLUG */ | ||
218 | |||
195 | struct device_type usb_device_type = { | 219 | struct device_type usb_device_type = { |
196 | .name = "usb_device", | 220 | .name = "usb_device", |
197 | .release = usb_release_dev, | 221 | .release = usb_release_dev, |
222 | .uevent = usb_dev_uevent, | ||
198 | }; | 223 | }; |
199 | 224 | ||
200 | #ifdef CONFIG_PM | 225 | #ifdef CONFIG_PM |
diff --git a/drivers/usb/gadget/omap_udc.c b/drivers/usb/gadget/omap_udc.c index 87c4f50dfb61..d377154658b5 100644 --- a/drivers/usb/gadget/omap_udc.c +++ b/drivers/usb/gadget/omap_udc.c | |||
@@ -1241,14 +1241,14 @@ static void pullup_enable(struct omap_udc *udc) | |||
1241 | udc->gadget.dev.parent->power.power_state = PMSG_ON; | 1241 | udc->gadget.dev.parent->power.power_state = PMSG_ON; |
1242 | udc->gadget.dev.power.power_state = PMSG_ON; | 1242 | udc->gadget.dev.power.power_state = PMSG_ON; |
1243 | UDC_SYSCON1_REG |= UDC_PULLUP_EN; | 1243 | UDC_SYSCON1_REG |= UDC_PULLUP_EN; |
1244 | if (!gadget_is_otg(udc->gadget) && !cpu_is_omap15xx()) | 1244 | if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) |
1245 | OTG_CTRL_REG |= OTG_BSESSVLD; | 1245 | OTG_CTRL_REG |= OTG_BSESSVLD; |
1246 | UDC_IRQ_EN_REG = UDC_DS_CHG_IE; | 1246 | UDC_IRQ_EN_REG = UDC_DS_CHG_IE; |
1247 | } | 1247 | } |
1248 | 1248 | ||
1249 | static void pullup_disable(struct omap_udc *udc) | 1249 | static void pullup_disable(struct omap_udc *udc) |
1250 | { | 1250 | { |
1251 | if (!gadget_is_otg(udc->gadget) && !cpu_is_omap15xx()) | 1251 | if (!gadget_is_otg(&udc->gadget) && !cpu_is_omap15xx()) |
1252 | OTG_CTRL_REG &= ~OTG_BSESSVLD; | 1252 | OTG_CTRL_REG &= ~OTG_BSESSVLD; |
1253 | UDC_IRQ_EN_REG = UDC_DS_CHG_IE; | 1253 | UDC_IRQ_EN_REG = UDC_DS_CHG_IE; |
1254 | UDC_SYSCON1_REG &= ~UDC_PULLUP_EN; | 1254 | UDC_SYSCON1_REG &= ~UDC_PULLUP_EN; |
@@ -1386,7 +1386,7 @@ static void update_otg(struct omap_udc *udc) | |||
1386 | { | 1386 | { |
1387 | u16 devstat; | 1387 | u16 devstat; |
1388 | 1388 | ||
1389 | if (!gadget_is_otg(udc->gadget)) | 1389 | if (!gadget_is_otg(&udc->gadget)) |
1390 | return; | 1390 | return; |
1391 | 1391 | ||
1392 | if (OTG_CTRL_REG & OTG_ID) | 1392 | if (OTG_CTRL_REG & OTG_ID) |
diff --git a/drivers/usb/gadget/s3c2410_udc.c b/drivers/usb/gadget/s3c2410_udc.c index e3e90f8a75e7..4ce050c3d13f 100644 --- a/drivers/usb/gadget/s3c2410_udc.c +++ b/drivers/usb/gadget/s3c2410_udc.c | |||
@@ -52,10 +52,10 @@ | |||
52 | #include <asm/arch/irqs.h> | 52 | #include <asm/arch/irqs.h> |
53 | 53 | ||
54 | #include <asm/arch/hardware.h> | 54 | #include <asm/arch/hardware.h> |
55 | #include <asm/arch/regs-clock.h> | ||
56 | #include <asm/arch/regs-gpio.h> | 55 | #include <asm/arch/regs-gpio.h> |
57 | #include <asm/arch/regs-udc.h> | 56 | |
58 | #include <asm/arch/udc.h> | 57 | #include <asm/plat-s3c24xx/regs-udc.h> |
58 | #include <asm/plat-s3c24xx/udc.h> | ||
59 | 59 | ||
60 | #include <asm/mach-types.h> | 60 | #include <asm/mach-types.h> |
61 | 61 | ||
@@ -1511,7 +1511,11 @@ static irqreturn_t s3c2410_udc_vbus_irq(int irq, void *_dev) | |||
1511 | unsigned int value; | 1511 | unsigned int value; |
1512 | 1512 | ||
1513 | dprintk(DEBUG_NORMAL, "%s()\n", __func__); | 1513 | dprintk(DEBUG_NORMAL, "%s()\n", __func__); |
1514 | |||
1515 | /* some cpus cannot read from an line configured to IRQ! */ | ||
1516 | s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_INPUT); | ||
1514 | value = s3c2410_gpio_getpin(udc_info->vbus_pin); | 1517 | value = s3c2410_gpio_getpin(udc_info->vbus_pin); |
1518 | s3c2410_gpio_cfgpin(udc_info->vbus_pin, S3C2410_GPIO_SFN2); | ||
1515 | 1519 | ||
1516 | if (udc_info->vbus_pin_inverted) | 1520 | if (udc_info->vbus_pin_inverted) |
1517 | value = !value; | 1521 | value = !value; |
@@ -1872,9 +1876,9 @@ static int s3c2410_udc_probe(struct platform_device *pdev) | |||
1872 | if (udc_info && udc_info->vbus_pin > 0) { | 1876 | if (udc_info && udc_info->vbus_pin > 0) { |
1873 | irq = s3c2410_gpio_getirq(udc_info->vbus_pin); | 1877 | irq = s3c2410_gpio_getirq(udc_info->vbus_pin); |
1874 | retval = request_irq(irq, s3c2410_udc_vbus_irq, | 1878 | retval = request_irq(irq, s3c2410_udc_vbus_irq, |
1875 | IRQF_DISABLED | IRQF_TRIGGER_RISING | 1879 | IRQF_DISABLED | IRQF_TRIGGER_RISING |
1876 | | IRQF_TRIGGER_FALLING, | 1880 | | IRQF_TRIGGER_FALLING | IRQF_SHARED, |
1877 | gadget_name, udc); | 1881 | gadget_name, udc); |
1878 | 1882 | ||
1879 | if (retval != 0) { | 1883 | if (retval != 0) { |
1880 | dev_err(dev, "can't get vbus irq %i, err %d\n", | 1884 | dev_err(dev, "can't get vbus irq %i, err %d\n", |
diff --git a/drivers/usb/host/Kconfig b/drivers/usb/host/Kconfig index 177e78ed241b..49a91c5ee51b 100644 --- a/drivers/usb/host/Kconfig +++ b/drivers/usb/host/Kconfig | |||
@@ -156,7 +156,7 @@ config USB_OHCI_HCD_PCI | |||
156 | 156 | ||
157 | config USB_OHCI_HCD_SSB | 157 | config USB_OHCI_HCD_SSB |
158 | bool "OHCI support for Broadcom SSB OHCI core" | 158 | bool "OHCI support for Broadcom SSB OHCI core" |
159 | depends on USB_OHCI_HCD && (SSB = y || SSB = CONFIG_USB_OHCI_HCD) && EXPERIMENTAL | 159 | depends on USB_OHCI_HCD && (SSB = y || SSB = USB_OHCI_HCD) && EXPERIMENTAL |
160 | default n | 160 | default n |
161 | ---help--- | 161 | ---help--- |
162 | Support for the Sonics Silicon Backplane (SSB) attached | 162 | Support for the Sonics Silicon Backplane (SSB) attached |
diff --git a/drivers/usb/host/ehci-hcd.c b/drivers/usb/host/ehci-hcd.c index c1514442883e..5f2d74ed5ad7 100644 --- a/drivers/usb/host/ehci-hcd.c +++ b/drivers/usb/host/ehci-hcd.c | |||
@@ -575,12 +575,15 @@ static int ehci_run (struct usb_hcd *hcd) | |||
575 | * from the companions to the EHCI controller. If any of the | 575 | * from the companions to the EHCI controller. If any of the |
576 | * companions are in the middle of a port reset at the time, it | 576 | * companions are in the middle of a port reset at the time, it |
577 | * could cause trouble. Write-locking ehci_cf_port_reset_rwsem | 577 | * could cause trouble. Write-locking ehci_cf_port_reset_rwsem |
578 | * guarantees that no resets are in progress. | 578 | * guarantees that no resets are in progress. After we set CF, |
579 | * a short delay lets the hardware catch up; new resets shouldn't | ||
580 | * be started before the port switching actions could complete. | ||
579 | */ | 581 | */ |
580 | down_write(&ehci_cf_port_reset_rwsem); | 582 | down_write(&ehci_cf_port_reset_rwsem); |
581 | hcd->state = HC_STATE_RUNNING; | 583 | hcd->state = HC_STATE_RUNNING; |
582 | ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag); | 584 | ehci_writel(ehci, FLAG_CF, &ehci->regs->configured_flag); |
583 | ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ | 585 | ehci_readl(ehci, &ehci->regs->command); /* unblock posted writes */ |
586 | msleep(5); | ||
584 | up_write(&ehci_cf_port_reset_rwsem); | 587 | up_write(&ehci_cf_port_reset_rwsem); |
585 | 588 | ||
586 | temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); | 589 | temp = HC_VERSION(ehci_readl(ehci, &ehci->caps->hc_capbase)); |
diff --git a/drivers/usb/image/microtek.c b/drivers/usb/image/microtek.c index 91e999c9f680..bc207e3c21f5 100644 --- a/drivers/usb/image/microtek.c +++ b/drivers/usb/image/microtek.c | |||
@@ -819,7 +819,7 @@ static int mts_usb_probe(struct usb_interface *intf, | |||
819 | goto out_kfree2; | 819 | goto out_kfree2; |
820 | 820 | ||
821 | new_desc->host->hostdata[0] = (unsigned long)new_desc; | 821 | new_desc->host->hostdata[0] = (unsigned long)new_desc; |
822 | if (scsi_add_host(new_desc->host, NULL)) { | 822 | if (scsi_add_host(new_desc->host, &dev->dev)) { |
823 | err_retval = -EIO; | 823 | err_retval = -EIO; |
824 | goto out_host_put; | 824 | goto out_host_put; |
825 | } | 825 | } |
diff --git a/drivers/usb/misc/adutux.c b/drivers/usb/misc/adutux.c index c567aa7a41ea..5a2c44e4c1f7 100644 --- a/drivers/usb/misc/adutux.c +++ b/drivers/usb/misc/adutux.c | |||
@@ -79,12 +79,22 @@ MODULE_DEVICE_TABLE(usb, device_table); | |||
79 | 79 | ||
80 | #define COMMAND_TIMEOUT (2*HZ) /* 60 second timeout for a command */ | 80 | #define COMMAND_TIMEOUT (2*HZ) /* 60 second timeout for a command */ |
81 | 81 | ||
82 | /* | ||
83 | * The locking scheme is a vanilla 3-lock: | ||
84 | * adu_device.buflock: A spinlock, covers what IRQs touch. | ||
85 | * adutux_mutex: A Static lock to cover open_count. It would also cover | ||
86 | * any globals, but we don't have them in 2.6. | ||
87 | * adu_device.mtx: A mutex to hold across sleepers like copy_from_user. | ||
88 | * It covers all of adu_device, except the open_count | ||
89 | * and what .buflock covers. | ||
90 | */ | ||
91 | |||
82 | /* Structure to hold all of our device specific stuff */ | 92 | /* Structure to hold all of our device specific stuff */ |
83 | struct adu_device { | 93 | struct adu_device { |
84 | struct mutex mtx; /* locks this structure */ | 94 | struct mutex mtx; |
85 | struct usb_device* udev; /* save off the usb device pointer */ | 95 | struct usb_device* udev; /* save off the usb device pointer */ |
86 | struct usb_interface* interface; | 96 | struct usb_interface* interface; |
87 | unsigned char minor; /* the starting minor number for this device */ | 97 | unsigned int minor; /* the starting minor number for this device */ |
88 | char serial_number[8]; | 98 | char serial_number[8]; |
89 | 99 | ||
90 | int open_count; /* number of times this port has been opened */ | 100 | int open_count; /* number of times this port has been opened */ |
@@ -107,8 +117,11 @@ struct adu_device { | |||
107 | char* interrupt_out_buffer; | 117 | char* interrupt_out_buffer; |
108 | struct usb_endpoint_descriptor* interrupt_out_endpoint; | 118 | struct usb_endpoint_descriptor* interrupt_out_endpoint; |
109 | struct urb* interrupt_out_urb; | 119 | struct urb* interrupt_out_urb; |
120 | int out_urb_finished; | ||
110 | }; | 121 | }; |
111 | 122 | ||
123 | static DEFINE_MUTEX(adutux_mutex); | ||
124 | |||
112 | static struct usb_driver adu_driver; | 125 | static struct usb_driver adu_driver; |
113 | 126 | ||
114 | static void adu_debug_data(int level, const char *function, int size, | 127 | static void adu_debug_data(int level, const char *function, int size, |
@@ -132,27 +145,31 @@ static void adu_debug_data(int level, const char *function, int size, | |||
132 | */ | 145 | */ |
133 | static void adu_abort_transfers(struct adu_device *dev) | 146 | static void adu_abort_transfers(struct adu_device *dev) |
134 | { | 147 | { |
135 | dbg(2," %s : enter", __FUNCTION__); | 148 | unsigned long flags; |
136 | 149 | ||
137 | if (dev == NULL) { | 150 | dbg(2," %s : enter", __FUNCTION__); |
138 | dbg(1," %s : dev is null", __FUNCTION__); | ||
139 | goto exit; | ||
140 | } | ||
141 | 151 | ||
142 | if (dev->udev == NULL) { | 152 | if (dev->udev == NULL) { |
143 | dbg(1," %s : udev is null", __FUNCTION__); | 153 | dbg(1," %s : udev is null", __FUNCTION__); |
144 | goto exit; | 154 | goto exit; |
145 | } | 155 | } |
146 | 156 | ||
147 | dbg(2," %s : udev state %d", __FUNCTION__, dev->udev->state); | ||
148 | if (dev->udev->state == USB_STATE_NOTATTACHED) { | ||
149 | dbg(1," %s : udev is not attached", __FUNCTION__); | ||
150 | goto exit; | ||
151 | } | ||
152 | |||
153 | /* shutdown transfer */ | 157 | /* shutdown transfer */ |
154 | usb_unlink_urb(dev->interrupt_in_urb); | 158 | |
155 | usb_unlink_urb(dev->interrupt_out_urb); | 159 | /* XXX Anchor these instead */ |
160 | spin_lock_irqsave(&dev->buflock, flags); | ||
161 | if (!dev->read_urb_finished) { | ||
162 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
163 | usb_kill_urb(dev->interrupt_in_urb); | ||
164 | } else | ||
165 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
166 | |||
167 | spin_lock_irqsave(&dev->buflock, flags); | ||
168 | if (!dev->out_urb_finished) { | ||
169 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
170 | usb_kill_urb(dev->interrupt_out_urb); | ||
171 | } else | ||
172 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
156 | 173 | ||
157 | exit: | 174 | exit: |
158 | dbg(2," %s : leave", __FUNCTION__); | 175 | dbg(2," %s : leave", __FUNCTION__); |
@@ -162,8 +179,6 @@ static void adu_delete(struct adu_device *dev) | |||
162 | { | 179 | { |
163 | dbg(2, "%s enter", __FUNCTION__); | 180 | dbg(2, "%s enter", __FUNCTION__); |
164 | 181 | ||
165 | adu_abort_transfers(dev); | ||
166 | |||
167 | /* free data structures */ | 182 | /* free data structures */ |
168 | usb_free_urb(dev->interrupt_in_urb); | 183 | usb_free_urb(dev->interrupt_in_urb); |
169 | usb_free_urb(dev->interrupt_out_urb); | 184 | usb_free_urb(dev->interrupt_out_urb); |
@@ -239,7 +254,10 @@ static void adu_interrupt_out_callback(struct urb *urb) | |||
239 | goto exit; | 254 | goto exit; |
240 | } | 255 | } |
241 | 256 | ||
242 | wake_up_interruptible(&dev->write_wait); | 257 | spin_lock(&dev->buflock); |
258 | dev->out_urb_finished = 1; | ||
259 | wake_up(&dev->write_wait); | ||
260 | spin_unlock(&dev->buflock); | ||
243 | exit: | 261 | exit: |
244 | 262 | ||
245 | adu_debug_data(5, __FUNCTION__, urb->actual_length, | 263 | adu_debug_data(5, __FUNCTION__, urb->actual_length, |
@@ -252,12 +270,17 @@ static int adu_open(struct inode *inode, struct file *file) | |||
252 | struct adu_device *dev = NULL; | 270 | struct adu_device *dev = NULL; |
253 | struct usb_interface *interface; | 271 | struct usb_interface *interface; |
254 | int subminor; | 272 | int subminor; |
255 | int retval = 0; | 273 | int retval; |
256 | 274 | ||
257 | dbg(2,"%s : enter", __FUNCTION__); | 275 | dbg(2,"%s : enter", __FUNCTION__); |
258 | 276 | ||
259 | subminor = iminor(inode); | 277 | subminor = iminor(inode); |
260 | 278 | ||
279 | if ((retval = mutex_lock_interruptible(&adutux_mutex))) { | ||
280 | dbg(2, "%s : mutex lock failed", __FUNCTION__); | ||
281 | goto exit_no_lock; | ||
282 | } | ||
283 | |||
261 | interface = usb_find_interface(&adu_driver, subminor); | 284 | interface = usb_find_interface(&adu_driver, subminor); |
262 | if (!interface) { | 285 | if (!interface) { |
263 | err("%s - error, can't find device for minor %d", | 286 | err("%s - error, can't find device for minor %d", |
@@ -267,54 +290,54 @@ static int adu_open(struct inode *inode, struct file *file) | |||
267 | } | 290 | } |
268 | 291 | ||
269 | dev = usb_get_intfdata(interface); | 292 | dev = usb_get_intfdata(interface); |
270 | if (!dev) { | 293 | if (!dev || !dev->udev) { |
271 | retval = -ENODEV; | 294 | retval = -ENODEV; |
272 | goto exit_no_device; | 295 | goto exit_no_device; |
273 | } | 296 | } |
274 | 297 | ||
275 | /* lock this device */ | 298 | /* check that nobody else is using the device */ |
276 | if ((retval = mutex_lock_interruptible(&dev->mtx))) { | 299 | if (dev->open_count) { |
277 | dbg(2, "%s : mutex lock failed", __FUNCTION__); | 300 | retval = -EBUSY; |
278 | goto exit_no_device; | 301 | goto exit_no_device; |
279 | } | 302 | } |
280 | 303 | ||
281 | /* increment our usage count for the device */ | ||
282 | ++dev->open_count; | 304 | ++dev->open_count; |
283 | dbg(2,"%s : open count %d", __FUNCTION__, dev->open_count); | 305 | dbg(2,"%s : open count %d", __FUNCTION__, dev->open_count); |
284 | 306 | ||
285 | /* save device in the file's private structure */ | 307 | /* save device in the file's private structure */ |
286 | file->private_data = dev; | 308 | file->private_data = dev; |
287 | 309 | ||
288 | if (dev->open_count == 1) { | 310 | /* initialize in direction */ |
289 | /* initialize in direction */ | 311 | dev->read_buffer_length = 0; |
290 | dev->read_buffer_length = 0; | ||
291 | 312 | ||
292 | /* fixup first read by having urb waiting for it */ | 313 | /* fixup first read by having urb waiting for it */ |
293 | usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, | 314 | usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, |
294 | usb_rcvintpipe(dev->udev, | 315 | usb_rcvintpipe(dev->udev, |
295 | dev->interrupt_in_endpoint->bEndpointAddress), | 316 | dev->interrupt_in_endpoint->bEndpointAddress), |
296 | dev->interrupt_in_buffer, | 317 | dev->interrupt_in_buffer, |
297 | le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), | 318 | le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), |
298 | adu_interrupt_in_callback, dev, | 319 | adu_interrupt_in_callback, dev, |
299 | dev->interrupt_in_endpoint->bInterval); | 320 | dev->interrupt_in_endpoint->bInterval); |
300 | /* dev->interrupt_in_urb->transfer_flags |= URB_ASYNC_UNLINK; */ | 321 | dev->read_urb_finished = 0; |
301 | dev->read_urb_finished = 0; | 322 | if (usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL)) |
302 | retval = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL); | 323 | dev->read_urb_finished = 1; |
303 | if (retval) | 324 | /* we ignore failure */ |
304 | --dev->open_count; | 325 | /* end of fixup for first read */ |
305 | } | 326 | |
306 | mutex_unlock(&dev->mtx); | 327 | /* initialize out direction */ |
328 | dev->out_urb_finished = 1; | ||
329 | |||
330 | retval = 0; | ||
307 | 331 | ||
308 | exit_no_device: | 332 | exit_no_device: |
333 | mutex_unlock(&adutux_mutex); | ||
334 | exit_no_lock: | ||
309 | dbg(2,"%s : leave, return value %d ", __FUNCTION__, retval); | 335 | dbg(2,"%s : leave, return value %d ", __FUNCTION__, retval); |
310 | |||
311 | return retval; | 336 | return retval; |
312 | } | 337 | } |
313 | 338 | ||
314 | static int adu_release_internal(struct adu_device *dev) | 339 | static void adu_release_internal(struct adu_device *dev) |
315 | { | 340 | { |
316 | int retval = 0; | ||
317 | |||
318 | dbg(2," %s : enter", __FUNCTION__); | 341 | dbg(2," %s : enter", __FUNCTION__); |
319 | 342 | ||
320 | /* decrement our usage count for the device */ | 343 | /* decrement our usage count for the device */ |
@@ -326,12 +349,11 @@ static int adu_release_internal(struct adu_device *dev) | |||
326 | } | 349 | } |
327 | 350 | ||
328 | dbg(2," %s : leave", __FUNCTION__); | 351 | dbg(2," %s : leave", __FUNCTION__); |
329 | return retval; | ||
330 | } | 352 | } |
331 | 353 | ||
332 | static int adu_release(struct inode *inode, struct file *file) | 354 | static int adu_release(struct inode *inode, struct file *file) |
333 | { | 355 | { |
334 | struct adu_device *dev = NULL; | 356 | struct adu_device *dev; |
335 | int retval = 0; | 357 | int retval = 0; |
336 | 358 | ||
337 | dbg(2," %s : enter", __FUNCTION__); | 359 | dbg(2," %s : enter", __FUNCTION__); |
@@ -343,15 +365,13 @@ static int adu_release(struct inode *inode, struct file *file) | |||
343 | } | 365 | } |
344 | 366 | ||
345 | dev = file->private_data; | 367 | dev = file->private_data; |
346 | |||
347 | if (dev == NULL) { | 368 | if (dev == NULL) { |
348 | dbg(1," %s : object is NULL", __FUNCTION__); | 369 | dbg(1," %s : object is NULL", __FUNCTION__); |
349 | retval = -ENODEV; | 370 | retval = -ENODEV; |
350 | goto exit; | 371 | goto exit; |
351 | } | 372 | } |
352 | 373 | ||
353 | /* lock our device */ | 374 | mutex_lock(&adutux_mutex); /* not interruptible */ |
354 | mutex_lock(&dev->mtx); /* not interruptible */ | ||
355 | 375 | ||
356 | if (dev->open_count <= 0) { | 376 | if (dev->open_count <= 0) { |
357 | dbg(1," %s : device not opened", __FUNCTION__); | 377 | dbg(1," %s : device not opened", __FUNCTION__); |
@@ -359,19 +379,15 @@ static int adu_release(struct inode *inode, struct file *file) | |||
359 | goto exit; | 379 | goto exit; |
360 | } | 380 | } |
361 | 381 | ||
382 | adu_release_internal(dev); | ||
362 | if (dev->udev == NULL) { | 383 | if (dev->udev == NULL) { |
363 | /* the device was unplugged before the file was released */ | 384 | /* the device was unplugged before the file was released */ |
364 | mutex_unlock(&dev->mtx); | 385 | if (!dev->open_count) /* ... and we're the last user */ |
365 | adu_delete(dev); | 386 | adu_delete(dev); |
366 | dev = NULL; | ||
367 | } else { | ||
368 | /* do the work */ | ||
369 | retval = adu_release_internal(dev); | ||
370 | } | 387 | } |
371 | 388 | ||
372 | exit: | 389 | exit: |
373 | if (dev) | 390 | mutex_unlock(&adutux_mutex); |
374 | mutex_unlock(&dev->mtx); | ||
375 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); | 391 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); |
376 | return retval; | 392 | return retval; |
377 | } | 393 | } |
@@ -393,12 +409,12 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
393 | 409 | ||
394 | dev = file->private_data; | 410 | dev = file->private_data; |
395 | dbg(2," %s : dev=%p", __FUNCTION__, dev); | 411 | dbg(2," %s : dev=%p", __FUNCTION__, dev); |
396 | /* lock this object */ | 412 | |
397 | if (mutex_lock_interruptible(&dev->mtx)) | 413 | if (mutex_lock_interruptible(&dev->mtx)) |
398 | return -ERESTARTSYS; | 414 | return -ERESTARTSYS; |
399 | 415 | ||
400 | /* verify that the device wasn't unplugged */ | 416 | /* verify that the device wasn't unplugged */ |
401 | if (dev->udev == NULL || dev->minor == 0) { | 417 | if (dev->udev == NULL) { |
402 | retval = -ENODEV; | 418 | retval = -ENODEV; |
403 | err("No device or device unplugged %d", retval); | 419 | err("No device or device unplugged %d", retval); |
404 | goto exit; | 420 | goto exit; |
@@ -452,7 +468,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
452 | should_submit = 1; | 468 | should_submit = 1; |
453 | } else { | 469 | } else { |
454 | /* even the primary was empty - we may need to do IO */ | 470 | /* even the primary was empty - we may need to do IO */ |
455 | if (dev->interrupt_in_urb->status == -EINPROGRESS) { | 471 | if (!dev->read_urb_finished) { |
456 | /* somebody is doing IO */ | 472 | /* somebody is doing IO */ |
457 | spin_unlock_irqrestore(&dev->buflock, flags); | 473 | spin_unlock_irqrestore(&dev->buflock, flags); |
458 | dbg(2," %s : submitted already", __FUNCTION__); | 474 | dbg(2," %s : submitted already", __FUNCTION__); |
@@ -460,6 +476,7 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
460 | /* we must initiate input */ | 476 | /* we must initiate input */ |
461 | dbg(2," %s : initiate input", __FUNCTION__); | 477 | dbg(2," %s : initiate input", __FUNCTION__); |
462 | dev->read_urb_finished = 0; | 478 | dev->read_urb_finished = 0; |
479 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
463 | 480 | ||
464 | usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, | 481 | usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, |
465 | usb_rcvintpipe(dev->udev, | 482 | usb_rcvintpipe(dev->udev, |
@@ -469,15 +486,12 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
469 | adu_interrupt_in_callback, | 486 | adu_interrupt_in_callback, |
470 | dev, | 487 | dev, |
471 | dev->interrupt_in_endpoint->bInterval); | 488 | dev->interrupt_in_endpoint->bInterval); |
472 | retval = usb_submit_urb(dev->interrupt_in_urb, GFP_ATOMIC); | 489 | retval = usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL); |
473 | if (!retval) { | 490 | if (retval) { |
474 | spin_unlock_irqrestore(&dev->buflock, flags); | 491 | dev->read_urb_finished = 1; |
475 | dbg(2," %s : submitted OK", __FUNCTION__); | ||
476 | } else { | ||
477 | if (retval == -ENOMEM) { | 492 | if (retval == -ENOMEM) { |
478 | retval = bytes_read ? bytes_read : -ENOMEM; | 493 | retval = bytes_read ? bytes_read : -ENOMEM; |
479 | } | 494 | } |
480 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
481 | dbg(2," %s : submit failed", __FUNCTION__); | 495 | dbg(2," %s : submit failed", __FUNCTION__); |
482 | goto exit; | 496 | goto exit; |
483 | } | 497 | } |
@@ -486,10 +500,14 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
486 | /* we wait for I/O to complete */ | 500 | /* we wait for I/O to complete */ |
487 | set_current_state(TASK_INTERRUPTIBLE); | 501 | set_current_state(TASK_INTERRUPTIBLE); |
488 | add_wait_queue(&dev->read_wait, &wait); | 502 | add_wait_queue(&dev->read_wait, &wait); |
489 | if (!dev->read_urb_finished) | 503 | spin_lock_irqsave(&dev->buflock, flags); |
504 | if (!dev->read_urb_finished) { | ||
505 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
490 | timeout = schedule_timeout(COMMAND_TIMEOUT); | 506 | timeout = schedule_timeout(COMMAND_TIMEOUT); |
491 | else | 507 | } else { |
508 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
492 | set_current_state(TASK_RUNNING); | 509 | set_current_state(TASK_RUNNING); |
510 | } | ||
493 | remove_wait_queue(&dev->read_wait, &wait); | 511 | remove_wait_queue(&dev->read_wait, &wait); |
494 | 512 | ||
495 | if (timeout <= 0) { | 513 | if (timeout <= 0) { |
@@ -509,19 +527,23 @@ static ssize_t adu_read(struct file *file, __user char *buffer, size_t count, | |||
509 | 527 | ||
510 | retval = bytes_read; | 528 | retval = bytes_read; |
511 | /* if the primary buffer is empty then use it */ | 529 | /* if the primary buffer is empty then use it */ |
512 | if (should_submit && !dev->interrupt_in_urb->status==-EINPROGRESS) { | 530 | spin_lock_irqsave(&dev->buflock, flags); |
531 | if (should_submit && dev->read_urb_finished) { | ||
532 | dev->read_urb_finished = 0; | ||
533 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
513 | usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, | 534 | usb_fill_int_urb(dev->interrupt_in_urb,dev->udev, |
514 | usb_rcvintpipe(dev->udev, | 535 | usb_rcvintpipe(dev->udev, |
515 | dev->interrupt_in_endpoint->bEndpointAddress), | 536 | dev->interrupt_in_endpoint->bEndpointAddress), |
516 | dev->interrupt_in_buffer, | 537 | dev->interrupt_in_buffer, |
517 | le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), | 538 | le16_to_cpu(dev->interrupt_in_endpoint->wMaxPacketSize), |
518 | adu_interrupt_in_callback, | 539 | adu_interrupt_in_callback, |
519 | dev, | 540 | dev, |
520 | dev->interrupt_in_endpoint->bInterval); | 541 | dev->interrupt_in_endpoint->bInterval); |
521 | /* dev->interrupt_in_urb->transfer_flags |= URB_ASYNC_UNLINK; */ | 542 | if (usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL) != 0) |
522 | dev->read_urb_finished = 0; | 543 | dev->read_urb_finished = 1; |
523 | usb_submit_urb(dev->interrupt_in_urb, GFP_KERNEL); | ||
524 | /* we ignore failure */ | 544 | /* we ignore failure */ |
545 | } else { | ||
546 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
525 | } | 547 | } |
526 | 548 | ||
527 | exit: | 549 | exit: |
@@ -535,24 +557,24 @@ exit: | |||
535 | static ssize_t adu_write(struct file *file, const __user char *buffer, | 557 | static ssize_t adu_write(struct file *file, const __user char *buffer, |
536 | size_t count, loff_t *ppos) | 558 | size_t count, loff_t *ppos) |
537 | { | 559 | { |
560 | DECLARE_WAITQUEUE(waita, current); | ||
538 | struct adu_device *dev; | 561 | struct adu_device *dev; |
539 | size_t bytes_written = 0; | 562 | size_t bytes_written = 0; |
540 | size_t bytes_to_write; | 563 | size_t bytes_to_write; |
541 | size_t buffer_size; | 564 | size_t buffer_size; |
565 | unsigned long flags; | ||
542 | int retval; | 566 | int retval; |
543 | int timeout = 0; | ||
544 | 567 | ||
545 | dbg(2," %s : enter, count = %Zd", __FUNCTION__, count); | 568 | dbg(2," %s : enter, count = %Zd", __FUNCTION__, count); |
546 | 569 | ||
547 | dev = file->private_data; | 570 | dev = file->private_data; |
548 | 571 | ||
549 | /* lock this object */ | ||
550 | retval = mutex_lock_interruptible(&dev->mtx); | 572 | retval = mutex_lock_interruptible(&dev->mtx); |
551 | if (retval) | 573 | if (retval) |
552 | goto exit_nolock; | 574 | goto exit_nolock; |
553 | 575 | ||
554 | /* verify that the device wasn't unplugged */ | 576 | /* verify that the device wasn't unplugged */ |
555 | if (dev->udev == NULL || dev->minor == 0) { | 577 | if (dev->udev == NULL) { |
556 | retval = -ENODEV; | 578 | retval = -ENODEV; |
557 | err("No device or device unplugged %d", retval); | 579 | err("No device or device unplugged %d", retval); |
558 | goto exit; | 580 | goto exit; |
@@ -564,42 +586,37 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, | |||
564 | goto exit; | 586 | goto exit; |
565 | } | 587 | } |
566 | 588 | ||
567 | |||
568 | while (count > 0) { | 589 | while (count > 0) { |
569 | if (dev->interrupt_out_urb->status == -EINPROGRESS) { | 590 | add_wait_queue(&dev->write_wait, &waita); |
570 | timeout = COMMAND_TIMEOUT; | 591 | set_current_state(TASK_INTERRUPTIBLE); |
592 | spin_lock_irqsave(&dev->buflock, flags); | ||
593 | if (!dev->out_urb_finished) { | ||
594 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
571 | 595 | ||
572 | while (timeout > 0) { | 596 | mutex_unlock(&dev->mtx); |
573 | if (signal_pending(current)) { | 597 | if (signal_pending(current)) { |
574 | dbg(1," %s : interrupted", __FUNCTION__); | 598 | dbg(1," %s : interrupted", __FUNCTION__); |
599 | set_current_state(TASK_RUNNING); | ||
575 | retval = -EINTR; | 600 | retval = -EINTR; |
576 | goto exit; | 601 | goto exit_onqueue; |
577 | } | 602 | } |
578 | mutex_unlock(&dev->mtx); | 603 | if (schedule_timeout(COMMAND_TIMEOUT) == 0) { |
579 | timeout = interruptible_sleep_on_timeout(&dev->write_wait, timeout); | 604 | dbg(1, "%s - command timed out.", __FUNCTION__); |
605 | retval = -ETIMEDOUT; | ||
606 | goto exit_onqueue; | ||
607 | } | ||
608 | remove_wait_queue(&dev->write_wait, &waita); | ||
580 | retval = mutex_lock_interruptible(&dev->mtx); | 609 | retval = mutex_lock_interruptible(&dev->mtx); |
581 | if (retval) { | 610 | if (retval) { |
582 | retval = bytes_written ? bytes_written : retval; | 611 | retval = bytes_written ? bytes_written : retval; |
583 | goto exit_nolock; | 612 | goto exit_nolock; |
584 | } | 613 | } |
585 | if (timeout > 0) { | ||
586 | break; | ||
587 | } | ||
588 | dbg(1," %s : interrupted timeout: %d", __FUNCTION__, timeout); | ||
589 | } | ||
590 | |||
591 | |||
592 | dbg(1," %s : final timeout: %d", __FUNCTION__, timeout); | ||
593 | |||
594 | if (timeout == 0) { | ||
595 | dbg(1, "%s - command timed out.", __FUNCTION__); | ||
596 | retval = -ETIMEDOUT; | ||
597 | goto exit; | ||
598 | } | ||
599 | |||
600 | dbg(4," %s : in progress, count = %Zd", __FUNCTION__, count); | ||
601 | 614 | ||
615 | dbg(4," %s : in progress, count = %Zd", __FUNCTION__, count); | ||
602 | } else { | 616 | } else { |
617 | spin_unlock_irqrestore(&dev->buflock, flags); | ||
618 | set_current_state(TASK_RUNNING); | ||
619 | remove_wait_queue(&dev->write_wait, &waita); | ||
603 | dbg(4," %s : sending, count = %Zd", __FUNCTION__, count); | 620 | dbg(4," %s : sending, count = %Zd", __FUNCTION__, count); |
604 | 621 | ||
605 | /* write the data into interrupt_out_buffer from userspace */ | 622 | /* write the data into interrupt_out_buffer from userspace */ |
@@ -622,11 +639,12 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, | |||
622 | bytes_to_write, | 639 | bytes_to_write, |
623 | adu_interrupt_out_callback, | 640 | adu_interrupt_out_callback, |
624 | dev, | 641 | dev, |
625 | dev->interrupt_in_endpoint->bInterval); | 642 | dev->interrupt_out_endpoint->bInterval); |
626 | /* dev->interrupt_in_urb->transfer_flags |= URB_ASYNC_UNLINK; */ | ||
627 | dev->interrupt_out_urb->actual_length = bytes_to_write; | 643 | dev->interrupt_out_urb->actual_length = bytes_to_write; |
644 | dev->out_urb_finished = 0; | ||
628 | retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); | 645 | retval = usb_submit_urb(dev->interrupt_out_urb, GFP_KERNEL); |
629 | if (retval < 0) { | 646 | if (retval < 0) { |
647 | dev->out_urb_finished = 1; | ||
630 | err("Couldn't submit interrupt_out_urb %d", retval); | 648 | err("Couldn't submit interrupt_out_urb %d", retval); |
631 | goto exit; | 649 | goto exit; |
632 | } | 650 | } |
@@ -637,16 +655,17 @@ static ssize_t adu_write(struct file *file, const __user char *buffer, | |||
637 | bytes_written += bytes_to_write; | 655 | bytes_written += bytes_to_write; |
638 | } | 656 | } |
639 | } | 657 | } |
640 | 658 | mutex_unlock(&dev->mtx); | |
641 | retval = bytes_written; | 659 | return bytes_written; |
642 | 660 | ||
643 | exit: | 661 | exit: |
644 | /* unlock the device */ | ||
645 | mutex_unlock(&dev->mtx); | 662 | mutex_unlock(&dev->mtx); |
646 | exit_nolock: | 663 | exit_nolock: |
647 | |||
648 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); | 664 | dbg(2," %s : leave, return value %d", __FUNCTION__, retval); |
665 | return retval; | ||
649 | 666 | ||
667 | exit_onqueue: | ||
668 | remove_wait_queue(&dev->write_wait, &waita); | ||
650 | return retval; | 669 | return retval; |
651 | } | 670 | } |
652 | 671 | ||
@@ -831,25 +850,22 @@ static void adu_disconnect(struct usb_interface *interface) | |||
831 | dbg(2," %s : enter", __FUNCTION__); | 850 | dbg(2," %s : enter", __FUNCTION__); |
832 | 851 | ||
833 | dev = usb_get_intfdata(interface); | 852 | dev = usb_get_intfdata(interface); |
834 | usb_set_intfdata(interface, NULL); | ||
835 | 853 | ||
854 | mutex_lock(&dev->mtx); /* not interruptible */ | ||
855 | dev->udev = NULL; /* poison */ | ||
836 | minor = dev->minor; | 856 | minor = dev->minor; |
837 | |||
838 | /* give back our minor */ | ||
839 | usb_deregister_dev(interface, &adu_class); | 857 | usb_deregister_dev(interface, &adu_class); |
840 | dev->minor = 0; | 858 | mutex_unlock(&dev->mtx); |
841 | 859 | ||
842 | mutex_lock(&dev->mtx); /* not interruptible */ | 860 | mutex_lock(&adutux_mutex); |
861 | usb_set_intfdata(interface, NULL); | ||
843 | 862 | ||
844 | /* if the device is not opened, then we clean up right now */ | 863 | /* if the device is not opened, then we clean up right now */ |
845 | dbg(2," %s : open count %d", __FUNCTION__, dev->open_count); | 864 | dbg(2," %s : open count %d", __FUNCTION__, dev->open_count); |
846 | if (!dev->open_count) { | 865 | if (!dev->open_count) |
847 | mutex_unlock(&dev->mtx); | ||
848 | adu_delete(dev); | 866 | adu_delete(dev); |
849 | } else { | 867 | |
850 | dev->udev = NULL; | 868 | mutex_unlock(&adutux_mutex); |
851 | mutex_unlock(&dev->mtx); | ||
852 | } | ||
853 | 869 | ||
854 | dev_info(&interface->dev, "ADU device adutux%d now disconnected\n", | 870 | dev_info(&interface->dev, "ADU device adutux%d now disconnected\n", |
855 | (minor - ADU_MINOR_BASE)); | 871 | (minor - ADU_MINOR_BASE)); |
diff --git a/drivers/usb/misc/usbled.c b/drivers/usb/misc/usbled.c index 49c5c5c4c431..06cb71942dc7 100644 --- a/drivers/usb/misc/usbled.c +++ b/drivers/usb/misc/usbled.c | |||
@@ -144,12 +144,14 @@ static void led_disconnect(struct usb_interface *interface) | |||
144 | struct usb_led *dev; | 144 | struct usb_led *dev; |
145 | 145 | ||
146 | dev = usb_get_intfdata (interface); | 146 | dev = usb_get_intfdata (interface); |
147 | usb_set_intfdata (interface, NULL); | ||
148 | 147 | ||
149 | device_remove_file(&interface->dev, &dev_attr_blue); | 148 | device_remove_file(&interface->dev, &dev_attr_blue); |
150 | device_remove_file(&interface->dev, &dev_attr_red); | 149 | device_remove_file(&interface->dev, &dev_attr_red); |
151 | device_remove_file(&interface->dev, &dev_attr_green); | 150 | device_remove_file(&interface->dev, &dev_attr_green); |
152 | 151 | ||
152 | /* first remove the files, then set the pointer to NULL */ | ||
153 | usb_set_intfdata (interface, NULL); | ||
154 | |||
153 | usb_put_dev(dev->udev); | 155 | usb_put_dev(dev->udev); |
154 | 156 | ||
155 | kfree(dev); | 157 | kfree(dev); |
diff --git a/drivers/usb/serial/generic.c b/drivers/usb/serial/generic.c index 9eb4a65ee4d9..d41531139c55 100644 --- a/drivers/usb/serial/generic.c +++ b/drivers/usb/serial/generic.c | |||
@@ -327,6 +327,7 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb) | |||
327 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; | 327 | struct usb_serial_port *port = (struct usb_serial_port *)urb->context; |
328 | unsigned char *data = urb->transfer_buffer; | 328 | unsigned char *data = urb->transfer_buffer; |
329 | int status = urb->status; | 329 | int status = urb->status; |
330 | unsigned long flags; | ||
330 | 331 | ||
331 | dbg("%s - port %d", __FUNCTION__, port->number); | 332 | dbg("%s - port %d", __FUNCTION__, port->number); |
332 | 333 | ||
@@ -339,11 +340,11 @@ void usb_serial_generic_read_bulk_callback (struct urb *urb) | |||
339 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); | 340 | usb_serial_debug_data(debug, &port->dev, __FUNCTION__, urb->actual_length, data); |
340 | 341 | ||
341 | /* Throttle the device if requested by tty */ | 342 | /* Throttle the device if requested by tty */ |
342 | spin_lock(&port->lock); | 343 | spin_lock_irqsave(&port->lock, flags); |
343 | if (!(port->throttled = port->throttle_req)) | 344 | if (!(port->throttled = port->throttle_req)) |
344 | /* Handle data and continue reading from device */ | 345 | /* Handle data and continue reading from device */ |
345 | flush_and_resubmit_read_urb(port); | 346 | flush_and_resubmit_read_urb(port); |
346 | spin_unlock(&port->lock); | 347 | spin_unlock_irqrestore(&port->lock, flags); |
347 | } | 348 | } |
348 | EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); | 349 | EXPORT_SYMBOL_GPL(usb_serial_generic_read_bulk_callback); |
349 | 350 | ||
diff --git a/drivers/usb/serial/keyspan.c b/drivers/usb/serial/keyspan.c index 1f7ab15df36d..feba9679ace8 100644 --- a/drivers/usb/serial/keyspan.c +++ b/drivers/usb/serial/keyspan.c | |||
@@ -1215,12 +1215,14 @@ static int keyspan_chars_in_buffer (struct usb_serial_port *port) | |||
1215 | 1215 | ||
1216 | static int keyspan_open (struct usb_serial_port *port, struct file *filp) | 1216 | static int keyspan_open (struct usb_serial_port *port, struct file *filp) |
1217 | { | 1217 | { |
1218 | struct keyspan_port_private *p_priv; | 1218 | struct keyspan_port_private *p_priv; |
1219 | struct keyspan_serial_private *s_priv; | 1219 | struct keyspan_serial_private *s_priv; |
1220 | struct usb_serial *serial = port->serial; | 1220 | struct usb_serial *serial = port->serial; |
1221 | const struct keyspan_device_details *d_details; | 1221 | const struct keyspan_device_details *d_details; |
1222 | int i, err; | 1222 | int i, err; |
1223 | int baud_rate, device_port; | ||
1223 | struct urb *urb; | 1224 | struct urb *urb; |
1225 | unsigned int cflag; | ||
1224 | 1226 | ||
1225 | s_priv = usb_get_serial_data(serial); | 1227 | s_priv = usb_get_serial_data(serial); |
1226 | p_priv = usb_get_serial_port_data(port); | 1228 | p_priv = usb_get_serial_port_data(port); |
@@ -1263,6 +1265,30 @@ static int keyspan_open (struct usb_serial_port *port, struct file *filp) | |||
1263 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ | 1265 | /* usb_settoggle(urb->dev, usb_pipeendpoint(urb->pipe), usb_pipeout(urb->pipe), 0); */ |
1264 | } | 1266 | } |
1265 | 1267 | ||
1268 | /* get the terminal config for the setup message now so we don't | ||
1269 | * need to send 2 of them */ | ||
1270 | |||
1271 | cflag = port->tty->termios->c_cflag; | ||
1272 | device_port = port->number - port->serial->minor; | ||
1273 | |||
1274 | /* Baud rate calculation takes baud rate as an integer | ||
1275 | so other rates can be generated if desired. */ | ||
1276 | baud_rate = tty_get_baud_rate(port->tty); | ||
1277 | /* If no match or invalid, leave as default */ | ||
1278 | if (baud_rate >= 0 | ||
1279 | && d_details->calculate_baud_rate(baud_rate, d_details->baudclk, | ||
1280 | NULL, NULL, NULL, device_port) == KEYSPAN_BAUD_RATE_OK) { | ||
1281 | p_priv->baud = baud_rate; | ||
1282 | } | ||
1283 | |||
1284 | /* set CTS/RTS handshake etc. */ | ||
1285 | p_priv->cflag = cflag; | ||
1286 | p_priv->flow_control = (cflag & CRTSCTS)? flow_cts: flow_none; | ||
1287 | |||
1288 | keyspan_send_setup(port, 1); | ||
1289 | //mdelay(100); | ||
1290 | //keyspan_set_termios(port, NULL); | ||
1291 | |||
1266 | return (0); | 1292 | return (0); |
1267 | } | 1293 | } |
1268 | 1294 | ||
diff --git a/drivers/usb/serial/mos7840.c b/drivers/usb/serial/mos7840.c index a5ced7e08cbf..c29c91271133 100644 --- a/drivers/usb/serial/mos7840.c +++ b/drivers/usb/serial/mos7840.c | |||
@@ -2711,7 +2711,7 @@ static int mos7840_startup(struct usb_serial *serial) | |||
2711 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); | 2711 | status = mos7840_set_reg_sync(serial->port[0], ZLP_REG5, Data); |
2712 | if (status < 0) { | 2712 | if (status < 0) { |
2713 | dbg("Writing ZLP_REG5 failed status-0x%x\n", status); | 2713 | dbg("Writing ZLP_REG5 failed status-0x%x\n", status); |
2714 | return -1; | 2714 | goto error; |
2715 | } else | 2715 | } else |
2716 | dbg("ZLP_REG5 Writing success status%d\n", status); | 2716 | dbg("ZLP_REG5 Writing success status%d\n", status); |
2717 | 2717 | ||
diff --git a/drivers/usb/serial/pl2303.c b/drivers/usb/serial/pl2303.c index 2cd3f1d4b687..cf8add91de05 100644 --- a/drivers/usb/serial/pl2303.c +++ b/drivers/usb/serial/pl2303.c | |||
@@ -86,6 +86,7 @@ static struct usb_device_id id_table [] = { | |||
86 | { USB_DEVICE(ALCOR_VENDOR_ID, ALCOR_PRODUCT_ID) }, | 86 | { USB_DEVICE(ALCOR_VENDOR_ID, ALCOR_PRODUCT_ID) }, |
87 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ID) }, | 87 | { USB_DEVICE(HUAWEI_VENDOR_ID, HUAWEI_PRODUCT_ID) }, |
88 | { USB_DEVICE(WS002IN_VENDOR_ID, WS002IN_PRODUCT_ID) }, | 88 | { USB_DEVICE(WS002IN_VENDOR_ID, WS002IN_PRODUCT_ID) }, |
89 | { USB_DEVICE(COREGA_VENDOR_ID, COREGA_PRODUCT_ID) }, | ||
89 | { } /* Terminating entry */ | 90 | { } /* Terminating entry */ |
90 | }; | 91 | }; |
91 | 92 | ||
diff --git a/drivers/usb/serial/pl2303.h b/drivers/usb/serial/pl2303.h index ed603e3decd6..d31f5d299989 100644 --- a/drivers/usb/serial/pl2303.h +++ b/drivers/usb/serial/pl2303.h | |||
@@ -104,3 +104,6 @@ | |||
104 | #define WS002IN_VENDOR_ID 0x11f6 | 104 | #define WS002IN_VENDOR_ID 0x11f6 |
105 | #define WS002IN_PRODUCT_ID 0x2001 | 105 | #define WS002IN_PRODUCT_ID 0x2001 |
106 | 106 | ||
107 | /* Corega CG-USBRS232R Serial Adapter */ | ||
108 | #define COREGA_VENDOR_ID 0x07aa | ||
109 | #define COREGA_PRODUCT_ID 0x002a | ||
diff --git a/drivers/usb/serial/sierra.c b/drivers/usb/serial/sierra.c index 833f6e1e3721..605ebccdcd51 100644 --- a/drivers/usb/serial/sierra.c +++ b/drivers/usb/serial/sierra.c | |||
@@ -136,6 +136,8 @@ static struct usb_device_id id_table_3port [] = { | |||
136 | { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */ | 136 | { USB_DEVICE(0x0f30, 0x1b1d) }, /* Sierra Wireless MC5720 */ |
137 | { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ | 137 | { USB_DEVICE(0x1199, 0x0218) }, /* Sierra Wireless MC5720 */ |
138 | { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ | 138 | { USB_DEVICE(0x1199, 0x0020) }, /* Sierra Wireless MC5725 */ |
139 | { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ | ||
140 | { USB_DEVICE(0x1199, 0x0220) }, /* Sierra Wireless MC5725 */ | ||
139 | { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ | 141 | { USB_DEVICE(0x1199, 0x0019) }, /* Sierra Wireless AirCard 595 */ |
140 | { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ | 142 | { USB_DEVICE(0x1199, 0x0021) }, /* Sierra Wireless AirCard 597E */ |
141 | { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U*/ | 143 | { USB_DEVICE(0x1199, 0x0120) }, /* Sierra Wireless USB Dongle 595U*/ |
diff --git a/drivers/usb/storage/scsiglue.c b/drivers/usb/storage/scsiglue.c index 1ba19eaa1970..836a34ae6ec6 100644 --- a/drivers/usb/storage/scsiglue.c +++ b/drivers/usb/storage/scsiglue.c | |||
@@ -177,6 +177,10 @@ static int slave_configure(struct scsi_device *sdev) | |||
177 | * is an occasional series of retries that will all fail. */ | 177 | * is an occasional series of retries that will all fail. */ |
178 | sdev->retry_hwerror = 1; | 178 | sdev->retry_hwerror = 1; |
179 | 179 | ||
180 | /* USB disks should allow restart. Some drives spin down | ||
181 | * automatically, requiring a START-STOP UNIT command. */ | ||
182 | sdev->allow_restart = 1; | ||
183 | |||
180 | } else { | 184 | } else { |
181 | 185 | ||
182 | /* Non-disk-type devices don't need to blacklist any pages | 186 | /* Non-disk-type devices don't need to blacklist any pages |
diff --git a/drivers/usb/storage/unusual_devs.h b/drivers/usb/storage/unusual_devs.h index 22ab2380367d..2c27721bd259 100644 --- a/drivers/usb/storage/unusual_devs.h +++ b/drivers/usb/storage/unusual_devs.h | |||
@@ -342,11 +342,11 @@ UNUSUAL_DEV( 0x04b0, 0x040d, 0x0100, 0x0100, | |||
342 | US_FL_FIX_CAPACITY), | 342 | US_FL_FIX_CAPACITY), |
343 | 343 | ||
344 | /* Reported by Graber and Mike Pagano <mpagano-kernel@mpagano.com> */ | 344 | /* Reported by Graber and Mike Pagano <mpagano-kernel@mpagano.com> */ |
345 | UNUSUAL_DEV( 0x04b0, 0x040f, 0x0200, 0x0200, | 345 | UNUSUAL_DEV( 0x04b0, 0x040f, 0x0100, 0x0200, |
346 | "NIKON", | 346 | "NIKON", |
347 | "NIKON DSC D200", | 347 | "NIKON DSC D200", |
348 | US_SC_DEVICE, US_PR_DEVICE, NULL, | 348 | US_SC_DEVICE, US_PR_DEVICE, NULL, |
349 | US_FL_FIX_CAPACITY), | 349 | US_FL_FIX_CAPACITY), |
350 | 350 | ||
351 | /* Reported by Emil Larsson <emil@swip.net> */ | 351 | /* Reported by Emil Larsson <emil@swip.net> */ |
352 | UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0101, | 352 | UNUSUAL_DEV( 0x04b0, 0x0411, 0x0100, 0x0101, |
@@ -731,6 +731,13 @@ UNUSUAL_DEV( 0x0584, 0x0008, 0x0102, 0x0102, | |||
731 | US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ), | 731 | US_SC_SCSI, US_PR_ALAUDA, init_alauda, 0 ), |
732 | #endif | 732 | #endif |
733 | 733 | ||
734 | /* Reported by RTE <raszilki@yandex.ru> */ | ||
735 | UNUSUAL_DEV( 0x058f, 0x6387, 0x0141, 0x0141, | ||
736 | "JetFlash", | ||
737 | "TS1GJF2A/120", | ||
738 | US_SC_DEVICE, US_PR_DEVICE, NULL, | ||
739 | US_FL_MAX_SECTORS_64 ), | ||
740 | |||
734 | /* Fabrizio Fellini <fello@libero.it> */ | 741 | /* Fabrizio Fellini <fello@libero.it> */ |
735 | UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210, | 742 | UNUSUAL_DEV( 0x0595, 0x4343, 0x0000, 0x2210, |
736 | "Fujifilm", | 743 | "Fujifilm", |
diff --git a/drivers/video/Kconfig b/drivers/video/Kconfig index 7d86e9eae915..5b3dbcfcda48 100644 --- a/drivers/video/Kconfig +++ b/drivers/video/Kconfig | |||
@@ -641,6 +641,17 @@ config FB_VESA | |||
641 | You will get a boot time penguin logo at no additional cost. Please | 641 | You will get a boot time penguin logo at no additional cost. Please |
642 | read <file:Documentation/fb/vesafb.txt>. If unsure, say Y. | 642 | read <file:Documentation/fb/vesafb.txt>. If unsure, say Y. |
643 | 643 | ||
644 | config FB_EFI | ||
645 | bool "EFI-based Framebuffer Support" | ||
646 | depends on (FB = y) && X86 | ||
647 | select FB_CFB_FILLRECT | ||
648 | select FB_CFB_COPYAREA | ||
649 | select FB_CFB_IMAGEBLIT | ||
650 | help | ||
651 | This is the EFI frame buffer device driver. If the firmware on | ||
652 | your platform is UEFI2.0, select Y to add support for | ||
653 | Graphics Output Protocol for early console messages to appear. | ||
654 | |||
644 | config FB_IMAC | 655 | config FB_IMAC |
645 | bool "Intel-based Macintosh Framebuffer Support" | 656 | bool "Intel-based Macintosh Framebuffer Support" |
646 | depends on (FB = y) && X86 && EFI | 657 | depends on (FB = y) && X86 && EFI |
diff --git a/drivers/video/Makefile b/drivers/video/Makefile index 59d6c45a910d..83e02b3429b6 100644 --- a/drivers/video/Makefile +++ b/drivers/video/Makefile | |||
@@ -118,6 +118,7 @@ obj-$(CONFIG_FB_OMAP) += omap/ | |||
118 | obj-$(CONFIG_FB_UVESA) += uvesafb.o | 118 | obj-$(CONFIG_FB_UVESA) += uvesafb.o |
119 | obj-$(CONFIG_FB_VESA) += vesafb.o | 119 | obj-$(CONFIG_FB_VESA) += vesafb.o |
120 | obj-$(CONFIG_FB_IMAC) += imacfb.o | 120 | obj-$(CONFIG_FB_IMAC) += imacfb.o |
121 | obj-$(CONFIG_FB_EFI) += efifb.o | ||
121 | obj-$(CONFIG_FB_VGA16) += vga16fb.o | 122 | obj-$(CONFIG_FB_VGA16) += vga16fb.o |
122 | obj-$(CONFIG_FB_OF) += offb.o | 123 | obj-$(CONFIG_FB_OF) += offb.o |
123 | obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-lq043fb.o | 124 | obj-$(CONFIG_FB_BF54X_LQ043) += bf54x-lq043fb.o |
diff --git a/drivers/video/atmel_lcdfb.c b/drivers/video/atmel_lcdfb.c index 235b618b4117..11a3a222dfc3 100644 --- a/drivers/video/atmel_lcdfb.c +++ b/drivers/video/atmel_lcdfb.c | |||
@@ -268,6 +268,10 @@ static int atmel_lcdfb_set_par(struct fb_info *info) | |||
268 | /* Turn off the LCD controller and the DMA controller */ | 268 | /* Turn off the LCD controller and the DMA controller */ |
269 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET); | 269 | lcdc_writel(sinfo, ATMEL_LCDC_PWRCON, sinfo->guard_time << ATMEL_LCDC_GUARDT_OFFSET); |
270 | 270 | ||
271 | /* Wait for the LCDC core to become idle */ | ||
272 | while (lcdc_readl(sinfo, ATMEL_LCDC_PWRCON) & ATMEL_LCDC_BUSY) | ||
273 | msleep(10); | ||
274 | |||
271 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); | 275 | lcdc_writel(sinfo, ATMEL_LCDC_DMACON, 0); |
272 | 276 | ||
273 | if (info->var.bits_per_pixel == 1) | 277 | if (info->var.bits_per_pixel == 1) |
diff --git a/drivers/video/aty/radeon_base.c b/drivers/video/aty/radeon_base.c index 1e32b3d13f2e..62867cb63fef 100644 --- a/drivers/video/aty/radeon_base.c +++ b/drivers/video/aty/radeon_base.c | |||
@@ -202,6 +202,7 @@ static struct pci_device_id radeonfb_pci_table[] = { | |||
202 | CHIP_DEF(PCI_CHIP_RV380_3154, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY), | 202 | CHIP_DEF(PCI_CHIP_RV380_3154, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY), |
203 | CHIP_DEF(PCI_CHIP_RV370_5B60, RV380, CHIP_HAS_CRTC2), | 203 | CHIP_DEF(PCI_CHIP_RV370_5B60, RV380, CHIP_HAS_CRTC2), |
204 | CHIP_DEF(PCI_CHIP_RV370_5B62, RV380, CHIP_HAS_CRTC2), | 204 | CHIP_DEF(PCI_CHIP_RV370_5B62, RV380, CHIP_HAS_CRTC2), |
205 | CHIP_DEF(PCI_CHIP_RV370_5B63, RV380, CHIP_HAS_CRTC2), | ||
205 | CHIP_DEF(PCI_CHIP_RV370_5B64, RV380, CHIP_HAS_CRTC2), | 206 | CHIP_DEF(PCI_CHIP_RV370_5B64, RV380, CHIP_HAS_CRTC2), |
206 | CHIP_DEF(PCI_CHIP_RV370_5B65, RV380, CHIP_HAS_CRTC2), | 207 | CHIP_DEF(PCI_CHIP_RV370_5B65, RV380, CHIP_HAS_CRTC2), |
207 | CHIP_DEF(PCI_CHIP_RV370_5460, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY), | 208 | CHIP_DEF(PCI_CHIP_RV370_5460, RV380, CHIP_HAS_CRTC2 | CHIP_IS_MOBILITY), |
diff --git a/drivers/video/console/Kconfig b/drivers/video/console/Kconfig index 267422f66255..b87ed37ac0c1 100644 --- a/drivers/video/console/Kconfig +++ b/drivers/video/console/Kconfig | |||
@@ -6,7 +6,7 @@ menu "Console display driver support" | |||
6 | 6 | ||
7 | config VGA_CONSOLE | 7 | config VGA_CONSOLE |
8 | bool "VGA text console" if EMBEDDED || !X86 | 8 | bool "VGA text console" if EMBEDDED || !X86 |
9 | depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !ARCH_VERSATILE && !SUPERH && !BFIN | 9 | depends on !ARCH_ACORN && !ARCH_EBSA110 && !4xx && !8xx && !SPARC && !M68K && !PARISC && !FRV && !ARCH_VERSATILE && !SUPERH && !BLACKFIN |
10 | default y | 10 | default y |
11 | help | 11 | help |
12 | Saying Y here will allow you to use Linux in text mode through a | 12 | Saying Y here will allow you to use Linux in text mode through a |
diff --git a/drivers/video/efifb.c b/drivers/video/efifb.c new file mode 100644 index 000000000000..bd779ae44b1e --- /dev/null +++ b/drivers/video/efifb.c | |||
@@ -0,0 +1,232 @@ | |||
1 | /* | ||
2 | * Framebuffer driver for EFI/UEFI based system | ||
3 | * | ||
4 | * (c) 2006 Edgar Hucek <gimli@dark-green.com> | ||
5 | * Original efi driver written by Gerd Knorr <kraxel@goldbach.in-berlin.de> | ||
6 | * | ||
7 | */ | ||
8 | |||
9 | #include <linux/module.h> | ||
10 | #include <linux/kernel.h> | ||
11 | #include <linux/errno.h> | ||
12 | #include <linux/fb.h> | ||
13 | #include <linux/platform_device.h> | ||
14 | #include <linux/screen_info.h> | ||
15 | |||
16 | #include <video/vga.h> | ||
17 | |||
18 | static struct fb_var_screeninfo efifb_defined __initdata = { | ||
19 | .activate = FB_ACTIVATE_NOW, | ||
20 | .height = -1, | ||
21 | .width = -1, | ||
22 | .right_margin = 32, | ||
23 | .upper_margin = 16, | ||
24 | .lower_margin = 4, | ||
25 | .vsync_len = 4, | ||
26 | .vmode = FB_VMODE_NONINTERLACED, | ||
27 | }; | ||
28 | |||
29 | static struct fb_fix_screeninfo efifb_fix __initdata = { | ||
30 | .id = "EFI VGA", | ||
31 | .type = FB_TYPE_PACKED_PIXELS, | ||
32 | .accel = FB_ACCEL_NONE, | ||
33 | .visual = FB_VISUAL_TRUECOLOR, | ||
34 | }; | ||
35 | |||
36 | static int efifb_setcolreg(unsigned regno, unsigned red, unsigned green, | ||
37 | unsigned blue, unsigned transp, | ||
38 | struct fb_info *info) | ||
39 | { | ||
40 | /* | ||
41 | * Set a single color register. The values supplied are | ||
42 | * already rounded down to the hardware's capabilities | ||
43 | * (according to the entries in the `var' structure). Return | ||
44 | * != 0 for invalid regno. | ||
45 | */ | ||
46 | |||
47 | if (regno >= info->cmap.len) | ||
48 | return 1; | ||
49 | |||
50 | if (regno < 16) { | ||
51 | red >>= 8; | ||
52 | green >>= 8; | ||
53 | blue >>= 8; | ||
54 | ((u32 *)(info->pseudo_palette))[regno] = | ||
55 | (red << info->var.red.offset) | | ||
56 | (green << info->var.green.offset) | | ||
57 | (blue << info->var.blue.offset); | ||
58 | } | ||
59 | return 0; | ||
60 | } | ||
61 | |||
62 | static struct fb_ops efifb_ops = { | ||
63 | .owner = THIS_MODULE, | ||
64 | .fb_setcolreg = efifb_setcolreg, | ||
65 | .fb_fillrect = cfb_fillrect, | ||
66 | .fb_copyarea = cfb_copyarea, | ||
67 | .fb_imageblit = cfb_imageblit, | ||
68 | }; | ||
69 | |||
70 | static int __init efifb_probe(struct platform_device *dev) | ||
71 | { | ||
72 | struct fb_info *info; | ||
73 | int err; | ||
74 | unsigned int size_vmode; | ||
75 | unsigned int size_remap; | ||
76 | unsigned int size_total; | ||
77 | |||
78 | efifb_fix.smem_start = screen_info.lfb_base; | ||
79 | efifb_defined.bits_per_pixel = screen_info.lfb_depth; | ||
80 | efifb_defined.xres = screen_info.lfb_width; | ||
81 | efifb_defined.yres = screen_info.lfb_height; | ||
82 | efifb_fix.line_length = screen_info.lfb_linelength; | ||
83 | |||
84 | /* size_vmode -- that is the amount of memory needed for the | ||
85 | * used video mode, i.e. the minimum amount of | ||
86 | * memory we need. */ | ||
87 | size_vmode = efifb_defined.yres * efifb_fix.line_length; | ||
88 | |||
89 | /* size_total -- all video memory we have. Used for | ||
90 | * entries, ressource allocation and bounds | ||
91 | * checking. */ | ||
92 | size_total = screen_info.lfb_size; | ||
93 | if (size_total < size_vmode) | ||
94 | size_total = size_vmode; | ||
95 | |||
96 | /* size_remap -- the amount of video memory we are going to | ||
97 | * use for efifb. With modern cards it is no | ||
98 | * option to simply use size_total as that | ||
99 | * wastes plenty of kernel address space. */ | ||
100 | size_remap = size_vmode * 2; | ||
101 | if (size_remap < size_vmode) | ||
102 | size_remap = size_vmode; | ||
103 | if (size_remap > size_total) | ||
104 | size_remap = size_total; | ||
105 | efifb_fix.smem_len = size_remap; | ||
106 | |||
107 | if (!request_mem_region(efifb_fix.smem_start, size_total, "efifb")) | ||
108 | /* We cannot make this fatal. Sometimes this comes from magic | ||
109 | spaces our resource handlers simply don't know about */ | ||
110 | printk(KERN_WARNING | ||
111 | "efifb: cannot reserve video memory at 0x%lx\n", | ||
112 | efifb_fix.smem_start); | ||
113 | |||
114 | info = framebuffer_alloc(sizeof(u32) * 16, &dev->dev); | ||
115 | if (!info) { | ||
116 | err = -ENOMEM; | ||
117 | goto err_release_mem; | ||
118 | } | ||
119 | info->pseudo_palette = info->par; | ||
120 | info->par = NULL; | ||
121 | |||
122 | info->screen_base = ioremap(efifb_fix.smem_start, efifb_fix.smem_len); | ||
123 | if (!info->screen_base) { | ||
124 | printk(KERN_ERR "efifb: abort, cannot ioremap video memory " | ||
125 | "0x%x @ 0x%lx\n", | ||
126 | efifb_fix.smem_len, efifb_fix.smem_start); | ||
127 | err = -EIO; | ||
128 | goto err_unmap; | ||
129 | } | ||
130 | |||
131 | printk(KERN_INFO "efifb: framebuffer at 0x%lx, mapped to 0x%p, " | ||
132 | "using %dk, total %dk\n", | ||
133 | efifb_fix.smem_start, info->screen_base, | ||
134 | size_remap/1024, size_total/1024); | ||
135 | printk(KERN_INFO "efifb: mode is %dx%dx%d, linelength=%d, pages=%d\n", | ||
136 | efifb_defined.xres, efifb_defined.yres, | ||
137 | efifb_defined.bits_per_pixel, efifb_fix.line_length, | ||
138 | screen_info.pages); | ||
139 | |||
140 | efifb_defined.xres_virtual = efifb_defined.xres; | ||
141 | efifb_defined.yres_virtual = efifb_fix.smem_len / | ||
142 | efifb_fix.line_length; | ||
143 | printk(KERN_INFO "efifb: scrolling: redraw\n"); | ||
144 | efifb_defined.yres_virtual = efifb_defined.yres; | ||
145 | |||
146 | /* some dummy values for timing to make fbset happy */ | ||
147 | efifb_defined.pixclock = 10000000 / efifb_defined.xres * | ||
148 | 1000 / efifb_defined.yres; | ||
149 | efifb_defined.left_margin = (efifb_defined.xres / 8) & 0xf8; | ||
150 | efifb_defined.hsync_len = (efifb_defined.xres / 8) & 0xf8; | ||
151 | |||
152 | efifb_defined.red.offset = screen_info.red_pos; | ||
153 | efifb_defined.red.length = screen_info.red_size; | ||
154 | efifb_defined.green.offset = screen_info.green_pos; | ||
155 | efifb_defined.green.length = screen_info.green_size; | ||
156 | efifb_defined.blue.offset = screen_info.blue_pos; | ||
157 | efifb_defined.blue.length = screen_info.blue_size; | ||
158 | efifb_defined.transp.offset = screen_info.rsvd_pos; | ||
159 | efifb_defined.transp.length = screen_info.rsvd_size; | ||
160 | |||
161 | printk(KERN_INFO "efifb: %s: " | ||
162 | "size=%d:%d:%d:%d, shift=%d:%d:%d:%d\n", | ||
163 | "Truecolor", | ||
164 | screen_info.rsvd_size, | ||
165 | screen_info.red_size, | ||
166 | screen_info.green_size, | ||
167 | screen_info.blue_size, | ||
168 | screen_info.rsvd_pos, | ||
169 | screen_info.red_pos, | ||
170 | screen_info.green_pos, | ||
171 | screen_info.blue_pos); | ||
172 | |||
173 | efifb_fix.ypanstep = 0; | ||
174 | efifb_fix.ywrapstep = 0; | ||
175 | |||
176 | info->fbops = &efifb_ops; | ||
177 | info->var = efifb_defined; | ||
178 | info->fix = efifb_fix; | ||
179 | info->flags = FBINFO_FLAG_DEFAULT; | ||
180 | |||
181 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { | ||
182 | err = -ENOMEM; | ||
183 | goto err_unmap; | ||
184 | } | ||
185 | if (register_framebuffer(info) < 0) { | ||
186 | err = -EINVAL; | ||
187 | goto err_fb_dealoc; | ||
188 | } | ||
189 | printk(KERN_INFO "fb%d: %s frame buffer device\n", | ||
190 | info->node, info->fix.id); | ||
191 | return 0; | ||
192 | |||
193 | err_fb_dealoc: | ||
194 | fb_dealloc_cmap(&info->cmap); | ||
195 | err_unmap: | ||
196 | iounmap(info->screen_base); | ||
197 | framebuffer_release(info); | ||
198 | err_release_mem: | ||
199 | release_mem_region(efifb_fix.smem_start, size_total); | ||
200 | return err; | ||
201 | } | ||
202 | |||
203 | static struct platform_driver efifb_driver = { | ||
204 | .probe = efifb_probe, | ||
205 | .driver = { | ||
206 | .name = "efifb", | ||
207 | }, | ||
208 | }; | ||
209 | |||
210 | static struct platform_device efifb_device = { | ||
211 | .name = "efifb", | ||
212 | }; | ||
213 | |||
214 | static int __init efifb_init(void) | ||
215 | { | ||
216 | int ret; | ||
217 | |||
218 | if (screen_info.orig_video_isVGA != VIDEO_TYPE_EFI) | ||
219 | return -ENODEV; | ||
220 | |||
221 | ret = platform_driver_register(&efifb_driver); | ||
222 | |||
223 | if (!ret) { | ||
224 | ret = platform_device_register(&efifb_device); | ||
225 | if (ret) | ||
226 | platform_driver_unregister(&efifb_driver); | ||
227 | } | ||
228 | return ret; | ||
229 | } | ||
230 | module_init(efifb_init); | ||
231 | |||
232 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/video/fb_ddc.c b/drivers/video/fb_ddc.c index f836137a0eda..a0df63289b5f 100644 --- a/drivers/video/fb_ddc.c +++ b/drivers/video/fb_ddc.c | |||
@@ -56,13 +56,12 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter) | |||
56 | int i, j; | 56 | int i, j; |
57 | 57 | ||
58 | algo_data->setscl(algo_data->data, 1); | 58 | algo_data->setscl(algo_data->data, 1); |
59 | algo_data->setscl(algo_data->data, 0); | ||
60 | 59 | ||
61 | for (i = 0; i < 3; i++) { | 60 | for (i = 0; i < 3; i++) { |
62 | /* For some old monitors we need the | 61 | /* For some old monitors we need the |
63 | * following process to initialize/stop DDC | 62 | * following process to initialize/stop DDC |
64 | */ | 63 | */ |
65 | algo_data->setsda(algo_data->data, 0); | 64 | algo_data->setsda(algo_data->data, 1); |
66 | msleep(13); | 65 | msleep(13); |
67 | 66 | ||
68 | algo_data->setscl(algo_data->data, 1); | 67 | algo_data->setscl(algo_data->data, 1); |
@@ -97,14 +96,15 @@ unsigned char *fb_ddc_read(struct i2c_adapter *adapter) | |||
97 | algo_data->setsda(algo_data->data, 1); | 96 | algo_data->setsda(algo_data->data, 1); |
98 | msleep(15); | 97 | msleep(15); |
99 | algo_data->setscl(algo_data->data, 0); | 98 | algo_data->setscl(algo_data->data, 0); |
99 | algo_data->setsda(algo_data->data, 0); | ||
100 | if (edid) | 100 | if (edid) |
101 | break; | 101 | break; |
102 | } | 102 | } |
103 | /* Release the DDC lines when done or the Apple Cinema HD display | 103 | /* Release the DDC lines when done or the Apple Cinema HD display |
104 | * will switch off | 104 | * will switch off |
105 | */ | 105 | */ |
106 | algo_data->setsda(algo_data->data, 0); | 106 | algo_data->setsda(algo_data->data, 1); |
107 | algo_data->setscl(algo_data->data, 0); | 107 | algo_data->setscl(algo_data->data, 1); |
108 | 108 | ||
109 | return edid; | 109 | return edid; |
110 | } | 110 | } |
diff --git a/drivers/video/imacfb.c b/drivers/video/imacfb.c index 6455fd2a39f2..9366ef2bb5f7 100644 --- a/drivers/video/imacfb.c +++ b/drivers/video/imacfb.c | |||
@@ -234,10 +234,6 @@ static int __init imacfb_probe(struct platform_device *dev) | |||
234 | size_remap = size_total; | 234 | size_remap = size_total; |
235 | imacfb_fix.smem_len = size_remap; | 235 | imacfb_fix.smem_len = size_remap; |
236 | 236 | ||
237 | #ifndef __i386__ | ||
238 | screen_info.imacpm_seg = 0; | ||
239 | #endif | ||
240 | |||
241 | if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) { | 237 | if (!request_mem_region(imacfb_fix.smem_start, size_total, "imacfb")) { |
242 | printk(KERN_WARNING | 238 | printk(KERN_WARNING |
243 | "imacfb: cannot reserve video memory at 0x%lx\n", | 239 | "imacfb: cannot reserve video memory at 0x%lx\n", |
diff --git a/drivers/video/ps3fb.c b/drivers/video/ps3fb.c index 75836aa83191..9c56c492a693 100644 --- a/drivers/video/ps3fb.c +++ b/drivers/video/ps3fb.c | |||
@@ -51,7 +51,6 @@ | |||
51 | #define L1GPU_DISPLAY_SYNC_HSYNC 1 | 51 | #define L1GPU_DISPLAY_SYNC_HSYNC 1 |
52 | #define L1GPU_DISPLAY_SYNC_VSYNC 2 | 52 | #define L1GPU_DISPLAY_SYNC_VSYNC 2 |
53 | 53 | ||
54 | #define DDR_SIZE (0) /* used no ddr */ | ||
55 | #define GPU_CMD_BUF_SIZE (64 * 1024) | 54 | #define GPU_CMD_BUF_SIZE (64 * 1024) |
56 | #define GPU_IOIF (0x0d000000UL) | 55 | #define GPU_IOIF (0x0d000000UL) |
57 | #define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64) | 56 | #define GPU_ALIGN_UP(x) _ALIGN_UP((x), 64) |
@@ -1060,6 +1059,7 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
1060 | u64 xdr_lpar; | 1059 | u64 xdr_lpar; |
1061 | int status, res_index; | 1060 | int status, res_index; |
1062 | struct task_struct *task; | 1061 | struct task_struct *task; |
1062 | unsigned long max_ps3fb_size; | ||
1063 | 1063 | ||
1064 | status = ps3_open_hv_device(dev); | 1064 | status = ps3_open_hv_device(dev); |
1065 | if (status) { | 1065 | if (status) { |
@@ -1085,8 +1085,15 @@ static int __devinit ps3fb_probe(struct ps3_system_bus_device *dev) | |||
1085 | 1085 | ||
1086 | ps3fb_set_sync(&dev->core); | 1086 | ps3fb_set_sync(&dev->core); |
1087 | 1087 | ||
1088 | max_ps3fb_size = _ALIGN_UP(GPU_IOIF, 256*1024*1024) - GPU_IOIF; | ||
1089 | if (ps3fb_videomemory.size > max_ps3fb_size) { | ||
1090 | dev_info(&dev->core, "Limiting ps3fb mem size to %lu bytes\n", | ||
1091 | max_ps3fb_size); | ||
1092 | ps3fb_videomemory.size = max_ps3fb_size; | ||
1093 | } | ||
1094 | |||
1088 | /* get gpu context handle */ | 1095 | /* get gpu context handle */ |
1089 | status = lv1_gpu_memory_allocate(DDR_SIZE, 0, 0, 0, 0, | 1096 | status = lv1_gpu_memory_allocate(ps3fb_videomemory.size, 0, 0, 0, 0, |
1090 | &ps3fb.memory_handle, &ddr_lpar); | 1097 | &ps3fb.memory_handle, &ddr_lpar); |
1091 | if (status) { | 1098 | if (status) { |
1092 | dev_err(&dev->core, "%s: lv1_gpu_memory_allocate failed: %d\n", | 1099 | dev_err(&dev->core, "%s: lv1_gpu_memory_allocate failed: %d\n", |
diff --git a/drivers/virtio/virtio.c b/drivers/virtio/virtio.c index 15d7787dea87..69d7ea02cd48 100644 --- a/drivers/virtio/virtio.c +++ b/drivers/virtio/virtio.c | |||
@@ -96,10 +96,23 @@ static int virtio_dev_probe(struct device *_d) | |||
96 | return err; | 96 | return err; |
97 | } | 97 | } |
98 | 98 | ||
99 | static int virtio_dev_remove(struct device *_d) | ||
100 | { | ||
101 | struct virtio_device *dev = container_of(_d,struct virtio_device,dev); | ||
102 | struct virtio_driver *drv = container_of(dev->dev.driver, | ||
103 | struct virtio_driver, driver); | ||
104 | |||
105 | dev->config->set_status(dev, dev->config->get_status(dev) | ||
106 | & ~VIRTIO_CONFIG_S_DRIVER); | ||
107 | drv->remove(dev); | ||
108 | return 0; | ||
109 | } | ||
110 | |||
99 | int register_virtio_driver(struct virtio_driver *driver) | 111 | int register_virtio_driver(struct virtio_driver *driver) |
100 | { | 112 | { |
101 | driver->driver.bus = &virtio_bus; | 113 | driver->driver.bus = &virtio_bus; |
102 | driver->driver.probe = virtio_dev_probe; | 114 | driver->driver.probe = virtio_dev_probe; |
115 | driver->driver.remove = virtio_dev_remove; | ||
103 | return driver_register(&driver->driver); | 116 | return driver_register(&driver->driver); |
104 | } | 117 | } |
105 | EXPORT_SYMBOL_GPL(register_virtio_driver); | 118 | EXPORT_SYMBOL_GPL(register_virtio_driver); |
diff --git a/drivers/zorro/zorro-driver.c b/drivers/zorro/zorro-driver.c index 067c07be928c..e6c4390d8bd6 100644 --- a/drivers/zorro/zorro-driver.c +++ b/drivers/zorro/zorro-driver.c | |||
@@ -60,6 +60,20 @@ static int zorro_device_probe(struct device *dev) | |||
60 | } | 60 | } |
61 | 61 | ||
62 | 62 | ||
63 | static int zorro_device_remove(struct device *dev) | ||
64 | { | ||
65 | struct zorro_dev *z = to_zorro_dev(dev); | ||
66 | struct zorro_driver *drv = to_zorro_driver(dev->driver); | ||
67 | |||
68 | if (drv) { | ||
69 | if (drv->remove) | ||
70 | drv->remove(z); | ||
71 | z->driver = NULL; | ||
72 | } | ||
73 | return 0; | ||
74 | } | ||
75 | |||
76 | |||
63 | /** | 77 | /** |
64 | * zorro_register_driver - register a new Zorro driver | 78 | * zorro_register_driver - register a new Zorro driver |
65 | * @drv: the driver structure to register | 79 | * @drv: the driver structure to register |
@@ -128,6 +142,7 @@ struct bus_type zorro_bus_type = { | |||
128 | .name = "zorro", | 142 | .name = "zorro", |
129 | .match = zorro_bus_match, | 143 | .match = zorro_bus_match, |
130 | .probe = zorro_device_probe, | 144 | .probe = zorro_device_probe, |
145 | .remove = zorro_device_remove, | ||
131 | }; | 146 | }; |
132 | 147 | ||
133 | 148 | ||