From patchwork Fri Jun 19 14:33:06 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: 191260 Delivered-To: patch@linaro.org Received: by 2002:a92:cf06:0:0:0:0:0 with SMTP id c6csp694108ilo; Fri, 19 Jun 2020 09:42:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVtlWsN9zXlYBfTSnYs5VoAiKlLSA2Kkoqiril9K52RxzyXpV9nLO0iObOBArS39BNALu6 X-Received: by 2002:a17:906:328d:: with SMTP id 13mr4576484ejw.71.1592584948869; Fri, 19 Jun 2020 09:42:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1592584948; cv=none; d=google.com; s=arc-20160816; b=WjI3xN/cYDu6FhZ5U7SYj3jqoapTDaMB+jJr8J0hBhqOWNwbCnC/VXBVw6RiVs9AfA 8/wLoMep2u3rCBLLCPIakCbAoUDQqljZD+cr3EHl4qOfXc51BdZp7CvMZXxRIZusSymZ NfaALf1vYwa9900aitieyo2q1De+Yzpeh93Rfzn6d/3kFpt/dKUg8NiummLj1sGeA3Dp /1+9D4bd3eb/IO7PQtiKt5tyM8uFS36pdnXaSi0ZFgsB710kv/P0tQlLMPDi82hgzgAj 7OrKef5cpTXS0Jox9Dw9Lx3g1dyveNDLke1OH9FxKulQwqaEM3YKnofn/R62Pd3mmB4J 3qzg== 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=Mfd6xJIHEEP2ph2KJezJyV9uao57rLBqVAhPA2STa5I=; b=zGxgrzoTC50T5oTeGnTVALYEBxe9Uf4RR5SBzd0OzcxoQS/AEbAnXD6+Zvl2+br8sv 5XJKDLgqO/iC43D0sQ6G55lZKPVNFPihYe9ZbzK2gnrcsK4namB5pMhN3joHrYk25Iv4 neZLrVfnUMcDRyb+SEsvulSx8TqNhuaf9s16gL8jpzUp1iCp/+LWvGidA+MOsLVv5Vnd BMw9M/mRJ28czkt2vGbyEJsZsmAIoBbUlFFlizJzzMHJ27k6jZwjswS6Tmc9esrCZrw7 WJCVzDOFPFuZMdVCtXduY8PKYXrUk2aZDStLdQqOmpEMkSwU7q1HEndVNbuWDCo+ol8l VrXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=bSFkCABM; 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 30si4429116edr.262.2020.06.19.09.42.28; Fri, 19 Jun 2020 09:42:28 -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=bSFkCABM; 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 S2394080AbgFSQmV (ORCPT + 15 others); Fri, 19 Jun 2020 12:42:21 -0400 Received: from mail.kernel.org ([198.145.29.99]:35744 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2387441AbgFSOo3 (ORCPT ); Fri, 19 Jun 2020 10:44:29 -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 986B620A8B; Fri, 19 Jun 2020 14:44:28 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1592577869; bh=zg1MY30pWLAJyYYeXVGxxC6IoKKFWbAWqtBif7+QwTA=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=bSFkCABMwfMmvXqADKJcDM/tSxQSf/8i5ZBBQq0yb9NCvwgR2YJ5r8Hgi/mmvEzav RRX08WaNFL/gt2IxY7A3BINIGXd+rTeesxCYQsjlJQiJcC1V/RghSQJnFCehyiWYpz zrb3P4VY7ADGntWez0XvTnbsT5tQRFzYin3Sgby8= 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.9 092/128] staging: greybus: sdio: Respect the cmd->busy_timeout from the mmc core Date: Fri, 19 Jun 2020 16:33:06 +0200 Message-Id: <20200619141625.005365358@linuxfoundation.org> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200619141620.148019466@linuxfoundation.org> References: <20200619141620.148019466@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 5649ef1e379d..82a1c2cf6687 100644 --- a/drivers/staging/greybus/sdio.c +++ b/drivers/staging/greybus/sdio.c @@ -413,6 +413,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; @@ -471,9 +472,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;