aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/acpi/scan.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/acpi/scan.c')
-rw-r--r--drivers/acpi/scan.c77
1 files changed, 30 insertions, 47 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 18c8e3e2fbad..a7b1fda572cf 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -162,11 +162,10 @@ static void acpi_device_unregister(struct acpi_device *device, int type)
162 162
163void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context) 163void acpi_bus_data_handler(acpi_handle handle, u32 function, void *context)
164{ 164{
165 ACPI_FUNCTION_TRACE("acpi_bus_data_handler");
166 165
167 /* TBD */ 166 /* TBD */
168 167
169 return_VOID; 168 return;
170} 169}
171 170
172static int acpi_bus_get_power_flags(struct acpi_device *device) 171static int acpi_bus_get_power_flags(struct acpi_device *device)
@@ -175,7 +174,6 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
175 acpi_handle handle = NULL; 174 acpi_handle handle = NULL;
176 u32 i = 0; 175 u32 i = 0;
177 176
178 ACPI_FUNCTION_TRACE("acpi_bus_get_power_flags");
179 177
180 /* 178 /*
181 * Power Management Flags 179 * Power Management Flags
@@ -228,7 +226,7 @@ static int acpi_bus_get_power_flags(struct acpi_device *device)
228 226
229 device->power.state = ACPI_STATE_UNKNOWN; 227 device->power.state = ACPI_STATE_UNKNOWN;
230 228
231 return_VALUE(0); 229 return 0;
232} 230}
233 231
234int acpi_match_ids(struct acpi_device *device, char *ids) 232int acpi_match_ids(struct acpi_device *device, char *ids)
@@ -306,7 +304,6 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
306 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL }; 304 struct acpi_buffer buffer = { ACPI_ALLOCATE_BUFFER, NULL };
307 union acpi_object *package = NULL; 305 union acpi_object *package = NULL;
308 306
309 ACPI_FUNCTION_TRACE("acpi_bus_get_wakeup_flags");
310 307
311 /* _PRW */ 308 /* _PRW */
312 status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer); 309 status = acpi_evaluate_object(device->handle, "_PRW", NULL, &buffer);
@@ -332,7 +329,7 @@ static int acpi_bus_get_wakeup_device_flags(struct acpi_device *device)
332 end: 329 end:
333 if (ACPI_FAILURE(status)) 330 if (ACPI_FAILURE(status))
334 device->flags.wake_capable = 0; 331 device->flags.wake_capable = 0;
335 return_VALUE(0); 332 return 0;
336} 333}
337 334
338/* -------------------------------------------------------------------------- 335/* --------------------------------------------------------------------------
@@ -488,19 +485,18 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver)
488{ 485{
489 int result = 0; 486 int result = 0;
490 487
491 ACPI_FUNCTION_TRACE("acpi_bus_driver_init");
492 488
493 if (!device || !driver) 489 if (!device || !driver)
494 return_VALUE(-EINVAL); 490 return -EINVAL;
495 491
496 if (!driver->ops.add) 492 if (!driver->ops.add)
497 return_VALUE(-ENOSYS); 493 return -ENOSYS;
498 494
499 result = driver->ops.add(device); 495 result = driver->ops.add(device);
500 if (result) { 496 if (result) {
501 device->driver = NULL; 497 device->driver = NULL;
502 acpi_driver_data(device) = NULL; 498 acpi_driver_data(device) = NULL;
503 return_VALUE(result); 499 return result;
504 } 500 }
505 501
506 device->driver = driver; 502 device->driver = driver;
@@ -512,7 +508,7 @@ acpi_bus_driver_init(struct acpi_device *device, struct acpi_driver *driver)
512 508
513 ACPI_DEBUG_PRINT((ACPI_DB_INFO, 509 ACPI_DEBUG_PRINT((ACPI_DB_INFO,
514 "Driver successfully bound to device\n")); 510 "Driver successfully bound to device\n"));
515 return_VALUE(0); 511 return 0;
516} 512}
517 513
518static int acpi_start_single_object(struct acpi_device *device) 514static int acpi_start_single_object(struct acpi_device *device)
@@ -520,10 +516,9 @@ static int acpi_start_single_object(struct acpi_device *device)
520 int result = 0; 516 int result = 0;
521 struct acpi_driver *driver; 517 struct acpi_driver *driver;
522 518
523 ACPI_FUNCTION_TRACE("acpi_start_single_object");
524 519
525 if (!(driver = device->driver)) 520 if (!(driver = device->driver))
526 return_VALUE(0); 521 return 0;
527 522
528 if (driver->ops.start) { 523 if (driver->ops.start) {
529 result = driver->ops.start(device); 524 result = driver->ops.start(device);
@@ -531,14 +526,13 @@ static int acpi_start_single_object(struct acpi_device *device)
531 driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL); 526 driver->ops.remove(device, ACPI_BUS_REMOVAL_NORMAL);
532 } 527 }
533 528
534 return_VALUE(result); 529 return result;
535} 530}
536 531
537static void acpi_driver_attach(struct acpi_driver *drv) 532static void acpi_driver_attach(struct acpi_driver *drv)
538{ 533{
539 struct list_head *node, *next; 534 struct list_head *node, *next;
540 535
541 ACPI_FUNCTION_TRACE("acpi_driver_attach");
542 536
543 spin_lock(&acpi_device_lock); 537 spin_lock(&acpi_device_lock);
544 list_for_each_safe(node, next, &acpi_device_list) { 538 list_for_each_safe(node, next, &acpi_device_list) {
@@ -567,7 +561,6 @@ static void acpi_driver_detach(struct acpi_driver *drv)
567{ 561{
568 struct list_head *node, *next; 562 struct list_head *node, *next;
569 563
570 ACPI_FUNCTION_TRACE("acpi_driver_detach");
571 564
572 spin_lock(&acpi_device_lock); 565 spin_lock(&acpi_device_lock);
573 list_for_each_safe(node, next, &acpi_device_list) { 566 list_for_each_safe(node, next, &acpi_device_list) {
@@ -597,17 +590,16 @@ static void acpi_driver_detach(struct acpi_driver *drv)
597 */ 590 */
598int acpi_bus_register_driver(struct acpi_driver *driver) 591int acpi_bus_register_driver(struct acpi_driver *driver)
599{ 592{
600 ACPI_FUNCTION_TRACE("acpi_bus_register_driver");
601 593
602 if (acpi_disabled) 594 if (acpi_disabled)
603 return_VALUE(-ENODEV); 595 return -ENODEV;
604 596
605 spin_lock(&acpi_device_lock); 597 spin_lock(&acpi_device_lock);
606 list_add_tail(&driver->node, &acpi_bus_drivers); 598 list_add_tail(&driver->node, &acpi_bus_drivers);
607 spin_unlock(&acpi_device_lock); 599 spin_unlock(&acpi_device_lock);
608 acpi_driver_attach(driver); 600 acpi_driver_attach(driver);
609 601
610 return_VALUE(0); 602 return 0;
611} 603}
612 604
613EXPORT_SYMBOL(acpi_bus_register_driver); 605EXPORT_SYMBOL(acpi_bus_register_driver);
@@ -645,7 +637,6 @@ static int acpi_bus_find_driver(struct acpi_device *device)
645 int result = 0; 637 int result = 0;
646 struct list_head *node, *next; 638 struct list_head *node, *next;
647 639
648 ACPI_FUNCTION_TRACE("acpi_bus_find_driver");
649 640
650 spin_lock(&acpi_device_lock); 641 spin_lock(&acpi_device_lock);
651 list_for_each_safe(node, next, &acpi_bus_drivers) { 642 list_for_each_safe(node, next, &acpi_bus_drivers) {
@@ -665,7 +656,7 @@ static int acpi_bus_find_driver(struct acpi_device *device)
665 spin_unlock(&acpi_device_lock); 656 spin_unlock(&acpi_device_lock);
666 657
667 Done: 658 Done:
668 return_VALUE(result); 659 return result;
669} 660}
670 661
671/* -------------------------------------------------------------------------- 662/* --------------------------------------------------------------------------
@@ -677,7 +668,6 @@ static int acpi_bus_get_flags(struct acpi_device *device)
677 acpi_status status = AE_OK; 668 acpi_status status = AE_OK;
678 acpi_handle temp = NULL; 669 acpi_handle temp = NULL;
679 670
680 ACPI_FUNCTION_TRACE("acpi_bus_get_flags");
681 671
682 /* Presence of _STA indicates 'dynamic_status' */ 672 /* Presence of _STA indicates 'dynamic_status' */
683 status = acpi_get_handle(device->handle, "_STA", &temp); 673 status = acpi_get_handle(device->handle, "_STA", &temp);
@@ -723,7 +713,7 @@ static int acpi_bus_get_flags(struct acpi_device *device)
723 713
724 /* TBD: Peformance management */ 714 /* TBD: Peformance management */
725 715
726 return_VALUE(0); 716 return 0;
727} 717}
728 718
729static void acpi_device_get_busid(struct acpi_device *device, 719static void acpi_device_get_busid(struct acpi_device *device,
@@ -917,10 +907,9 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
917 int result = 0; 907 int result = 0;
918 struct acpi_driver *driver; 908 struct acpi_driver *driver;
919 909
920 ACPI_FUNCTION_TRACE("acpi_bus_remove");
921 910
922 if (!dev) 911 if (!dev)
923 return_VALUE(-EINVAL); 912 return -EINVAL;
924 913
925 driver = dev->driver; 914 driver = dev->driver;
926 915
@@ -929,12 +918,12 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
929 if (driver->ops.stop) { 918 if (driver->ops.stop) {
930 result = driver->ops.stop(dev, ACPI_BUS_REMOVAL_EJECT); 919 result = driver->ops.stop(dev, ACPI_BUS_REMOVAL_EJECT);
931 if (result) 920 if (result)
932 return_VALUE(result); 921 return result;
933 } 922 }
934 923
935 result = dev->driver->ops.remove(dev, ACPI_BUS_REMOVAL_EJECT); 924 result = dev->driver->ops.remove(dev, ACPI_BUS_REMOVAL_EJECT);
936 if (result) { 925 if (result) {
937 return_VALUE(result); 926 return result;
938 } 927 }
939 928
940 atomic_dec(&dev->driver->references); 929 atomic_dec(&dev->driver->references);
@@ -943,7 +932,7 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
943 } 932 }
944 933
945 if (!rmdevice) 934 if (!rmdevice)
946 return_VALUE(0); 935 return 0;
947 936
948 if (dev->flags.bus_address) { 937 if (dev->flags.bus_address) {
949 if ((dev->parent) && (dev->parent->ops.unbind)) 938 if ((dev->parent) && (dev->parent->ops.unbind))
@@ -952,7 +941,7 @@ static int acpi_bus_remove(struct acpi_device *dev, int rmdevice)
952 941
953 acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT); 942 acpi_device_unregister(dev, ACPI_BUS_REMOVAL_EJECT);
954 943
955 return_VALUE(0); 944 return 0;
956} 945}
957 946
958static int 947static int
@@ -962,15 +951,14 @@ acpi_add_single_object(struct acpi_device **child,
962 int result = 0; 951 int result = 0;
963 struct acpi_device *device = NULL; 952 struct acpi_device *device = NULL;
964 953
965 ACPI_FUNCTION_TRACE("acpi_add_single_object");
966 954
967 if (!child) 955 if (!child)
968 return_VALUE(-EINVAL); 956 return -EINVAL;
969 957
970 device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL); 958 device = kmalloc(sizeof(struct acpi_device), GFP_KERNEL);
971 if (!device) { 959 if (!device) {
972 printk(KERN_ERR PREFIX "Memory allocation error\n"); 960 printk(KERN_ERR PREFIX "Memory allocation error\n");
973 return_VALUE(-ENOMEM); 961 return -ENOMEM;
974 } 962 }
975 memset(device, 0, sizeof(struct acpi_device)); 963 memset(device, 0, sizeof(struct acpi_device));
976 964
@@ -1095,7 +1083,7 @@ acpi_add_single_object(struct acpi_device **child,
1095 kfree(device); 1083 kfree(device);
1096 } 1084 }
1097 1085
1098 return_VALUE(result); 1086 return result;
1099} 1087}
1100 1088
1101static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops) 1089static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
@@ -1108,10 +1096,9 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
1108 acpi_object_type type = 0; 1096 acpi_object_type type = 0;
1109 u32 level = 1; 1097 u32 level = 1;
1110 1098
1111 ACPI_FUNCTION_TRACE("acpi_bus_scan");
1112 1099
1113 if (!start) 1100 if (!start)
1114 return_VALUE(-EINVAL); 1101 return -EINVAL;
1115 1102
1116 parent = start; 1103 parent = start;
1117 phandle = start->handle; 1104 phandle = start->handle;
@@ -1208,7 +1195,7 @@ static int acpi_bus_scan(struct acpi_device *start, struct acpi_bus_ops *ops)
1208 } 1195 }
1209 } 1196 }
1210 1197
1211 return_VALUE(0); 1198 return 0;
1212} 1199}
1213 1200
1214int 1201int
@@ -1218,7 +1205,6 @@ acpi_bus_add(struct acpi_device **child,
1218 int result; 1205 int result;
1219 struct acpi_bus_ops ops; 1206 struct acpi_bus_ops ops;
1220 1207
1221 ACPI_FUNCTION_TRACE("acpi_bus_add");
1222 1208
1223 result = acpi_add_single_object(child, parent, handle, type); 1209 result = acpi_add_single_object(child, parent, handle, type);
1224 if (!result) { 1210 if (!result) {
@@ -1226,7 +1212,7 @@ acpi_bus_add(struct acpi_device **child,
1226 ops.acpi_op_add = 1; 1212 ops.acpi_op_add = 1;
1227 result = acpi_bus_scan(*child, &ops); 1213 result = acpi_bus_scan(*child, &ops);
1228 } 1214 }
1229 return_VALUE(result); 1215 return result;
1230} 1216}
1231 1217
1232EXPORT_SYMBOL(acpi_bus_add); 1218EXPORT_SYMBOL(acpi_bus_add);
@@ -1236,10 +1222,9 @@ int acpi_bus_start(struct acpi_device *device)
1236 int result; 1222 int result;
1237 struct acpi_bus_ops ops; 1223 struct acpi_bus_ops ops;
1238 1224
1239 ACPI_FUNCTION_TRACE("acpi_bus_start");
1240 1225
1241 if (!device) 1226 if (!device)
1242 return_VALUE(-EINVAL); 1227 return -EINVAL;
1243 1228
1244 result = acpi_start_single_object(device); 1229 result = acpi_start_single_object(device);
1245 if (!result) { 1230 if (!result) {
@@ -1247,7 +1232,7 @@ int acpi_bus_start(struct acpi_device *device)
1247 ops.acpi_op_start = 1; 1232 ops.acpi_op_start = 1;
1248 result = acpi_bus_scan(device, &ops); 1233 result = acpi_bus_scan(device, &ops);
1249 } 1234 }
1250 return_VALUE(result); 1235 return result;
1251} 1236}
1252 1237
1253EXPORT_SYMBOL(acpi_bus_start); 1238EXPORT_SYMBOL(acpi_bus_start);
@@ -1313,10 +1298,9 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
1313 int result = 0; 1298 int result = 0;
1314 struct acpi_device *device = NULL; 1299 struct acpi_device *device = NULL;
1315 1300
1316 ACPI_FUNCTION_TRACE("acpi_bus_scan_fixed");
1317 1301
1318 if (!root) 1302 if (!root)
1319 return_VALUE(-ENODEV); 1303 return -ENODEV;
1320 1304
1321 /* 1305 /*
1322 * Enumerate all fixed-feature devices. 1306 * Enumerate all fixed-feature devices.
@@ -1337,7 +1321,7 @@ static int acpi_bus_scan_fixed(struct acpi_device *root)
1337 result = acpi_start_single_object(device); 1321 result = acpi_start_single_object(device);
1338 } 1322 }
1339 1323
1340 return_VALUE(result); 1324 return result;
1341} 1325}
1342 1326
1343 1327
@@ -1439,10 +1423,9 @@ static int __init acpi_scan_init(void)
1439 int result; 1423 int result;
1440 struct acpi_bus_ops ops; 1424 struct acpi_bus_ops ops;
1441 1425
1442 ACPI_FUNCTION_TRACE("acpi_scan_init");
1443 1426
1444 if (acpi_disabled) 1427 if (acpi_disabled)
1445 return_VALUE(0); 1428 return 0;
1446 1429
1447 kset_register(&acpi_namespace_kset); 1430 kset_register(&acpi_namespace_kset);
1448 1431
@@ -1487,7 +1470,7 @@ static int __init acpi_scan_init(void)
1487 acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL); 1470 acpi_device_unregister(acpi_root, ACPI_BUS_REMOVAL_NORMAL);
1488 1471
1489 Done: 1472 Done:
1490 return_VALUE(result); 1473 return result;
1491} 1474}
1492 1475
1493subsys_initcall(acpi_scan_init); 1476subsys_initcall(acpi_scan_init);