From patchwork Fri Jun 19 14:32:28 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 191230 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp645087ilo; Fri, 19 Jun 2020 08:46:46 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz+vmvXhOoGV88XyG9KIvVzXgv5YxuYgAXXfDkESzhMyDnmwpgu8znlL8Iw1EzZKq6bnDpb X-Received: by 2002:a50:c054:: with SMTP id u20mr4057079edd.142.1592581606475; Fri, 19 Jun 2020 08:46:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592581606; cv=none; d=google.com; s=arc-20160816; b=eJk8Ak/ADcXl72ScBd+oRNeoKy5f3rAqAWpoQkCfuLvwHV4JZ17ov3fGcmIgy8V1c8 DBYJ2JKzCjYfA2ZyokoOBF1oTMBCf0DVZK4OjJKGPDi0Vx3uOg05yDL2O8wSM8pTeRuF RPe/uvLtffkok+lcANhjNx2tXgg3WoOcYX8Y4eye0vyZtdAjVxHj26J3siSo4k8lFAlv 1NURrCKCjG42BzbM4tN8aIEBWXWA7oacfiTNLPcbgZ40tyAB4Pstkdru46iDW3C+AEuW w9+OoXX+ulNihUTbkEnOZtcj5oAzvE3+GZF/GsnpNfnFRhbqCnmvEJJ2EKIo5gmdy0dW +LTg== 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=IwIV9qP5nnFoZFwpEOrRylCfeNX9OT6QLNYMIlkyV0I=; b=BuFQaemLYQlQN/ZVDX/4Q/qV6wsom3y8Imj8bzVozcXBJBm5zpSQPVD7libQeP0f4I 1srE9C1vS0yR18uJAHkYXaakjmPHQMPW2CrObnvfP5mGm9JKDoqBY9yaTQ6N7e5s4sK6 1tv9omX8TsEzIviYVq6aGbJ1Qtsu7m0OixtR1KziIxQ0eoWgzKShroI/jeScBRtAdc1V mvWejIBh0dAeHIsp7Gnal+V53iRLPUPWIH9AiIk7g4LYC879/fdnXdu72z9m+d3E00iR YrA3+kXtCUwcbBN9QfDQwiQ95/Cd0AwTjMfvoaDcr6vzgsuoujJq3dYiCchTB5UBZUFg 37IQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=qoKGm0YY; 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 z13si4129562ejp.589.2020.06.19.08.46.46; Fri, 19 Jun 2020 08:46:46 -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=qoKGm0YY; 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 S2403763AbgFSPqo (ORCPT + 15 others); Fri, 19 Jun 2020 11:46:44 -0400 Received: from mail.kernel.org ([198.145.29.99]:58250 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2404320AbgFSP0a (ORCPT ); Fri, 19 Jun 2020 11:26:30 -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 B74DE21582; Fri, 19 Jun 2020 15:26:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592580389; bh=iN4uu/SZtCI23lgelTAMXjz+AGc7s2h6+bTtogWffiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=qoKGm0YYGedsVsOhuZzPvyHacioZNPWRnJiWAQNrrGb2BBQjRtCh9aDS8dUhv2jMs KQfa3yNX+47vnebpRJfQDXgBr1W5OZBDru/h4XSLafmpTvBpTr2IKCVudJ2I+Ac+dB sbmLBtgkJuLxMHsZI5gdCMo6HEa5yDTtJEf4TSBM= 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 5.7 230/376] staging: greybus: sdio: Respect the cmd->busy_timeout from the mmc core Date: Fri, 19 Jun 2020 16:32:28 +0200 Message-Id: <20200619141721.208210621@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141710.350494719@linuxfoundation.org> References: <20200619141710.350494719@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 68c5718be827..c4b16bb5c1a4 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;