Skip to content

Commit ad8d1e3

Browse files
KunWuChanRussell King (Oracle)
authored andcommitted
ARM: 9415/1: amba: Add dev_is_amba() function and export it for modules
Add dev_is_amba() function to determine whether the device is a AMBA device. Suggested-by: Andy Shevchenko <[email protected]> Signed-off-by: Kunwu Chan <[email protected]> Signed-off-by: Russell King (Oracle) <[email protected]>
1 parent 9852d85 commit ad8d1e3

File tree

2 files changed

+11
-0
lines changed

2 files changed

+11
-0
lines changed

drivers/amba/bus.c

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -449,6 +449,12 @@ const struct bus_type amba_bustype = {
449449
};
450450
EXPORT_SYMBOL_GPL(amba_bustype);
451451

452+
bool dev_is_amba(const struct device *dev)
453+
{
454+
return dev->bus == &amba_bustype;
455+
}
456+
EXPORT_SYMBOL_GPL(dev_is_amba);
457+
452458
static int __init amba_init(void)
453459
{
454460
return bus_register(&amba_bustype);

include/linux/amba/bus.h

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -121,6 +121,7 @@ extern const struct bus_type amba_bustype;
121121
#ifdef CONFIG_ARM_AMBA
122122
int __amba_driver_register(struct amba_driver *, struct module *);
123123
void amba_driver_unregister(struct amba_driver *);
124+
bool dev_is_amba(const struct device *dev);
124125
#else
125126
static inline int __amba_driver_register(struct amba_driver *drv,
126127
struct module *owner)
@@ -130,6 +131,10 @@ static inline int __amba_driver_register(struct amba_driver *drv,
130131
static inline void amba_driver_unregister(struct amba_driver *drv)
131132
{
132133
}
134+
static inline bool dev_is_amba(const struct device *dev)
135+
{
136+
return false;
137+
}
133138
#endif
134139

135140
struct amba_device *amba_device_alloc(const char *, resource_size_t, size_t);

0 commit comments

Comments
 (0)