[PATCH] [v2] nvme: keyring: fix conditional compilation
Arnd Bergmann
arnd at arndb.de
Wed Oct 25 00:36:23 PDT 2023
On Wed, Oct 25, 2023, at 09:02, Hannes Reinecke wrote:
> On 10/20/23 22:54, Arnd Bergmann wrote:
oid)
>> +
>> +static inline key_serial_t nvme_target_keyring_id(void)
>> {
>> + if (IS_ENABLED(CONFIG_NVME_TARGET_TCP_TLS))
>> + return nvme_keyring_id();
>> +
>> return 0;
>> }
>> -static inline int nvme_keyring_init(void)
>> +
>> +static inline int nvme_target_keyring_init(void)
>> {
>> + if (IS_ENABLED(CONFIG_NVME_TCP_TLS))
>> + return nvme_keyring_init();
>> +
>> return 0;
>> }
>> -static inline void nvme_keyring_exit(void) {}
>>
>> -#endif /* !CONFIG_NVME_KEYRING */
>> +static inline void nvme_target_keyring_exit(void)
>> +{
>> + if (IS_ENABLED(CONFIG_NVME_TARGET_TCP_TLS))
>> + nvme_keyring_exit();
>> +}
>> +
>> #endif /* _NVME_KEYRING_H */
>
> I guess the right way is to make 'keyring' a 'real' module, and move
> 'nvme_keyring_init()' and 'nvme_keyring_exit()' as the modules init/exit
> functions. I'll prepare a patch.
That's probably a good idea, but you still need to address
the link failure for nvme_keyring_id() and nvme_tls_psk_default()
when the caller is built-in and the definition is in a loadable
module.
Arnd
More information about the Linux-nvme
mailing list