From patchwork Tue Apr 14 16:14:13 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 185421 Delivered-To: patches@linaro.org Received: by 2002:a92:3d9a:0:0:0:0:0 with SMTP id k26csp1602013ilf; Tue, 14 Apr 2020 09:14:51 -0700 (PDT) X-Received: by 2002:a05:651c:554:: with SMTP id q20mr610585ljp.104.1586880891291; Tue, 14 Apr 2020 09:14:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586880891; cv=none; d=google.com; s=arc-20160816; b=a92oFoooME41h138pR05Upf3wqdv9FZdXd8a5p4plPmNB6n62VvxOna8tBztFQPn2W CoEgsm4xQm1Z+7sYueTOZwolhl6gRQAYD6jDErpdzYalNC7I7MkZeqfN40AmIV9wHYZx EPyyXgZcG9Ji14Dsl03guBP01L5OxFOvxUrivNUPPmZr8XOa+BpfUHIiY1kmnR58SaQm O3joH2pg+6tUtrnXXf+yCWOmX59ZFYhbjwvCkFa7FhSb4rin/vbqFMQCAkxIjmYOLtTM rtyoeNerml4NjJjH2CFtXDrPUp7Wi5SRg5WlOun00HGSFmyJuWqEfw0X9YahjJ0M4bWI 1+fw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Bpyge4k8Iz/MW6vpPqOyXsMz3UoNxf4ygGN/PrDN23s=; b=sq3wAZjhkk7Hlfmn69j++O8m37N8ydL3WrRzO8XeCvyQSuRqZafCXgm3UU0sFOhph2 XxRfyujYYRnItoLPDom0o13U3pQSKOtNeAdZik5zeXOKumjtYj2eNjr5L0DCzbjS1N4k 1H8lsLxYnUauARzPP/nuyQQzP0RZmV6Obq6/SxR6yP/lAQ9lXHz7DDNPMxL6swr07ewj TjEGHgZavRH9afNAK/TlbqxYyaE9QtHqjswRgoWfHXcDuaY9QrFj4BizO4ruP1J98zCY PgGz1P5OYA1FpR1lmrIAqd2OdDi8OERnhNZdVvSiyinq1wUaoOPw8ROTUZxrmpPGZHTy H/pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m7tzsSdo; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id b30sor4138207lfo.1.2020.04.14.09.14.51 for (Google Transport Security); Tue, 14 Apr 2020 09:14:51 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=m7tzsSdo; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Bpyge4k8Iz/MW6vpPqOyXsMz3UoNxf4ygGN/PrDN23s=; b=m7tzsSdoqidUMOYYffWIVvNzzOkmdfg+BlltbgNDyDHYItaxuxu7vlYresXdqk6vQv D1vtkIKdiPxe0VmBocbrJb8+RR2jsB5/PR4o9cSrD0CBQ+Deo18au7HngD4aapz8uN5s wNrIqMOeMKLHkGPs6aTOR9HucmlEVNvLYIYwIWk+dcPCMXefe5E35RhttGIciUVbUY7R w0mJd6ufoGcywW0DjWwpcn1mICnTQ7g9bhZpqe8Uw6i+m7KAsSDOvfNer0KNkWMFmjxy Tz9cgFFhelwwDFL8Banrz9p9aK/Z7NLsgIRfpHDyQRvGg/VJqaFDWl9jXElVKKXXe6e4 36kQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Bpyge4k8Iz/MW6vpPqOyXsMz3UoNxf4ygGN/PrDN23s=; b=XX/RVqlEWO8FBgd8Wqa82e7Xy3+8dSm2fRsM8kzuh+H+ErtsitpyCXf5wG+Z6OEU9F 2vZnMF8iwxRrgkgvHeyk3X/VCpSZIxMlQQKYgGuZTt4sJmSgpyciuWP8ZoRBA2Ek6FLV 4jcjGefPQQza0RXAqaMR5ABz9ma/pjzCs5b2kaGJZZA9TG4eVcDYNjvaRluSvi6t8U5Y GgC0NBmlk6dCfw4cmRqwiK/GMeX0xf1WKahrjghejLG+ZOsa6n3rEGenk2lNYVUXIu+c 92Dm+1g2dUbRTeWjEsGCUlgCn08qNNx0qMfhmn4PwB6egconCHq076C2TI0tyWOiJvnd pCvg== X-Gm-Message-State: AGi0PuYxYJa/DqVm2RhM2S4hguKJTH39ePD9LT/CqLQnQLJeqlFZBaZr ylsEJyKVkdIAnDDGmaU2ewYwV7CA X-Google-Smtp-Source: APiQypKs1XralZ2xpuJEJsfyXQSt7ex/4mhrOaimKzrhLIPk2A27zZq8+qJo3Rovpcol1PZ3P4LfzQ== X-Received: by 2002:ac2:550e:: with SMTP id j14mr349553lfk.188.1586880890888; Tue, 14 Apr 2020 09:14:50 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-98-128-181-131.NA.cust.bahnhof.se. [98.128.181.131]) by smtp.gmail.com with ESMTPSA id a26sm9330669ljn.22.2020.04.14.09.14.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 14 Apr 2020 09:14:50 -0700 (PDT) From: Ulf Hansson To: linux-mmc@vger.kernel.org, Ulf Hansson Cc: Adrian Hunter , Linus Walleij , Rui Miguel Silva , Johan Hovold , Alex Elder , Greg Kroah-Hartman , =?utf-8?q?Jonathan_Neusch=C3=A4fer?= , Bruce Chang , Harald Welte , Alex Dubov , Sascha Sommer , Manivannan Sadhasivam , mirq-linux@rere.qmqm.pl, Jesper Nilsson , Lars Persson , Paul Cercueil , Ludovic Desroches , Nicolas Ferre , greybus-dev@lists.linaro.org Subject: [PATCH 19/19] staging: greybus: sdio: Respect the cmd->busy_timeout from the mmc core Date: Tue, 14 Apr 2020 18:14:13 +0200 Message-Id: <20200414161413.3036-20-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20200414161413.3036-1-ulf.hansson@linaro.org> References: <20200414161413.3036-1-ulf.hansson@linaro.org> MIME-Version: 1.0 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 --- drivers/staging/greybus/sdio.c | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) -- 2.20.1 Acked-by: Greg Kroah-Hartman 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;