aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2008-03-18 10:48:23 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-03-18 10:48:23 -0400
commit74fe030532d779a3774fcc9e1ddce65f3773e156 (patch)
tree668da06acf3fc395e5525ba6fc201bcb7de43c29 /drivers
parentfb00f7629bb94ef9189fc3790b95306a144f58c5 (diff)
parent13d93924f13e1989cf27375cd46451475bc70d1d (diff)
Merge branch 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6
* 'release' of git://git.kernel.org/pub/scm/linux/kernel/git/lenb/linux-acpi-2.6: ACPI: Set flag DOCK_UNDOCKING when triggered via sysfs Revert "ACPI: video: Ignore devices that aren't present in hardware" asus_acpi: remove misleading mask Revert "ACPI: video: Ignore ACPI video devices that aren't present in hardware" thermal: delete "default y" thermal: re-document thermal units Revert "thermal: fix generic thermal I/F for hwmon" ACPI: fix ATA_ACPI build ACPI: battery: Don't return -EFAIL on broken packages. ACPI: lockdep warning on boot, 2.6.25-rc5
Diffstat (limited to 'drivers')
-rw-r--r--drivers/acpi/asus_acpi.c2
-rw-r--r--drivers/acpi/battery.c11
-rw-r--r--drivers/acpi/dock.c1
-rw-r--r--drivers/acpi/processor_idle.c12
-rw-r--r--drivers/acpi/video.c60
-rw-r--r--drivers/ata/Kconfig1
-rw-r--r--drivers/thermal/Kconfig2
-rw-r--r--drivers/thermal/thermal.c169
8 files changed, 44 insertions, 214 deletions
diff --git a/drivers/acpi/asus_acpi.c b/drivers/acpi/asus_acpi.c
index d25ef961415c..44ad90c03c2e 100644
--- a/drivers/acpi/asus_acpi.c
+++ b/drivers/acpi/asus_acpi.c
@@ -610,7 +610,7 @@ write_led(const char __user * buffer, unsigned long count,
610 (led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask); 610 (led_out) ? (hotk->status | ledmask) : (hotk->status & ~ledmask);
611 611
612 if (invert) /* invert target value */ 612 if (invert) /* invert target value */
613 led_out = !led_out & 0x1; 613 led_out = !led_out;
614 614
615 if (!write_acpi_int(hotk->handle, ledname, led_out, NULL)) 615 if (!write_acpi_int(hotk->handle, ledname, led_out, NULL))
616 printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n", 616 printk(KERN_WARNING "Asus ACPI: LED (%s) write failed\n",
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index f6215e809808..d5729d5dc190 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -293,13 +293,12 @@ static int extract_package(struct acpi_battery *battery,
293 strncpy(ptr, (u8 *)&element->integer.value, 293 strncpy(ptr, (u8 *)&element->integer.value,
294 sizeof(acpi_integer)); 294 sizeof(acpi_integer));
295 ptr[sizeof(acpi_integer)] = 0; 295 ptr[sizeof(acpi_integer)] = 0;
296 } else return -EFAULT; 296 } else
297 *ptr = 0; /* don't have value */
297 } else { 298 } else {
298 if (element->type == ACPI_TYPE_INTEGER) { 299 int *x = (int *)((u8 *)battery + offsets[i].offset);
299 int *x = (int *)((u8 *)battery + 300 *x = (element->type == ACPI_TYPE_INTEGER) ?
300 offsets[i].offset); 301 element->integer.value : -1;
301 *x = element->integer.value;
302 } else return -EFAULT;
303 } 302 }
304 } 303 }
305 return 0; 304 return 0;
diff --git a/drivers/acpi/dock.c b/drivers/acpi/dock.c
index 307cef65c247..fa44fb96fc34 100644
--- a/drivers/acpi/dock.c
+++ b/drivers/acpi/dock.c
@@ -710,6 +710,7 @@ static ssize_t write_undock(struct device *dev, struct device_attribute *attr,
710 if (!count) 710 if (!count)
711 return -EINVAL; 711 return -EINVAL;
712 712
713 begin_undock(dock_station);
713 ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST); 714 ret = handle_eject_request(dock_station, ACPI_NOTIFY_EJECT_REQUEST);
714 return ret ? ret: count; 715 return ret ? ret: count;
715} 716}
diff --git a/drivers/acpi/processor_idle.c b/drivers/acpi/processor_idle.c
index 6f3b217699e9..e8e2d8869236 100644
--- a/drivers/acpi/processor_idle.c
+++ b/drivers/acpi/processor_idle.c
@@ -216,8 +216,10 @@ static void acpi_safe_halt(void)
216 * test NEED_RESCHED: 216 * test NEED_RESCHED:
217 */ 217 */
218 smp_mb(); 218 smp_mb();
219 if (!need_resched()) 219 if (!need_resched()) {
220 safe_halt(); 220 safe_halt();
221 local_irq_disable();
222 }
221 current_thread_info()->status |= TS_POLLING; 223 current_thread_info()->status |= TS_POLLING;
222} 224}
223 225
@@ -421,7 +423,9 @@ static void acpi_processor_idle(void)
421 else 423 else
422 acpi_safe_halt(); 424 acpi_safe_halt();
423 425
424 local_irq_enable(); 426 if (irqs_disabled())
427 local_irq_enable();
428
425 return; 429 return;
426 } 430 }
427 431
@@ -530,7 +534,9 @@ static void acpi_processor_idle(void)
530 * skew otherwise. 534 * skew otherwise.
531 */ 535 */
532 sleep_ticks = 0xFFFFFFFF; 536 sleep_ticks = 0xFFFFFFFF;
533 local_irq_enable(); 537 if (irqs_disabled())
538 local_irq_enable();
539
534 break; 540 break;
535 541
536 case ACPI_STATE_C2: 542 case ACPI_STATE_C2:
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c
index 1bc0c74f2755..12fb44f16766 100644
--- a/drivers/acpi/video.c
+++ b/drivers/acpi/video.c
@@ -807,40 +807,11 @@ static void acpi_video_bus_find_cap(struct acpi_video_bus *video)
807static int acpi_video_bus_check(struct acpi_video_bus *video) 807static int acpi_video_bus_check(struct acpi_video_bus *video)
808{ 808{
809 acpi_status status = -ENOENT; 809 acpi_status status = -ENOENT;
810 long device_id; 810
811 struct device *dev;
812 struct acpi_device *device;
813 811
814 if (!video) 812 if (!video)
815 return -EINVAL; 813 return -EINVAL;
816 814
817 device = video->device;
818
819 status =
820 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
821
822 if (!ACPI_SUCCESS(status))
823 return -ENODEV;
824
825 /* We need to attempt to determine whether the _ADR refers to a
826 PCI device or not. There's no terribly good way to do this,
827 so the best we can hope for is to assume that there'll never
828 be a video device in the host bridge */
829 if (device_id >= 0x10000) {
830 /* It looks like a PCI device. Does it exist? */
831 dev = acpi_get_physical_device(device->handle);
832 } else {
833 /* It doesn't look like a PCI device. Does its parent
834 exist? */
835 acpi_handle phandle;
836 if (acpi_get_parent(device->handle, &phandle))
837 return -ENODEV;
838 dev = acpi_get_physical_device(phandle);
839 }
840 if (!dev)
841 return -ENODEV;
842 put_device(dev);
843
844 /* Since there is no HID, CID and so on for VGA driver, we have 815 /* Since there is no HID, CID and so on for VGA driver, we have
845 * to check well known required nodes. 816 * to check well known required nodes.
846 */ 817 */
@@ -1366,37 +1337,8 @@ acpi_video_bus_write_DOS(struct file *file,
1366 1337
1367static int acpi_video_bus_add_fs(struct acpi_device *device) 1338static int acpi_video_bus_add_fs(struct acpi_device *device)
1368{ 1339{
1369 long device_id;
1370 int status;
1371 struct proc_dir_entry *entry = NULL; 1340 struct proc_dir_entry *entry = NULL;
1372 struct acpi_video_bus *video; 1341 struct acpi_video_bus *video;
1373 struct device *dev;
1374
1375 status =
1376 acpi_evaluate_integer(device->handle, "_ADR", NULL, &device_id);
1377
1378 if (!ACPI_SUCCESS(status))
1379 return -ENODEV;
1380
1381 /* We need to attempt to determine whether the _ADR refers to a
1382 PCI device or not. There's no terribly good way to do this,
1383 so the best we can hope for is to assume that there'll never
1384 be a video device in the host bridge */
1385 if (device_id >= 0x10000) {
1386 /* It looks like a PCI device. Does it exist? */
1387 dev = acpi_get_physical_device(device->handle);
1388 } else {
1389 /* It doesn't look like a PCI device. Does its parent
1390 exist? */
1391 acpi_handle phandle;
1392 if (acpi_get_parent(device->handle, &phandle))
1393 return -ENODEV;
1394 dev = acpi_get_physical_device(phandle);
1395 }
1396 if (!dev)
1397 return -ENODEV;
1398 put_device(dev);
1399
1400 1342
1401 1343
1402 video = acpi_driver_data(device); 1344 video = acpi_driver_data(device);
diff --git a/drivers/ata/Kconfig b/drivers/ata/Kconfig
index e469647330de..25aba69b59b4 100644
--- a/drivers/ata/Kconfig
+++ b/drivers/ata/Kconfig
@@ -30,6 +30,7 @@ config ATA_NONSTANDARD
30config ATA_ACPI 30config ATA_ACPI
31 bool 31 bool
32 depends on ACPI && PCI 32 depends on ACPI && PCI
33 select ACPI_DOCK
33 default y 34 default y
34 help 35 help
35 This option adds support for ATA-related ACPI objects. 36 This option adds support for ATA-related ACPI objects.
diff --git a/drivers/thermal/Kconfig b/drivers/thermal/Kconfig
index 3ab313ed441c..17e71d56f31e 100644
--- a/drivers/thermal/Kconfig
+++ b/drivers/thermal/Kconfig
@@ -4,8 +4,6 @@
4 4
5menuconfig THERMAL 5menuconfig THERMAL
6 bool "Generic Thermal sysfs driver" 6 bool "Generic Thermal sysfs driver"
7 select HWMON
8 default y
9 help 7 help
10 Generic Thermal Sysfs driver offers a generic mechanism for 8 Generic Thermal Sysfs driver offers a generic mechanism for
11 thermal management. Usually it's made up of one or more thermal 9 thermal management. Usually it's made up of one or more thermal
diff --git a/drivers/thermal/thermal.c b/drivers/thermal/thermal.c
index 41bd4c805ace..8b86e53ccf7a 100644
--- a/drivers/thermal/thermal.c
+++ b/drivers/thermal/thermal.c
@@ -30,10 +30,8 @@
30#include <linux/idr.h> 30#include <linux/idr.h>
31#include <linux/thermal.h> 31#include <linux/thermal.h>
32#include <linux/spinlock.h> 32#include <linux/spinlock.h>
33#include <linux/hwmon.h>
34#include <linux/hwmon-sysfs.h>
35 33
36MODULE_AUTHOR("Zhang Rui"); 34MODULE_AUTHOR("Zhang Rui")
37MODULE_DESCRIPTION("Generic thermal management sysfs support"); 35MODULE_DESCRIPTION("Generic thermal management sysfs support");
38MODULE_LICENSE("GPL"); 36MODULE_LICENSE("GPL");
39 37
@@ -58,9 +56,6 @@ static LIST_HEAD(thermal_tz_list);
58static LIST_HEAD(thermal_cdev_list); 56static LIST_HEAD(thermal_cdev_list);
59static DEFINE_MUTEX(thermal_list_lock); 57static DEFINE_MUTEX(thermal_list_lock);
60 58
61static struct device *thermal_hwmon;
62#define MAX_THERMAL_ZONES 10
63
64static int get_idr(struct idr *idr, struct mutex *lock, int *id) 59static int get_idr(struct idr *idr, struct mutex *lock, int *id)
65{ 60{
66 int err; 61 int err;
@@ -92,67 +87,7 @@ static void release_idr(struct idr *idr, struct mutex *lock, int id)
92 mutex_unlock(lock); 87 mutex_unlock(lock);
93} 88}
94 89
95/* hwmon sys I/F*/ 90/* sys I/F for thermal zone */
96static ssize_t
97name_show(struct device *dev, struct device_attribute *attr, char *buf)
98{
99 return sprintf(buf, "thermal_sys_class\n");
100}
101
102static ssize_t
103temp_input_show(struct device *dev, struct device_attribute *attr, char *buf)
104{
105 struct thermal_zone_device *tz;
106 struct sensor_device_attribute *sensor_attr
107 = to_sensor_dev_attr(attr);
108
109 list_for_each_entry(tz, &thermal_tz_list, node)
110 if (tz->id == sensor_attr->index)
111 return tz->ops->get_temp(tz, buf);
112
113 return -ENODEV;
114}
115
116static ssize_t
117temp_crit_show(struct device *dev, struct device_attribute *attr,
118 char *buf)
119{
120 struct thermal_zone_device *tz;
121 struct sensor_device_attribute *sensor_attr
122 = to_sensor_dev_attr(attr);
123
124 list_for_each_entry(tz, &thermal_tz_list, node)
125 if (tz->id == sensor_attr->index)
126 return tz->ops->get_trip_temp(tz, 0, buf);
127
128 return -ENODEV;
129}
130
131static DEVICE_ATTR(name, 0444, name_show, NULL);
132static struct sensor_device_attribute sensor_attrs[] = {
133 SENSOR_ATTR(temp1_input, 0444, temp_input_show, NULL, 0),
134 SENSOR_ATTR(temp1_crit, 0444, temp_crit_show, NULL, 0),
135 SENSOR_ATTR(temp2_input, 0444, temp_input_show, NULL, 1),
136 SENSOR_ATTR(temp2_crit, 0444, temp_crit_show, NULL, 1),
137 SENSOR_ATTR(temp3_input, 0444, temp_input_show, NULL, 2),
138 SENSOR_ATTR(temp3_crit, 0444, temp_crit_show, NULL, 2),
139 SENSOR_ATTR(temp4_input, 0444, temp_input_show, NULL, 3),
140 SENSOR_ATTR(temp4_crit, 0444, temp_crit_show, NULL, 3),
141 SENSOR_ATTR(temp5_input, 0444, temp_input_show, NULL, 4),
142 SENSOR_ATTR(temp5_crit, 0444, temp_crit_show, NULL, 4),
143 SENSOR_ATTR(temp6_input, 0444, temp_input_show, NULL, 5),
144 SENSOR_ATTR(temp6_crit, 0444, temp_crit_show, NULL, 5),
145 SENSOR_ATTR(temp7_input, 0444, temp_input_show, NULL, 6),
146 SENSOR_ATTR(temp7_crit, 0444, temp_crit_show, NULL, 6),
147 SENSOR_ATTR(temp8_input, 0444, temp_input_show, NULL, 7),
148 SENSOR_ATTR(temp8_crit, 0444, temp_crit_show, NULL, 7),
149 SENSOR_ATTR(temp9_input, 0444, temp_input_show, NULL, 8),
150 SENSOR_ATTR(temp9_crit, 0444, temp_crit_show, NULL, 8),
151 SENSOR_ATTR(temp10_input, 0444, temp_input_show, NULL, 9),
152 SENSOR_ATTR(temp10_crit, 0444, temp_crit_show, NULL, 9),
153};
154
155/* thermal zone sys I/F */
156 91
157#define to_thermal_zone(_dev) \ 92#define to_thermal_zone(_dev) \
158 container_of(_dev, struct thermal_zone_device, device) 93 container_of(_dev, struct thermal_zone_device, device)
@@ -279,7 +214,7 @@ do { \
279 device_remove_file(_dev, &trip_point_attrs[_index * 2 + 1]); \ 214 device_remove_file(_dev, &trip_point_attrs[_index * 2 + 1]); \
280} while (0) 215} while (0)
281 216
282/* cooling device sys I/F */ 217/* sys I/F for cooling device */
283#define to_cooling_device(_dev) \ 218#define to_cooling_device(_dev) \
284 container_of(_dev, struct thermal_cooling_device, device) 219 container_of(_dev, struct thermal_cooling_device, device)
285 220
@@ -512,9 +447,6 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
512 struct thermal_zone_device *pos; 447 struct thermal_zone_device *pos;
513 int result; 448 int result;
514 449
515 if (!type)
516 return ERR_PTR(-EINVAL);
517
518 if (strlen(type) >= THERMAL_NAME_LENGTH) 450 if (strlen(type) >= THERMAL_NAME_LENGTH)
519 return ERR_PTR(-EINVAL); 451 return ERR_PTR(-EINVAL);
520 452
@@ -545,9 +477,11 @@ struct thermal_cooling_device *thermal_cooling_device_register(char *type,
545 } 477 }
546 478
547 /* sys I/F */ 479 /* sys I/F */
548 result = device_create_file(&cdev->device, &dev_attr_cdev_type); 480 if (type) {
549 if (result) 481 result = device_create_file(&cdev->device, &dev_attr_cdev_type);
550 goto unregister; 482 if (result)
483 goto unregister;
484 }
551 485
552 result = device_create_file(&cdev->device, &dev_attr_max_state); 486 result = device_create_file(&cdev->device, &dev_attr_max_state);
553 if (result) 487 if (result)
@@ -613,8 +547,8 @@ void thermal_cooling_device_unregister(struct
613 tz->ops->unbind(tz, cdev); 547 tz->ops->unbind(tz, cdev);
614 } 548 }
615 mutex_unlock(&thermal_list_lock); 549 mutex_unlock(&thermal_list_lock);
616 550 if (cdev->type[0])
617 device_remove_file(&cdev->device, &dev_attr_cdev_type); 551 device_remove_file(&cdev->device, &dev_attr_cdev_type);
618 device_remove_file(&cdev->device, &dev_attr_max_state); 552 device_remove_file(&cdev->device, &dev_attr_max_state);
619 device_remove_file(&cdev->device, &dev_attr_cur_state); 553 device_remove_file(&cdev->device, &dev_attr_cur_state);
620 554
@@ -646,9 +580,6 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
646 int result; 580 int result;
647 int count; 581 int count;
648 582
649 if (!type)
650 return ERR_PTR(-EINVAL);
651
652 if (strlen(type) >= THERMAL_NAME_LENGTH) 583 if (strlen(type) >= THERMAL_NAME_LENGTH)
653 return ERR_PTR(-EINVAL); 584 return ERR_PTR(-EINVAL);
654 585
@@ -670,13 +601,6 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
670 kfree(tz); 601 kfree(tz);
671 return ERR_PTR(result); 602 return ERR_PTR(result);
672 } 603 }
673 if (tz->id >= MAX_THERMAL_ZONES) {
674 printk(KERN_ERR PREFIX
675 "Too many thermal zones\n");
676 release_idr(&thermal_tz_idr, &thermal_idr_lock, tz->id);
677 kfree(tz);
678 return ERR_PTR(-EINVAL);
679 }
680 604
681 strcpy(tz->type, type); 605 strcpy(tz->type, type);
682 tz->ops = ops; 606 tz->ops = ops;
@@ -691,27 +615,12 @@ struct thermal_zone_device *thermal_zone_device_register(char *type,
691 return ERR_PTR(result); 615 return ERR_PTR(result);
692 } 616 }
693 617
694 /* hwmon sys I/F */
695 result = device_create_file(thermal_hwmon,
696 &sensor_attrs[tz->id * 2].dev_attr);
697 if (result)
698 goto unregister;
699
700 if (trips > 0) {
701 char buf[40];
702 result = tz->ops->get_trip_type(tz, 0, buf);
703 if (result > 0 && !strcmp(buf, "critical\n")) {
704 result = device_create_file(thermal_hwmon,
705 &sensor_attrs[tz->id * 2 + 1].dev_attr);
706 if (result)
707 goto unregister;
708 }
709 }
710
711 /* sys I/F */ 618 /* sys I/F */
712 result = device_create_file(&tz->device, &dev_attr_type); 619 if (type) {
713 if (result) 620 result = device_create_file(&tz->device, &dev_attr_type);
714 goto unregister; 621 if (result)
622 goto unregister;
623 }
715 624
716 result = device_create_file(&tz->device, &dev_attr_temp); 625 result = device_create_file(&tz->device, &dev_attr_temp);
717 if (result) 626 if (result)
@@ -778,17 +687,8 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
778 tz->ops->unbind(tz, cdev); 687 tz->ops->unbind(tz, cdev);
779 mutex_unlock(&thermal_list_lock); 688 mutex_unlock(&thermal_list_lock);
780 689
781 device_remove_file(thermal_hwmon, 690 if (tz->type[0])
782 &sensor_attrs[tz->id * 2].dev_attr); 691 device_remove_file(&tz->device, &dev_attr_type);
783 if (tz->trips > 0) {
784 char buf[40];
785 if (tz->ops->get_trip_type(tz, 0, buf) > 0)
786 if (!strcmp(buf, "critical\n"))
787 device_remove_file(thermal_hwmon,
788 &sensor_attrs[tz->id * 2 + 1].dev_attr);
789 }
790
791 device_remove_file(&tz->device, &dev_attr_type);
792 device_remove_file(&tz->device, &dev_attr_temp); 692 device_remove_file(&tz->device, &dev_attr_temp);
793 if (tz->ops->get_mode) 693 if (tz->ops->get_mode)
794 device_remove_file(&tz->device, &dev_attr_mode); 694 device_remove_file(&tz->device, &dev_attr_mode);
@@ -805,19 +705,6 @@ void thermal_zone_device_unregister(struct thermal_zone_device *tz)
805 705
806EXPORT_SYMBOL(thermal_zone_device_unregister); 706EXPORT_SYMBOL(thermal_zone_device_unregister);
807 707
808static void thermal_exit(void)
809{
810 if (thermal_hwmon) {
811 device_remove_file(thermal_hwmon, &dev_attr_name);
812 hwmon_device_unregister(thermal_hwmon);
813 }
814 class_unregister(&thermal_class);
815 idr_destroy(&thermal_tz_idr);
816 idr_destroy(&thermal_cdev_idr);
817 mutex_destroy(&thermal_idr_lock);
818 mutex_destroy(&thermal_list_lock);
819}
820
821static int __init thermal_init(void) 708static int __init thermal_init(void)
822{ 709{
823 int result = 0; 710 int result = 0;
@@ -829,21 +716,17 @@ static int __init thermal_init(void)
829 mutex_destroy(&thermal_idr_lock); 716 mutex_destroy(&thermal_idr_lock);
830 mutex_destroy(&thermal_list_lock); 717 mutex_destroy(&thermal_list_lock);
831 } 718 }
832
833 thermal_hwmon = hwmon_device_register(NULL);
834 if (IS_ERR(thermal_hwmon)) {
835 result = PTR_ERR(thermal_hwmon);
836 thermal_hwmon = NULL;
837 printk(KERN_ERR PREFIX
838 "unable to register hwmon device\n");
839 thermal_exit();
840 return result;
841 }
842
843 result = device_create_file(thermal_hwmon, &dev_attr_name);
844
845 return result; 719 return result;
846} 720}
847 721
722static void __exit thermal_exit(void)
723{
724 class_unregister(&thermal_class);
725 idr_destroy(&thermal_tz_idr);
726 idr_destroy(&thermal_cdev_idr);
727 mutex_destroy(&thermal_idr_lock);
728 mutex_destroy(&thermal_list_lock);
729}
730
848subsys_initcall(thermal_init); 731subsys_initcall(thermal_init);
849module_exit(thermal_exit); 732module_exit(thermal_exit);