hc
2023-12-11 d2ccde1c8e90d38cee87a1b0309ad2827f3fd30d
kernel/drivers/acpi/glue.c
....@@ -1,10 +1,9 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Link physical devices with ACPI devices support
34 *
45 * Copyright (c) 2005 David Shaohua Li <shaohua.li@intel.com>
56 * Copyright (c) 2005 Intel Corp.
6
- *
7
- * This file is released under the GPLv2.
87 */
98
109 #include <linux/acpi_iort.h>
....@@ -296,7 +295,7 @@
296295 }
297296 EXPORT_SYMBOL_GPL(acpi_unbind_one);
298297
299
-static int acpi_platform_notify(struct device *dev)
298
+static int acpi_device_notify(struct device *dev)
300299 {
301300 struct acpi_bus_type *type = acpi_get_bus_type(dev);
302301 struct acpi_device *adev;
....@@ -320,7 +319,7 @@
320319 if (!adev)
321320 goto out;
322321
323
- if (dev->bus == &platform_bus_type)
322
+ if (dev_is_platform(dev))
324323 acpi_configure_pmsi_domain(dev);
325324
326325 if (type && type->setup)
....@@ -343,7 +342,7 @@
343342 return ret;
344343 }
345344
346
-static int acpi_platform_notify_remove(struct device *dev)
345
+static int acpi_device_notify_remove(struct device *dev)
347346 {
348347 struct acpi_device *adev = ACPI_COMPANION(dev);
349348 struct acpi_bus_type *type;
....@@ -361,12 +360,17 @@
361360 return 0;
362361 }
363362
364
-void __init init_acpi_device_notify(void)
363
+int acpi_platform_notify(struct device *dev, enum kobject_action action)
365364 {
366
- if (platform_notify || platform_notify_remove) {
367
- printk(KERN_ERR PREFIX "Can't use platform_notify\n");
368
- return;
365
+ switch (action) {
366
+ case KOBJ_ADD:
367
+ acpi_device_notify(dev);
368
+ break;
369
+ case KOBJ_REMOVE:
370
+ acpi_device_notify_remove(dev);
371
+ break;
372
+ default:
373
+ break;
369374 }
370
- platform_notify = acpi_platform_notify;
371
- platform_notify_remove = acpi_platform_notify_remove;
375
+ return 0;
372376 }