Commit f7e62c58 authored by Rafael J. Wysocki's avatar Rafael J. Wysocki Committed by Hans de Goede

platform/x86: Replace acpi_bus_get_device()

Replace acpi_bus_get_device() that is going to be dropped with
acpi_fetch_acpi_dev().

No intentional functional impact.
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://lore.kernel.org/r/2631712.mvXUDI8C0e@kreacherReviewed-by: default avatarHans de Goede <hdegoede@redhat.com>
Signed-off-by: default avatarHans de Goede <hdegoede@redhat.com>
parent e9b0e120
...@@ -726,12 +726,9 @@ static acpi_status __init ...@@ -726,12 +726,9 @@ static acpi_status __init
check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv)
{ {
const struct acpi_device_id *ids = context; const struct acpi_device_id *ids = context;
struct acpi_device *dev; struct acpi_device *dev = acpi_fetch_acpi_dev(handle);
if (acpi_bus_get_device(handle, &dev) != 0) if (dev && acpi_match_device_ids(dev, ids) == 0)
return AE_OK;
if (acpi_match_device_ids(dev, ids) == 0)
if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL))) if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL)))
dev_info(&dev->dev, dev_info(&dev->dev,
"intel-hid: created platform device\n"); "intel-hid: created platform device\n");
......
...@@ -112,7 +112,6 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347 ...@@ -112,7 +112,6 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
struct acpi_device *adev; struct acpi_device *adev;
acpi_handle handle; acpi_handle handle;
acpi_status status; acpi_status status;
int ret;
if (int3472->n_sensor_gpios >= INT3472_MAX_SENSOR_GPIOS) { if (int3472->n_sensor_gpios >= INT3472_MAX_SENSOR_GPIOS) {
dev_warn(int3472->dev, "Too many GPIOs mapped\n"); dev_warn(int3472->dev, "Too many GPIOs mapped\n");
...@@ -139,8 +138,8 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347 ...@@ -139,8 +138,8 @@ static int skl_int3472_map_gpio_to_sensor(struct int3472_discrete_device *int347
if (ACPI_FAILURE(status)) if (ACPI_FAILURE(status))
return -EINVAL; return -EINVAL;
ret = acpi_bus_get_device(handle, &adev); adev = acpi_fetch_acpi_dev(handle);
if (ret) if (!adev)
return -ENODEV; return -ENODEV;
table_entry = &int3472->gpios.table[int3472->n_sensor_gpios]; table_entry = &int3472->gpios.table[int3472->n_sensor_gpios];
......
...@@ -384,12 +384,9 @@ static acpi_status __init ...@@ -384,12 +384,9 @@ static acpi_status __init
check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv) check_acpi_dev(acpi_handle handle, u32 lvl, void *context, void **rv)
{ {
const struct acpi_device_id *ids = context; const struct acpi_device_id *ids = context;
struct acpi_device *dev; struct acpi_device *dev = acpi_fetch_acpi_dev(handle);
if (acpi_bus_get_device(handle, &dev) != 0) if (dev && acpi_match_device_ids(dev, ids) == 0)
return AE_OK;
if (acpi_match_device_ids(dev, ids) == 0)
if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL))) if (!IS_ERR_OR_NULL(acpi_create_platform_device(dev, NULL)))
dev_info(&dev->dev, dev_info(&dev->dev,
"intel-vbtn: created platform device\n"); "intel-vbtn: created platform device\n");
......
...@@ -728,11 +728,10 @@ static void __init drv_acpi_handle_init(const char *name, ...@@ -728,11 +728,10 @@ static void __init drv_acpi_handle_init(const char *name,
static acpi_status __init tpacpi_acpi_handle_locate_callback(acpi_handle handle, static acpi_status __init tpacpi_acpi_handle_locate_callback(acpi_handle handle,
u32 level, void *context, void **return_value) u32 level, void *context, void **return_value)
{ {
struct acpi_device *dev;
if (!strcmp(context, "video")) { if (!strcmp(context, "video")) {
if (acpi_bus_get_device(handle, &dev)) struct acpi_device *dev = acpi_fetch_acpi_dev(handle);
return AE_OK;
if (strcmp(ACPI_VIDEO_HID, acpi_device_hid(dev))) if (!dev || strcmp(ACPI_VIDEO_HID, acpi_device_hid(dev)))
return AE_OK; return AE_OK;
} }
...@@ -786,7 +785,6 @@ static void dispatch_acpi_notify(acpi_handle handle, u32 event, void *data) ...@@ -786,7 +785,6 @@ static void dispatch_acpi_notify(acpi_handle handle, u32 event, void *data)
static int __init setup_acpi_notify(struct ibm_struct *ibm) static int __init setup_acpi_notify(struct ibm_struct *ibm)
{ {
acpi_status status; acpi_status status;
int rc;
BUG_ON(!ibm->acpi); BUG_ON(!ibm->acpi);
...@@ -796,9 +794,9 @@ static int __init setup_acpi_notify(struct ibm_struct *ibm) ...@@ -796,9 +794,9 @@ static int __init setup_acpi_notify(struct ibm_struct *ibm)
vdbg_printk(TPACPI_DBG_INIT, vdbg_printk(TPACPI_DBG_INIT,
"setting up ACPI notify for %s\n", ibm->name); "setting up ACPI notify for %s\n", ibm->name);
rc = acpi_bus_get_device(*ibm->acpi->handle, &ibm->acpi->device); ibm->acpi->device = acpi_fetch_acpi_dev(*ibm->acpi->handle);
if (rc < 0) { if (!ibm->acpi->device) {
pr_err("acpi_bus_get_device(%s) failed: %d\n", ibm->name, rc); pr_err("acpi_fetch_acpi_dev(%s) failed\n", ibm->name);
return -ENODEV; return -ENODEV;
} }
...@@ -6723,7 +6721,8 @@ static int __init tpacpi_query_bcl_levels(acpi_handle handle) ...@@ -6723,7 +6721,8 @@ static int __init tpacpi_query_bcl_levels(acpi_handle handle)
struct acpi_device *device, *child; struct acpi_device *device, *child;
int rc; int rc;
if (acpi_bus_get_device(handle, &device)) device = acpi_fetch_acpi_dev(handle);
if (!device)
return 0; return 0;
rc = 0; rc = 0;
......
...@@ -105,7 +105,7 @@ static int x86_acpi_irq_helper_get(const struct x86_acpi_irq_data *data) ...@@ -105,7 +105,7 @@ static int x86_acpi_irq_helper_get(const struct x86_acpi_irq_data *data)
return -ENODEV; return -ENODEV;
} }
acpi_bus_get_device(handle, &adev); adev = acpi_fetch_acpi_dev(handle);
if (!adev) { if (!adev) {
pr_err("error could not get %s adev\n", data->chip); pr_err("error could not get %s adev\n", data->chip);
return -ENODEV; return -ENODEV;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment