From 98f5c14c2a08be9bae91c471936733bdffeae754 Mon Sep 17 00:00:00 2001 From: Nuno Sa Date: Fri, 14 Jun 2024 15:55:14 +0200 Subject: [PATCH] jesd204: core: support module compilation Two things that need to be fixed in order to have jesd204 core compiled as module (or allow users to be compiled as modules). 1) We need to properly export jesd204_printk() as it's being used by other drives/modules. 2) We also need to use IS_ENABLED() instead of defined(CONFIG_JESD204) since IS_ENABLED() will evaluates to y if the config option is set to y or m. Fixes: 2b1927d4f080 ("jesd204: check if CONFIG_JESD204 is defined") Fixes: 90be5cce1243 ("jesd204: core: add printk helpers") Signed-off-by: Nuno Sa --- drivers/jesd204/jesd204-core.c | 1 + include/linux/jesd204/jesd204.h | 5 +++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/jesd204/jesd204-core.c b/drivers/jesd204/jesd204-core.c index 218961319ed68a..b030752c94af4f 100644 --- a/drivers/jesd204/jesd204-core.c +++ b/drivers/jesd204/jesd204-core.c @@ -627,6 +627,7 @@ void jesd204_printk(const char *level, const struct jesd204_dev *jdev, va_end(args); } +EXPORT_SYMBOL_GPL(jesd204_printk); static int jesd204_dev_alloc_links(struct jesd204_dev_top *jdev_top) { diff --git a/include/linux/jesd204/jesd204.h b/include/linux/jesd204/jesd204.h index b24c1a8a1b0764..698011feac44cc 100644 --- a/include/linux/jesd204/jesd204.h +++ b/include/linux/jesd204/jesd204.h @@ -7,6 +7,7 @@ #ifndef _JESD204_H_ #define _JESD204_H_ +#include #include #include @@ -249,7 +250,7 @@ struct jesd204_dev_data { struct jesd204_state_op state_ops[__JESD204_MAX_OPS]; }; -#ifdef CONFIG_JESD204 +#if IS_ENABLED(CONFIG_JESD204) struct jesd204_dev *devm_jesd204_dev_register(struct device *dev, const struct jesd204_dev_data *i); @@ -400,7 +401,7 @@ static inline void jesd204_copy_link_params(struct jesd204_link *dst, #endif /* #ifdef CONFIG_JESD204 */ -#if defined(CONFIG_PRINTK) && defined(CONFIG_JESD204) +#if defined(CONFIG_PRINTK) && IS_ENABLED(CONFIG_JESD204) __printf(3, 4) void jesd204_printk(const char *level, const struct jesd204_dev *jdev,