diff options
author | Bjorn Helgaas <bjorn.helgaas@hp.com> | 2009-09-21 15:29:05 -0400 |
---|---|---|
committer | Len Brown <len.brown@intel.com> | 2009-09-25 14:24:24 -0400 |
commit | 66b7ed40aaf153d634aabff409a0dda675f37f45 (patch) | |
tree | 5036abad82e645ab99878fea41b96c93634efdd9 /drivers/acpi | |
parent | e8b945c9c155d06e1d1ea594f8e18e01aa36f612 (diff) |
ACPI: remove redundant "handle" and "parent" arguments
In several cases, functions take handle and parent device pointers in
addition to acpi_device pointers. But the acpi_device structure contains
both the handle and the parent pointer, so it's pointless and error-prone
to pass them all. This patch removes the unnecessary "handle" and "parent"
arguments.
Signed-off-by: Bjorn Helgaas <bjorn.helgaas@hp.com>
Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/scan.c | 27 |
1 files changed, 12 insertions, 15 deletions
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c index 0302dd454e17..ab5a26469707 100644 --- a/drivers/acpi/scan.c +++ b/drivers/acpi/scan.c | |||
@@ -474,12 +474,12 @@ struct bus_type acpi_bus_type = { | |||
474 | .uevent = acpi_device_uevent, | 474 | .uevent = acpi_device_uevent, |
475 | }; | 475 | }; |
476 | 476 | ||
477 | static int acpi_device_register(struct acpi_device *device, | 477 | static int acpi_device_register(struct acpi_device *device) |
478 | struct acpi_device *parent) | ||
479 | { | 478 | { |
480 | int result; | 479 | int result; |
481 | struct acpi_device_bus_id *acpi_device_bus_id, *new_bus_id; | 480 | struct acpi_device_bus_id *acpi_device_bus_id, *new_bus_id; |
482 | int found = 0; | 481 | int found = 0; |
482 | |||
483 | /* | 483 | /* |
484 | * Linkage | 484 | * Linkage |
485 | * ------- | 485 | * ------- |
@@ -524,7 +524,7 @@ static int acpi_device_register(struct acpi_device *device, | |||
524 | mutex_unlock(&acpi_device_lock); | 524 | mutex_unlock(&acpi_device_lock); |
525 | 525 | ||
526 | if (device->parent) | 526 | if (device->parent) |
527 | device->dev.parent = &parent->dev; | 527 | device->dev.parent = &device->parent->dev; |
528 | device->dev.bus = &acpi_bus_type; | 528 | device->dev.bus = &acpi_bus_type; |
529 | device->dev.release = &acpi_device_release; | 529 | device->dev.release = &acpi_device_release; |
530 | result = device_register(&device->dev); | 530 | result = device_register(&device->dev); |
@@ -918,8 +918,7 @@ static int acpi_bus_get_flags(struct acpi_device *device) | |||
918 | return 0; | 918 | return 0; |
919 | } | 919 | } |
920 | 920 | ||
921 | static void acpi_device_get_busid(struct acpi_device *device, | 921 | static void acpi_device_get_busid(struct acpi_device *device, int type) |
922 | acpi_handle handle, int type) | ||
923 | { | 922 | { |
924 | char bus_id[5] = { '?', 0 }; | 923 | char bus_id[5] = { '?', 0 }; |
925 | struct acpi_buffer buffer = { sizeof(bus_id), bus_id }; | 924 | struct acpi_buffer buffer = { sizeof(bus_id), bus_id }; |
@@ -942,7 +941,7 @@ static void acpi_device_get_busid(struct acpi_device *device, | |||
942 | strcpy(device->pnp.bus_id, "SLPF"); | 941 | strcpy(device->pnp.bus_id, "SLPF"); |
943 | break; | 942 | break; |
944 | default: | 943 | default: |
945 | acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer); | 944 | acpi_get_name(device->handle, ACPI_SINGLE_NAME, &buffer); |
946 | /* Clean up trailing underscores (if any) */ | 945 | /* Clean up trailing underscores (if any) */ |
947 | for (i = 3; i > 1; i--) { | 946 | for (i = 3; i > 1; i--) { |
948 | if (bus_id[i] == '_') | 947 | if (bus_id[i] == '_') |
@@ -1058,9 +1057,7 @@ acpi_add_cid( | |||
1058 | return cid; | 1057 | return cid; |
1059 | } | 1058 | } |
1060 | 1059 | ||
1061 | static void acpi_device_set_id(struct acpi_device *device, | 1060 | static void acpi_device_set_id(struct acpi_device *device, int type) |
1062 | struct acpi_device *parent, acpi_handle handle, | ||
1063 | int type) | ||
1064 | { | 1061 | { |
1065 | struct acpi_device_info *info = NULL; | 1062 | struct acpi_device_info *info = NULL; |
1066 | char *hid = NULL; | 1063 | char *hid = NULL; |
@@ -1071,7 +1068,7 @@ static void acpi_device_set_id(struct acpi_device *device, | |||
1071 | 1068 | ||
1072 | switch (type) { | 1069 | switch (type) { |
1073 | case ACPI_BUS_TYPE_DEVICE: | 1070 | case ACPI_BUS_TYPE_DEVICE: |
1074 | status = acpi_get_object_info(handle, &info); | 1071 | status = acpi_get_object_info(device->handle, &info); |
1075 | if (ACPI_FAILURE(status)) { | 1072 | if (ACPI_FAILURE(status)) { |
1076 | printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__); | 1073 | printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__); |
1077 | return; | 1074 | return; |
@@ -1126,7 +1123,8 @@ static void acpi_device_set_id(struct acpi_device *device, | |||
1126 | * ---- | 1123 | * ---- |
1127 | * Fix for the system root bus device -- the only root-level device. | 1124 | * Fix for the system root bus device -- the only root-level device. |
1128 | */ | 1125 | */ |
1129 | if (((acpi_handle)parent == ACPI_ROOT_OBJECT) && (type == ACPI_BUS_TYPE_DEVICE)) { | 1126 | if (((acpi_handle)device->parent == ACPI_ROOT_OBJECT) && |
1127 | (type == ACPI_BUS_TYPE_DEVICE)) { | ||
1130 | hid = ACPI_BUS_HID; | 1128 | hid = ACPI_BUS_HID; |
1131 | strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); | 1129 | strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME); |
1132 | strcpy(device->pnp.device_class, ACPI_BUS_CLASS); | 1130 | strcpy(device->pnp.device_class, ACPI_BUS_CLASS); |
@@ -1246,8 +1244,7 @@ acpi_add_single_object(struct acpi_device **child, | |||
1246 | device->parent = parent; | 1244 | device->parent = parent; |
1247 | device->bus_ops = *ops; /* workround for not call .start */ | 1245 | device->bus_ops = *ops; /* workround for not call .start */ |
1248 | 1246 | ||
1249 | 1247 | acpi_device_get_busid(device, type); | |
1250 | acpi_device_get_busid(device, handle, type); | ||
1251 | 1248 | ||
1252 | /* | 1249 | /* |
1253 | * Flags | 1250 | * Flags |
@@ -1310,7 +1307,7 @@ acpi_add_single_object(struct acpi_device **child, | |||
1310 | * Hardware ID, Unique ID, & Bus Address | 1307 | * Hardware ID, Unique ID, & Bus Address |
1311 | * ------------------------------------- | 1308 | * ------------------------------------- |
1312 | */ | 1309 | */ |
1313 | acpi_device_set_id(device, parent, handle, type); | 1310 | acpi_device_set_id(device, type); |
1314 | 1311 | ||
1315 | /* | 1312 | /* |
1316 | * Power Management | 1313 | * Power Management |
@@ -1345,7 +1342,7 @@ acpi_add_single_object(struct acpi_device **child, | |||
1345 | if ((result = acpi_device_set_context(device, type))) | 1342 | if ((result = acpi_device_set_context(device, type))) |
1346 | goto end; | 1343 | goto end; |
1347 | 1344 | ||
1348 | result = acpi_device_register(device, parent); | 1345 | result = acpi_device_register(device); |
1349 | 1346 | ||
1350 | /* | 1347 | /* |
1351 | * Bind _ADR-Based Devices when hot add | 1348 | * Bind _ADR-Based Devices when hot add |