]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
ARM: 9415/1: amba: Add dev_is_amba() function and export it for modules
authorKunwu Chan <chentao@kylinos.cn>
Mon, 2 Sep 2024 06:39:20 +0000 (07:39 +0100)
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Tue, 12 Nov 2024 16:41:45 +0000 (16:41 +0000)
Add dev_is_amba() function to determine
whether the device is a AMBA device.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Kunwu Chan <chentao@kylinos.cn>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
drivers/amba/bus.c
include/linux/amba/bus.h

index 0230c43377c1da23230d7fe28833f0603f55686e..8ef259b4d0378a27cccc2183e7e0cab62dae2342 100644 (file)
@@ -449,6 +449,12 @@ const struct bus_type amba_bustype = {
 };
 EXPORT_SYMBOL_GPL(amba_bustype);
 
+bool dev_is_amba(const struct device *dev)
+{
+       return dev->bus == &amba_bustype;
+}
+EXPORT_SYMBOL_GPL(dev_is_amba);
+
 static int __init amba_init(void)
 {
        return bus_register(&amba_bustype);
index dda2f3ea89cb5d7a9b2f8189c6c740b0c4b20532..9946276aff73779435fc42b7a44f0717944e3e1a 100644 (file)
@@ -121,6 +121,7 @@ extern const struct bus_type amba_bustype;
 #ifdef CONFIG_ARM_AMBA
 int __amba_driver_register(struct amba_driver *, struct module *);
 void amba_driver_unregister(struct amba_driver *);
+bool dev_is_amba(const struct device *dev);
 #else
 static inline int __amba_driver_register(struct amba_driver *drv,
                                         struct module *owner)
@@ -130,6 +131,10 @@ static inline int __amba_driver_register(struct amba_driver *drv,
 static inline void amba_driver_unregister(struct amba_driver *drv)
 {
 }
+static inline bool dev_is_amba(const struct device *dev)
+{
+       return false;
+}
 #endif
 
 struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);