Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp396271lqh; Thu, 28 Mar 2024 05:39:20 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+mKsqwveFLMK5NTphQd5Z/3Lg1CNFW2P+kbltFXnurmPFnSF58bsBrNYBHQ7pVAMTHfFy3skNACCvkXmQo3iDierRy4Mi/JcuaFY/VQ== X-Google-Smtp-Source: AGHT+IEuDTjoO9hD7DAcpLHuc9qn2GfeRL0Wj9LsoTEuJ1ctTw6z3bn492+oGfArGvDvb87iApXI X-Received: by 2002:a17:907:1b1a:b0:a4e:253f:99ef with SMTP id mp26-20020a1709071b1a00b00a4e253f99efmr1141773ejc.46.1711629560150; Thu, 28 Mar 2024 05:39:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711629560; cv=pass; d=google.com; s=arc-20160816; b=O5u2oPd63gqOneFyrjDCbwRGS9UR7Zh0QgCulce83uPm8Bjl8cJvoEfr5o9A5Jh5PP QMbzU2IDCUnmRrWv/9bsqktuaT5K4aUDmJknr+8/RBcYkWdwU9177vsHbWiik/omEj9M /W6qalEgoWzNwNFQ0scS1/2V1mxOWTDnD2qxN2FKVF+RyRz6vJgqvtDmzEIvk7cOH/CK sTXb2q8FUE1rvmIiB4EujdkpYJQFrIpVtiG8x1f6H0kJ61A6LCwfOpOfOl1OaUMj6gOP ArGEZhz/sXwb2nRZLxJSPMGmaY2YpqZv7fpBfzdEgoC+vMYByYo4VkJYRqTvHivZle4n t8YA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :dkim-signature; bh=CbFZsO42nxYTcylJXM+AgVeR+gZ+Nokwozi7iOFo168=; fh=+01Xsx5IHHwZv5ih4nDwzeTFXrY+mSjUwe8JNQCjlUM=; b=BArmeUF52ig+F3snWs3iumPZOGu3GiHwXYQKSfIRZ6UrIqOS8zyn2EAT5iNz5awbrm rE39Tj62RFwiSXPZkaYrOjA0CnoHMaFlDBD23OeeGZmiRPUS529AG3cpzS5rOKx30uy2 zqOMjvn1+W2idKxXJJygg0xn8n1VUjFt7ZPukT50gEho/Ioty2VfGO4S5Pay8lcrfShq gprtW7j7dLfK86b9p3xXl8tjkVzNdTZ0DrNXCiHw8iFaxgWaVHFIBuDUaPJe6d0LLakp OkfG6dIor47/het1xi4QthkK42zvwLMb+GepCBtAgE5JFdWzHRyDLoLHtVg6f8u2k9CH ISxQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sCcqPo2h; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-122899-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122899-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id sh17-20020a1709076e9100b00a4e26c44b4asi322290ejc.98.2024.03.28.05.39.20 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 05:39:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-122899-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sCcqPo2h; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-122899-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-122899-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id DD4B31F24E93 for ; Thu, 28 Mar 2024 12:39:19 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 21F1B7F489; Thu, 28 Mar 2024 12:39:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="sCcqPo2h" Received: from mail-yw1-f169.google.com (mail-yw1-f169.google.com [209.85.128.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id C970D7F46E for ; Thu, 28 Mar 2024 12:39:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.169 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711629543; cv=none; b=BHanyK6UpgjJiIjUMojYQCvi7+T2JMgakg9SQrHYnMx0aG4i+q1PttUrFGyDdEjbEp7gwVJ1ARphsPTjO46pJCZ591biibBP8YxLG6BovFbUGe5RoXBz7YTOWg3ufUQ2jx13T//4mlVoqiwCUP76FD2Y14hhjlVQMJ4vCO6x/P8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711629543; c=relaxed/simple; bh=i3zyUL1p+Drh++oy3h6WA7kTXggCpKM16wFE0I1SiNY=; h=MIME-Version:References:In-Reply-To:From:Date:Message-ID:Subject: To:Cc:Content-Type; b=ZSLWBioXiaEo+eoU8ifVyeFzLQd8sRbR/rXe7An4DO51KmWDXTG1/bpaZWKS6z0egV+yqrBXuDsN5kL7iwjJATY36hKxOEdlz2Md2WsDF/YOK2B/6Z+QGTsYqD9cUufT1hG536r996ceefXGFmRq1NtMD8VYbj8Jdid+276IC3E= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=sCcqPo2h; arc=none smtp.client-ip=209.85.128.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Received: by mail-yw1-f169.google.com with SMTP id 00721157ae682-61424186a13so2174677b3.0 for ; Thu, 28 Mar 2024 05:39:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711629541; x=1712234341; darn=vger.kernel.org; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:from:to:cc:subject:date:message-id:reply-to; bh=CbFZsO42nxYTcylJXM+AgVeR+gZ+Nokwozi7iOFo168=; b=sCcqPo2h1PgNjicmUv1twnJ42ofd1MD/p8FdmKaf/eQEkBWp62jcfSAV/axFK7rww8 1xUxVFay/dEC0uqjyTHVzYC8cx8RBtl2g86e9LorJlAlJemagNaSlwjIDRQQ3Q9C51qE lmJAMI9vZACxxa7u6EngP8zgyOf2eM3nD7fRKqbJT49xi5Lwn4MKv+vnkMl4FXwAlqH7 yj2thN3RCBANMBmelwjeSLjU/yLMs7NOkA1WtFcYF4t1xwHnZuJqHSdOocnQge7DQD9D wQqVFJIyGpFgma0Mb3/kqbI1wm8QUPfPRQ8YTx+M6b0FrAqM6huic/sYVsXyQnCDTfeb EL2w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711629541; x=1712234341; h=cc:to:subject:message-id:date:from:in-reply-to:references :mime-version:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=CbFZsO42nxYTcylJXM+AgVeR+gZ+Nokwozi7iOFo168=; b=igT6iG2Dy2C/pbARvziPFqhP6MRU2lx+9Wl/KonXWltuevCSY3wpPJQ4Ryhkov9sE1 GvF8lPs4NRsQNtbh7bYCoxWVNglTPP7V/TSUof7mbZQ4r8d4NG1gJIrvQMiu3lRwWABe UeWxg5wfwa4tuNlPtPVwAEna2Xhr1Kb4CdSpyujscwbr2D/ApuZ4bJTqVasulqY5gUiW l2woT0sVJva35nbIqryli3zQdrWI2gsQ0Ukc/TWdbFT6MPhDneBqXx9yvZW/2C5e89Id 2E+u+CjWgCRKAEkuTuSNMJS/CqZEOpPOhzS/mebrUKzecJZt2bmixJ1HxJXRM1+Etf2d SqSQ== X-Forwarded-Encrypted: i=1; AJvYcCVmktZ2FAbJnAmgNUkWDocPZfOEr0pOJt+uSyfazr/oH4+JqEaoB8x626ZAr3JvnBFeiCFDZjLQdRbHjcPU+ZbUvjBZc4js227sAmor X-Gm-Message-State: AOJu0YxyYTn4+oaWx5BGnIeN3ragyr0BZKVJx/Bzap6jPnbDL4YJiz/E OAAevFMpqEgkbRXBqJmu901ZQMhrfKUAi1Iiif/mIFBUjhqMItRYsB4t1T8X97IHU4mY4LnYzQl 2C6qy/3TKWHAehWrWgY9CD4EoSv6/c/0Qlefy9g== X-Received: by 2002:a25:bed1:0:b0:dc6:d22e:ef4c with SMTP id k17-20020a25bed1000000b00dc6d22eef4cmr2625248ybm.17.1711629540724; Thu, 28 Mar 2024 05:39:00 -0700 (PDT) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 References: <20240327024545.138351-1-ricky_wu@realtek.com> In-Reply-To: <20240327024545.138351-1-ricky_wu@realtek.com> From: Ulf Hansson Date: Thu, 28 Mar 2024 13:38:24 +0100 Message-ID: Subject: Re: [PATCH] mmc: core: resume not check card exist before powerup To: Ricky Wu Cc: wenchao.chen@unisoc.com, ricardo@marliere.net, marex@denx.de, linux-mmc@vger.kernel.org, linux-kernel@vger.kernel.org Content-Type: text/plain; charset="UTF-8" On Wed, 27 Mar 2024 at 03:46, Ricky Wu wrote: > > _mmc_sd_resume > add get_cd before call powerup, make sure the card exist Please elaborate more on what problem you are trying to solve, the above doesn't make much sense to me, sorry. Yes, the card may be removed while the system is suspended. Then, even if ->get_cd() indicates that there is no card inserted in the SD-card-slot, we may still have the card being registered - and then we need to unregister it. That said, we need to call mmc_power_up() in order to try to communicate with the card again. At least that is what the mmc_rescan() work assumes when it runs the bus_ops->detect() callback at some point later in time. > > Signed-off-by: Ricky Wu > --- > drivers/mmc/core/sd.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/mmc/core/sd.c b/drivers/mmc/core/sd.c > index 1c8148cdda50..35e036672cfb 100644 > --- a/drivers/mmc/core/sd.c > +++ b/drivers/mmc/core/sd.c > @@ -1750,6 +1750,9 @@ static int _mmc_sd_resume(struct mmc_host *host) > if (!mmc_card_suspended(host->card)) > goto out; > > + if (host->ops->get_cd && !host->ops->get_cd(host)) > + goto out; > + > mmc_power_up(host, host->card->ocr); > err = mmc_sd_init_card(host, host->card->ocr, host->card); > mmc_card_clr_suspended(host->card); > -- > 2.25.1 > Kind regards Uffe