Skip to content

Commit

Permalink
backport: fix EXPORT_SYMBOL_NS_GPL() with Linux 6.13
Browse files Browse the repository at this point in the history
The macro EXPORT_SYMBOL_NS_GPL() no longer stringifies its argument
since commit cdd30ebb1b9f ("module: Convert symbol namespace to
string literal"), which must now be done by the caller.

Fixes: 7613542 ("backport: Add definitions for module namespace")
Signed-off-by: Peter Colberg <[email protected]>
  • Loading branch information
pcolberg committed Dec 9, 2024
1 parent 34c87ca commit 0c9b649
Show file tree
Hide file tree
Showing 2 changed files with 28 additions and 6 deletions.
10 changes: 5 additions & 5 deletions drivers/mfd/intel-m10-bmc-core.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ void m10bmc_fw_state_set(struct intel_m10bmc *m10bmc, enum m10bmc_fw_state new_s
m10bmc->bmcfw_state = new_state;
up_write(&m10bmc->bmcfw_lock);
}
EXPORT_SYMBOL_NS_GPL(m10bmc_fw_state_set, INTEL_M10_BMC_CORE);
EXPORT_SYMBOL_NS_GPL(m10bmc_fw_state_set, "INTEL_M10_BMC_CORE");

/*
* For some Intel FPGA devices, the BMC firmware is not available to service
Expand Down Expand Up @@ -76,7 +76,7 @@ int m10bmc_sys_read(struct intel_m10bmc *m10bmc, unsigned int offset, unsigned i

return ret;
}
EXPORT_SYMBOL_NS_GPL(m10bmc_sys_read, INTEL_M10_BMC_CORE);
EXPORT_SYMBOL_NS_GPL(m10bmc_sys_read, "INTEL_M10_BMC_CORE");

int m10bmc_sys_update_bits(struct intel_m10bmc *m10bmc, unsigned int offset,
unsigned int msk, unsigned int val)
Expand All @@ -96,7 +96,7 @@ int m10bmc_sys_update_bits(struct intel_m10bmc *m10bmc, unsigned int offset,

return ret;
}
EXPORT_SYMBOL_NS_GPL(m10bmc_sys_update_bits, INTEL_M10_BMC_CORE);
EXPORT_SYMBOL_NS_GPL(m10bmc_sys_update_bits, "INTEL_M10_BMC_CORE");

static ssize_t bmc_version_show(struct device *dev,
struct device_attribute *attr, char *buf)
Expand Down Expand Up @@ -184,7 +184,7 @@ const struct attribute_group *m10bmc_dev_groups[] = {
&m10bmc_group,
NULL,
};
EXPORT_SYMBOL_NS_GPL(m10bmc_dev_groups, INTEL_M10_BMC_CORE);
EXPORT_SYMBOL_NS_GPL(m10bmc_dev_groups, "INTEL_M10_BMC_CORE");

int m10bmc_dev_init(struct intel_m10bmc *m10bmc, const struct intel_m10bmc_platform_info *info)
{
Expand All @@ -202,7 +202,7 @@ int m10bmc_dev_init(struct intel_m10bmc *m10bmc, const struct intel_m10bmc_platf

return ret;
}
EXPORT_SYMBOL_NS_GPL(m10bmc_dev_init, INTEL_M10_BMC_CORE);
EXPORT_SYMBOL_NS_GPL(m10bmc_dev_init, "INTEL_M10_BMC_CORE");

MODULE_DESCRIPTION("Intel MAX 10 BMC core driver");
MODULE_AUTHOR("Intel Corporation");
Expand Down
24 changes: 23 additions & 1 deletion include/linux/export.h
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,30 @@
#include <linux/version.h>
#include_next <linux/export.h>

#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0) && RHEL_RELEASE_CODE < 0x900
#if LINUX_VERSION_CODE < KERNEL_VERSION(5, 4, 0)
#define EXPORT_SYMBOL_NS_GPL(sym, ns) EXPORT_SYMBOL_GPL(sym)
#elif LINUX_VERSION_CODE < KERNEL_VERSION(5, 5, 0)
/* The macro EXPORT_SYMBOL_NS_GPL() called __EXPORT_SYMBOL_NS()
* before commit c3a6cf19e695 ("export: avoid code duplication in
* include/linux/export.h"), which merged __EXPORT_SYMBOL_NS()
* into __EXPORT_SYMBOL().
*/
#undef EXPORT_SYMBOL_NS_GPL
#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL_NS(sym, "_gpl", ns)
#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 4, 0) && RHEL_RELEASE_CODE < 0x905
/* The macro EXPORT_SYMBOL_NS_GPL() passed the license string "_gpl"
* to __EXPORT_SYMBOL() before commit ddb5cdbafaaa ("kbuild: generate
* KSYMTAB entries by modpost"), after which it passes "GPL" instead.
*/
#undef EXPORT_SYMBOL_NS_GPL
#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "_gpl", ns)
#elif LINUX_VERSION_CODE < KERNEL_VERSION(6, 13, 0)
/* The macro EXPORT_SYMBOL_NS_GPL() no longer stringifies its argument
* since commit cdd30ebb1b9f ("module: Convert symbol namespace to
* string literal"), which must now be done by the caller.
*/
#undef EXPORT_SYMBOL_NS_GPL
#define EXPORT_SYMBOL_NS_GPL(sym, ns) __EXPORT_SYMBOL(sym, "GPL", ns)
#endif

#endif

0 comments on commit 0c9b649

Please sign in to comment.