From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-10.3 required=3.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI,NICE_REPLY_A, SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id B2138C49EA2 for ; Mon, 21 Jun 2021 08:26:46 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 8878B60FDB for ; Mon, 21 Jun 2021 08:26:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229804AbhFUI27 (ORCPT ); Mon, 21 Jun 2021 04:28:59 -0400 Received: from mga12.intel.com ([192.55.52.136]:24002 "EHLO mga12.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229618AbhFUI2k (ORCPT ); Mon, 21 Jun 2021 04:28:40 -0400 IronPort-SDR: k39Vif9ptnWqPdHRLlgHmHUzRCFlTF2Kn+PtEAGpKxQ1abkS92lUeTUw/BJyO86XTpxOYm5lro gCmX2ZhfqrZA== X-IronPort-AV: E=McAfee;i="6200,9189,10021"; a="186493776" X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="186493776" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by fmsmga106.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 21 Jun 2021 01:26:13 -0700 IronPort-SDR: hxcA78INHdWfg4UQOQk1P94OI/FpiRdsDuOWMkTKM5iwIaKweeT3KVSPsGTz6324lAdY32Or/c JHBWRUV13H5A== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.83,289,1616482800"; d="scan'208";a="405551361" Received: from ahunter-desktop.fi.intel.com (HELO [10.237.72.79]) ([10.237.72.79]) by orsmga006.jf.intel.com with ESMTP; 21 Jun 2021 01:26:11 -0700 Subject: Re: [PATCH] mmc: disable tuning when checking card presence To: Wolfram Sang , Ulrich Hecht , Ulf Hansson , linux-mmc , Linux-Renesas , Yoshihiro Shimoda References: <20210618082317.58408-1-wsa+renesas@sang-engineering.com> <563832257.373371.1624260736936@webmail.strato.com> <5adc8601-23c7-4378-94e2-cb3641d9039c@intel.com> From: Adrian Hunter Organization: Intel Finland Oy, Registered Address: PL 281, 00181 Helsinki, Business Identity Code: 0357606 - 4, Domiciled in Helsinki Message-ID: Date: Mon, 21 Jun 2021 11:26:35 +0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Language: en-US Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-mmc@vger.kernel.org On 21/06/21 11:11 am, Wolfram Sang wrote: > On 21/06/21 10:54 am, Adrian Hunter wrote: >> On 21/06/21 10:32 am, Ulrich Hecht wrote: >>> >>>> On 06/21/2021 9:15 AM Adrian Hunter wrote: >>>> Can we clarify, is the only problem that the error message is confusing? >>> >>> AFAICT there are no ill effects of the retune failing apart from the error message. >>> >> >> So maybe the simplest thing to do is just amend the message: >> e.g. >> >> diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c >> index 4e52eb14198a..5cbf05e331c4 100644 >> --- a/drivers/mmc/core/core.c >> +++ b/drivers/mmc/core/core.c >> @@ -936,13 +936,22 @@ int mmc_execute_tuning(struct mmc_card *card) >> opcode = MMC_SEND_TUNING_BLOCK; >> >> err = host->ops->execute_tuning(host, opcode); >> - >> if (err) >> - pr_err("%s: tuning execution failed: %d\n", >> - mmc_hostname(host), err); >> - else >> - mmc_retune_enable(host); >> + goto out_err; >> + >> + mmc_retune_enable(host); >> >> + return 0; >> + >> +out_err: >> + if (mmc_card_is_removable(host)) { >> + if (err != -ENOMEDIUM) >> + pr_err("%s: tuning execution failed: %d (this is normal if card removed)\n", >> + mmc_hostname(host), err); > > Hmm, an error message saying "this is normal" doesn't look like a good > option to me. Can't we surpress the message somehow or even avoid tuning > somehow if the card is removed? Sorry, I can't look this up myself right > now, working on another task today. With the code above, if the host controller knows the card has been removed, it can return -ENOMEDIUM from ->execute_tuning() to suppress the message. Otherwise, you need to introduce a new card state or flag to indicate that the card may not be present, and use that to suppress the message. > >> + } else { >> + pr_err("%s: tuning execution failed: %d\n", >> + mmc_hostname(host), err); >> + } >> return err; >> } >> >> >> >