Skip to content

Commit

Permalink
jesd204: core: support module compilation
Browse files Browse the repository at this point in the history
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: 2b1927d ("jesd204: check if CONFIG_JESD204 is defined")
Fixes: 90be5cc ("jesd204: core: add printk helpers")
Signed-off-by: Nuno Sa <[email protected]>
  • Loading branch information
nunojsa committed Jun 17, 2024
1 parent a77b005 commit 98f5c14
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
1 change: 1 addition & 0 deletions drivers/jesd204/jesd204-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down
5 changes: 3 additions & 2 deletions include/linux/jesd204/jesd204.h
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
#ifndef _JESD204_H_
#define _JESD204_H_

#include <linux/kconfig.h>
#include <linux/kern_levels.h>
#include <dt-bindings/jesd204/device-states.h>

Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 98f5c14

Please sign in to comment.