Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp648076pxa; Fri, 14 Aug 2020 14:01:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyJgrklj4FB3aMvON7qHXIo6vau6dN9rajZngQZjQcDhitQTsTYGusWL7LBs/8sS8Hiizj4 X-Received: by 2002:a17:906:3715:: with SMTP id d21mr4107463ejc.281.1597438870739; Fri, 14 Aug 2020 14:01:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1597438870; cv=none; d=google.com; s=arc-20160816; b=Oau9c3z+teNdNae9RIvAL3Lm/CA5BId0BQ9yrFdzlpXjNG49LqPWbdqSsaz6ujtQAr Dz9wIC1vwjj6qFlDi+tmEsJuIKd/1jWl0WPn7vJbTBDVsUyf9LeZC0r4Dhe0DvpTqumc ZztgblhuAkNz1QQmgNwJiKRvfVBS+nZIYo0XLz1A6v72DOBcsId6CGwXwUMZBN9x2PkX rBWqhorJmzHjp+eBJhCxIlufgR8yYRmV8iKrjn2QniEQ0sEDfukQ2dBYQr6abxWB9pMk Lp9brhSR17RYbVEtKJmTfVlj8ZLNqYDDjKSFuwlP7cgDaIFO6PZbgDdZs+WaGEAhao0C FWPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from; bh=4ezjXisAjk3UDj3fGz5sSIsOdoGzptu51TunvIAtLzU=; b=p8UITvwEV8lsbTGmSc8jYD93wA4tW6NmVaBfVYrQ9RZqmDiCY/01WSnUcM+TskcbIi zgKUuJ/akuWdL+ur6hNu/NBontYfhdBbaOzGCwPJXXwaJNTbh9YBrUuDoZDuJQqdC3dZ 2Ah0AyBK0x7Mx9KHZSikWUbbVz7lN9SaNMuEChN1uZBgqNrjlLdsj6XUjaOlDeDiIvol D8jphfnrpC4aqf/Rh+Miwb/1gYpTiluvfSpnrFbp80M1JwIynsbn1ucUVooknnk78KgY u+Xocd3Of4NSbleO+/oY3oeiSBujp3OjMhlB76LpT25NXJGwBLabOx79RWiCy/FsaB/5 N2Nw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id sd25si6048006ejb.341.2020.08.14.14.00.47; Fri, 14 Aug 2020 14:01:10 -0700 (PDT) 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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726882AbgHNSug (ORCPT + 99 others); Fri, 14 Aug 2020 14:50:36 -0400 Received: from mail.manjaro.org ([176.9.38.148]:50836 "EHLO mail.manjaro.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726651AbgHNSuf (ORCPT ); Fri, 14 Aug 2020 14:50:35 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.manjaro.org (Postfix) with ESMTP id 922D7E1446; Fri, 14 Aug 2020 20:50:34 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at manjaro.org Received: from mail.manjaro.org ([127.0.0.1]) by localhost (manjaro.org [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id XD5iMQt1uVXx; Fri, 14 Aug 2020 20:50:31 +0200 (CEST) From: Tobias Schramm To: Ulf Hansson Cc: linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org, Tobias Schramm Subject: [PATCH] mmc: mmc_spi: fix timeout calculation Date: Fri, 14 Aug 2020 20:50:11 +0200 Message-Id: <20200814185011.3252020-1-t.schramm@manjaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Previously the cycle timeout was converted to a microsecond value but then incorrectly treated as a nanosecond timeout. This patch changes the code to convert both the nanosecond timeout and the cycle timeout to a microsecond value and use that directly. Signed-off-by: Tobias Schramm --- drivers/mmc/host/mmc_spi.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/host/mmc_spi.c b/drivers/mmc/host/mmc_spi.c index 39bb1e30c2d7..f85e0ad896a9 100644 --- a/drivers/mmc/host/mmc_spi.c +++ b/drivers/mmc/host/mmc_spi.c @@ -882,9 +882,9 @@ mmc_spi_data_do(struct mmc_spi_host *host, struct mmc_command *cmd, else clock_rate = spi->max_speed_hz; - timeout = data->timeout_ns + + timeout = data->timeout_ns / 1000 + data->timeout_clks * 1000000 / clock_rate; - timeout = usecs_to_jiffies((unsigned int)(timeout / 1000)) + 1; + timeout = usecs_to_jiffies((unsigned int)timeout) + 1; /* Handle scatterlist segments one at a time, with synch for * each 512-byte block -- 2.28.0