Files

91 lines
2.2 KiB
C
Raw Permalink Normal View History

/* SPDX-License-Identifier: GPL-2.0 */
2007-05-01 16:49:51 +10:00
#ifndef _LINUX_OF_DEVICE_H
#define _LINUX_OF_DEVICE_H
#include <linux/device/driver.h>
2007-05-01 16:49:51 +10:00
struct device;
2023-03-29 10:52:02 -05:00
struct of_device_id;
struct kobj_uevent_env;
2013-04-19 17:32:52 -05:00
#ifdef CONFIG_OF
2007-05-01 16:49:51 +10:00
extern const struct of_device_id *of_match_device(
const struct of_device_id *matches, const struct device *dev);
2007-05-01 16:49:51 +10:00
/**
* of_driver_match_device - Tell if a driver's of_match_table matches a device.
* @drv: the device_driver structure to test
* @dev: the device structure to match against
*/
static inline int of_driver_match_device(struct device *dev,
const struct device_driver *drv)
{
return of_match_device(drv->of_match_table, dev) != NULL;
}
extern ssize_t of_device_modalias(struct device *dev, char *str, ssize_t len);
2010-06-08 07:48:12 -06:00
extern void of_device_uevent(const struct device *dev, struct kobj_uevent_env *env);
extern int of_device_uevent_modalias(const struct device *dev, struct kobj_uevent_env *env);
2010-06-08 07:48:12 -06:00
int of_dma_configure_id(struct device *dev,
2018-05-03 16:25:08 +02:00
struct device_node *np,
bool force_dma, const u32 *id);
static inline int of_dma_configure(struct device *dev,
struct device_node *np,
bool force_dma)
{
return of_dma_configure_id(dev, np, force_dma, NULL);
}
2023-12-15 11:15:27 +00:00
void of_device_make_bus_id(struct device *dev);
2013-04-19 17:32:52 -05:00
#else /* CONFIG_OF */
static inline int of_driver_match_device(struct device *dev,
const struct device_driver *drv)
{
return 0;
}
static inline void of_device_uevent(const struct device *dev,
struct kobj_uevent_env *env) { }
static inline int of_device_modalias(struct device *dev,
char *str, ssize_t len)
{
return -ENODEV;
}
static inline int of_device_uevent_modalias(const struct device *dev,
struct kobj_uevent_env *env)
{
return -ENODEV;
}
static inline const struct of_device_id *of_match_device(
const struct of_device_id *matches, const struct device *dev)
{
return NULL;
}
static inline int of_dma_configure_id(struct device *dev,
struct device_node *np,
bool force_dma,
const u32 *id)
{
return 0;
}
2018-05-03 16:25:08 +02:00
static inline int of_dma_configure(struct device *dev,
struct device_node *np,
bool force_dma)
{
return 0;
}
2023-12-15 11:15:27 +00:00
static inline void of_device_make_bus_id(struct device *dev) {}
2013-04-19 17:32:52 -05:00
#endif /* CONFIG_OF */
2007-05-01 16:49:51 +10:00
#endif /* _LINUX_OF_DEVICE_H */