ACPI / glue: Split dev_is_platform() out of module for wide use
authorAndy Shevchenko <andriy.shevchenko@linux.intel.com>
Mon, 20 Aug 2018 13:45:41 +0000 (16:45 +0300)
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>
Mon, 10 Sep 2018 10:48:50 +0000 (12:48 +0200)
There would be useful to have in future the similar API in platform
core, as we have, for example, for PCI subsystem, to check if device
belongs to it.

Thus, split out conditional to a macro dev_is_platform() for wide use.

No functional change intended.

Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
drivers/acpi/glue.c
include/linux/platform_device.h

index 3be1433853bfb9920a96f1cd212f052922f253a3..12ba2bee8789b3d5d562e8e0736409886f70c282 100644 (file)
@@ -320,7 +320,7 @@ static int acpi_platform_notify(struct device *dev)
        if (!adev)
                goto out;
 
-       if (dev->bus == &platform_bus_type)
+       if (dev_is_platform(dev))
                acpi_configure_pmsi_domain(dev);
 
        if (type && type->setup)
index 1a9f38f27f65649c3fe4c4ca67e7880b3e1c5e1a..c7c081dc6034e7057d69a79680e796d0f48a3831 100644 (file)
@@ -40,6 +40,7 @@ struct platform_device {
 
 #define platform_get_device_id(pdev)   ((pdev)->id_entry)
 
+#define dev_is_platform(dev) ((dev)->bus == &platform_bus_type)
 #define to_platform_device(x) container_of((x), struct platform_device, dev)
 
 extern int platform_device_register(struct platform_device *);