From patchwork Fri Jun 19 14:32:57 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: 191257 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp686307ilo; Fri, 19 Jun 2020 09:32:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxsEv5GhFcao7Jam34fG0nEoL8pp96AkVjB+nVRKh/GcmPGdDi3QWG8s42juE8+L7OlBqAp X-Received: by 2002:aa7:d717:: with SMTP id t23mr3996466edq.304.1592584379537; Fri, 19 Jun 2020 09:32:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592584379; cv=none; d=google.com; s=arc-20160816; b=MlFA/n6idWLdU+8ONRGkOkchAHbgB1rolEsO73FOQtGIUxwEVLCI35NfEGkpfBcy/6 GYG67thOXP42m/rnYU89QynhZCoYjPP0E2BSMgdH5GrJV3CR7fwBEYL/HZYIJKukqYMY USlXDr/RbAMeAxCEy7SURgiQ8uN/5wBEZI7R8208LEKRm1nLVYrokVKcA2CuytyVyt/M j0yb8tuKiPIJHAd3nLukvN/sBem668WgEZbrAqBPZEGWk/vCEHn/Jxujx7EH0GiVkzRr V/S0Wd1/NP8UT3Yqmt+IIVLlltYYZ8Doy4yC8yC0Oo7wSsXdtO3vu8ncbOBfbtaNceiH TswQ== 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=KCNMNefcYx6j9NNmrEVRvDIQMVjcvCf9wI+dxdU4Ooo=; b=A7XXzkRJudd3nRxNAozNPXfIYf1Ko0uwoqTmMcWSU4pjsBl8OwxImpZHi0d12e8IZX IPDGhLVs3eSxy2v73l7hYXoDAGKDTN/SET8Za6Z/7MNOOepipUq/7IEVYCKyrjZwTRky 8C5um4yu4qodItMcUOP9ykm4j54EQUq/aZGoNhodDK6BmQWltBZD+qrEMZ7Su4Bdyc+c zNVdZrkg00/vcqMjp6x7dlN5PIpWixz8t4ln/PEJEkc+CksDFUze8yvBJge8IePiVuKm R3rpwIXSJ1sAD+BnBUlI8Rp+ZCtQo0JUqfaAFnCS+Sf/L/a/WbowdCDtQ+Js+aGxPxbE v4dA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=gdEqaH5T; 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 r6si3861773eja.531.2020.06.19.09.32.59; Fri, 19 Jun 2020 09:32:59 -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=gdEqaH5T; 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 S2389508AbgFSOvy (ORCPT + 15 others); Fri, 19 Jun 2020 10:51:54 -0400 Received: from mail.kernel.org ([198.145.29.99]:45546 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2389493AbgFSOvp (ORCPT ); Fri, 19 Jun 2020 10:51: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 5FE6621852; Fri, 19 Jun 2020 14:51:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592578305; bh=qZzGSYMamJhxwefjLo2x0UV9tBBc30LX2T7wPSzplg8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=gdEqaH5TZ5Vizy/hN9AXpgcu/+1AW2Ds3UYGAbUZKR+sdIvxVhlxIoRcbB+KjGLX0 NOfnO9mVPt7nRlXkLM2GlehMDW8+jbhLgra5usF2UQKsPicxz9LrnOwvLGZ6BkW4lG SMvp8Yz06HV14I4cgjVHr0ukThseRVyPMf/IlZBw= 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.14 132/190] staging: greybus: sdio: Respect the cmd->busy_timeout from the mmc core Date: Fri, 19 Jun 2020 16:32:57 +0200 Message-Id: <20200619141640.221168613@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141633.446429600@linuxfoundation.org> References: <20200619141633.446429600@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 101ca5097fc9..93e2c091c565 100644 --- a/drivers/staging/greybus/sdio.c +++ b/drivers/staging/greybus/sdio.c @@ -412,6 +412,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; @@ -470,9 +471,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;