Received: by 2002:a25:683:0:0:0:0:0 with SMTP id 125csp103108ybg; Mon, 8 Jun 2020 17:39:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzOi8ZwfhwKOaCoG8C1OoDxiCvh5M8jiVR404+Po19y+6nnOz4Iprb5N1QeBnve+/Cj2gV/ X-Received: by 2002:a17:906:6897:: with SMTP id n23mr23741224ejr.437.1591663190301; Mon, 08 Jun 2020 17:39:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1591663190; cv=none; d=google.com; s=arc-20160816; b=xNl6FdoqARCuGjRfW+CnYi37Lznrx7AZjH3ngRmpqs1qfNSPIoQ31HDJ8igs8iBJfL s0PjQ3zyL3t7NRBIs3oGMBtaw2eFB8NoOJ+d+IAWUxOKeESWkc9lB2cHYxqOGbMRwXeq vyl1EpbV2U26dNGhKaJY0kThAaaOpqEhMJNMdSShvZIKMJqp9RUIECPeybcCKJrAiQwV Jm0yZDXNmgxQMKzMoPmkPyS7i1KdfGFsRfXJOblixosxNDE6x2ZuD6JhVbznPGW/pIf6 bSnciJo1NB3YAW0xcTL9XbGs7fAzRDgzcb0aS43HrXKUcQwPo1nWyVAVtV1JkoGfynnw F7Pg== 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 :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=IwIV9qP5nnFoZFwpEOrRylCfeNX9OT6QLNYMIlkyV0I=; b=bIEBpRnqGsnihWTVIZwvJMlseYFODQiebCGs3drBgg0JoGTnCBcfTCafL7GlKDtb37 S5+kotQSNpLz++ijrWvqJuGKkl1Uachcw3F567RmVdulWPpyl7yelQ/e9zrkWRKYEV0h kAzdoVK/SgZOKf+pS2CqPCoEEbjP5SewmCnsBm/NmeEew3swOJtITNdTytqp8Nkf7REk 4LwKNnXkpYstKK7Bl81zo/EAaDRY+bZTPMK1JpMtYjoClAWBNn2qO44Zf4mypylRWtEE ll5SWKxFGz4sISIHI9bwyCWkc7BDxqYWo9EGoEAyqMDqR0UjQKbPH/a2jZdLbn/0gQNs lyJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=jWWYwh4U; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id gu1si9517787ejb.240.2020.06.08.17.39.20; Mon, 08 Jun 2020 17:39:50 -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; dkim=pass header.i=@kernel.org header.s=default header.b=jWWYwh4U; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727115AbgFHXN4 (ORCPT + 99 others); Mon, 8 Jun 2020 19:13:56 -0400 Received: from mail.kernel.org ([198.145.29.99]:58468 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728916AbgFHXLc (ORCPT ); Mon, 8 Jun 2020 19:11:32 -0400 Received: from sasha-vm.mshome.net (c-73-47-72-35.hsd1.nh.comcast.net [73.47.72.35]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 4CA7520B80; Mon, 8 Jun 2020 23:11:31 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1591657892; bh=iN4uu/SZtCI23lgelTAMXjz+AGc7s2h6+bTtogWffiQ=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=jWWYwh4UuThnu1ZfiBHM4XKxI4kOzGsbl1UmdZ9Yc5TvwB8h9zE9Ah1lVTs0DTPmU iZqCeKnYq7l5qNBGFGI5LxnqcmZxESzY0kMXpda1SXzyaQniJmNUTWSs/Qt5+esSKO 35tDIsE5MBlFmOH4rsIkmQzfzdqUy1gsV08unFB4= From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ulf Hansson , Rui Miguel Silva , Johan Hovold , Alex Elder , Greg Kroah-Hartman , greybus-dev@lists.linaro.org, Sasha Levin , devel@driverdev.osuosl.org Subject: [PATCH AUTOSEL 5.7 247/274] staging: greybus: sdio: Respect the cmd->busy_timeout from the mmc core Date: Mon, 8 Jun 2020 19:05:40 -0400 Message-Id: <20200608230607.3361041-247-sashal@kernel.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200608230607.3361041-1-sashal@kernel.org> References: <20200608230607.3361041-1-sashal@kernel.org> MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@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(-) 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; -- 2.25.1