Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp36919135rwd; Tue, 11 Jul 2023 07:18:37 -0700 (PDT) X-Google-Smtp-Source: APBJJlFTLO2Eh/Rg65bht2fZ/N9xlRGyLyy188vYxVfhtSM4WtEV3eMr1ieemYxAji7orYu6bCfa X-Received: by 2002:aa7:c75a:0:b0:51d:f39d:1716 with SMTP id c26-20020aa7c75a000000b0051df39d1716mr1007600eds.22.1689085116985; Tue, 11 Jul 2023 07:18:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1689085116; cv=none; d=google.com; s=arc-20160816; b=zZVzxPgb7P2c0Zfexedp0JIr1bWtUTQd0xRrIADk8njzpx82zZhJsZ0NtVni9QxyZc zE+xx3N9D0gCDRLjWKD+IZwyT3ulbTE27mLHf0jOWfuYwTZWCEtU5sH4M7+iKWJwaPfM cjk0HOK/751lu0yXNQRZ2EJ+Japtj5eIfxrjHjbWM2ZkO+8Hm6A68NSqUShcrCi1Xhx3 dX1SVMhiLNcdrQ5NgO+MzPQQ0MwQcBQEjhJTgyC8VWZ5SxPkoakM3QVEAzUHDj5zdYO1 7EPGKluJVeoC1qrf72B/0wNvowqnkjljBqBadYyyToz/lFol9K81nMDNWjSU1LoPhiAD zuKA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=XuSPDAUVkuMM+tDaoIFswAmCD5n9mH/QvBiG0vx9QPg=; fh=rTU4kvZ6uNOp3D6llb6DnSEFyRHs0Ffssqi034BeBac=; b=GlY9Eh0usj8ncW5uOv1pS7QbAy9XvPIT3X88dWJzO2F91+qWU+KA8iGuA2VvvtDdrv ADLgbizVV4WgvR9VdkkVKxv2inNJQe6jmRLVyRdMrm20gL7vec5snIndF2kVyJCV7uBg kK3eh3AKWuoq981V6lZfWbq/UnKgRPf0m/FUV8jdgm78JvcA3MSlgEYy6zEg7l4Dhs22 OUQe8Vb6Zf8ZifeEUp6YOKY7dMvftb8ZASRxIRNvQuodZOi9psvy9oweUWivcu9aUEIJ Rht5H2GojIE+I/L97qAytuHqG9ZjMHJ0emSVTo5S1lB0wQlJULuURmt2UY2B9wLqgHsq +Z8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Bj0EFZpA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id i13-20020aa7dd0d000000b0051df225e708si2256785edv.46.2023.07.11.07.18.11; Tue, 11 Jul 2023 07:18:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@collabora.com header.s=mail header.b=Bj0EFZpA; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232941AbjGKN3c (ORCPT + 99 others); Tue, 11 Jul 2023 09:29:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48266 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232186AbjGKN3b (ORCPT ); Tue, 11 Jul 2023 09:29:31 -0400 Received: from madras.collabora.co.uk (madras.collabora.co.uk [46.235.227.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4C9D318D; Tue, 11 Jul 2023 06:29:30 -0700 (PDT) Received: from [192.168.1.100] (2-237-20-237.ip236.fastwebnet.it [2.237.20.237]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) (Authenticated sender: kholk11) by madras.collabora.co.uk (Postfix) with ESMTPSA id 78FF36607010; Tue, 11 Jul 2023 14:29:26 +0100 (BST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=collabora.com; s=mail; t=1689082168; bh=A6Rhy91tdjux/U1OjfY+XN+em6idN9fFsp4Gj75jj3Q=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Bj0EFZpAy7nFby7CUTs+PEwT8vs+La8bzX9UYqF73oazR63yx2IHPPA2JHUd1crN7 u7PAxyRka3DqmNvhZ5M72I2mvt/zbjiS0yMalOlSuWvlx/bfnSvODSAi5oU/MRyGf3 aGWBbXbtkrs/c69s3IIJc3n9NU+l9N7Vq3udf22WAzHRfo+NjJu3NVNgqg/mGODjal U+8BVvc+3X5TXjQn5d75fL8W+WXl0I2H6Avc6DBiihqQZ7faWNiWwtdS1K6qIpx6e4 KBce2lFKpLIa/z0lFI7YUxCPDHlYxhSB5sfm0e4oNH095a1OsDfr7jPiRj41PQODwj CMKuG2rPGicFQ== Message-ID: <82a48b1c-b070-ba45-04f8-2f2bf645d893@collabora.com> Date: Tue, 11 Jul 2023 15:29:23 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH v2 04/15] spi: Replace open coded spi_controller_xfer_timeout() Content-Language: en-US To: Mark Brown Cc: Andy Shevchenko , Cristian Ciocaltea , Yang Yingliang , Amit Kumar Mahapatra via Alsa-devel , Neil Armstrong , Tharun Kumar P , Vijaya Krishna Nivarthi , =?UTF-8?Q?Uwe_Kleine-K=c3=b6nig?= , linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-amlogic@lists.infradead.org, linux-mediatek@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-rockchip@lists.infradead.org, linux-riscv@lists.infradead.org, linux-stm32@st-md-mailman.stormreply.com, linux-trace-kernel@vger.kernel.org, netdev@vger.kernel.org, Sanjay R Mehta , Radu Pirea , Nicolas Ferre , Alexandre Belloni , Claudiu Beznea , Tudor Ambarus , Serge Semin , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Kevin Hilman , Jerome Brunet , Martin Blumenstingl , Matthias Brugger , Andy Gross , Bjorn Andersson , Konrad Dybcio , Heiko Stuebner , Palmer Dabbelt , Paul Walmsley , Orson Zhai , Baolin Wang , Chunyan Zhang , Alain Volmat , Maxime Coquelin , Alexandre Torgue , Max Filippov , Steven Rostedt , Masami Hiramatsu , Richard Cochran References: <20230710154932.68377-1-andriy.shevchenko@linux.intel.com> <20230710154932.68377-5-andriy.shevchenko@linux.intel.com> <83c4b75a-06d7-9fca-ffa0-f2e6a6ae7aed@collabora.com> From: AngeloGioacchino Del Regno In-Reply-To: Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Il 11/07/23 15:05, Mark Brown ha scritto: > On Tue, Jul 11, 2023 at 10:28:13AM +0200, AngeloGioacchino Del Regno wrote: >> Il 10/07/23 17:49, Andy Shevchenko ha scritto: > >>> + ms = spi_controller_xfer_timeout(ctlr, xfer); > >> I agree on using helpers, but the logic is slightly changing here: yes it is >> unlikely (and also probably useless) to get ms == UINT_MAX, but the helper is >> limiting the maximum timeout value to 500mS, which may not work for some slow >> controllers/devices. > > The helper is limiting the *minimum* timeout value to 500ms - it's using > max() not min(). The idea is the other way around, that for a very fast > transfer we don't want to end up with such a short timeout that it false > triggers due to scheduling issues. After reading the code again, yeah, I've totally misread it the first time. Argh! Thanks! :-)