[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <b1787919-77d3-41da-9ebb-cecc65d2d310@app.fastmail.com>
Date: Mon, 02 Sep 2024 08:31:08 +0000
From: "Arnd Bergmann" <arnd@...db.de>
To: "Jens Wiklander" <jens.wiklander@...aro.org>,
linux-kernel@...r.kernel.org, "Ulf Hansson" <ulf.hansson@...aro.org>
Cc: "Linus Walleij" <linus.walleij@...aro.org>,
"Greg Kroah-Hartman" <gregkh@...uxfoundation.org>,
"kernel test robot" <lkp@...el.com>
Subject: Re: [PATCH] rpmb: use IS_REACHABLE instead of IS_ENABLED
On Mon, Sep 2, 2024, at 08:07, Jens Wiklander wrote:
> Use the macro IS_REACHABLE instead of IS_ENABLED in <linux/rpmb.h> when
> deciding if prototypes or stubbed static inline functions should be
> provided. This fixes link errors when the calling code is builtin while
> the RPMB subsystem is a module.
>
> Reported-by: kernel test robot <lkp@...el.com>
> Closes:
> https://lore.kernel.org/oe-kbuild-all/202409021448.RSvcBPzt-lkp@intel.com/
> Fixes: 1e9046e3a154 ("rpmb: add Replay Protected Memory Block (RPMB)
> subsystem")
> Signed-off-by: Jens Wiklander <jens.wiklander@...aro.org>
Please don't work around a bug like this, fix it properly instead.
> diff --git a/include/linux/rpmb.h b/include/linux/rpmb.h
> index cccda73eea4d..37b5273c4027 100644
> --- a/include/linux/rpmb.h
> +++ b/include/linux/rpmb.h
> @@ -61,7 +61,7 @@ struct rpmb_dev {
>
> #define to_rpmb_dev(x) container_of((x), struct rpmb_dev, dev)
>
> -#if IS_ENABLED(CONFIG_RPMB)
> +#if IS_REACHABLE(CONFIG_RPMB)
> struct rpmb_dev *rpmb_dev_get(struct rpmb_dev *rdev);
> void rpmb_dev_put(struct rpmb_dev *rdev);
This gives very unexpected runtime behavior where both RPMB and
its user are enabled, but it doesn't work.
I think what you want here is a dependency like
depends on RPMB || !RPMB
for every caller. This enforces at build time that the MMC core can
be built either when RPMB is disabled, of when it is reachable.
Arnd
Powered by blists - more mailing lists