From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A6EB3EB64D8 for ; Wed, 21 Jun 2023 15:52:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mkyLRaQgolD+GnZcS1L1E4DUwYOgz6hQLsDncxERN8E=; b=gSNYJSlsJINQUm JxcFOeLTYhCJJJg4xIEDLVilrKTnxgIytXg/qkUa/HBgInqdTgVeFUeQdlaWR0PFgWg5B0EuTDpiT wQGx66wlaeJIdb8WcenfwKb7GP7aj02UbIOC3WehQn/9NzR8A7KziCmTgfW6fHX1Uf6t6qTfCE19/ tucQvmwqavYtJ+pNCJY9BSn5iT1wuGY4S2YFWRGx7/ajaDvwqIYN5MYk0A3e5nOx4raO93KWQZq1Q e2VMbEZgshzJnO22DIVTv29AMnQhRGP0z5pcBMvaseLRMATW6KNwLduuJWD2t8A8Wuv5H9PnlszRw 1ufiHhoIF7zCfZlPX7ew==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qC07X-00F0TZ-2g; Wed, 21 Jun 2023 15:51:47 +0000 Received: from mail-wr1-x433.google.com ([2a00:1450:4864:20::433]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qC07V-00F0R8-1L for linux-arm-kernel@lists.infradead.org; Wed, 21 Jun 2023 15:51:46 +0000 Received: by mail-wr1-x433.google.com with SMTP id ffacd0b85a97d-31109cd8d8cso6013159f8f.2 for ; Wed, 21 Jun 2023 08:51:44 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20221208; t=1687362703; x=1689954703; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=aC81hT2eRQBjkojJrQa9BM2dAGgpSMK2LXGRglIV5hw=; b=mqi7fm69G1L7cEB/FeYvXqf9QyhMh1oLHnDcNBlWVNoFnHegIYS+R+ecL+9SrnZdoJ omi7ZPmVm0NSXZXd2auduGsejwdcEGoF/3dwrmt9sc6SsMg0NEE0ef13Ov+KzxwA9cE3 BIEYV/3eYIwoyofzhRYjkFpf7O/MjWlLsiEvBmpbdHRIHqUAS9PCe8IkwS8BkAz9+zaj ofXKscB/utGxvaGcm56qkL4yZUuTvE+JH827SzSlEKJTJbxtWWXbtcETz6PjMmg8gUSQ qGdzas3bkJeJR+DE/gBkYgcvmL5zQc6lpOeveBlRORqlxAnRrFfzonuo6PMlT1VpdLuJ ByNg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687362703; x=1689954703; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=aC81hT2eRQBjkojJrQa9BM2dAGgpSMK2LXGRglIV5hw=; b=bwsSghWoeRKJHahpvc36J+1U/87sy9Y3Ue4et/p6OK0mfs9iiQvJitz+qOvzzz1EuT tIJT3G+3DV9f14eJL6gazRqQWSKb1q6nLH0tfDl/8idp1VMoWYooJxVoPZWynG4ZY+NJ EyQS8hack77r1X8cxvMEN7ebEvcvD+gm7B+RWAtKd1Ai9ze/wjsaScTz+NnUmN1NfL7d 7/m8IEkOUn6FUGXy9I71b+DhecAZdnWymElaEFLNfriwmE7TPZSnHM7lteVVoUZJEVdJ 5fKRVjIkgS0y8D2ySSEbKRngi9RFIy19H+2sFszcq1AKu5KNjy45sAkuQAvAWLchNkMv x9EA== X-Gm-Message-State: AC+VfDyc0GTGPPrMCFJdZT3647KGiTboIf371T/8kMpprK2QnSNy/XAw vx1QhjfgibsxQpxlVt20ZKU= X-Google-Smtp-Source: ACHHUZ6mfiuUSKUL9T4FG0zO9eFCzfqn7gdQJ+UxFybrS+0IlVlSOIzIttkP0rZOt+iRNg6rGhm6KQ== X-Received: by 2002:a5d:4bc1:0:b0:311:b8d:a63b with SMTP id l1-20020a5d4bc1000000b003110b8da63bmr11474994wrt.15.1687362702797; Wed, 21 Jun 2023 08:51:42 -0700 (PDT) Received: from jernej-laptop.localnet (82-149-1-233.dynamic.telemach.net. [82.149.1.233]) by smtp.gmail.com with ESMTPSA id x1-20020a5d4441000000b00311d8c2561bsm4795824wrr.60.2023.06.21.08.51.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 21 Jun 2023 08:51:42 -0700 (PDT) From: Jernej =?utf-8?B?xaBrcmFiZWM=?= To: Mark Brown , linux-spi@vger.kernel.org, Miquel Raynal Subject: Re: [PATCH v2 3/3] spi: sun6i: Use the new helper to derive the xfer timeout value Date: Wed, 21 Jun 2023 17:51:40 +0200 Message-ID: <5683683.DvuYhMxLoT@jernej-laptop> In-Reply-To: <20230619155349.3118420-4-miquel.raynal@bootlin.com> References: <20230619155349.3118420-1-miquel.raynal@bootlin.com> <20230619155349.3118420-4-miquel.raynal@bootlin.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230621_085145_452725_089DFDF2 X-CRM114-Status: GOOD ( 20.92 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Alexandre Belloni , Samuel Holland , Chen-Yu Tsai , Tudor Ambarus , Thomas Petazzoni , Miquel Raynal , linux-sunxi@lists.linux.dev, Claudiu Beznea , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Dne ponedeljek, 19. junij 2023 ob 17:53:49 CEST je Miquel Raynal napisal(a): > A helper was recently added to the core to factorize common code between > drivers, like the amount of time a driver should wait for a transfer to > happen. > > It is of course possible to use a default value (like eg. 1s) but it is > way stronger to adapt this amount of time to the transfer. Indeed, long > transfers (eg. 4MiB) on a slow single-spi bus might take more than the > usual second of timeout and prevent lengthy transfers. > > The core helper was heavily inspired by the logic applied in this > driver, the only difference being the minimum amount of time which was > enlarged from 0.1s to 0.5s. > > Use this helper instead of open-coding it. > > Signed-off-by: Miquel Raynal Acked-by: Jernej Skrabec Best regards, Jernej > --- > drivers/spi/spi-sun6i.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/spi/spi-sun6i.c b/drivers/spi/spi-sun6i.c > index 23ad052528db..180094dfae19 100644 > --- a/drivers/spi/spi-sun6i.c > +++ b/drivers/spi/spi-sun6i.c > @@ -422,7 +422,7 @@ static int sun6i_spi_transfer_one(struct spi_master *master, > reg = sun6i_spi_read(sspi, SUN6I_TFR_CTL_REG); > sun6i_spi_write(sspi, SUN6I_TFR_CTL_REG, reg | SUN6I_TFR_CTL_XCH); > > - tx_time = max(tfr->len * 8 * 2 / (tfr->speed_hz / 1000), 100U); > + tx_time = spi_controller_xfer_timeout(master, tfr); > start = jiffies; > timeout = wait_for_completion_timeout(&sspi->done, > msecs_to_jiffies(tx_time)); > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel