diff mbox series

[v1] ACPI / glue: Split dev_is_platform() out of module for wide use

Message ID 20180820134541.82270-1-andriy.shevchenko@linux.intel.com (mailing list archive)
State Accepted, archived
Delegated to: Rafael Wysocki
Headers show
Series [v1] ACPI / glue: Split dev_is_platform() out of module for wide use | expand

Commit Message

Andy Shevchenko Aug. 20, 2018, 1:45 p.m. UTC
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>
---
 drivers/acpi/glue.c             | 2 +-
 include/linux/platform_device.h | 1 +
 2 files changed, 2 insertions(+), 1 deletion(-)

Comments

Rafael J. Wysocki Sept. 14, 2018, 8:39 a.m. UTC | #1
On Monday, August 20, 2018 3:45:41 PM CEST Andy Shevchenko wrote:
> 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>
> ---
>  drivers/acpi/glue.c             | 2 +-
>  include/linux/platform_device.h | 1 +
>  2 files changed, 2 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
> index 3be1433853bf..12ba2bee8789 100644
> --- a/drivers/acpi/glue.c
> +++ b/drivers/acpi/glue.c
> @@ -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)
> diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
> index 1a9f38f27f65..c7c081dc6034 100644
> --- a/include/linux/platform_device.h
> +++ b/include/linux/platform_device.h
> @@ -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 *);
> 

Applied, thanks!
diff mbox series

Patch

diff --git a/drivers/acpi/glue.c b/drivers/acpi/glue.c
index 3be1433853bf..12ba2bee8789 100644
--- a/drivers/acpi/glue.c
+++ b/drivers/acpi/glue.c
@@ -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)
diff --git a/include/linux/platform_device.h b/include/linux/platform_device.h
index 1a9f38f27f65..c7c081dc6034 100644
--- a/include/linux/platform_device.h
+++ b/include/linux/platform_device.h
@@ -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 *);