From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Sakari Ailus <sakari.ailus@linux.intel.com>,
Mauro Carvalho Chehab <mchehab@kernel.org>,
Nathan Chancellor <nathan@kernel.org>,
Jacopo Mondi <jacopo.mondi@ideasonboard.com>,
Hans Verkuil <hverkuil-cisco@xs4all.nl>,
Arnd Bergmann <arnd@arndb.de>,
Nick Desaulniers <ndesaulniers@google.com>,
Bill Wendling <morbo@google.com>,
Justin Stitt <justinstitt@google.com>,
Tomi Valkeinen <tomi.valkeinen@ideasonboard.com>,
Shuah Khan <skhan@linuxfoundation.org>,
linux-media@vger.kernel.org, linux-kernel@vger.kernel.org,
llvm@lists.linux.dev
Subject: Re: [PATCH] [v2] media: i2c: mt9m114: use fsleep() in place of udelay()
Date: Wed, 13 Dec 2023 13:36:45 +0200 [thread overview]
Message-ID: <20231213113645.GA769@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20231213112322.1655236-1-arnd@kernel.org>
Hi Arnd,
Thank you for the patch.
On Wed, Dec 13, 2023 at 12:23:07PM +0100, Arnd Bergmann wrote:
> From: Arnd Bergmann <arnd@arndb.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@linux.intel.com>
> Fixes: 24d756e914fc ("media: i2c: Add driver for onsemi MT9M114 camera sensor")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> ---
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.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
next prev parent reply other threads:[~2023-12-13 11:36 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-13 11:23 [PATCH] [v2] media: i2c: mt9m114: use fsleep() in place of udelay() Arnd Bergmann
2023-12-13 11:36 ` Laurent Pinchart [this message]
2023-12-13 11:40 ` Tomi Valkeinen
2023-12-13 11:48 ` Laurent Pinchart
2023-12-13 11:56 ` Tomi Valkeinen
2023-12-13 12:09 ` Laurent Pinchart
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231213113645.GA769@pendragon.ideasonboard.com \
--to=laurent.pinchart@ideasonboard.com \
--cc=arnd@arndb.de \
--cc=arnd@kernel.org \
--cc=hverkuil-cisco@xs4all.nl \
--cc=jacopo.mondi@ideasonboard.com \
--cc=justinstitt@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=llvm@lists.linux.dev \
--cc=mchehab@kernel.org \
--cc=morbo@google.com \
--cc=nathan@kernel.org \
--cc=ndesaulniers@google.com \
--cc=sakari.ailus@linux.intel.com \
--cc=skhan@linuxfoundation.org \
--cc=tomi.valkeinen@ideasonboard.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox