From patchwork Fri Jun 19 14:32:43 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg KH X-Patchwork-Id: 191253 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp676599ilo; Fri, 19 Jun 2020 09:21:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwD8FP5K/7SERbGmbiS2Kc7jDgW4cggcZqKZYkU4b3BJAFCt3mQKxlCN3zwi8Z1d7fCgMDl X-Received: by 2002:a17:906:2bd8:: with SMTP id n24mr4645786ejg.83.1592583686352; Fri, 19 Jun 2020 09:21:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592583686; cv=none; d=google.com; s=arc-20160816; b=r3aDGcIhtsHrVeKQGtdXhrCFkgNs2y/SrfhXZj+By2yTAQqxOzNapA3keAAhh6X3ZG C+IoKybu9OzXXguMAikJW5mvzQy5res1fnrh02if3l6wWQcHxr3li4gy9MfQqosH6kMy /RQKhfXiaVJUFjnscze2vQf/Ekvuf+pGCChcejhfopa7oD5wzbXAkZClrsRkPEBOpbD1 tU8EGIjw8+zoZqKNWIeypXKKfjaa0E0xX4zmRFW2m/FPt3xZH8LUAsnfe8CZKkQIs+lo FMf5+X51VrPSZJCKR/W8kSjNsPDfyUGtjd1R2Jejvs6KfS/TibcTX+6w9uxySMQxBDQ7 GnCQ== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=t+/Xp4UiPi5kQVtO2N/zkhJtWotNfbuZCO9osCb/co4=; b=D0oEjV/xS3BYSNdwJsEtJ2Y8psGFMFc/6iHyEq+KNK3v+c2/PQCGoelt5HUMqroi+c LwIlTustBbe9LaZMlzoCCX4Me90iHvrAyAijmhdJ2aip93n01CK+GQH2y6OjEQYlZnRv wWElvksb/Gvbi9xTWevMepkyLo9DROOPvr9wlIj07JEpIra/wLTV33tKuM8BTm/TaDlk rb8P3TR7hyhpxhvmoC7kn38cgQqi1TmmfJOqqYsyGIYZisBxgAXkxiBWGWZYH7O859QZ AjZw+jlK9l/3KX4KpAESccy+afDkZPBnl/uGdCxP5HBLr4yK5TUHgBNpoHawK1MYUfuj UoAw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Kf3qJcXg; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-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 dn4si4693505ejc.39.2020.06.19.09.21.26; Fri, 19 Jun 2020 09:21:26 -0700 (PDT) Received-SPF: pass (google.com: domain of stable-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=@kernel.org header.s=default header.b=Kf3qJcXg; spf=pass (google.com: domain of stable-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=stable-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390306AbgFSPAw (ORCPT + 15 others); Fri, 19 Jun 2020 11:00:52 -0400 Received: from mail.kernel.org ([198.145.29.99]:57250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390660AbgFSPAp (ORCPT ); Fri, 19 Jun 2020 11:00:45 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 01B082186A; Fri, 19 Jun 2020 15:00:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578845; bh=CKS5+HdSoST1TSqe2wRB6hzz6m7D616MmSXTHXlLY/U=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Kf3qJcXgdDvUIr+ovviaHJzeE0lyLTrbqV+/3RRGdnTj19PFGPVIBmMh+sTmiXCNt YtJ8ATJQAX3DGqgEvFVoWpxL098tZ9J0yD08yEwsYZVbS+EyoTrCHWtLXr+muu230l uNc2dY7BKEzDYEJGkZPmR8IcR9FuJiLNZfzYDXGY= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Rui Miguel Silva , Johan Hovold , Alex Elder , greybus-dev@lists.linaro.org, Ulf Hansson , Sasha Levin Subject: [PATCH 4.19 178/267] staging: greybus: sdio: Respect the cmd->busy_timeout from the mmc core Date: Fri, 19 Jun 2020 16:32:43 +0200 Message-Id: <20200619141657.320999023@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141648.840376470@linuxfoundation.org> References: <20200619141648.840376470@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Sender: stable-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: stable@vger.kernel.org From: Ulf Hansson [ Upstream commit a389087ee9f195fcf2f31cd771e9ec5f02c16650 ] Using a fixed 1s timeout for all commands is a bit problematic. For some commands it means waiting longer than needed for the timeout to expire, which may not a big issue, but still. For other commands, like for an erase (CMD38) that uses a R1B response, may require longer timeouts than 1s. In these cases, we may end up treating the command as it failed, while it just needed some more time to complete successfully. Fix the problem by respecting the cmd->busy_timeout, which is provided by the mmc core. Cc: Rui Miguel Silva Cc: Johan Hovold Cc: Alex Elder Cc: Greg Kroah-Hartman Cc: greybus-dev@lists.linaro.org Signed-off-by: Ulf Hansson Acked-by: Rui Miguel Silva Acked-by: Greg Kroah-Hartman Link: https://lore.kernel.org/r/20200414161413.3036-20-ulf.hansson@linaro.org Signed-off-by: Ulf Hansson Signed-off-by: Sasha Levin --- drivers/staging/greybus/sdio.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.25.1 diff --git a/drivers/staging/greybus/sdio.c b/drivers/staging/greybus/sdio.c index 38e85033fc4b..afb2e5e5111a 100644 --- a/drivers/staging/greybus/sdio.c +++ b/drivers/staging/greybus/sdio.c @@ -411,6 +411,7 @@ static int gb_sdio_command(struct gb_sdio_host *host, struct mmc_command *cmd) struct gb_sdio_command_request request = {0}; struct gb_sdio_command_response response; struct mmc_data *data = host->mrq->data; + unsigned int timeout_ms; u8 cmd_flags; u8 cmd_type; int i; @@ -469,9 +470,12 @@ static int gb_sdio_command(struct gb_sdio_host *host, struct mmc_command *cmd) request.data_blksz = cpu_to_le16(data->blksz); } - ret = gb_operation_sync(host->connection, GB_SDIO_TYPE_COMMAND, - &request, sizeof(request), &response, - sizeof(response)); + timeout_ms = cmd->busy_timeout ? cmd->busy_timeout : + GB_OPERATION_TIMEOUT_DEFAULT; + + ret = gb_operation_sync_timeout(host->connection, GB_SDIO_TYPE_COMMAND, + &request, sizeof(request), &response, + sizeof(response), timeout_ms); if (ret < 0) goto out;