Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2113909ioo; Mon, 23 May 2022 10:20:57 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyNwFZSnvRTaqIn0MDHyRrI3J9xe40UA5RGzvH9Ttofqcu1g5m4ZSL8KUU9r9ZNgO6f6wae X-Received: by 2002:a63:4f53:0:b0:3fa:7e31:ca73 with SMTP id p19-20020a634f53000000b003fa7e31ca73mr2897193pgl.123.1653326457048; Mon, 23 May 2022 10:20:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653326457; cv=none; d=google.com; s=arc-20160816; b=PN5C2Cz+hcD4kKRecScesmbq+CvNrATz5cxbmzBeab1NypcZPgdmEhqvWR9XA3VOXN J9y6xQLHcDljGLboBIke+8CDUDaqhmOlqkF5GlYu4ieh6FHugPeLzgHTTVc1Vc3iWfiK IpD/1m6p9Mvtjnii8D8yYdn5ORwMCsKQ9zicfF2LrfPKIdExANbrjMzmxcYHqElLuDp4 uhPSdtIQ3bnwwZcrBtbiSyjp8/7cPFjgGfrLokGTio7gbrGF28qdkQzRGMEtLYcXKF05 0DXAqASW5Fmd9/HZMwXLR0kaYfdvXJKwc3XyW23+tENxqylaJ3pAKjz6Rp+NXqefQwhW VnXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=2IGRe+5g8E+NKpidDopOZ5kJDoO36TnEij0gsHv+IYg=; b=me8TON2kInM7Su1YATyi5/17S0JMqhSsBIvI5mcFAIkEmaroESXF4VLCRq1fzjMIak D6QJOregh9/jFImYUOTqE1C75Kc7sT0+I5bN8Vroff/rlaWlxto32F7V36nG+RiCcSus qjWe+e/QcNqFTunnZR4gW3QfxLaUvyi1cUUdi4laNeib6oq1soGvKKt+jwVNLHGVueKk G1kuZHKrS9yw53Hm0W9LI7LjeIxNlNRsTHRXBIztLCejhusVf2jEFmu6tOzd1pcFoZ6w KYqhgiRO/yFv1sN+DxTBq5VNJvVL6Yk0rClHRJtRgQYq0qJDJcZH1lYUsgarKtd4Xuds flmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H67gd2Qq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id b26-20020a631b1a000000b003c2699c8074si11295446pgb.563.2022.05.23.10.20.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:20:57 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=H67gd2Qq; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 9653184A21; Mon, 23 May 2022 10:20:38 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239930AbiEWRSI (ORCPT + 99 others); Mon, 23 May 2022 13:18:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34330 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240085AbiEWROn (ORCPT ); Mon, 23 May 2022 13:14:43 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [IPv6:2604:1380:4601:e00::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0EF20DEBF; Mon, 23 May 2022 10:12:34 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id 5DC63B811F6; Mon, 23 May 2022 17:12:34 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B9820C385AA; Mon, 23 May 2022 17:12:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325953; bh=0bHuKlaZyD4pTHB6Ty/v9KNYAtL/A59eG8fgVGdQav4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=H67gd2QqLOy/zoVHP6UqEWGPKGFTY3XZmzR+Aq3MOWofr+Q6+ELEhVaoBM4yhgum6 BTPoNPORnAmsNBvJKYJvfkbCJaFtY+dx8gFIo812eUr0YjvoMHVmxf6RNJovSh/7b1 vefUFlcnZWB8Wft+4JnHy9+FzTcxMM2Os9yVFjd0= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Ulf Hansson , Florian Fainelli Subject: [PATCH 5.4 21/68] mmc: core: Default to generic_cmd6_time as timeout in __mmc_switch() Date: Mon, 23 May 2022 19:04:48 +0200 Message-Id: <20220523165806.139716938@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165802.500642349@linuxfoundation.org> References: <20220523165802.500642349@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.6 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Ulf Hansson commit 533a6cfe08f96a7b5c65e06d20916d552c11b256 upstream All callers of __mmc_switch() should now be specifying a valid timeout for the CMD6 command. However, just to be sure, let's print a warning and default to use the generic_cmd6_time in case the provided timeout_ms argument is zero. In this context, let's also simplify some of the corresponding code and clarify some related comments. Signed-off-by: Ulf Hansson Link: https://lore.kernel.org/r/20200122142747.5690-4-ulf.hansson@linaro.org Signed-off-by: Florian Fainelli Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/mmc_ops.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -460,10 +460,6 @@ static int mmc_poll_for_busy(struct mmc_ bool expired = false; bool busy = false; - /* We have an unspecified cmd timeout, use the fallback value. */ - if (!timeout_ms) - timeout_ms = MMC_OPS_TIMEOUT_MS; - /* * In cases when not allowed to poll by using CMD13 or because we aren't * capable of polling by using ->card_busy(), then rely on waiting the @@ -536,6 +532,12 @@ int __mmc_switch(struct mmc_card *card, mmc_retune_hold(host); + if (!timeout_ms) { + pr_warn("%s: unspecified timeout for CMD6 - use generic\n", + mmc_hostname(host)); + timeout_ms = card->ext_csd.generic_cmd6_time; + } + /* * If the cmd timeout and the max_busy_timeout of the host are both * specified, let's validate them. A failure means we need to prevent @@ -544,7 +546,7 @@ int __mmc_switch(struct mmc_card *card, * which also means they are on their own when it comes to deal with the * busy timeout. */ - if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && timeout_ms && + if (!(host->caps & MMC_CAP_NEED_RSP_BUSY) && host->max_busy_timeout && (timeout_ms > host->max_busy_timeout)) use_r1b_resp = false; @@ -556,10 +558,6 @@ int __mmc_switch(struct mmc_card *card, cmd.flags = MMC_CMD_AC; if (use_r1b_resp) { cmd.flags |= MMC_RSP_SPI_R1B | MMC_RSP_R1B; - /* - * A busy_timeout of zero means the host can decide to use - * whatever value it finds suitable. - */ cmd.busy_timeout = timeout_ms; } else { cmd.flags |= MMC_RSP_SPI_R1 | MMC_RSP_R1;