Received: by 2002:a05:6a10:9848:0:0:0:0 with SMTP id x8csp45147pxf; Tue, 9 Mar 2021 23:18:33 -0800 (PST) X-Google-Smtp-Source: ABdhPJzo08kPRTxyl8daSWxNT0Pmy9drIfGKRX2JIV30bHf8CpaOablUdgK4x3F/nMipaWRkfca9 X-Received: by 2002:a17:907:b06:: with SMTP id h6mr2156212ejl.144.1615360712999; Tue, 09 Mar 2021 23:18:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1615360712; cv=none; d=google.com; s=arc-20160816; b=MZxLMQcNcqSq/gLg+b7LcoUNV9+2dlL46DfZz/ItbYzZeFDa0EFPXwPD8pWV9LR8ds 4OAkWqKB1JUGrm5Btgy2e67PQVnuIzKlQ/VO5Rvc4YkSTUxY6yr39HBvEHGMO++57FCV knH2NNWafWT94nFUyt7DguFjpa1zm0QGseOYKMuo2o0q1Yboah3OympGbuDFYnosDBed BL8U6phtmP9TzrvnbLhvNfplSDBNHYG8amlU2PrHCnh4mzZ8zH3l5BSlKUAtxHY527iU GKhP7bwCo/YjnnVoQisKGEfiGJ0HU5geR+I+MLiFCBv1J/5+P9IPjIthFzl6aDOVuxzp eg6g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=5O4bWXBCQeQuk0BdQom2dNS7Jmj8ph1wsbHk08MJAMo=; b=CUnNI5J3SES8e+a0e5p2abZt2jsgEbB3AlIPR2r4bOa4SIqaPrPpQfa22GyWQwts1q aojDRLtbkg1n8JuuP0VppxamE22qJ0e4gLwE6Ug/ZM7aPj8gH10OHKi0odShQ6ChwAle AalohG2eSEKb5fJH0CUeYwgwMOk2L1rT6VtxxQN4Eyin6oDsodjO9yNXyBnHMCHHFXYb LXehHB20RTUEEkFnQwOyjes4rMgl5Ga6FaE2fJNvVB+3JJDryF8GqYh7tmvXfFy4xfI4 MapzCFntSS2uyzuGvt4IjN9oDT5WH+/pcQ+COIM9+Da0PB1fdmfeN/9EbEHHk9OaXlNq spiw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=h1lBv7HH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h14si10882756ejt.198.2021.03.09.23.18.10; Tue, 09 Mar 2021 23:18:32 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@deviqon.com header.s=google header.b=h1lBv7HH; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=deviqon.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229516AbhCJHRL (ORCPT + 99 others); Wed, 10 Mar 2021 02:17:11 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229499AbhCJHRG (ORCPT ); Wed, 10 Mar 2021 02:17:06 -0500 Received: from mail-vs1-xe29.google.com (mail-vs1-xe29.google.com [IPv6:2607:f8b0:4864:20::e29]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D528FC061760 for ; Tue, 9 Mar 2021 23:17:03 -0800 (PST) Received: by mail-vs1-xe29.google.com with SMTP id a15so8217526vsi.7 for ; Tue, 09 Mar 2021 23:17:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=deviqon.com; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=5O4bWXBCQeQuk0BdQom2dNS7Jmj8ph1wsbHk08MJAMo=; b=h1lBv7HHj122ZOQj79sUyMEcd0w5tZ5oV+JyqbEAP6IjncbQiGVy8O14kGSopZ/RBx 9v2gMNrpI9dt04NG+QIN/gmmZWg3fVjIn1tcv81o1Zn57C+4gpo/i+K6DDJGIjAYDD1d KZbwTuKJwz1WrxDTxcAVijM/GojWEq9d8mJct7JWW7QAaNeF1syI/sRvDtbi+HPObcfq 5uHQyTctmvjfVGPbz5aASZ00uqwQaJVO9XeaiinwzqpdY68XcFk8CFpmzqPAMAbdjUeH vuZGlGdUJgO/m0f2Ul4b4DUBi6I43LHxDjtkfkGsgWwGw6cEOKY5wfKkRuGxJLBAuKXt OI4A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=5O4bWXBCQeQuk0BdQom2dNS7Jmj8ph1wsbHk08MJAMo=; b=dsk9D/FzBmSXhuRzKF57y40ZoXKY5CBQVy84FVkvOpGKQL2cqFm/cYlm1A4wD3qZOZ YCBWBOXflPZz0qdOfpYmQ4rDs+Bp0S1LrRy6mQA9rmvqNaukbR28xJ+s1OHQvuCVoQI7 xltpx3HqWx1oS8eqogAOcUxgopUXxDXrb9N6Tj2AH394YU1svuZpK2Z/pI9FQg9ZvHUq iJMRyoOi65NBOxkN9OE8+NG4uup1lgra/I306QYdqdoq3veOFsz/Fc69lfvYuJ/ZFh4g ue4aE8wfc95kNuv0M1U8+KQe01/BpQXz7DlOL+aRQoKwNZW2T4SXPg2P+6t1csaYZOu1 TFoA== X-Gm-Message-State: AOAM532aQjzcObQhiRI/Wm/7cfgodn4xjaqDJ+7r8A8g75vYKZxKqrEY 6FE7LjuxKMhjh4DlpdXHrZcDrsHh+VsQTN7fBcS8Yg== X-Received: by 2002:a67:31d1:: with SMTP id x200mr972514vsx.16.1615360622918; Tue, 09 Mar 2021 23:17:02 -0800 (PST) MIME-Version: 1.0 References: <20210308145502.1075689-1-aardelean@deviqon.com> <20210308145502.1075689-2-aardelean@deviqon.com> <8a6ec9a1-71f8-ce1d-600a-66eba9244a54@metafoo.de> In-Reply-To: <8a6ec9a1-71f8-ce1d-600a-66eba9244a54@metafoo.de> From: Alexandru Ardelean Date: Wed, 10 Mar 2021 09:16:51 +0200 Message-ID: Subject: Re: [PATCH 01/10] spi: spi-axi-spi-engine: remove usage of delay_usecs To: Lars-Peter Clausen Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org, greybus-dev@lists.linaro.org, devel@driverdev.osuosl.org, linux-tegra@vger.kernel.org, bcm-kernel-feedback-list@broadcom.com, broonie@kernel.org, gregkh@linuxfoundation.org, elder@kernel.org, johan@kernel.org, vireshk@kernel.org, rmfrfs@gmail.com, f.fainelli@gmail.com, ldewangan@nvidia.com, thierry.reding@gmail.com, jonathanh@nvidia.com, linux@deviqon.com Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 8 Mar 2021 at 18:42, Lars-Peter Clausen wrote: > > On 3/8/21 3:54 PM, Alexandru Ardelean wrote: > > The 'delay_usecs' field was handled for backwards compatibility in case > > there were some users that still configured SPI delay transfers with > > this field. > > > > They should all be removed by now. > > > > Signed-off-by: Alexandru Ardelean > > --- > > drivers/spi/spi-axi-spi-engine.c | 12 ++++-------- > > 1 file changed, 4 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/spi/spi-axi-spi-engine.c b/drivers/spi/spi-axi-spi-engine.c > > index af86e6d6e16b..80c3e38f5c1b 100644 > > --- a/drivers/spi/spi-axi-spi-engine.c > > +++ b/drivers/spi/spi-axi-spi-engine.c > > @@ -170,14 +170,10 @@ static void spi_engine_gen_sleep(struct spi_engine_program *p, bool dry, > > unsigned int t; > > int delay; > > > > - if (xfer->delay_usecs) { > > - delay = xfer->delay_usecs; > > - } else { > > - delay = spi_delay_to_ns(&xfer->delay, xfer); > > - if (delay < 0) > > - return; > > - delay /= 1000; > > - } > > + delay = spi_delay_to_ns(&xfer->delay, xfer); > > + if (delay < 0) > > + return; > > Bit of a nit, but this could be `delay <= 0` and then drop the check for > `delay == 0` below. hmm, that's a bit debatable, because the `delay == 0` check comes after `delay /= 1000` ; to do what you're suggesting, it would probably need a DIV_ROUND_UP(delay, 1000) to make sure that even sub-microsecond delays don't become zero; if you're acking this suggestion i'll implement it; i'll wait a few more days to see if there are any other acks or complaints on the set before sending a V2; btw: this new spi_delay struct supports delays in microseconds, nanoseconds and clock cycles; at some point it may be interesting to use a `spi_delay_to_clk_cycles()` for this driver and other similar; > > > + delay /= 1000; > > > > if (delay == 0) > > return; > >