From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C9ECB24201 for ; Wed, 13 Dec 2023 11:36:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ideasonboard.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="UuCFT1Qn" Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DD41C4A9; Wed, 13 Dec 2023 12:35:52 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1702467353; bh=9SNuEfZLlJT5AlsFvY/gtkXYHwYDbd5a9YwB+YSaGK4=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=UuCFT1Qn6ZcuX8C+fg9wEvsrlUcfxqKRi1w/w7U9dekr+A7lF7FLZeoS9BruSD5n7 D61gHByMqeLufQirxT+zx9UCeCJQBFxplnqUjpVYfqIGIGZduH4yaEAySfHKmBQfTj N/4k9OeHCrO8Sx5Bt6cCK1Dpr5IBr4uC2juouIUw= Date: Wed, 13 Dec 2023 13:36:45 +0200 From: Laurent Pinchart To: Arnd Bergmann Cc: Sakari Ailus , Mauro Carvalho Chehab , Nathan Chancellor , Jacopo Mondi , Hans Verkuil , Arnd Bergmann , Nick Desaulniers , Bill Wendling , Justin Stitt , Tomi Valkeinen , Shuah Khan , 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() Message-ID: <20231213113645.GA769@pendragon.ideasonboard.com> References: <20231213112322.1655236-1-arnd@kernel.org> Precedence: bulk X-Mailing-List: llvm@lists.linux.dev List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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 > > 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 > Fixes: 24d756e914fc ("media: i2c: Add driver for onsemi MT9M114 camera sensor") > Signed-off-by: Arnd Bergmann > --- Reviewed-by: Laurent Pinchart > 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