Received: by 2002:a05:7412:8d10:b0:f3:1519:9f41 with SMTP id bj16csp5251513rdb; Wed, 13 Dec 2023 03:37:28 -0800 (PST) X-Google-Smtp-Source: AGHT+IHL0T6a4h2FaZO8TsDKtChdbMbS2biKvgp9SFnDZS/TOg170KESYxqqDC3BH8zhAnGPQ8IX X-Received: by 2002:a05:6808:2e95:b0:3ba:587:b349 with SMTP id gt21-20020a0568082e9500b003ba0587b349mr7749427oib.111.1702467448511; Wed, 13 Dec 2023 03:37:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1702467448; cv=none; d=google.com; s=arc-20160816; b=ohXYmeRq4vHmBMpnfG0swp1NzRQQ4UdIIXEW70BCCKckAPO9DO/Mm0O/HcPfzyawX8 KXSAs2eK8ou3nGD5UZW/XG+gMI4bHBvlSB5L7ttlMYAB9pPT9MLlM25HV2E+4Ed9R2zF PipqVUUBNQu54n+GnhYsbouNVr6R+8AwKPwtRXCxDLHrY/ufu1ZSjijVxB1hoSMWC52o jUoq15IEzig66ghKWudJ+JzJKrTpfH3K9GEcK7Ul4cXCAzH6zGUCa2fyAO9rxJSOo7si QVbfE885i37/qzUF54dzQ5yY7qNkwPySklNhowlVEFBoJmkj9nuINOB+/OtNb8gzNkoG xvEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=FvNM2cqvULqIVZckJkGfXuMkG5NOOsIhtidnGvlkIm8=; fh=nb+cRrIfn0CYsuighV8p/CcvZT9qbUtDNGcyf8nJ0eo=; b=tvXRSaguV1OtqCcs4j5XpzOMyPTfCHryEe/w3KF8z+tj1iCcn1iEgjkN01zR4rINNW Mfnz2sYTmuUbisdyRWanP1kEieiuoHMQqHm1fD8O3NwYHklaw8e3jsBnEDFE7hXyUblh 62YNHMpMhPk9f4tvDGjJmHSXu00A9HyI3cy1KL/8w7fNkTNXPMZIWJ5fPhIIvS+rU9Hc MFdtTK3iReJGbuafLJ4gS0qOC8WUWG+sTtdUr2cBsdbCpLodXDRmOyeZ5sITCua7d096 a4AORf/rD+4GkTTo7QVqIar0ueCVC13uV2+BtUaw1CWAGF9thayckBvmM5prLu4p6H4V Vnug== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=UuCFT1Qn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [23.128.96.38]) by mx.google.com with ESMTPS id y13-20020a056a00190d00b006cd8cddf8c5si9545452pfi.14.2023.12.13.03.37.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Dec 2023 03:37:28 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) client-ip=23.128.96.38; Authentication-Results: mx.google.com; dkim=pass (test mode) header.i=@ideasonboard.com header.s=mail header.b=UuCFT1Qn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.38 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id DB41A8043063; Wed, 13 Dec 2023 03:37:25 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1378823AbjLMLg6 (ORCPT + 99 others); Wed, 13 Dec 2023 06:36:58 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:38338 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235310AbjLMLgj (ORCPT ); Wed, 13 Dec 2023 06:36:39 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B076310D; Wed, 13 Dec 2023 03:36:40 -0800 (PST) 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> 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> X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Wed, 13 Dec 2023 03:37:26 -0800 (PST) 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