mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2025-01-04 04:06:26 +00:00
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>
This commit is contained in:
parent
e8b945c9c1
commit
66b7ed40aa
@ -474,12 +474,12 @@ struct bus_type acpi_bus_type = {
|
|||||||
.uevent = acpi_device_uevent,
|
.uevent = acpi_device_uevent,
|
||||||
};
|
};
|
||||||
|
|
||||||
static int acpi_device_register(struct acpi_device *device,
|
static int acpi_device_register(struct acpi_device *device)
|
||||||
struct acpi_device *parent)
|
|
||||||
{
|
{
|
||||||
int result;
|
int result;
|
||||||
struct acpi_device_bus_id *acpi_device_bus_id, *new_bus_id;
|
struct acpi_device_bus_id *acpi_device_bus_id, *new_bus_id;
|
||||||
int found = 0;
|
int found = 0;
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Linkage
|
* Linkage
|
||||||
* -------
|
* -------
|
||||||
@ -524,7 +524,7 @@ static int acpi_device_register(struct acpi_device *device,
|
|||||||
mutex_unlock(&acpi_device_lock);
|
mutex_unlock(&acpi_device_lock);
|
||||||
|
|
||||||
if (device->parent)
|
if (device->parent)
|
||||||
device->dev.parent = &parent->dev;
|
device->dev.parent = &device->parent->dev;
|
||||||
device->dev.bus = &acpi_bus_type;
|
device->dev.bus = &acpi_bus_type;
|
||||||
device->dev.release = &acpi_device_release;
|
device->dev.release = &acpi_device_release;
|
||||||
result = device_register(&device->dev);
|
result = device_register(&device->dev);
|
||||||
@ -918,8 +918,7 @@ static int acpi_bus_get_flags(struct acpi_device *device)
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void acpi_device_get_busid(struct acpi_device *device,
|
static void acpi_device_get_busid(struct acpi_device *device, int type)
|
||||||
acpi_handle handle, int type)
|
|
||||||
{
|
{
|
||||||
char bus_id[5] = { '?', 0 };
|
char bus_id[5] = { '?', 0 };
|
||||||
struct acpi_buffer buffer = { sizeof(bus_id), bus_id };
|
struct acpi_buffer buffer = { sizeof(bus_id), bus_id };
|
||||||
@ -942,7 +941,7 @@ static void acpi_device_get_busid(struct acpi_device *device,
|
|||||||
strcpy(device->pnp.bus_id, "SLPF");
|
strcpy(device->pnp.bus_id, "SLPF");
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
acpi_get_name(handle, ACPI_SINGLE_NAME, &buffer);
|
acpi_get_name(device->handle, ACPI_SINGLE_NAME, &buffer);
|
||||||
/* Clean up trailing underscores (if any) */
|
/* Clean up trailing underscores (if any) */
|
||||||
for (i = 3; i > 1; i--) {
|
for (i = 3; i > 1; i--) {
|
||||||
if (bus_id[i] == '_')
|
if (bus_id[i] == '_')
|
||||||
@ -1058,9 +1057,7 @@ acpi_add_cid(
|
|||||||
return cid;
|
return cid;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void acpi_device_set_id(struct acpi_device *device,
|
static void acpi_device_set_id(struct acpi_device *device, int type)
|
||||||
struct acpi_device *parent, acpi_handle handle,
|
|
||||||
int type)
|
|
||||||
{
|
{
|
||||||
struct acpi_device_info *info = NULL;
|
struct acpi_device_info *info = NULL;
|
||||||
char *hid = NULL;
|
char *hid = NULL;
|
||||||
@ -1071,7 +1068,7 @@ static void acpi_device_set_id(struct acpi_device *device,
|
|||||||
|
|
||||||
switch (type) {
|
switch (type) {
|
||||||
case ACPI_BUS_TYPE_DEVICE:
|
case ACPI_BUS_TYPE_DEVICE:
|
||||||
status = acpi_get_object_info(handle, &info);
|
status = acpi_get_object_info(device->handle, &info);
|
||||||
if (ACPI_FAILURE(status)) {
|
if (ACPI_FAILURE(status)) {
|
||||||
printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__);
|
printk(KERN_ERR PREFIX "%s: Error reading device info\n", __func__);
|
||||||
return;
|
return;
|
||||||
@ -1126,7 +1123,8 @@ static void acpi_device_set_id(struct acpi_device *device,
|
|||||||
* ----
|
* ----
|
||||||
* Fix for the system root bus device -- the only root-level device.
|
* Fix for the system root bus device -- the only root-level device.
|
||||||
*/
|
*/
|
||||||
if (((acpi_handle)parent == ACPI_ROOT_OBJECT) && (type == ACPI_BUS_TYPE_DEVICE)) {
|
if (((acpi_handle)device->parent == ACPI_ROOT_OBJECT) &&
|
||||||
|
(type == ACPI_BUS_TYPE_DEVICE)) {
|
||||||
hid = ACPI_BUS_HID;
|
hid = ACPI_BUS_HID;
|
||||||
strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME);
|
strcpy(device->pnp.device_name, ACPI_BUS_DEVICE_NAME);
|
||||||
strcpy(device->pnp.device_class, ACPI_BUS_CLASS);
|
strcpy(device->pnp.device_class, ACPI_BUS_CLASS);
|
||||||
@ -1246,8 +1244,7 @@ acpi_add_single_object(struct acpi_device **child,
|
|||||||
device->parent = parent;
|
device->parent = parent;
|
||||||
device->bus_ops = *ops; /* workround for not call .start */
|
device->bus_ops = *ops; /* workround for not call .start */
|
||||||
|
|
||||||
|
acpi_device_get_busid(device, type);
|
||||||
acpi_device_get_busid(device, handle, type);
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Flags
|
* Flags
|
||||||
@ -1310,7 +1307,7 @@ acpi_add_single_object(struct acpi_device **child,
|
|||||||
* Hardware ID, Unique ID, & Bus Address
|
* Hardware ID, Unique ID, & Bus Address
|
||||||
* -------------------------------------
|
* -------------------------------------
|
||||||
*/
|
*/
|
||||||
acpi_device_set_id(device, parent, handle, type);
|
acpi_device_set_id(device, type);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Power Management
|
* Power Management
|
||||||
@ -1345,7 +1342,7 @@ acpi_add_single_object(struct acpi_device **child,
|
|||||||
if ((result = acpi_device_set_context(device, type)))
|
if ((result = acpi_device_set_context(device, type)))
|
||||||
goto end;
|
goto end;
|
||||||
|
|
||||||
result = acpi_device_register(device, parent);
|
result = acpi_device_register(device);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Bind _ADR-Based Devices when hot add
|
* Bind _ADR-Based Devices when hot add
|
||||||
|
Loading…
Reference in New Issue
Block a user