nvme: common: make keyring and auth separate modules
authorArnd Bergmann <arnd@arndb.de>
Thu, 26 Oct 2023 13:08:03 +0000 (15:08 +0200)
committerKeith Busch <kbusch@kernel.org>
Tue, 7 Nov 2023 18:05:15 +0000 (10:05 -0800)
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>
drivers/nvme/Makefile
drivers/nvme/common/Kconfig
drivers/nvme/common/Makefile
drivers/nvme/common/keyring.c
drivers/nvme/host/Kconfig
drivers/nvme/target/Kconfig
include/linux/nvme-keyring.h

index eedca8c720983cfdd0a8e1b21b36b3688744c940..74f59ceed3d5aed9930b559fbc45c6fec286b4be 100644 (file)
@@ -1,5 +1,5 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-obj-$(CONFIG_NVME_COMMON)              += common/
+obj-y          += common/
 obj-y          += host/
 obj-y          += target/
index 06c8df00d1e21450e180c3edcec170d05d81b0c4..244432e0b73d8e9df71ba8e717ee3315ac3e78eb 100644 (file)
@@ -1,14 +1,11 @@
 # SPDX-License-Identifier: GPL-2.0-only
 
-config NVME_COMMON
-       tristate
-
 config NVME_KEYRING
-       bool
+       tristate
        select KEYS
 
 config NVME_AUTH
-       bool
+       tristate
        select CRYPTO
        select CRYPTO_HMAC
        select CRYPTO_SHA256
index 0cbd0b0b8d499864ae65db2b0406a6b6cfde5ec8..681514cf2e2f50649f690e8b5d9fc135457f58ab 100644 (file)
@@ -2,7 +2,8 @@
 
 ccflags-y                      += -I$(src)
 
-obj-$(CONFIG_NVME_COMMON)      += nvme-common.o
+obj-$(CONFIG_NVME_AUTH)                += nvme-auth.o
+obj-$(CONFIG_NVME_KEYRING)     += nvme-keyring.o
 
-nvme-common-$(CONFIG_NVME_AUTH)        += auth.o
-nvme-common-$(CONFIG_NVME_KEYRING) += keyring.o
+nvme-auth-y                    += auth.o
+nvme-keyring-y                 += keyring.o
index f8d9a208397b4d580cac4398b7edb0b22f6fe77d..46d7a537dbc2eace5cde12f414b095c6c64a86d7 100644 (file)
@@ -180,3 +180,5 @@ void nvme_keyring_exit(void)
        key_put(nvme_keyring);
 }
 EXPORT_SYMBOL_GPL(nvme_keyring_exit);
+
+MODULE_LICENSE("GPL v2");
index 48f7d72de5e9a5d2d2861e6835640d0176736517..8fe2dd619e80eb4b3f45b85e940397e1f2ae6cca 100644 (file)
@@ -95,7 +95,6 @@ config NVME_TCP
 config NVME_TCP_TLS
        bool "NVMe over Fabrics TCP TLS encryption support"
        depends on NVME_TCP
-       select NVME_COMMON
        select NVME_KEYRING
        select NET_HANDSHAKE
        select KEYS
@@ -110,7 +109,6 @@ config NVME_TCP_TLS
 config NVME_HOST_AUTH
        bool "NVM Express over Fabrics In-Band Authentication"
        depends on NVME_CORE
-       select NVME_COMMON
        select NVME_AUTH
        help
          This provides support for NVMe over Fabrics In-Band Authentication.
index fa479c9f5c3d3237939ac01a2aa65128abdc0599..31633da9427c7f54958ecb0eb514f3df20600cb3 100644 (file)
@@ -87,7 +87,6 @@ config NVME_TARGET_TCP
 config NVME_TARGET_TCP_TLS
        bool "NVMe over Fabrics TCP target TLS encryption support"
        depends on NVME_TARGET_TCP
-       select NVME_COMMON
        select NVME_KEYRING
        select NET_HANDSHAKE
        select KEYS
@@ -102,7 +101,6 @@ config NVME_TARGET_TCP_TLS
 config NVME_TARGET_AUTH
        bool "NVMe over Fabrics In-band Authentication support"
        depends on NVME_TARGET
-       select NVME_COMMON
        select NVME_AUTH
        help
          This enables support for NVMe over Fabrics In-band Authentication
index 4efea9dd967c1bd7c58e7d84d073784159936bdb..6cc0696625f36181fb1d9a271a67cb2f9cdb6376 100644 (file)
@@ -6,7 +6,7 @@
 #ifndef _NVME_KEYRING_H
 #define _NVME_KEYRING_H
 
-#ifdef CONFIG_NVME_KEYRING
+#if IS_ENABLED(CONFIG_NVME_KEYRING)
 
 key_serial_t nvme_tls_psk_default(struct key *keyring,
                const char *hostnqn, const char *subnqn);