aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/kernel-parameters.txt19
-rw-r--r--arch/i386/kernel/io_apic.c8
-rw-r--r--arch/x86_64/kernel/io_apic.c8
-rw-r--r--drivers/acpi/battery.c47
-rw-r--r--drivers/acpi/ec.c47
-rw-r--r--drivers/acpi/hardware/hwsleep.c19
-rw-r--r--drivers/acpi/tables/tbutils.c71
-rw-r--r--drivers/acpi/thermal.c47
-rw-r--r--drivers/acpi/video.c91
-rw-r--r--drivers/misc/asus-laptop.c3
-rw-r--r--drivers/misc/sony-laptop.c24
-rw-r--r--drivers/pnp/card.c16
-rw-r--r--drivers/pnp/core.c7
-rw-r--r--drivers/pnp/driver.c6
-rw-r--r--drivers/pnp/interface.c9
-rw-r--r--drivers/pnp/isapnp/core.c24
-rw-r--r--drivers/pnp/isapnp/proc.c45
-rw-r--r--drivers/pnp/manager.c27
-rw-r--r--drivers/pnp/pnpacpi/core.c4
-rw-r--r--drivers/pnp/pnpacpi/rsparser.c23
-rw-r--r--drivers/pnp/pnpbios/core.c44
-rw-r--r--drivers/pnp/pnpbios/proc.c2
-rw-r--r--drivers/pnp/pnpbios/rsparser.c9
-rw-r--r--drivers/pnp/resource.c26
-rw-r--r--include/asm-i386/io_apic.h1
-rw-r--r--include/asm-x86_64/io_apic.h6
-rw-r--r--include/linux/input.h6
-rw-r--r--init/main.c12
28 files changed, 367 insertions, 284 deletions
diff --git a/Documentation/kernel-parameters.txt b/Documentation/kernel-parameters.txt
index 975f029be25c..b41cde31d112 100644
--- a/Documentation/kernel-parameters.txt
+++ b/Documentation/kernel-parameters.txt
@@ -952,14 +952,10 @@ and is between 256 and 4096 characters. It is defined in the file
952 Format: <1-256> 952 Format: <1-256>
953 953
954 maxcpus= [SMP] Maximum number of processors that an SMP kernel 954 maxcpus= [SMP] Maximum number of processors that an SMP kernel
955 should make use of. 955 should make use of. maxcpus=n : n >= 0 limits the
956 Using "nosmp" or "maxcpus=0" will disable SMP 956 kernel to using 'n' processors. n=0 is a special case,
957 entirely (the MPS table probe still happens, though). 957 it is equivalent to "nosmp", which also disables
958 A command-line option of "maxcpus=<NUM>", where <NUM> 958 the IO APIC.
959 is an integer greater than 0, limits the maximum number
960 of CPUs activated in SMP mode to <NUM>.
961 Using "maxcpus=1" on an SMP kernel is the trivial
962 case of an SMP kernel with only one CPU.
963 959
964 max_addr=[KMG] [KNL,BOOT,ia64] All physical memory greater than or 960 max_addr=[KMG] [KNL,BOOT,ia64] All physical memory greater than or
965 equal to this physical address is ignored. 961 equal to this physical address is ignored.
@@ -1184,7 +1180,8 @@ and is between 256 and 4096 characters. It is defined in the file
1184 1180
1185 nosep [BUGS=X86-32] Disables x86 SYSENTER/SYSEXIT support. 1181 nosep [BUGS=X86-32] Disables x86 SYSENTER/SYSEXIT support.
1186 1182
1187 nosmp [SMP] Tells an SMP kernel to act as a UP kernel. 1183 nosmp [SMP] Tells an SMP kernel to act as a UP kernel,
1184 and disable the IO APIC. legacy for "maxcpus=0".
1188 1185
1189 nosoftlockup [KNL] Disable the soft-lockup detector. 1186 nosoftlockup [KNL] Disable the soft-lockup detector.
1190 1187
@@ -1826,6 +1823,10 @@ and is between 256 and 4096 characters. It is defined in the file
1826 -1: disable all active trip points in all thermal zones 1823 -1: disable all active trip points in all thermal zones
1827 <degrees C>: override all lowest active trip points 1824 <degrees C>: override all lowest active trip points
1828 1825
1826 thermal.crt= [HW,ACPI]
1827 -1: disable all critical trip points in all thermal zones
1828 <degrees C>: lower all critical trip points
1829
1829 thermal.nocrt= [HW,ACPI] 1830 thermal.nocrt= [HW,ACPI]
1830 Set to disable actions on ACPI thermal zone 1831 Set to disable actions on ACPI thermal zone
1831 critical and hot trip points. 1832 critical and hot trip points.
diff --git a/arch/i386/kernel/io_apic.c b/arch/i386/kernel/io_apic.c
index 4b8a8da4b2e0..e2f4a1c68547 100644
--- a/arch/i386/kernel/io_apic.c
+++ b/arch/i386/kernel/io_apic.c
@@ -754,14 +754,6 @@ static int pirq_entries [MAX_PIRQS];
754static int pirqs_enabled; 754static int pirqs_enabled;
755int skip_ioapic_setup; 755int skip_ioapic_setup;
756 756
757static int __init ioapic_setup(char *str)
758{
759 skip_ioapic_setup = 1;
760 return 1;
761}
762
763__setup("noapic", ioapic_setup);
764
765static int __init ioapic_pirq_setup(char *str) 757static int __init ioapic_pirq_setup(char *str)
766{ 758{
767 int i, max; 759 int i, max;
diff --git a/arch/x86_64/kernel/io_apic.c b/arch/x86_64/kernel/io_apic.c
index f57f8b901912..966fa1062491 100644
--- a/arch/x86_64/kernel/io_apic.c
+++ b/arch/x86_64/kernel/io_apic.c
@@ -397,14 +397,12 @@ static void clear_IO_APIC (void)
397int skip_ioapic_setup; 397int skip_ioapic_setup;
398int ioapic_force; 398int ioapic_force;
399 399
400/* dummy parsing: see setup.c */ 400static int __init parse_noapic(char *str)
401
402static int __init disable_ioapic_setup(char *str)
403{ 401{
404 skip_ioapic_setup = 1; 402 disable_ioapic_setup();
405 return 0; 403 return 0;
406} 404}
407early_param("noapic", disable_ioapic_setup); 405early_param("noapic", parse_noapic);
408 406
409/* Actually the next is obsolete, but keep it for paranoid reasons -AK */ 407/* Actually the next is obsolete, but keep it for paranoid reasons -AK */
410static int __init disable_timer_pin_setup(char *arg) 408static int __init disable_timer_pin_setup(char *arg)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index d7b499fe0cd9..81651032791b 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -113,7 +113,7 @@ struct acpi_battery_info {
113 acpi_string oem_info; 113 acpi_string oem_info;
114}; 114};
115 115
116enum acpi_battery_files { 116enum acpi_battery_files{
117 ACPI_BATTERY_INFO = 0, 117 ACPI_BATTERY_INFO = 0,
118 ACPI_BATTERY_STATE, 118 ACPI_BATTERY_STATE,
119 ACPI_BATTERY_ALARM, 119 ACPI_BATTERY_ALARM,
@@ -129,14 +129,13 @@ struct acpi_battery_flags {
129}; 129};
130 130
131struct acpi_battery { 131struct acpi_battery {
132 struct mutex mutex;
132 struct acpi_device *device; 133 struct acpi_device *device;
133 struct acpi_battery_flags flags; 134 struct acpi_battery_flags flags;
134 struct acpi_buffer bif_data; 135 struct acpi_buffer bif_data;
135 struct acpi_buffer bst_data; 136 struct acpi_buffer bst_data;
136 struct mutex lock;
137 unsigned long alarm; 137 unsigned long alarm;
138 unsigned long update_time[ACPI_BATTERY_NUMFILES]; 138 unsigned long update_time[ACPI_BATTERY_NUMFILES];
139
140}; 139};
141 140
142inline int acpi_battery_present(struct acpi_battery *battery) 141inline int acpi_battery_present(struct acpi_battery *battery)
@@ -236,10 +235,10 @@ static int acpi_battery_get_info(struct acpi_battery *battery)
236 return 0; 235 return 0;
237 236
238 /* Evaluate _BIF */ 237 /* Evaluate _BIF */
239 mutex_lock(&battery->lock); 238
240 status = acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", 239 status =
241 NULL, &buffer); 240 acpi_evaluate_object(acpi_battery_handle(battery), "_BIF", NULL,
242 mutex_unlock(&battery->lock); 241 &buffer);
243 if (ACPI_FAILURE(status)) { 242 if (ACPI_FAILURE(status)) {
244 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF")); 243 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BIF"));
245 return -ENODEV; 244 return -ENODEV;
@@ -286,10 +285,10 @@ static int acpi_battery_get_state(struct acpi_battery *battery)
286 return 0; 285 return 0;
287 286
288 /* Evaluate _BST */ 287 /* Evaluate _BST */
289 mutex_lock(&battery->lock); 288
290 status = acpi_evaluate_object(acpi_battery_handle(battery), "_BST", 289 status =
291 NULL, &buffer); 290 acpi_evaluate_object(acpi_battery_handle(battery), "_BST", NULL,
292 mutex_unlock(&battery->lock); 291 &buffer);
293 if (ACPI_FAILURE(status)) { 292 if (ACPI_FAILURE(status)) {
294 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST")); 293 ACPI_EXCEPTION((AE_INFO, status, "Evaluating _BST"));
295 return -ENODEV; 294 return -ENODEV;
@@ -337,10 +336,9 @@ static int acpi_battery_set_alarm(struct acpi_battery *battery,
337 336
338 arg0.integer.value = alarm; 337 arg0.integer.value = alarm;
339 338
340 mutex_lock(&battery->lock); 339 status =
341 status = acpi_evaluate_object(acpi_battery_handle(battery), "_BTP", 340 acpi_evaluate_object(acpi_battery_handle(battery), "_BTP",
342 &arg_list, NULL); 341 &arg_list, NULL);
343 mutex_unlock(&battery->lock);
344 if (ACPI_FAILURE(status)) 342 if (ACPI_FAILURE(status))
345 return -ENODEV; 343 return -ENODEV;
346 344
@@ -660,6 +658,8 @@ acpi_battery_write_alarm(struct file *file,
660 if (!battery || (count > sizeof(alarm_string) - 1)) 658 if (!battery || (count > sizeof(alarm_string) - 1))
661 return -EINVAL; 659 return -EINVAL;
662 660
661 mutex_lock(&battery->mutex);
662
663 result = acpi_battery_update(battery, 1, &update_result); 663 result = acpi_battery_update(battery, 1, &update_result);
664 if (result) { 664 if (result) {
665 result = -ENODEV; 665 result = -ENODEV;
@@ -688,7 +688,9 @@ acpi_battery_write_alarm(struct file *file,
688 acpi_battery_check_result(battery, result); 688 acpi_battery_check_result(battery, result);
689 689
690 if (!result) 690 if (!result)
691 return count; 691 result = count;
692
693 mutex_unlock(&battery->mutex);
692 694
693 return result; 695 return result;
694} 696}
@@ -712,6 +714,8 @@ static int acpi_battery_read(int fid, struct seq_file *seq)
712 int update_result = ACPI_BATTERY_NONE_UPDATE; 714 int update_result = ACPI_BATTERY_NONE_UPDATE;
713 int update = 0; 715 int update = 0;
714 716
717 mutex_lock(&battery->mutex);
718
715 update = (get_seconds() - battery->update_time[fid] >= update_time); 719 update = (get_seconds() - battery->update_time[fid] >= update_time);
716 update = (update | battery->flags.update[fid]); 720 update = (update | battery->flags.update[fid]);
717 721
@@ -729,6 +733,7 @@ static int acpi_battery_read(int fid, struct seq_file *seq)
729 result = acpi_read_funcs[fid].print(seq, result); 733 result = acpi_read_funcs[fid].print(seq, result);
730 acpi_battery_check_result(battery, result); 734 acpi_battery_check_result(battery, result);
731 battery->flags.update[fid] = result; 735 battery->flags.update[fid] = result;
736 mutex_unlock(&battery->mutex);
732 return result; 737 return result;
733} 738}
734 739
@@ -892,7 +897,10 @@ static int acpi_battery_add(struct acpi_device *device)
892 if (!battery) 897 if (!battery)
893 return -ENOMEM; 898 return -ENOMEM;
894 899
895 mutex_init(&battery->lock); 900 mutex_init(&battery->mutex);
901
902 mutex_lock(&battery->mutex);
903
896 battery->device = device; 904 battery->device = device;
897 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME); 905 strcpy(acpi_device_name(device), ACPI_BATTERY_DEVICE_NAME);
898 strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS); 906 strcpy(acpi_device_class(device), ACPI_BATTERY_CLASS);
@@ -928,6 +936,7 @@ static int acpi_battery_add(struct acpi_device *device)
928 kfree(battery); 936 kfree(battery);
929 } 937 }
930 938
939 mutex_unlock(&battery->mutex);
931 940
932 return result; 941 return result;
933} 942}
@@ -942,6 +951,8 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
942 951
943 battery = acpi_driver_data(device); 952 battery = acpi_driver_data(device);
944 953
954 mutex_lock(&battery->mutex);
955
945 status = acpi_remove_notify_handler(device->handle, 956 status = acpi_remove_notify_handler(device->handle,
946 ACPI_ALL_NOTIFY, 957 ACPI_ALL_NOTIFY,
947 acpi_battery_notify); 958 acpi_battery_notify);
@@ -952,7 +963,9 @@ static int acpi_battery_remove(struct acpi_device *device, int type)
952 963
953 kfree(battery->bst_data.pointer); 964 kfree(battery->bst_data.pointer);
954 965
955 mutex_destroy(&battery->lock); 966 mutex_unlock(&battery->mutex);
967
968 mutex_destroy(&battery->mutex);
956 969
957 kfree(battery); 970 kfree(battery);
958 971
diff --git a/drivers/acpi/ec.c b/drivers/acpi/ec.c
index 56bee9e065cf..43749c86861f 100644
--- a/drivers/acpi/ec.c
+++ b/drivers/acpi/ec.c
@@ -696,14 +696,6 @@ ec_parse_device(acpi_handle handle, u32 Level, void *context, void **retval)
696 return AE_CTRL_TERMINATE; 696 return AE_CTRL_TERMINATE;
697} 697}
698 698
699static void ec_remove_handlers(struct acpi_ec *ec)
700{
701 acpi_remove_address_space_handler(ec->handle,
702 ACPI_ADR_SPACE_EC,
703 &acpi_ec_space_handler);
704 acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
705}
706
707static int acpi_ec_add(struct acpi_device *device) 699static int acpi_ec_add(struct acpi_device *device)
708{ 700{
709 struct acpi_ec *ec = NULL; 701 struct acpi_ec *ec = NULL;
@@ -727,13 +719,16 @@ static int acpi_ec_add(struct acpi_device *device)
727 /* Check if we found the boot EC */ 719 /* Check if we found the boot EC */
728 if (boot_ec) { 720 if (boot_ec) {
729 if (boot_ec->gpe == ec->gpe) { 721 if (boot_ec->gpe == ec->gpe) {
730 ec_remove_handlers(boot_ec); 722 /* We might have incorrect info for GL at boot time */
731 mutex_destroy(&boot_ec->lock); 723 mutex_lock(&boot_ec->lock);
732 kfree(boot_ec); 724 boot_ec->global_lock = ec->global_lock;
733 first_ec = boot_ec = NULL; 725 /* Copy handlers from new ec into boot ec */
726 list_splice(&ec->list, &boot_ec->list);
727 mutex_unlock(&boot_ec->lock);
728 kfree(ec);
729 ec = boot_ec;
734 } 730 }
735 } 731 } else
736 if (!first_ec)
737 first_ec = ec; 732 first_ec = ec;
738 ec->handle = device->handle; 733 ec->handle = device->handle;
739 acpi_driver_data(device) = ec; 734 acpi_driver_data(device) = ec;
@@ -762,6 +757,9 @@ static int acpi_ec_remove(struct acpi_device *device, int type)
762 if (ec == first_ec) 757 if (ec == first_ec)
763 first_ec = NULL; 758 first_ec = NULL;
764 759
760 /* Don't touch boot EC */
761 if (boot_ec != ec)
762 kfree(ec);
765 return 0; 763 return 0;
766} 764}
767 765
@@ -825,7 +823,9 @@ static int acpi_ec_start(struct acpi_device *device)
825 if (!ec) 823 if (!ec)
826 return -EINVAL; 824 return -EINVAL;
827 825
828 ret = ec_install_handlers(ec); 826 /* Boot EC is already working */
827 if (ec != boot_ec)
828 ret = ec_install_handlers(ec);
829 829
830 /* EC is fully operational, allow queries */ 830 /* EC is fully operational, allow queries */
831 atomic_set(&ec->query_pending, 0); 831 atomic_set(&ec->query_pending, 0);
@@ -835,6 +835,7 @@ static int acpi_ec_start(struct acpi_device *device)
835 835
836static int acpi_ec_stop(struct acpi_device *device, int type) 836static int acpi_ec_stop(struct acpi_device *device, int type)
837{ 837{
838 acpi_status status;
838 struct acpi_ec *ec; 839 struct acpi_ec *ec;
839 840
840 if (!device) 841 if (!device)
@@ -843,7 +844,21 @@ static int acpi_ec_stop(struct acpi_device *device, int type)
843 ec = acpi_driver_data(device); 844 ec = acpi_driver_data(device);
844 if (!ec) 845 if (!ec)
845 return -EINVAL; 846 return -EINVAL;
846 ec_remove_handlers(ec); 847
848 /* Don't touch boot EC */
849 if (ec == boot_ec)
850 return 0;
851
852 status = acpi_remove_address_space_handler(ec->handle,
853 ACPI_ADR_SPACE_EC,
854 &acpi_ec_space_handler);
855 if (ACPI_FAILURE(status))
856 return -ENODEV;
857
858 status = acpi_remove_gpe_handler(NULL, ec->gpe, &acpi_ec_gpe_handler);
859 if (ACPI_FAILURE(status))
860 return -ENODEV;
861
847 return 0; 862 return 0;
848} 863}
849 864
diff --git a/drivers/acpi/hardware/hwsleep.c b/drivers/acpi/hardware/hwsleep.c
index 76c525dc590b..cf69c0040a39 100644
--- a/drivers/acpi/hardware/hwsleep.c
+++ b/drivers/acpi/hardware/hwsleep.c
@@ -576,13 +576,10 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
576 ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS")); 576 ACPI_EXCEPTION((AE_INFO, status, "During Method _BFS"));
577 } 577 }
578 578
579 status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL);
580 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
581 ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK"));
582 }
583 /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
584
585 /* 579 /*
580 * GPEs must be enabled before _WAK is called as GPEs
581 * might get fired there
582 *
586 * Restore the GPEs: 583 * Restore the GPEs:
587 * 1) Disable/Clear all GPEs 584 * 1) Disable/Clear all GPEs
588 * 2) Enable all runtime GPEs 585 * 2) Enable all runtime GPEs
@@ -591,13 +588,19 @@ acpi_status acpi_leave_sleep_state(u8 sleep_state)
591 if (ACPI_FAILURE(status)) { 588 if (ACPI_FAILURE(status)) {
592 return_ACPI_STATUS(status); 589 return_ACPI_STATUS(status);
593 } 590 }
594 acpi_gbl_system_awake_and_running = TRUE;
595
596 status = acpi_hw_enable_all_runtime_gpes(); 591 status = acpi_hw_enable_all_runtime_gpes();
597 if (ACPI_FAILURE(status)) { 592 if (ACPI_FAILURE(status)) {
598 return_ACPI_STATUS(status); 593 return_ACPI_STATUS(status);
599 } 594 }
600 595
596 status = acpi_evaluate_object(NULL, METHOD_NAME__WAK, &arg_list, NULL);
597 if (ACPI_FAILURE(status) && status != AE_NOT_FOUND) {
598 ACPI_EXCEPTION((AE_INFO, status, "During Method _WAK"));
599 }
600 /* TBD: _WAK "sometimes" returns stuff - do we want to look at it? */
601
602 acpi_gbl_system_awake_and_running = TRUE;
603
601 /* Enable power button */ 604 /* Enable power button */
602 605
603 (void) 606 (void)
diff --git a/drivers/acpi/tables/tbutils.c b/drivers/acpi/tables/tbutils.c
index 1da64b4518c0..8cc9492ffbf2 100644
--- a/drivers/acpi/tables/tbutils.c
+++ b/drivers/acpi/tables/tbutils.c
@@ -51,6 +51,65 @@ ACPI_MODULE_NAME("tbutils")
51static acpi_physical_address 51static acpi_physical_address
52acpi_tb_get_root_table_entry(u8 * table_entry, 52acpi_tb_get_root_table_entry(u8 * table_entry,
53 acpi_native_uint table_entry_size); 53 acpi_native_uint table_entry_size);
54/*******************************************************************************
55 *
56 * FUNCTION: acpi_tb_check_xsdt
57 *
58 * PARAMETERS: address - Pointer to the XSDT
59 *
60 * RETURN: status
61 * AE_OK - XSDT is okay
62 * AE_NO_MEMORY - can't map XSDT
63 * AE_INVALID_TABLE_LENGTH - invalid table length
64 * AE_NULL_ENTRY - XSDT has NULL entry
65 *
66 * DESCRIPTION: validate XSDT
67******************************************************************************/
68
69static acpi_status
70acpi_tb_check_xsdt(acpi_physical_address address)
71{
72 struct acpi_table_header *table;
73 u32 length;
74 u64 xsdt_entry_address;
75 u8 *table_entry;
76 u32 table_count;
77 int i;
78
79 table = acpi_os_map_memory(address, sizeof(struct acpi_table_header));
80 if (!table)
81 return AE_NO_MEMORY;
82
83 length = table->length;
84 acpi_os_unmap_memory(table, sizeof(struct acpi_table_header));
85 if (length < sizeof(struct acpi_table_header))
86 return AE_INVALID_TABLE_LENGTH;
87
88 table = acpi_os_map_memory(address, length);
89 if (!table)
90 return AE_NO_MEMORY;
91
92 /* Calculate the number of tables described in XSDT */
93 table_count =
94 (u32) ((table->length -
95 sizeof(struct acpi_table_header)) / sizeof(u64));
96 table_entry =
97 ACPI_CAST_PTR(u8, table) + sizeof(struct acpi_table_header);
98 for (i = 0; i < table_count; i++) {
99 ACPI_MOVE_64_TO_64(&xsdt_entry_address, table_entry);
100 if (!xsdt_entry_address) {
101 /* XSDT has NULL entry */
102 break;
103 }
104 table_entry += sizeof(u64);
105 }
106 acpi_os_unmap_memory(table, length);
107
108 if (i < table_count)
109 return AE_NULL_ENTRY;
110 else
111 return AE_OK;
112}
54 113
55/******************************************************************************* 114/*******************************************************************************
56 * 115 *
@@ -341,6 +400,7 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
341 u32 table_count; 400 u32 table_count;
342 struct acpi_table_header *table; 401 struct acpi_table_header *table;
343 acpi_physical_address address; 402 acpi_physical_address address;
403 acpi_physical_address rsdt_address;
344 u32 length; 404 u32 length;
345 u8 *table_entry; 405 u8 *table_entry;
346 acpi_status status; 406 acpi_status status;
@@ -369,6 +429,8 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
369 */ 429 */
370 address = (acpi_physical_address) rsdp->xsdt_physical_address; 430 address = (acpi_physical_address) rsdp->xsdt_physical_address;
371 table_entry_size = sizeof(u64); 431 table_entry_size = sizeof(u64);
432 rsdt_address = (acpi_physical_address)
433 rsdp->rsdt_physical_address;
372 } else { 434 } else {
373 /* Root table is an RSDT (32-bit physical addresses) */ 435 /* Root table is an RSDT (32-bit physical addresses) */
374 436
@@ -382,6 +444,15 @@ acpi_tb_parse_root_table(acpi_physical_address rsdp_address, u8 flags)
382 */ 444 */
383 acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp)); 445 acpi_os_unmap_memory(rsdp, sizeof(struct acpi_table_rsdp));
384 446
447 if (table_entry_size == sizeof(u64)) {
448 if (acpi_tb_check_xsdt(address) == AE_NULL_ENTRY) {
449 /* XSDT has NULL entry, RSDT is used */
450 address = rsdt_address;
451 table_entry_size = sizeof(u32);
452 ACPI_WARNING((AE_INFO, "BIOS XSDT has NULL entry,"
453 "using RSDT"));
454 }
455 }
385 /* Map the RSDT/XSDT table header to get the full table length */ 456 /* Map the RSDT/XSDT table header to get the full table length */
386 457
387 table = acpi_os_map_memory(address, sizeof(struct acpi_table_header)); 458 table = acpi_os_map_memory(address, sizeof(struct acpi_table_header));
diff --git a/drivers/acpi/thermal.c b/drivers/acpi/thermal.c
index 1e06159fd9c4..7e8f48b7f9af 100644
--- a/drivers/acpi/thermal.c
+++ b/drivers/acpi/thermal.c
@@ -77,23 +77,27 @@ MODULE_LICENSE("GPL");
77 77
78static int act; 78static int act;
79module_param(act, int, 0644); 79module_param(act, int, 0644);
80MODULE_PARM_DESC(act, "Disable or override all lowest active trip points.\n"); 80MODULE_PARM_DESC(act, "Disable or override all lowest active trip points.");
81
82static int crt;
83module_param(crt, int, 0644);
84MODULE_PARM_DESC(crt, "Disable or lower all critical trip points.");
81 85
82static int tzp; 86static int tzp;
83module_param(tzp, int, 0444); 87module_param(tzp, int, 0444);
84MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.\n"); 88MODULE_PARM_DESC(tzp, "Thermal zone polling frequency, in 1/10 seconds.");
85 89
86static int nocrt; 90static int nocrt;
87module_param(nocrt, int, 0); 91module_param(nocrt, int, 0);
88MODULE_PARM_DESC(nocrt, "Set to disable action on ACPI thermal zone critical and hot trips.\n"); 92MODULE_PARM_DESC(nocrt, "Set to take no action upon ACPI thermal zone critical trips points.");
89 93
90static int off; 94static int off;
91module_param(off, int, 0); 95module_param(off, int, 0);
92MODULE_PARM_DESC(off, "Set to disable ACPI thermal support.\n"); 96MODULE_PARM_DESC(off, "Set to disable ACPI thermal support.");
93 97
94static int psv; 98static int psv;
95module_param(psv, int, 0644); 99module_param(psv, int, 0644);
96MODULE_PARM_DESC(psv, "Disable or override all passive trip points.\n"); 100MODULE_PARM_DESC(psv, "Disable or override all passive trip points.");
97 101
98static int acpi_thermal_add(struct acpi_device *device); 102static int acpi_thermal_add(struct acpi_device *device);
99static int acpi_thermal_remove(struct acpi_device *device, int type); 103static int acpi_thermal_remove(struct acpi_device *device, int type);
@@ -340,6 +344,20 @@ static int acpi_thermal_get_trip_points(struct acpi_thermal *tz)
340 tz->trips.critical.temperature)); 344 tz->trips.critical.temperature));
341 } 345 }
342 346
347 if (tz->trips.critical.flags.valid == 1) {
348 if (crt == -1) {
349 tz->trips.critical.flags.valid = 0;
350 } else if (crt > 0) {
351 unsigned long crt_k = CELSIUS_TO_KELVIN(crt);
352
353 /*
354 * Allow override to lower critical threshold
355 */
356 if (crt_k < tz->trips.critical.temperature)
357 tz->trips.critical.temperature = crt_k;
358 }
359 }
360
343 /* Critical Sleep (optional) */ 361 /* Critical Sleep (optional) */
344 362
345 status = 363 status =
@@ -1067,9 +1085,9 @@ static int acpi_thermal_add_fs(struct acpi_device *device)
1067 entry->owner = THIS_MODULE; 1085 entry->owner = THIS_MODULE;
1068 } 1086 }
1069 1087
1070 /* 'trip_points' [R/W] */ 1088 /* 'trip_points' [R] */
1071 entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS, 1089 entry = create_proc_entry(ACPI_THERMAL_FILE_TRIP_POINTS,
1072 S_IFREG | S_IRUGO | S_IWUSR, 1090 S_IRUGO,
1073 acpi_device_dir(device)); 1091 acpi_device_dir(device));
1074 if (!entry) 1092 if (!entry)
1075 return -ENODEV; 1093 return -ENODEV;
@@ -1339,6 +1357,13 @@ static int thermal_act(struct dmi_system_id *d) {
1339 } 1357 }
1340 return 0; 1358 return 0;
1341} 1359}
1360static int thermal_nocrt(struct dmi_system_id *d) {
1361
1362 printk(KERN_NOTICE "ACPI: %s detected: "
1363 "disabling all critical thermal trip point actions.\n", d->ident);
1364 nocrt = 1;
1365 return 0;
1366}
1342static int thermal_tzp(struct dmi_system_id *d) { 1367static int thermal_tzp(struct dmi_system_id *d) {
1343 1368
1344 if (tzp == 0) { 1369 if (tzp == 0) {
@@ -1387,6 +1412,14 @@ static struct dmi_system_id thermal_dmi_table[] __initdata = {
1387 DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"), 1412 DMI_MATCH(DMI_BOARD_NAME, "i915GMm-HFS"),
1388 }, 1413 },
1389 }, 1414 },
1415 {
1416 .callback = thermal_nocrt,
1417 .ident = "Gigabyte GA-7ZX",
1418 .matches = {
1419 DMI_MATCH(DMI_BOARD_VENDOR, "Gigabyte Technology Co., Ltd."),
1420 DMI_MATCH(DMI_BOARD_NAME, "7ZX"),
1421 },
1422 },
1390 {} 1423 {}
1391}; 1424};
1392#endif /* CONFIG_DMI */ 1425#endif /* CONFIG_DMI */
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index d98701941981..d727d2c715df 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -31,7 +31,7 @@
31#include <linux/list.h> 31#include <linux/list.h>
32#include <linux/proc_fs.h> 32#include <linux/proc_fs.h>
33#include <linux/seq_file.h> 33#include <linux/seq_file.h>
34 34#include <linux/input.h>
35#include <linux/backlight.h> 35#include <linux/backlight.h>
36#include <linux/video_output.h> 36#include <linux/video_output.h>
37#include <asm/uaccess.h> 37#include <asm/uaccess.h>
@@ -138,6 +138,8 @@ struct acpi_video_bus {
138 struct semaphore sem; 138 struct semaphore sem;
139 struct list_head video_device_list; 139 struct list_head video_device_list;
140 struct proc_dir_entry *dir; 140 struct proc_dir_entry *dir;
141 struct input_dev *input;
142 char phys[32]; /* for input device */
141}; 143};
142 144
143struct acpi_video_device_flags { 145struct acpi_video_device_flags {
@@ -1764,6 +1766,9 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1764{ 1766{
1765 struct acpi_video_bus *video = data; 1767 struct acpi_video_bus *video = data;
1766 struct acpi_device *device = NULL; 1768 struct acpi_device *device = NULL;
1769 struct input_dev *input;
1770 int keycode;
1771
1767 1772
1768 printk("video bus notify\n"); 1773 printk("video bus notify\n");
1769 1774
@@ -1771,11 +1776,13 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1771 return; 1776 return;
1772 1777
1773 device = video->device; 1778 device = video->device;
1779 input = video->input;
1774 1780
1775 switch (event) { 1781 switch (event) {
1776 case ACPI_VIDEO_NOTIFY_SWITCH: /* User requested a switch, 1782 case ACPI_VIDEO_NOTIFY_SWITCH: /* User requested a switch,
1777 * most likely via hotkey. */ 1783 * most likely via hotkey. */
1778 acpi_bus_generate_event(device, event, 0); 1784 acpi_bus_generate_event(device, event, 0);
1785 keycode = KEY_SWITCHVIDEOMODE;
1779 break; 1786 break;
1780 1787
1781 case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video 1788 case ACPI_VIDEO_NOTIFY_PROBE: /* User plugged in or removed a video
@@ -1784,21 +1791,37 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
1784 acpi_video_device_rebind(video); 1791 acpi_video_device_rebind(video);
1785 acpi_video_switch_output(video, event); 1792 acpi_video_switch_output(video, event);
1786 acpi_bus_generate_event(device, event, 0); 1793 acpi_bus_generate_event(device, event, 0);
1794 keycode = KEY_SWITCHVIDEOMODE;
1787 break; 1795 break;
1788 1796
1789 case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed. */ 1797 case ACPI_VIDEO_NOTIFY_CYCLE: /* Cycle Display output hotkey pressed. */
1798 acpi_video_switch_output(video, event);
1799 acpi_bus_generate_event(device, event, 0);
1800 keycode = KEY_SWITCHVIDEOMODE;
1801 break;
1790 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */ 1802 case ACPI_VIDEO_NOTIFY_NEXT_OUTPUT: /* Next Display output hotkey pressed. */
1803 acpi_video_switch_output(video, event);
1804 acpi_bus_generate_event(device, event, 0);
1805 keycode = KEY_VIDEO_NEXT;
1806 break;
1791 case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */ 1807 case ACPI_VIDEO_NOTIFY_PREV_OUTPUT: /* previous Display output hotkey pressed. */
1792 acpi_video_switch_output(video, event); 1808 acpi_video_switch_output(video, event);
1793 acpi_bus_generate_event(device, event, 0); 1809 acpi_bus_generate_event(device, event, 0);
1810 keycode = KEY_VIDEO_PREV;
1794 break; 1811 break;
1795 1812
1796 default: 1813 default:
1814 keycode = KEY_UNKNOWN;
1797 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 1815 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
1798 "Unsupported event [0x%x]\n", event)); 1816 "Unsupported event [0x%x]\n", event));
1799 break; 1817 break;
1800 } 1818 }
1801 1819
1820 input_report_key(input, keycode, 1);
1821 input_sync(input);
1822 input_report_key(input, keycode, 0);
1823 input_sync(input);
1824
1802 return; 1825 return;
1803} 1826}
1804 1827
@@ -1806,30 +1829,55 @@ static void acpi_video_device_notify(acpi_handle handle, u32 event, void *data)
1806{ 1829{
1807 struct acpi_video_device *video_device = data; 1830 struct acpi_video_device *video_device = data;
1808 struct acpi_device *device = NULL; 1831 struct acpi_device *device = NULL;
1832 struct acpi_video_bus *bus;
1833 struct input_dev *input;
1834 int keycode;
1809 1835
1810 if (!video_device) 1836 if (!video_device)
1811 return; 1837 return;
1812 1838
1813 device = video_device->dev; 1839 device = video_device->dev;
1840 bus = video_device->video;
1841 input = bus->input;
1814 1842
1815 switch (event) { 1843 switch (event) {
1816 case ACPI_VIDEO_NOTIFY_SWITCH: /* change in status (cycle output device) */ 1844 case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */
1817 case ACPI_VIDEO_NOTIFY_PROBE: /* change in status (output device status) */ 1845 acpi_video_switch_brightness(video_device, event);
1818 acpi_bus_generate_event(device, event, 0); 1846 acpi_bus_generate_event(device, event, 0);
1847 keycode = KEY_BRIGHTNESS_CYCLE;
1819 break; 1848 break;
1820 case ACPI_VIDEO_NOTIFY_CYCLE_BRIGHTNESS: /* Cycle brightness */
1821 case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */ 1849 case ACPI_VIDEO_NOTIFY_INC_BRIGHTNESS: /* Increase brightness */
1850 acpi_video_switch_brightness(video_device, event);
1851 acpi_bus_generate_event(device, event, 0);
1852 keycode = KEY_BRIGHTNESSUP;
1853 break;
1822 case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */ 1854 case ACPI_VIDEO_NOTIFY_DEC_BRIGHTNESS: /* Decrease brightness */
1855 acpi_video_switch_brightness(video_device, event);
1856 acpi_bus_generate_event(device, event, 0);
1857 keycode = KEY_BRIGHTNESSDOWN;
1858 break;
1823 case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */ 1859 case ACPI_VIDEO_NOTIFY_ZERO_BRIGHTNESS: /* zero brightnesss */
1860 acpi_video_switch_brightness(video_device, event);
1861 acpi_bus_generate_event(device, event, 0);
1862 keycode = KEY_BRIGHTNESS_ZERO;
1863 break;
1824 case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */ 1864 case ACPI_VIDEO_NOTIFY_DISPLAY_OFF: /* display device off */
1825 acpi_video_switch_brightness(video_device, event); 1865 acpi_video_switch_brightness(video_device, event);
1826 acpi_bus_generate_event(device, event, 0); 1866 acpi_bus_generate_event(device, event, 0);
1867 keycode = KEY_DISPLAY_OFF;
1827 break; 1868 break;
1828 default: 1869 default:
1870 keycode = KEY_UNKNOWN;
1829 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 1871 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
1830 "Unsupported event [0x%x]\n", event)); 1872 "Unsupported event [0x%x]\n", event));
1831 break; 1873 break;
1832 } 1874 }
1875
1876 input_report_key(input, keycode, 1);
1877 input_sync(input);
1878 input_report_key(input, keycode, 0);
1879 input_sync(input);
1880
1833 return; 1881 return;
1834} 1882}
1835 1883
@@ -1838,6 +1886,7 @@ static int acpi_video_bus_add(struct acpi_device *device)
1838 int result = 0; 1886 int result = 0;
1839 acpi_status status = 0; 1887 acpi_status status = 0;
1840 struct acpi_video_bus *video = NULL; 1888 struct acpi_video_bus *video = NULL;
1889 struct input_dev *input;
1841 1890
1842 1891
1843 if (!device) 1892 if (!device)
@@ -1881,6 +1930,39 @@ static int acpi_video_bus_add(struct acpi_device *device)
1881 goto end; 1930 goto end;
1882 } 1931 }
1883 1932
1933
1934 video->input = input = input_allocate_device();
1935
1936 snprintf(video->phys, sizeof(video->phys),
1937 "%s/video/input0", acpi_device_hid(video->device));
1938
1939 input->name = acpi_device_name(video->device);
1940 input->phys = video->phys;
1941 input->id.bustype = BUS_HOST;
1942 input->id.product = 0x06;
1943 input->evbit[0] = BIT(EV_KEY);
1944 set_bit(KEY_SWITCHVIDEOMODE, input->keybit);
1945 set_bit(KEY_VIDEO_NEXT, input->keybit);
1946 set_bit(KEY_VIDEO_PREV, input->keybit);
1947 set_bit(KEY_BRIGHTNESS_CYCLE, input->keybit);
1948 set_bit(KEY_BRIGHTNESSUP, input->keybit);
1949 set_bit(KEY_BRIGHTNESSDOWN, input->keybit);
1950 set_bit(KEY_BRIGHTNESS_ZERO, input->keybit);
1951 set_bit(KEY_DISPLAY_OFF, input->keybit);
1952 set_bit(KEY_UNKNOWN, input->keybit);
1953 result = input_register_device(input);
1954 if (result) {
1955 acpi_remove_notify_handler(video->device->handle,
1956 ACPI_DEVICE_NOTIFY,
1957 acpi_video_bus_notify);
1958 acpi_video_bus_stop_devices(video);
1959 acpi_video_bus_put_devices(video);
1960 kfree(video->attached_array);
1961 acpi_video_bus_remove_fs(device);
1962 goto end;
1963 }
1964
1965
1884 printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n", 1966 printk(KERN_INFO PREFIX "%s [%s] (multi-head: %s rom: %s post: %s)\n",
1885 ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device), 1967 ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
1886 video->flags.multihead ? "yes" : "no", 1968 video->flags.multihead ? "yes" : "no",
@@ -1914,6 +1996,7 @@ static int acpi_video_bus_remove(struct acpi_device *device, int type)
1914 acpi_video_bus_put_devices(video); 1996 acpi_video_bus_put_devices(video);
1915 acpi_video_bus_remove_fs(device); 1997 acpi_video_bus_remove_fs(device);
1916 1998
1999 input_unregister_device(video->input);
1917 kfree(video->attached_array); 2000 kfree(video->attached_array);
1918 kfree(video); 2001 kfree(video);
1919 2002
diff --git a/drivers/misc/asus-laptop.c b/drivers/misc/asus-laptop.c
index d0fc4fd212e6..40db9f70148f 100644
--- a/drivers/misc/asus-laptop.c
+++ b/drivers/misc/asus-laptop.c
@@ -1072,7 +1072,8 @@ static void asus_backlight_exit(void)
1072} 1072}
1073 1073
1074#define ASUS_LED_UNREGISTER(object) \ 1074#define ASUS_LED_UNREGISTER(object) \
1075 led_classdev_unregister(&object##_led) 1075 if (object##_led.dev) \
1076 led_classdev_unregister(&object##_led)
1076 1077
1077static void asus_led_exit(void) 1078static void asus_led_exit(void)
1078{ 1079{
diff --git a/drivers/misc/sony-laptop.c b/drivers/misc/sony-laptop.c
index 91da6880ae93..7d8bebec2961 100644
--- a/drivers/misc/sony-laptop.c
+++ b/drivers/misc/sony-laptop.c
@@ -856,6 +856,15 @@ static struct dmi_system_id sony_nc_ids[] = {
856 }, 856 },
857 }, 857 },
858 { 858 {
859 .ident = "Sony Vaio FZ Series",
860 .callback = sony_nc_C_enable,
861 .driver_data = sony_C_events,
862 .matches = {
863 DMI_MATCH(DMI_SYS_VENDOR, "Sony Corporation"),
864 DMI_MATCH(DMI_PRODUCT_NAME, "VGN-FZ"),
865 },
866 },
867 {
859 .ident = "Sony Vaio C Series", 868 .ident = "Sony Vaio C Series",
860 .callback = sony_nc_C_enable, 869 .callback = sony_nc_C_enable,
861 .driver_data = sony_C_events, 870 .driver_data = sony_C_events,
@@ -2308,8 +2317,6 @@ static int sony_pic_remove(struct acpi_device *device, int type)
2308 struct sony_pic_ioport *io, *tmp_io; 2317 struct sony_pic_ioport *io, *tmp_io;
2309 struct sony_pic_irq *irq, *tmp_irq; 2318 struct sony_pic_irq *irq, *tmp_irq;
2310 2319
2311 sonypi_compat_exit();
2312
2313 if (sony_pic_disable(device)) { 2320 if (sony_pic_disable(device)) {
2314 printk(KERN_ERR DRV_PFX "Couldn't disable device.\n"); 2321 printk(KERN_ERR DRV_PFX "Couldn't disable device.\n");
2315 return -ENXIO; 2322 return -ENXIO;
@@ -2319,6 +2326,8 @@ static int sony_pic_remove(struct acpi_device *device, int type)
2319 release_region(spic_dev.cur_ioport->io.minimum, 2326 release_region(spic_dev.cur_ioport->io.minimum,
2320 spic_dev.cur_ioport->io.address_length); 2327 spic_dev.cur_ioport->io.address_length);
2321 2328
2329 sonypi_compat_exit();
2330
2322 sony_laptop_remove_input(); 2331 sony_laptop_remove_input();
2323 2332
2324 /* pf attrs */ 2333 /* pf attrs */
@@ -2384,6 +2393,9 @@ static int sony_pic_add(struct acpi_device *device)
2384 goto err_free_resources; 2393 goto err_free_resources;
2385 } 2394 }
2386 2395
2396 if (sonypi_compat_init())
2397 goto err_remove_input;
2398
2387 /* request io port */ 2399 /* request io port */
2388 list_for_each_entry(io, &spic_dev.ioports, list) { 2400 list_for_each_entry(io, &spic_dev.ioports, list) {
2389 if (request_region(io->io.minimum, io->io.address_length, 2401 if (request_region(io->io.minimum, io->io.address_length,
@@ -2398,7 +2410,7 @@ static int sony_pic_add(struct acpi_device *device)
2398 if (!spic_dev.cur_ioport) { 2410 if (!spic_dev.cur_ioport) {
2399 printk(KERN_ERR DRV_PFX "Failed to request_region.\n"); 2411 printk(KERN_ERR DRV_PFX "Failed to request_region.\n");
2400 result = -ENODEV; 2412 result = -ENODEV;
2401 goto err_remove_input; 2413 goto err_remove_compat;
2402 } 2414 }
2403 2415
2404 /* request IRQ */ 2416 /* request IRQ */
@@ -2438,9 +2450,6 @@ static int sony_pic_add(struct acpi_device *device)
2438 if (result) 2450 if (result)
2439 goto err_remove_pf; 2451 goto err_remove_pf;
2440 2452
2441 if (sonypi_compat_init())
2442 goto err_remove_pf;
2443
2444 return 0; 2453 return 0;
2445 2454
2446err_remove_pf: 2455err_remove_pf:
@@ -2456,6 +2465,9 @@ err_release_region:
2456 release_region(spic_dev.cur_ioport->io.minimum, 2465 release_region(spic_dev.cur_ioport->io.minimum,
2457 spic_dev.cur_ioport->io.address_length); 2466 spic_dev.cur_ioport->io.address_length);
2458 2467
2468err_remove_compat:
2469 sonypi_compat_exit();
2470
2459err_remove_input: 2471err_remove_input:
2460 sony_laptop_remove_input(); 2472 sony_laptop_remove_input();
2461 2473
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c
index b6a4f02b01d1..6c0440c20e31 100644
--- a/drivers/pnp/card.c
+++ b/drivers/pnp/card.c
@@ -25,13 +25,13 @@ static const struct pnp_card_device_id *match_card(struct pnp_card_driver *drv,
25 int found; 25 int found;
26 struct pnp_dev *dev; 26 struct pnp_dev *dev;
27 27
28 if (i == PNP_MAX_DEVICES 28 if (i == PNP_MAX_DEVICES ||
29 || !*drv_id->devs[i].id) 29 !*drv_id->devs[i].id)
30 return drv_id; 30 return drv_id;
31 found = 0; 31 found = 0;
32 card_for_each_dev(card, dev) { 32 card_for_each_dev(card, dev) {
33 if (compare_pnp_id 33 if (compare_pnp_id(dev->id,
34 (dev->id, drv_id->devs[i].id)) { 34 drv_id->devs[i].id)) {
35 found = 1; 35 found = 1;
36 break; 36 break;
37 } 37 }
@@ -183,7 +183,7 @@ static int pnp_interface_attach_card(struct pnp_card *card)
183 183
184 return 0; 184 return 0;
185 185
186 err_name: 186err_name:
187 device_remove_file(&card->dev, &dev_attr_name); 187 device_remove_file(&card->dev, &dev_attr_name);
188 return rc; 188 return rc;
189} 189}
@@ -321,10 +321,10 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
321 pos = pos->next; 321 pos = pos->next;
322 } 322 }
323 323
324 done: 324done:
325 return NULL; 325 return NULL;
326 326
327 found: 327found:
328 dev->card_link = clink; 328 dev->card_link = clink;
329 dev->dev.driver = &drv->link.driver; 329 dev->dev.driver = &drv->link.driver;
330 if (pnp_bus_type.probe(&dev->dev)) 330 if (pnp_bus_type.probe(&dev->dev))
@@ -334,7 +334,7 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink,
334 334
335 return dev; 335 return dev;
336 336
337 err_out: 337err_out:
338 dev->dev.driver = NULL; 338 dev->dev.driver = NULL;
339 dev->card_link = NULL; 339 dev->card_link = NULL;
340 return NULL; 340 return NULL;
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c
index 61066fdb9e6d..d5964feb14de 100644
--- a/drivers/pnp/core.c
+++ b/drivers/pnp/core.c
@@ -52,9 +52,6 @@ int pnp_register_protocol(struct pnp_protocol *protocol)
52 int nodenum; 52 int nodenum;
53 struct list_head *pos; 53 struct list_head *pos;
54 54
55 if (!protocol)
56 return -EINVAL;
57
58 INIT_LIST_HEAD(&protocol->devices); 55 INIT_LIST_HEAD(&protocol->devices);
59 INIT_LIST_HEAD(&protocol->cards); 56 INIT_LIST_HEAD(&protocol->cards);
60 nodenum = 0; 57 nodenum = 0;
@@ -94,8 +91,6 @@ static void pnp_free_ids(struct pnp_dev *dev)
94 struct pnp_id *id; 91 struct pnp_id *id;
95 struct pnp_id *next; 92 struct pnp_id *next;
96 93
97 if (!dev)
98 return;
99 id = dev->id; 94 id = dev->id;
100 while (id) { 95 while (id) {
101 next = id->next; 96 next = id->next;
@@ -143,7 +138,7 @@ int __pnp_add_device(struct pnp_dev *dev)
143 */ 138 */
144int pnp_add_device(struct pnp_dev *dev) 139int pnp_add_device(struct pnp_dev *dev)
145{ 140{
146 if (!dev || !dev->protocol || dev->card) 141 if (dev->card)
147 return -EINVAL; 142 return -EINVAL;
148 dev->dev.parent = &dev->protocol->dev; 143 dev->dev.parent = &dev->protocol->dev;
149 sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, 144 sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number,
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c
index 30b8f6f3258a..2fa64a6b25c8 100644
--- a/drivers/pnp/driver.c
+++ b/drivers/pnp/driver.c
@@ -118,7 +118,7 @@ static int pnp_device_probe(struct device *dev)
118 goto fail; 118 goto fail;
119 return error; 119 return error;
120 120
121 fail: 121fail:
122 pnp_device_detach(pnp_dev); 122 pnp_device_detach(pnp_dev);
123 return error; 123 return error;
124} 124}
@@ -232,10 +232,6 @@ int pnp_add_id(struct pnp_id *id, struct pnp_dev *dev)
232{ 232{
233 struct pnp_id *ptr; 233 struct pnp_id *ptr;
234 234
235 if (!id)
236 return -EINVAL;
237 if (!dev)
238 return -EINVAL;
239 id->next = NULL; 235 id->next = NULL;
240 ptr = dev->id; 236 ptr = dev->id;
241 while (ptr && ptr->next) 237 while (ptr && ptr->next)
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c
index fe6684e13e82..a0cfb75bbb8d 100644
--- a/drivers/pnp/interface.c
+++ b/drivers/pnp/interface.c
@@ -459,7 +459,8 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr,
459 up(&pnp_res_mutex); 459 up(&pnp_res_mutex);
460 goto done; 460 goto done;
461 } 461 }
462 done: 462
463done:
463 if (retval < 0) 464 if (retval < 0)
464 return retval; 465 return retval;
465 return count; 466 return count;
@@ -499,10 +500,10 @@ int pnp_interface_attach_device(struct pnp_dev *dev)
499 500
500 return 0; 501 return 0;
501 502
502 err_res: 503err_res:
503 device_remove_file(&dev->dev, &dev_attr_resources); 504 device_remove_file(&dev->dev, &dev_attr_resources);
504 err_opt: 505err_opt:
505 device_remove_file(&dev->dev, &dev_attr_options); 506 device_remove_file(&dev->dev, &dev_attr_options);
506 err: 507err:
507 return rc; 508 return rc;
508} 509}
diff --git a/drivers/pnp/isapnp/core.c b/drivers/pnp/isapnp/core.c
index b4e2aa995b53..b035d60a1dcc 100644
--- a/drivers/pnp/isapnp/core.c
+++ b/drivers/pnp/isapnp/core.c
@@ -47,9 +47,6 @@
47#if 0 47#if 0
48#define ISAPNP_REGION_OK 48#define ISAPNP_REGION_OK
49#endif 49#endif
50#if 0
51#define ISAPNP_DEBUG
52#endif
53 50
54int isapnp_disable; /* Disable ISA PnP */ 51int isapnp_disable; /* Disable ISA PnP */
55static int isapnp_rdp; /* Read Data Port */ 52static int isapnp_rdp; /* Read Data Port */
@@ -93,7 +90,6 @@ MODULE_LICENSE("GPL");
93 90
94static unsigned char isapnp_checksum_value; 91static unsigned char isapnp_checksum_value;
95static DEFINE_MUTEX(isapnp_cfg_mutex); 92static DEFINE_MUTEX(isapnp_cfg_mutex);
96static int isapnp_detected;
97static int isapnp_csn_count; 93static int isapnp_csn_count;
98 94
99/* some prototypes */ 95/* some prototypes */
@@ -335,7 +331,7 @@ static int __init isapnp_isolate(void)
335 } else if (iteration > 1) { 331 } else if (iteration > 1) {
336 break; 332 break;
337 } 333 }
338 __next: 334__next:
339 if (csn == 255) 335 if (csn == 255)
340 break; 336 break;
341 checksum = 0x6a; 337 checksum = 0x6a;
@@ -733,7 +729,7 @@ static int __init isapnp_create_device(struct pnp_card *card,
733 "isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n", 729 "isapnp: unexpected or unknown tag type 0x%x for logical device %i (device %i), ignored\n",
734 type, dev->number, card->number); 730 type, dev->number, card->number);
735 } 731 }
736 __skip: 732__skip:
737 if (size > 0) 733 if (size > 0)
738 isapnp_skip_bytes(size); 734 isapnp_skip_bytes(size);
739 } 735 }
@@ -788,7 +784,7 @@ static void __init isapnp_parse_resource_map(struct pnp_card *card)
788 "isapnp: unexpected or unknown tag type 0x%x for device %i, ignored\n", 784 "isapnp: unexpected or unknown tag type 0x%x for device %i, ignored\n",
789 type, card->number); 785 type, card->number);
790 } 786 }
791 __skip: 787__skip:
792 if (size > 0) 788 if (size > 0)
793 isapnp_skip_bytes(size); 789 isapnp_skip_bytes(size);
794 } 790 }
@@ -940,9 +936,6 @@ EXPORT_SYMBOL(isapnp_protocol);
940EXPORT_SYMBOL(isapnp_present); 936EXPORT_SYMBOL(isapnp_present);
941EXPORT_SYMBOL(isapnp_cfg_begin); 937EXPORT_SYMBOL(isapnp_cfg_begin);
942EXPORT_SYMBOL(isapnp_cfg_end); 938EXPORT_SYMBOL(isapnp_cfg_end);
943#if 0
944EXPORT_SYMBOL(isapnp_read_byte);
945#endif
946EXPORT_SYMBOL(isapnp_write_byte); 939EXPORT_SYMBOL(isapnp_write_byte);
947 940
948static int isapnp_read_resources(struct pnp_dev *dev, 941static int isapnp_read_resources(struct pnp_dev *dev,
@@ -993,6 +986,7 @@ static int isapnp_get_resources(struct pnp_dev *dev,
993 struct pnp_resource_table *res) 986 struct pnp_resource_table *res)
994{ 987{
995 int ret; 988 int ret;
989
996 pnp_init_resource_table(res); 990 pnp_init_resource_table(res);
997 isapnp_cfg_begin(dev->card->number, dev->number); 991 isapnp_cfg_begin(dev->card->number, dev->number);
998 ret = isapnp_read_resources(dev, res); 992 ret = isapnp_read_resources(dev, res);
@@ -1046,7 +1040,7 @@ static int isapnp_set_resources(struct pnp_dev *dev,
1046 1040
1047static int isapnp_disable_resources(struct pnp_dev *dev) 1041static int isapnp_disable_resources(struct pnp_dev *dev)
1048{ 1042{
1049 if (!dev || !dev->active) 1043 if (!dev->active)
1050 return -EINVAL; 1044 return -EINVAL;
1051 isapnp_cfg_begin(dev->card->number, dev->number); 1045 isapnp_cfg_begin(dev->card->number, dev->number);
1052 isapnp_deactivate(dev->number); 1046 isapnp_deactivate(dev->number);
@@ -1069,7 +1063,6 @@ static int __init isapnp_init(void)
1069 struct pnp_dev *dev; 1063 struct pnp_dev *dev;
1070 1064
1071 if (isapnp_disable) { 1065 if (isapnp_disable) {
1072 isapnp_detected = 0;
1073 printk(KERN_INFO "isapnp: ISA Plug & Play support disabled\n"); 1066 printk(KERN_INFO "isapnp: ISA Plug & Play support disabled\n");
1074 return 0; 1067 return 0;
1075 } 1068 }
@@ -1117,7 +1110,6 @@ static int __init isapnp_init(void)
1117 } 1110 }
1118 isapnp_set_rdp(); 1111 isapnp_set_rdp();
1119 } 1112 }
1120 isapnp_detected = 1;
1121 if (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff) { 1113 if (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff) {
1122 cards = isapnp_isolate(); 1114 cards = isapnp_isolate();
1123 if (cards < 0 || (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff)) { 1115 if (cards < 0 || (isapnp_rdp < 0x203 || isapnp_rdp > 0x3ff)) {
@@ -1125,7 +1117,6 @@ static int __init isapnp_init(void)
1125 release_region(_PIDXR, 1); 1117 release_region(_PIDXR, 1);
1126#endif 1118#endif
1127 release_region(_PNPWRP, 1); 1119 release_region(_PNPWRP, 1);
1128 isapnp_detected = 0;
1129 printk(KERN_INFO 1120 printk(KERN_INFO
1130 "isapnp: No Plug & Play device found\n"); 1121 "isapnp: No Plug & Play device found\n");
1131 return 0; 1122 return 0;
@@ -1148,13 +1139,12 @@ static int __init isapnp_init(void)
1148 } 1139 }
1149 } 1140 }
1150 } 1141 }
1151 if (cards) { 1142 if (cards)
1152 printk(KERN_INFO 1143 printk(KERN_INFO
1153 "isapnp: %i Plug & Play card%s detected total\n", cards, 1144 "isapnp: %i Plug & Play card%s detected total\n", cards,
1154 cards > 1 ? "s" : ""); 1145 cards > 1 ? "s" : "");
1155 } else { 1146 else
1156 printk(KERN_INFO "isapnp: No Plug & Play card found\n"); 1147 printk(KERN_INFO "isapnp: No Plug & Play card found\n");
1157 }
1158 1148
1159 isapnp_proc_init(); 1149 isapnp_proc_init();
1160 return 0; 1150 return 0;
diff --git a/drivers/pnp/isapnp/proc.c b/drivers/pnp/isapnp/proc.c
index 3fbc0f9ffc26..560ccb640816 100644
--- a/drivers/pnp/isapnp/proc.c
+++ b/drivers/pnp/isapnp/proc.c
@@ -112,33 +112,6 @@ static int isapnp_proc_attach_device(struct pnp_dev *dev)
112 return 0; 112 return 0;
113} 113}
114 114
115#ifdef MODULE
116static int __exit isapnp_proc_detach_device(struct pnp_dev *dev)
117{
118 struct pnp_card *bus = dev->card;
119 struct proc_dir_entry *de;
120 char name[16];
121
122 if (!(de = bus->procdir))
123 return -EINVAL;
124 sprintf(name, "%02x", dev->number);
125 remove_proc_entry(name, de);
126 return 0;
127}
128
129static int __exit isapnp_proc_detach_bus(struct pnp_card *bus)
130{
131 struct proc_dir_entry *de;
132 char name[16];
133
134 if (!(de = bus->procdir))
135 return -EINVAL;
136 sprintf(name, "%02x", bus->number);
137 remove_proc_entry(name, isapnp_proc_bus_dir);
138 return 0;
139}
140#endif /* MODULE */
141
142int __init isapnp_proc_init(void) 115int __init isapnp_proc_init(void)
143{ 116{
144 struct pnp_dev *dev; 117 struct pnp_dev *dev;
@@ -149,21 +122,3 @@ int __init isapnp_proc_init(void)
149 } 122 }
150 return 0; 123 return 0;
151} 124}
152
153#ifdef MODULE
154int __exit isapnp_proc_done(void)
155{
156 struct pnp_dev *dev;
157 struct pnp_bus *card;
158
159 isapnp_for_each_dev(dev) {
160 isapnp_proc_detach_device(dev);
161 }
162 isapnp_for_each_card(card) {
163 isapnp_proc_detach_bus(card);
164 }
165 if (isapnp_proc_bus_dir)
166 remove_proc_entry("isapnp", proc_bus);
167 return 0;
168}
169#endif /* MODULE */
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c
index 3bda513a6bd3..0826287eef53 100644
--- a/drivers/pnp/manager.c
+++ b/drivers/pnp/manager.c
@@ -21,9 +21,6 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx)
21 resource_size_t *start, *end; 21 resource_size_t *start, *end;
22 unsigned long *flags; 22 unsigned long *flags;
23 23
24 if (!dev || !rule)
25 return -EINVAL;
26
27 if (idx >= PNP_MAX_PORT) { 24 if (idx >= PNP_MAX_PORT) {
28 pnp_err 25 pnp_err
29 ("More than 4 ports is incompatible with pnp specifications."); 26 ("More than 4 ports is incompatible with pnp specifications.");
@@ -66,9 +63,6 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx)
66 resource_size_t *start, *end; 63 resource_size_t *start, *end;
67 unsigned long *flags; 64 unsigned long *flags;
68 65
69 if (!dev || !rule)
70 return -EINVAL;
71
72 if (idx >= PNP_MAX_MEM) { 66 if (idx >= PNP_MAX_MEM) {
73 pnp_err 67 pnp_err
74 ("More than 8 mems is incompatible with pnp specifications."); 68 ("More than 8 mems is incompatible with pnp specifications.");
@@ -127,9 +121,6 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx)
127 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2 121 5, 10, 11, 12, 9, 14, 15, 7, 3, 4, 13, 0, 1, 6, 8, 2
128 }; 122 };
129 123
130 if (!dev || !rule)
131 return -EINVAL;
132
133 if (idx >= PNP_MAX_IRQ) { 124 if (idx >= PNP_MAX_IRQ) {
134 pnp_err 125 pnp_err
135 ("More than 2 irqs is incompatible with pnp specifications."); 126 ("More than 2 irqs is incompatible with pnp specifications.");
@@ -181,9 +172,6 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx)
181 1, 3, 5, 6, 7, 0, 2, 4 172 1, 3, 5, 6, 7, 0, 2, 4
182 }; 173 };
183 174
184 if (!dev || !rule)
185 return -EINVAL;
186
187 if (idx >= PNP_MAX_DMA) { 175 if (idx >= PNP_MAX_DMA) {
188 pnp_err 176 pnp_err
189 ("More than 2 dmas is incompatible with pnp specifications."); 177 ("More than 2 dmas is incompatible with pnp specifications.");
@@ -390,7 +378,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum)
390 up(&pnp_res_mutex); 378 up(&pnp_res_mutex);
391 return 1; 379 return 1;
392 380
393 fail: 381fail:
394 pnp_clean_resource_table(&dev->res); 382 pnp_clean_resource_table(&dev->res);
395 up(&pnp_res_mutex); 383 up(&pnp_res_mutex);
396 return 0; 384 return 0;
@@ -410,8 +398,6 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
410 int i; 398 int i;
411 struct pnp_resource_table *bak; 399 struct pnp_resource_table *bak;
412 400
413 if (!dev || !res)
414 return -EINVAL;
415 if (!pnp_can_configure(dev)) 401 if (!pnp_can_configure(dev))
416 return -ENODEV; 402 return -ENODEV;
417 bak = pnp_alloc(sizeof(struct pnp_resource_table)); 403 bak = pnp_alloc(sizeof(struct pnp_resource_table));
@@ -444,7 +430,7 @@ int pnp_manual_config_dev(struct pnp_dev *dev, struct pnp_resource_table *res,
444 kfree(bak); 430 kfree(bak);
445 return 0; 431 return 0;
446 432
447 fail: 433fail:
448 dev->res = *bak; 434 dev->res = *bak;
449 up(&pnp_res_mutex); 435 up(&pnp_res_mutex);
450 kfree(bak); 436 kfree(bak);
@@ -460,9 +446,6 @@ int pnp_auto_config_dev(struct pnp_dev *dev)
460 struct pnp_option *dep; 446 struct pnp_option *dep;
461 int i = 1; 447 int i = 1;
462 448
463 if (!dev)
464 return -EINVAL;
465
466 if (!pnp_can_configure(dev)) { 449 if (!pnp_can_configure(dev)) {
467 pnp_dbg("Device %s does not support resource configuration.", 450 pnp_dbg("Device %s does not support resource configuration.",
468 dev->dev.bus_id); 451 dev->dev.bus_id);
@@ -541,8 +524,6 @@ int pnp_activate_dev(struct pnp_dev *dev)
541{ 524{
542 int error; 525 int error;
543 526
544 if (!dev)
545 return -EINVAL;
546 if (dev->active) 527 if (dev->active)
547 return 0; /* the device is already active */ 528 return 0; /* the device is already active */
548 529
@@ -568,8 +549,6 @@ int pnp_disable_dev(struct pnp_dev *dev)
568{ 549{
569 int error; 550 int error;
570 551
571 if (!dev)
572 return -EINVAL;
573 if (!dev->active) 552 if (!dev->active)
574 return 0; /* the device is already disabled */ 553 return 0; /* the device is already disabled */
575 554
@@ -596,8 +575,6 @@ int pnp_disable_dev(struct pnp_dev *dev)
596void pnp_resource_change(struct resource *resource, resource_size_t start, 575void pnp_resource_change(struct resource *resource, resource_size_t start,
597 resource_size_t size) 576 resource_size_t size)
598{ 577{
599 if (resource == NULL)
600 return;
601 resource->flags &= ~(IORESOURCE_AUTO | IORESOURCE_UNSET); 578 resource->flags &= ~(IORESOURCE_AUTO | IORESOURCE_UNSET);
602 resource->start = start; 579 resource->start = start;
603 resource->end = start + size - 1; 580 resource->end = start + size - 1;
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c
index 616fc72190bf..a5a372222d69 100644
--- a/drivers/pnp/pnpacpi/core.c
+++ b/drivers/pnp/pnpacpi/core.c
@@ -248,9 +248,9 @@ static int __init pnpacpi_add_device(struct acpi_device *device)
248 num++; 248 num++;
249 249
250 return AE_OK; 250 return AE_OK;
251 err1: 251err1:
252 kfree(dev_id); 252 kfree(dev_id);
253 err: 253err:
254 kfree(dev); 254 kfree(dev);
255 return -EINVAL; 255 return -EINVAL;
256} 256}
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c
index ce5027feb3da..0e3b8d0ff06b 100644
--- a/drivers/pnp/pnpacpi/rsparser.c
+++ b/drivers/pnp/pnpacpi/rsparser.c
@@ -34,19 +34,17 @@
34 */ 34 */
35static int irq_flags(int triggering, int polarity) 35static int irq_flags(int triggering, int polarity)
36{ 36{
37 int flag;
38 if (triggering == ACPI_LEVEL_SENSITIVE) { 37 if (triggering == ACPI_LEVEL_SENSITIVE) {
39 if (polarity == ACPI_ACTIVE_LOW) 38 if (polarity == ACPI_ACTIVE_LOW)
40 flag = IORESOURCE_IRQ_LOWLEVEL; 39 return IORESOURCE_IRQ_LOWLEVEL;
41 else 40 else
42 flag = IORESOURCE_IRQ_HIGHLEVEL; 41 return IORESOURCE_IRQ_HIGHLEVEL;
43 } else { 42 } else {
44 if (polarity == ACPI_ACTIVE_LOW) 43 if (polarity == ACPI_ACTIVE_LOW)
45 flag = IORESOURCE_IRQ_LOWEDGE; 44 return IORESOURCE_IRQ_LOWEDGE;
46 else 45 else
47 flag = IORESOURCE_IRQ_HIGHEDGE; 46 return IORESOURCE_IRQ_HIGHEDGE;
48 } 47 }
49 return flag;
50} 48}
51 49
52static void decode_irq_flags(int flag, int *triggering, int *polarity) 50static void decode_irq_flags(int flag, int *triggering, int *polarity)
@@ -242,8 +240,7 @@ static void pnpacpi_parse_allocated_address_space(struct pnp_resource_table *res
242static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res, 240static acpi_status pnpacpi_allocated_resource(struct acpi_resource *res,
243 void *data) 241 void *data)
244{ 242{
245 struct pnp_resource_table *res_table = 243 struct pnp_resource_table *res_table = data;
246 (struct pnp_resource_table *)data;
247 int i; 244 int i;
248 245
249 switch (res->type) { 246 switch (res->type) {
@@ -566,8 +563,7 @@ static acpi_status pnpacpi_option_resource(struct acpi_resource *res,
566 void *data) 563 void *data)
567{ 564{
568 int priority = 0; 565 int priority = 0;
569 struct acpipnp_parse_option_s *parse_data = 566 struct acpipnp_parse_option_s *parse_data = data;
570 (struct acpipnp_parse_option_s *)data;
571 struct pnp_dev *dev = parse_data->dev; 567 struct pnp_dev *dev = parse_data->dev;
572 struct pnp_option *option = parse_data->option; 568 struct pnp_option *option = parse_data->option;
573 569
@@ -705,7 +701,7 @@ static int pnpacpi_supported_resource(struct acpi_resource *res)
705static acpi_status pnpacpi_count_resources(struct acpi_resource *res, 701static acpi_status pnpacpi_count_resources(struct acpi_resource *res,
706 void *data) 702 void *data)
707{ 703{
708 int *res_cnt = (int *)data; 704 int *res_cnt = data;
709 705
710 if (pnpacpi_supported_resource(res)) 706 if (pnpacpi_supported_resource(res))
711 (*res_cnt)++; 707 (*res_cnt)++;
@@ -714,7 +710,7 @@ static acpi_status pnpacpi_count_resources(struct acpi_resource *res,
714 710
715static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data) 711static acpi_status pnpacpi_type_resources(struct acpi_resource *res, void *data)
716{ 712{
717 struct acpi_resource **resource = (struct acpi_resource **)data; 713 struct acpi_resource **resource = data;
718 714
719 if (pnpacpi_supported_resource(res)) { 715 if (pnpacpi_supported_resource(res)) {
720 (*resource)->type = res->type; 716 (*resource)->type = res->type;
@@ -886,8 +882,7 @@ int pnpacpi_encode_resources(struct pnp_resource_table *res_table,
886 int i = 0; 882 int i = 0;
887 /* pnpacpi_build_resource_template allocates extra mem */ 883 /* pnpacpi_build_resource_template allocates extra mem */
888 int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1; 884 int res_cnt = (buffer->length - 1) / sizeof(struct acpi_resource) - 1;
889 struct acpi_resource *resource = 885 struct acpi_resource *resource = buffer->pointer;
890 (struct acpi_resource *)buffer->pointer;
891 int port = 0, irq = 0, dma = 0, mem = 0; 886 int port = 0, irq = 0, dma = 0, mem = 0;
892 887
893 pnp_dbg("res cnt %d", res_cnt); 888 pnp_dbg("res cnt %d", res_cnt);
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c
index 3692a099b45f..0691f473e9d4 100644
--- a/drivers/pnp/pnpbios/core.c
+++ b/drivers/pnp/pnpbios/core.c
@@ -419,7 +419,6 @@ static void __init build_devlist(void)
419static int pnpbios_disabled; 419static int pnpbios_disabled;
420int pnpbios_dont_use_current_config; 420int pnpbios_dont_use_current_config;
421 421
422#ifndef MODULE
423static int __init pnpbios_setup(char *str) 422static int __init pnpbios_setup(char *str)
424{ 423{
425 int invert; 424 int invert;
@@ -443,7 +442,6 @@ static int __init pnpbios_setup(char *str)
443} 442}
444 443
445__setup("pnpbios=", pnpbios_setup); 444__setup("pnpbios=", pnpbios_setup);
446#endif
447 445
448/* PnP BIOS signature: "$PnP" */ 446/* PnP BIOS signature: "$PnP" */
449#define PNP_SIGNATURE (('$' << 0) + ('P' << 8) + ('n' << 16) + ('P' << 24)) 447#define PNP_SIGNATURE (('$' << 0) + ('P' << 8) + ('n' << 16) + ('P' << 24))
@@ -591,6 +589,7 @@ subsys_initcall(pnpbios_init);
591static int __init pnpbios_thread_init(void) 589static int __init pnpbios_thread_init(void)
592{ 590{
593 struct task_struct *task; 591 struct task_struct *task;
592
594#if defined(CONFIG_PPC_MERGE) 593#if defined(CONFIG_PPC_MERGE)
595 if (check_legacy_ioport(PNPBIOS_BASE)) 594 if (check_legacy_ioport(PNPBIOS_BASE))
596 return 0; 595 return 0;
@@ -606,48 +605,7 @@ static int __init pnpbios_thread_init(void)
606 return 0; 605 return 0;
607} 606}
608 607
609#ifndef MODULE
610
611/* init/main.c calls pnpbios_init early */
612
613/* Start the kernel thread later: */ 608/* Start the kernel thread later: */
614module_init(pnpbios_thread_init); 609module_init(pnpbios_thread_init);
615 610
616#else
617
618/*
619 * N.B.: Building pnpbios as a module hasn't been fully implemented
620 */
621
622MODULE_LICENSE("GPL");
623
624static int __init pnpbios_init_all(void)
625{
626 int r;
627
628 r = pnpbios_init();
629 if (r)
630 return r;
631 r = pnpbios_thread_init();
632 if (r)
633 return r;
634 return 0;
635}
636
637static void __exit pnpbios_exit(void)
638{
639#ifdef CONFIG_HOTPLUG
640 unloading = 1;
641 wait_for_completion(&unload_sem);
642#endif
643 pnpbios_proc_exit();
644 /* We ought to free resources here */
645 return;
646}
647
648module_init(pnpbios_init_all);
649module_exit(pnpbios_exit);
650
651#endif
652
653EXPORT_SYMBOL(pnpbios_protocol); 611EXPORT_SYMBOL(pnpbios_protocol);
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c
index 9c8c07701b65..9d9841f24a85 100644
--- a/drivers/pnp/pnpbios/proc.c
+++ b/drivers/pnp/pnpbios/proc.c
@@ -212,7 +212,7 @@ static int proc_write_node(struct file *file, const char __user * buf,
212 goto out; 212 goto out;
213 } 213 }
214 ret = count; 214 ret = count;
215 out: 215out:
216 kfree(node); 216 kfree(node);
217 return ret; 217 return ret;
218} 218}
diff --git a/drivers/pnp/pnpbios/rsparser.c b/drivers/pnp/pnpbios/rsparser.c
index 04ecd7b67230..3fabf11b0027 100644
--- a/drivers/pnp/pnpbios/rsparser.c
+++ b/drivers/pnp/pnpbios/rsparser.c
@@ -238,7 +238,7 @@ static unsigned char *pnpbios_parse_allocated_resource_data(unsigned char *p,
238 break; 238 break;
239 239
240 default: /* an unkown tag */ 240 default: /* an unkown tag */
241 len_err: 241len_err:
242 printk(KERN_ERR 242 printk(KERN_ERR
243 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", 243 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
244 tag, len); 244 tag, len);
@@ -298,6 +298,7 @@ static void pnpbios_parse_fixed_mem32_option(unsigned char *p, int size,
298 struct pnp_option *option) 298 struct pnp_option *option)
299{ 299{
300 struct pnp_mem *mem; 300 struct pnp_mem *mem;
301
301 mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL); 302 mem = kzalloc(sizeof(struct pnp_mem), GFP_KERNEL);
302 if (!mem) 303 if (!mem)
303 return; 304 return;
@@ -468,7 +469,7 @@ static unsigned char *pnpbios_parse_resource_option_data(unsigned char *p,
468 return p + 2; 469 return p + 2;
469 470
470 default: /* an unkown tag */ 471 default: /* an unkown tag */
471 len_err: 472len_err:
472 printk(KERN_ERR 473 printk(KERN_ERR
473 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", 474 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
474 tag, len); 475 tag, len);
@@ -562,7 +563,7 @@ static unsigned char *pnpbios_parse_compatible_ids(unsigned char *p,
562 break; 563 break;
563 564
564 default: /* an unkown tag */ 565 default: /* an unkown tag */
565 len_err: 566len_err:
566 printk(KERN_ERR 567 printk(KERN_ERR
567 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", 568 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
568 tag, len); 569 tag, len);
@@ -756,7 +757,7 @@ static unsigned char *pnpbios_encode_allocated_resource_data(unsigned char *p,
756 break; 757 break;
757 758
758 default: /* an unkown tag */ 759 default: /* an unkown tag */
759 len_err: 760len_err:
760 printk(KERN_ERR 761 printk(KERN_ERR
761 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n", 762 "PnPBIOS: Unknown tag '0x%x', length '%d'.\n",
762 tag, len); 763 tag, len);
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c
index ea6ec14a0559..ef1286900db3 100644
--- a/drivers/pnp/resource.c
+++ b/drivers/pnp/resource.c
@@ -47,9 +47,6 @@ struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev)
47{ 47{
48 struct pnp_option *option; 48 struct pnp_option *option;
49 49
50 if (!dev)
51 return NULL;
52
53 option = pnp_build_option(PNP_RES_PRIORITY_PREFERRED); 50 option = pnp_build_option(PNP_RES_PRIORITY_PREFERRED);
54 51
55 /* this should never happen but if it does we'll try to continue */ 52 /* this should never happen but if it does we'll try to continue */
@@ -64,9 +61,6 @@ struct pnp_option *pnp_register_dependent_option(struct pnp_dev *dev,
64{ 61{
65 struct pnp_option *option; 62 struct pnp_option *option;
66 63
67 if (!dev)
68 return NULL;
69
70 option = pnp_build_option(priority); 64 option = pnp_build_option(priority);
71 65
72 if (dev->dependent) { 66 if (dev->dependent) {
@@ -83,11 +77,6 @@ int pnp_register_irq_resource(struct pnp_option *option, struct pnp_irq *data)
83{ 77{
84 struct pnp_irq *ptr; 78 struct pnp_irq *ptr;
85 79
86 if (!option)
87 return -EINVAL;
88 if (!data)
89 return -EINVAL;
90
91 ptr = option->irq; 80 ptr = option->irq;
92 while (ptr && ptr->next) 81 while (ptr && ptr->next)
93 ptr = ptr->next; 82 ptr = ptr->next;
@@ -112,11 +101,6 @@ int pnp_register_dma_resource(struct pnp_option *option, struct pnp_dma *data)
112{ 101{
113 struct pnp_dma *ptr; 102 struct pnp_dma *ptr;
114 103
115 if (!option)
116 return -EINVAL;
117 if (!data)
118 return -EINVAL;
119
120 ptr = option->dma; 104 ptr = option->dma;
121 while (ptr && ptr->next) 105 while (ptr && ptr->next)
122 ptr = ptr->next; 106 ptr = ptr->next;
@@ -132,11 +116,6 @@ int pnp_register_port_resource(struct pnp_option *option, struct pnp_port *data)
132{ 116{
133 struct pnp_port *ptr; 117 struct pnp_port *ptr;
134 118
135 if (!option)
136 return -EINVAL;
137 if (!data)
138 return -EINVAL;
139
140 ptr = option->port; 119 ptr = option->port;
141 while (ptr && ptr->next) 120 while (ptr && ptr->next)
142 ptr = ptr->next; 121 ptr = ptr->next;
@@ -152,11 +131,6 @@ int pnp_register_mem_resource(struct pnp_option *option, struct pnp_mem *data)
152{ 131{
153 struct pnp_mem *ptr; 132 struct pnp_mem *ptr;
154 133
155 if (!option)
156 return -EINVAL;
157 if (!data)
158 return -EINVAL;
159
160 ptr = option->mem; 134 ptr = option->mem;
161 while (ptr && ptr->next) 135 while (ptr && ptr->next)
162 ptr = ptr->next; 136 ptr = ptr->next;
diff --git a/include/asm-i386/io_apic.h b/include/asm-i386/io_apic.h
index 340764076d5f..dbe734ddf2af 100644
--- a/include/asm-i386/io_apic.h
+++ b/include/asm-i386/io_apic.h
@@ -150,7 +150,6 @@ extern int (*ioapic_renumber_irq)(int ioapic, int irq);
150 150
151#else /* !CONFIG_X86_IO_APIC */ 151#else /* !CONFIG_X86_IO_APIC */
152#define io_apic_assign_pci_irqs 0 152#define io_apic_assign_pci_irqs 0
153static inline void disable_ioapic_setup(void) { }
154#endif 153#endif
155 154
156#endif 155#endif
diff --git a/include/asm-x86_64/io_apic.h b/include/asm-x86_64/io_apic.h
index 969d225a9350..d9f2e54324d5 100644
--- a/include/asm-x86_64/io_apic.h
+++ b/include/asm-x86_64/io_apic.h
@@ -109,6 +109,12 @@ extern int mpc_default_type;
109/* 1 if "noapic" boot option passed */ 109/* 1 if "noapic" boot option passed */
110extern int skip_ioapic_setup; 110extern int skip_ioapic_setup;
111 111
112static inline void disable_ioapic_setup(void)
113{
114 skip_ioapic_setup = 1;
115}
116
117
112/* 118/*
113 * If we use the IO-APIC for IRQ routing, disable automatic 119 * If we use the IO-APIC for IRQ routing, disable automatic
114 * assignment of PCI IRQ's. 120 * assignment of PCI IRQ's.
diff --git a/include/linux/input.h b/include/linux/input.h
index e02c6a66b2ba..cf2b5619aa13 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
@@ -363,6 +363,12 @@ struct input_absinfo {
363 363
364#define KEY_UNKNOWN 240 364#define KEY_UNKNOWN 240
365 365
366#define KEY_VIDEO_NEXT 241 /* drive next video source */
367#define KEY_VIDEO_PREV 242 /* drive previous video source */
368#define KEY_BRIGHTNESS_CYCLE 243 /* brightness up, after max is min */
369#define KEY_BRIGHTNESS_ZERO 244 /* brightness off, use ambient */
370#define KEY_DISPLAY_OFF 245 /* display device to off state */
371
366#define BTN_MISC 0x100 372#define BTN_MISC 0x100
367#define BTN_0 0x100 373#define BTN_0 0x100
368#define BTN_1 0x101 374#define BTN_1 0x101
diff --git a/init/main.c b/init/main.c
index d3bcb3b11620..cc0653ec081d 100644
--- a/init/main.c
+++ b/init/main.c
@@ -146,9 +146,14 @@ static unsigned int __initdata max_cpus = NR_CPUS;
146 * greater than 0, limits the maximum number of CPUs activated in 146 * greater than 0, limits the maximum number of CPUs activated in
147 * SMP mode to <NUM>. 147 * SMP mode to <NUM>.
148 */ 148 */
149#ifndef CONFIG_X86_IO_APIC
150static inline void disable_ioapic_setup(void) {};
151#endif
152
149static int __init nosmp(char *str) 153static int __init nosmp(char *str)
150{ 154{
151 max_cpus = 0; 155 max_cpus = 0;
156 disable_ioapic_setup();
152 return 0; 157 return 0;
153} 158}
154 159
@@ -157,10 +162,13 @@ early_param("nosmp", nosmp);
157static int __init maxcpus(char *str) 162static int __init maxcpus(char *str)
158{ 163{
159 get_option(&str, &max_cpus); 164 get_option(&str, &max_cpus);
160 return 1; 165 if (max_cpus == 0)
166 disable_ioapic_setup();
167
168 return 0;
161} 169}
162 170
163__setup("maxcpus=", maxcpus); 171early_param("maxcpus=", maxcpus);
164#else 172#else
165#define max_cpus NR_CPUS 173#define max_cpus NR_CPUS
166#endif 174#endif