[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231213113645.GA769@pendragon.ideasonboard.com>
Date: Wed, 13 Dec 2023 13:36:45 +0200
From: Laurent Pinchart <laurent.pinchart@...asonboard.com>
To: Arnd Bergmann <arnd@...nel.org>
Cc: Sakari Ailus <sakari.ailus@...ux.intel.com>,
Mauro Carvalho Chehab <mchehab@...nel.org>,
Nathan Chancellor <nathan@...nel.org>,
Jacopo Mondi <jacopo.mondi@...asonboard.com>,
Hans Verkuil <hverkuil-cisco@...all.nl>,
Arnd Bergmann <arnd@...db.de>,
Nick Desaulniers <ndesaulniers@...gle.com>,
Bill Wendling <morbo@...gle.com>,
Justin Stitt <justinstitt@...gle.com>,
Tomi Valkeinen <tomi.valkeinen@...asonboard.com>,
Shuah Khan <skhan@...uxfoundation.org>,
linux-media@...r.kernel.org, linux-kernel@...r.kernel.org,
llvm@...ts.linux.dev
Subject: Re: [PATCH] [v2] media: i2c: mt9m114: use fsleep() in place of
udelay()
Hi Arnd,
Thank you for the patch.
On Wed, Dec 13, 2023 at 12:23:07PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@...db.de>
>
> With clang-16, building without COMMON_CLK triggers a range check on
> udelay() because of a constant division-by-zero calculation:
>
> ld.lld: error: undefined symbol: __bad_udelay
> >>> referenced by mt9m114.c
> >>> drivers/media/i2c/mt9m114.o:(mt9m114_power_on) in archive vmlinux.a
>
> In this configuration, the driver already fails to probe, before
> this function gets called, so it's enough to suppress the assertion.
>
> Do this by using fsleep(), which turns long delays into sleep() calls
> in place of the link failure.
>
> This is probably a good idea regardless to avoid overly long dynamic
> udelay() calls on a slow clock.
The longest delay would be 16.66µs, which may not be worth a sleep, but
I think that's fine. Using fsleep() by default is a good idea.
> Cc: Sakari Ailus <sakari.ailus@...ux.intel.com>
> Fixes: 24d756e914fc ("media: i2c: Add driver for onsemi MT9M114 camera sensor")
> Signed-off-by: Arnd Bergmann <arnd@...db.de>
> ---
Reviewed-by: Laurent Pinchart <laurent.pinchart@...asonboard.com>
> drivers/media/i2c/mt9m114.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/media/i2c/mt9m114.c b/drivers/media/i2c/mt9m114.c
> index 0a22f328981d..68adaecaf481 100644
> --- a/drivers/media/i2c/mt9m114.c
> +++ b/drivers/media/i2c/mt9m114.c
> @@ -2116,7 +2116,7 @@ static int mt9m114_power_on(struct mt9m114 *sensor)
> duration = DIV_ROUND_UP(2 * 50 * 1000000, freq);
>
> gpiod_set_value(sensor->reset, 1);
> - udelay(duration);
> + fsleep(duration);
> gpiod_set_value(sensor->reset, 0);
> } else {
> /*
--
Regards,
Laurent Pinchart
Powered by blists - more mailing lists