From patchwork Wed Dec 13 11:23:07 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 13490738 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (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 8F61F23765; Wed, 13 Dec 2023 11:23:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="kpQtbytX" Received: by smtp.kernel.org (Postfix) with ESMTPSA id E5B3DC433C8; Wed, 13 Dec 2023 11:23:25 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1702466609; bh=dM20k1aIuurzuuEbrL9Li5fyjqQfBsAPeqrud2tbKNE=; h=From:To:Cc:Subject:Date:From; b=kpQtbytXXYBOTNSZ14250C8VyTOF1kOnoCHIm5KJngdLNB/P4RO4L1wDawKiBApHh nvlOCJZfBV/VT8307P0u/xe/hkhLnC87ehAUfYJfC+cPbckYGfuqAEbUgt0RpN5YFQ HvxEiOhmAiFNu+q32QQ7pbhzgPWEMin+xANEXcc8DQpNxOlH3brUB1B4FVt4ADx11n AXqYQC0YF7uIy/9nb/+fbe0PzS6yDurdvg7S0YHWomyg1UL89AQlqUKnCnGT7lnfko uZq0aV49rVfyFQew3RK+Nt5FEex8AWk3gHqjhrJRSggKG/0cxkTbumMgXQ2PDv58j2 l2FL63m7wcDag== From: Arnd Bergmann To: Laurent Pinchart , Sakari Ailus , Mauro Carvalho Chehab , Nathan Chancellor , Jacopo Mondi , Hans Verkuil Cc: 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: [PATCH] [v2] media: i2c: mt9m114: use fsleep() in place of udelay() Date: Wed, 13 Dec 2023 12:23:07 +0100 Message-Id: <20231213112322.1655236-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 Precedence: bulk X-Mailing-List: linux-media@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 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. Cc: Sakari Ailus Fixes: 24d756e914fc ("media: i2c: Add driver for onsemi MT9M114 camera sensor") Signed-off-by: Arnd Bergmann Reviewed-by: Laurent Pinchart Reviewed-by: Tomi Valkeinen --- 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 { /*