Skip to content

Commit

Permalink
ARM: 9415/1: amba: Add dev_is_amba() function and export it for modules
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
KunWuChan authored and Russell King (Oracle) committed Nov 12, 2024
1 parent 9852d85 commit ad8d1e3
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
6 changes: 6 additions & 0 deletions drivers/amba/bus.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
5 changes: 5 additions & 0 deletions include/linux/amba/bus.h
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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);
Expand Down

0 comments on commit ad8d1e3

Please sign in to comment.