@@ -245,26 +245,3 @@ const void *of_device_get_match_data(const struct device *dev)
return match->data;
}
EXPORT_SYMBOL(of_device_get_match_data);
-
-int of_device_uevent_modalias(const struct device *dev, struct kobj_uevent_env *env)
-{
- int sl;
-
- if ((!dev) || (!dev->of_node) || dev->of_node_reused)
- return -ENODEV;
-
- /* Devicetree modalias is tricky, we add it in 2 steps */
- if (add_uevent_var(env, "MODALIAS="))
- return -ENOMEM;
-
- sl = of_modalias(dev->of_node, &env->buf[env->buflen-1],
- sizeof(env->buf) - env->buflen);
- if (sl < 0)
- return sl;
- if (sl >= (sizeof(env->buf) - env->buflen))
- return -ENOMEM;
- env->buflen += sl;
-
- return 0;
-}
-EXPORT_SYMBOL_GPL(of_device_uevent_modalias);
@@ -132,3 +132,24 @@ int of_uevent(struct device_node *np, struct kobj_uevent_env *env)
return 0;
}
+
+int of_uevent_modalias(const struct device_node *np, struct kobj_uevent_env *env)
+{
+ int sl;
+
+ if (!np)
+ return -ENODEV;
+
+ /* Devicetree modalias is tricky, we add it in 2 steps */
+ if (add_uevent_var(env, "MODALIAS="))
+ return -ENOMEM;
+
+ sl = of_modalias(np, &env->buf[env->buflen-1],
+ sizeof(env->buf) - env->buflen);
+ if (sl >= (sizeof(env->buf) - env->buflen))
+ return -ENOMEM;
+ env->buflen += sl;
+
+ return 0;
+}
+EXPORT_SYMBOL_GPL(of_uevent_modalias);
@@ -389,6 +389,7 @@ extern ssize_t of_printable_modalias(const struct device_node *np, char *str,
ssize_t len);
extern int of_request_module(const struct device_node *np);
extern int of_uevent(struct device_node *np, struct kobj_uevent_env *env);
+extern int of_uevent_modalias(const struct device_node *np, struct kobj_uevent_env *env);
/* phandle iterator functions */
extern int of_phandle_iterator_init(struct of_phandle_iterator *it,
@@ -777,6 +778,12 @@ static inline int of_uevent(struct device_node *np, struct kobj_uevent_env *env)
return -ENODEV;
}
+static inline int of_uevent_modalias(const struct device_node *np,
+ struct kobj_uevent_env *env)
+{
+ return -ENODEV;
+}
+
static inline int of_phandle_iterator_init(struct of_phandle_iterator *it,
const struct device_node *np,
const char *list_name,
@@ -44,7 +44,14 @@ static inline int of_device_uevent(const struct device *dev,
return of_uevent(dev->of_node, env);
}
-extern int of_device_uevent_modalias(const struct device *dev, struct kobj_uevent_env *env);
+static inline int of_device_uevent_modalias(const struct device *dev,
+ struct kobj_uevent_env *env)
+{
+ if (!dev || !dev->of_node || dev->of_node_reused)
+ return -ENODEV;
+
+ return of_uevent_modalias(dev->of_node, env);
+}
int of_dma_configure_id(struct device *dev,
struct device_node *np,
Let's move the logic of the former helper into module.c and use it from an inline helper located under of_device.c. This way there is no change for users while the logic gets moved to an OF-only file. Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com> --- drivers/of/device.c | 23 ----------------------- drivers/of/module.c | 21 +++++++++++++++++++++ include/linux/of.h | 7 +++++++ include/linux/of_device.h | 9 ++++++++- 4 files changed, 36 insertions(+), 24 deletions(-)