ACPI: scan: Call acpi_get_object_info() from acpi_set_pnp_ids()
Notice that it is not necessary to call acpi_get_object_info() from acpi_add_single_object() in order to pass the pointer returned by it to acpi_init_device_object() and from there to acpi_set_pnp_ids(). It is more straightforward to call acpi_get_object_info() from acpi_set_pnp_ids() and avoid unnecessary pointer passing, so change the code accordingly. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Reviewed-by: Hans de Goede <hdegoede@redhat.com>
This commit is contained in:
parent
f5d9ab1d80
commit
c830dbcfcc
@ -109,7 +109,7 @@ struct acpi_device_bus_id {
|
|||||||
int acpi_device_add(struct acpi_device *device,
|
int acpi_device_add(struct acpi_device *device,
|
||||||
void (*release)(struct device *));
|
void (*release)(struct device *));
|
||||||
void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
|
void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
|
||||||
int type, struct acpi_device_info *info);
|
int type);
|
||||||
int acpi_device_setup_files(struct acpi_device *dev);
|
int acpi_device_setup_files(struct acpi_device *dev);
|
||||||
void acpi_device_remove_files(struct acpi_device *dev);
|
void acpi_device_remove_files(struct acpi_device *dev);
|
||||||
void acpi_device_add_finalize(struct acpi_device *device);
|
void acpi_device_add_finalize(struct acpi_device *device);
|
||||||
|
@ -925,7 +925,7 @@ int acpi_add_power_resource(acpi_handle handle)
|
|||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
|
|
||||||
device = &resource->device;
|
device = &resource->device;
|
||||||
acpi_init_device_object(device, handle, ACPI_BUS_TYPE_POWER, NULL);
|
acpi_init_device_object(device, handle, ACPI_BUS_TYPE_POWER);
|
||||||
mutex_init(&resource->resource_lock);
|
mutex_init(&resource->resource_lock);
|
||||||
INIT_LIST_HEAD(&resource->list_node);
|
INIT_LIST_HEAD(&resource->list_node);
|
||||||
INIT_LIST_HEAD(&resource->dependents);
|
INIT_LIST_HEAD(&resource->dependents);
|
||||||
|
@ -1307,8 +1307,9 @@ static bool acpi_object_is_system_bus(acpi_handle handle)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp,
|
static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp,
|
||||||
int device_type, struct acpi_device_info *info)
|
int device_type)
|
||||||
{
|
{
|
||||||
|
struct acpi_device_info *info = NULL;
|
||||||
struct acpi_pnp_device_id_list *cid_list;
|
struct acpi_pnp_device_id_list *cid_list;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
@ -1319,6 +1320,7 @@ static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp,
|
|||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
acpi_get_object_info(handle, &info);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
pr_err(PREFIX "%s: Error reading device info\n",
|
pr_err(PREFIX "%s: Error reading device info\n",
|
||||||
__func__);
|
__func__);
|
||||||
@ -1344,6 +1346,8 @@ static void acpi_set_pnp_ids(acpi_handle handle, struct acpi_device_pnp *pnp,
|
|||||||
if (info->valid & ACPI_VALID_CLS)
|
if (info->valid & ACPI_VALID_CLS)
|
||||||
acpi_add_id(pnp, info->class_code.string);
|
acpi_add_id(pnp, info->class_code.string);
|
||||||
|
|
||||||
|
kfree(info);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Some devices don't reliably have _HIDs & _CIDs, so add
|
* Some devices don't reliably have _HIDs & _CIDs, so add
|
||||||
* synthetic HIDs to make sure drivers can find them.
|
* synthetic HIDs to make sure drivers can find them.
|
||||||
@ -1649,7 +1653,7 @@ static bool acpi_device_enumeration_by_parent(struct acpi_device *device)
|
|||||||
}
|
}
|
||||||
|
|
||||||
void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
|
void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
|
||||||
int type, struct acpi_device_info *info)
|
int type)
|
||||||
{
|
{
|
||||||
INIT_LIST_HEAD(&device->pnp.ids);
|
INIT_LIST_HEAD(&device->pnp.ids);
|
||||||
device->device_type = type;
|
device->device_type = type;
|
||||||
@ -1658,7 +1662,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
|
|||||||
fwnode_init(&device->fwnode, &acpi_device_fwnode_ops);
|
fwnode_init(&device->fwnode, &acpi_device_fwnode_ops);
|
||||||
acpi_set_device_status(device, ACPI_STA_DEFAULT);
|
acpi_set_device_status(device, ACPI_STA_DEFAULT);
|
||||||
acpi_device_get_busid(device);
|
acpi_device_get_busid(device);
|
||||||
acpi_set_pnp_ids(handle, &device->pnp, type, info);
|
acpi_set_pnp_ids(handle, &device->pnp, type);
|
||||||
acpi_init_properties(device);
|
acpi_init_properties(device);
|
||||||
acpi_bus_get_flags(device);
|
acpi_bus_get_flags(device);
|
||||||
device->flags.match_driver = false;
|
device->flags.match_driver = false;
|
||||||
@ -1688,21 +1692,14 @@ static void acpi_scan_init_status(struct acpi_device *adev)
|
|||||||
static int acpi_add_single_object(struct acpi_device **child,
|
static int acpi_add_single_object(struct acpi_device **child,
|
||||||
acpi_handle handle, int type)
|
acpi_handle handle, int type)
|
||||||
{
|
{
|
||||||
struct acpi_device_info *info = NULL;
|
|
||||||
struct acpi_device *device;
|
struct acpi_device *device;
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
if (type == ACPI_BUS_TYPE_DEVICE && handle != ACPI_ROOT_OBJECT)
|
|
||||||
acpi_get_object_info(handle, &info);
|
|
||||||
|
|
||||||
device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL);
|
device = kzalloc(sizeof(struct acpi_device), GFP_KERNEL);
|
||||||
if (!device) {
|
if (!device)
|
||||||
kfree(info);
|
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
|
||||||
|
|
||||||
acpi_init_device_object(device, handle, type, info);
|
acpi_init_device_object(device, handle, type);
|
||||||
kfree(info);
|
|
||||||
/*
|
/*
|
||||||
* Getting the status is delayed till here so that we can call
|
* Getting the status is delayed till here so that we can call
|
||||||
* acpi_bus_get_status() and use its quirk handling. Note that
|
* acpi_bus_get_status() and use its quirk handling. Note that
|
||||||
|
Loading…
x
Reference in New Issue
Block a user