From nobody Sun Feb 8 01:30:44 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 45814C433FE for ; Mon, 23 May 2022 17:05:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239357AbiEWRFc (ORCPT ); Mon, 23 May 2022 13:05:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47736 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S239257AbiEWREx (ORCPT ); Mon, 23 May 2022 13:04:53 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A9E6D674C5; Mon, 23 May 2022 10:04:51 -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 dfw.source.kernel.org (Postfix) with ESMTPS id DD3E7614BB; Mon, 23 May 2022 17:04:50 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id E74E7C385A9; Mon, 23 May 2022 17:04:49 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325490; bh=1vNedQjfYeJf4gSkwmjMImK2i6aez+HKQrc2U7rc+6M=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=VN5GSvfiMJbyUtpdXUPlIxLCHopfeeZ3EO0Wl9UTuqqMmqvvcKgM4Khao9jXhYhop 1nlKjm9NFu3gTLMHEL8lCLvE5UFriZd4ylqoNC25HGKkiOvgvf+TOHcuiVy6/xeFRR VwGY3fL/OJTzjTPXjaP4GvbEwsNIJYHAjJKRY8fk= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Greg Kroah-Hartman , Ulf Hansson , Kamal Dasu , Florian Fainelli Subject: [PATCH 4.9 09/25] mmc: core: Default to generic_cmd6_time as timeout in __mmc_switch() Date: Mon, 23 May 2022 19:03:27 +0200 Message-Id: <20220523165746.295047581@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165743.398280407@linuxfoundation.org> References: <20220523165743.398280407@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Type: text/plain; charset="utf-8" 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: Kamal Dasu [kamal: Drop non-existent hunks in 4.9's __mmc_switch] Signed-off-by: Florian Fainelli Signed-off-by: Greg Kroah-Hartman --- drivers/mmc/core/mmc_ops.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -22,8 +22,6 @@ #include "host.h" #include "mmc_ops.h" =20 -#define MMC_OPS_TIMEOUT_MS (10 * 60 * 1000) /* 10 minute timeout */ - static const u8 tuning_blk_pattern_4bit[] =3D { 0xff, 0x0f, 0xff, 0x00, 0xff, 0xcc, 0xc3, 0xcc, 0xc3, 0x3c, 0xcc, 0xff, 0xfe, 0xff, 0xfe, 0xef, @@ -530,8 +528,11 @@ int __mmc_switch(struct mmc_card *card, ignore_crc =3D false; =20 /* We have an unspecified cmd timeout, use the fallback value. */ - if (!timeout_ms) - timeout_ms =3D MMC_OPS_TIMEOUT_MS; + if (!timeout_ms) { + pr_warn("%s: unspecified timeout for CMD6 - use generic\n", + mmc_hostname(host)); + timeout_ms =3D card->ext_csd.generic_cmd6_time; + } =20 /* Must check status to be sure of no errors. */ timeout =3D jiffies + msecs_to_jiffies(timeout_ms) + 1;