lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 8 Dec 2020 09:39:57 -0800
From:   Randy Dunlap <rdunlap@...radead.org>
To:     Paul Cercueil <paul@...pouillou.net>,
        Linus Walleij <linus.walleij@...aro.org>
Cc:     Arnd Bergmann <arnd@...nel.org>, od@...c.me,
        linux-arm-kernel@...ts.infradead.org, linux-mips@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/2] if_enabled.h: Add IF_ENABLED_OR_ELSE() and
 IF_ENABLED() macros

On 12/8/20 8:48 AM, Paul Cercueil wrote:
> 
> Signed-off-by: Paul Cercueil <paul@...pouillou.net>

Hi Paul,

Why not just add these 2 new macros to <linux/kconfig.h> ?

Maybe you don't want to add the other 2 headers there also?

> ---
>  include/linux/if_enabled.h | 22 ++++++++++++++++++++++
>  1 file changed, 22 insertions(+)
>  create mode 100644 include/linux/if_enabled.h
> 
> diff --git a/include/linux/if_enabled.h b/include/linux/if_enabled.h
> new file mode 100644
> index 000000000000..8189d1402340
> --- /dev/null
> +++ b/include/linux/if_enabled.h
> @@ -0,0 +1,22 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +#ifndef __LINUX_IF_ENABLED_H
> +#define __LINUX_IF_ENABLED_H
> +
> +#include <linux/build_bug.h>
> +#include <linux/compiler_types.h>
> +#include <linux/kconfig.h>
> +
> +/*
> + * IF_ENABLED_OR_ELSE(CONFIG_FOO, a, b) evaluates to (a) if CONFIG_FOO is set
> + * to 'y' or 'm', (b) otherwise.
> + */
> +#define IF_ENABLED_OR_ELSE(option, a, b) \
> +	(BUILD_BUG_ON_ZERO(__same_type((a), (b))) || IS_ENABLED(option) ? (a) : (b))
> +
> +/*
> + * IF_ENABLED(CONFIG_FOO, ptr) evaluates to (ptr) if CONFIG_FOO is set to 'y'
> + * or 'm', NULL otherwise.
> + */
> +#define IF_ENABLED(option, ptr) IF_ENABLED_OR_ELSE(option, ptr, NULL)
> +
> +#endif /* __LINUX_IF_ENABLED_H */
> 


thanks.
-- 
~Randy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ