Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

nvme: common: make keyring and auth separate modules

When only the keyring module is included but auth is not, modpost
complains about the lack of a module license tag:

ERROR: modpost: missing MODULE_LICENSE() in drivers/nvme/common/nvme-common.o

Address this by making both modules buildable standalone,
removing the now unnecessary CONFIG_NVME_COMMON symbol
in the process.

Also, now that NVME_KEYRING config symbol can be either a module or
built-in, the stubs need to check for '#if IS_ENABLED' rather than a
simple '#ifdef'.

Fixes: 9d77eb5277849 ("nvme-keyring: register '.nvme' keyring")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hannes Reinecke <hare@suse.de>
Signed-off-by: Christoph Hellwig <hch@lst.de>
Signed-off-by: Keith Busch <kbusch@kernel.org>

authored by

Arnd Bergmann and committed by
Keith Busch
6affe08a 4733b65d

+10 -14
+1 -1
drivers/nvme/Makefile
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 3 - obj-$(CONFIG_NVME_COMMON) += common/ 3 + obj-y += common/ 4 4 obj-y += host/ 5 5 obj-y += target/
+2 -5
drivers/nvme/common/Kconfig
··· 1 1 # SPDX-License-Identifier: GPL-2.0-only 2 2 3 - config NVME_COMMON 4 - tristate 5 - 6 3 config NVME_KEYRING 7 - bool 4 + tristate 8 5 select KEYS 9 6 10 7 config NVME_AUTH 11 - bool 8 + tristate 12 9 select CRYPTO 13 10 select CRYPTO_HMAC 14 11 select CRYPTO_SHA256
+4 -3
drivers/nvme/common/Makefile
··· 2 2 3 3 ccflags-y += -I$(src) 4 4 5 - obj-$(CONFIG_NVME_COMMON) += nvme-common.o 5 + obj-$(CONFIG_NVME_AUTH) += nvme-auth.o 6 + obj-$(CONFIG_NVME_KEYRING) += nvme-keyring.o 6 7 7 - nvme-common-$(CONFIG_NVME_AUTH) += auth.o 8 - nvme-common-$(CONFIG_NVME_KEYRING) += keyring.o 8 + nvme-auth-y += auth.o 9 + nvme-keyring-y += keyring.o
+2
drivers/nvme/common/keyring.c
··· 180 180 key_put(nvme_keyring); 181 181 } 182 182 EXPORT_SYMBOL_GPL(nvme_keyring_exit); 183 + 184 + MODULE_LICENSE("GPL v2");
-2
drivers/nvme/host/Kconfig
··· 95 95 config NVME_TCP_TLS 96 96 bool "NVMe over Fabrics TCP TLS encryption support" 97 97 depends on NVME_TCP 98 - select NVME_COMMON 99 98 select NVME_KEYRING 100 99 select NET_HANDSHAKE 101 100 select KEYS ··· 109 110 config NVME_HOST_AUTH 110 111 bool "NVM Express over Fabrics In-Band Authentication" 111 112 depends on NVME_CORE 112 - select NVME_COMMON 113 113 select NVME_AUTH 114 114 help 115 115 This provides support for NVMe over Fabrics In-Band Authentication.
-2
drivers/nvme/target/Kconfig
··· 87 87 config NVME_TARGET_TCP_TLS 88 88 bool "NVMe over Fabrics TCP target TLS encryption support" 89 89 depends on NVME_TARGET_TCP 90 - select NVME_COMMON 91 90 select NVME_KEYRING 92 91 select NET_HANDSHAKE 93 92 select KEYS ··· 101 102 config NVME_TARGET_AUTH 102 103 bool "NVMe over Fabrics In-band Authentication support" 103 104 depends on NVME_TARGET 104 - select NVME_COMMON 105 105 select NVME_AUTH 106 106 help 107 107 This enables support for NVMe over Fabrics In-band Authentication
+1 -1
include/linux/nvme-keyring.h
··· 6 6 #ifndef _NVME_KEYRING_H 7 7 #define _NVME_KEYRING_H 8 8 9 - #ifdef CONFIG_NVME_KEYRING 9 + #if IS_ENABLED(CONFIG_NVME_KEYRING) 10 10 11 11 key_serial_t nvme_tls_psk_default(struct key *keyring, 12 12 const char *hostnqn, const char *subnqn);