From patchwork Tue Apr 1 09:58:37 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 14034623 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 291B7CA4B for ; Tue, 1 Apr 2025 09:58:53 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501538; cv=none; b=uTTYnxb5e8+wwta8g0XApvtd69in89LlVzT5kA1gwtu1c16dqirvrB7Hal0cgpKeykdWVJXDNh86lQvNQfgtv5GGhH9CS2XeuCJMBJFn+G+K6U960+E/bkAJTEIsGPeI8KFYMc1ro0umSQ/iqSOU2pn0iRkweMNCRmqHIMIuZaE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501538; c=relaxed/simple; bh=mPJO6QTVDs2HHCs1zYsQto5PWuYgzYGx3YkEbjfBJIU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=cPUWDY0f275sGW+JYZTxxtvGlVTPsACvSgF0rUR3AWKcOCe8EXAdQvxYHof1MUf74NDF1waIfcb6wROea2uOQ3b8uSuuxJklRBcivBOjzNhbHkhmqJVBLapSCOQOm/GuNwaNNzYRroc5FEYKxI0yhc/RVTVe9hMSDXS1L9I2V0U= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=I8Aj7cAS; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="I8Aj7cAS" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=A6GGo5SfyF7os/ufSOXGKUy76AprZB4EdSWMdvmwKl4=; b=I8Aj7c ASJ7MyfeJ+UawH2alddUC/o53WBiy1t5Q/VV4nf9qzUz+03SJNbema8AYeAqPamB LmhzCPdNmlZiKH9QDEGbzn5h+S/PvqT27LpDvFkxJyE3GvKNXPvyLNoZ57ZuyJ2K 5O0VNbhVPzHs9EQjLhKrXCrHqX8Y0zUVyJQEVhn0c+kFTNlowNi/DqDuwwrsXSus GatEJzoIRyD0xUSo+Zdu+sSbKEF9T5oiIeLYUr5qGZxvs7kCgUyiHG1CF/U54usq b/oSeiN7HcXBkrWKIHM4NkfZ0jpWCwj6LF0R5HZoktLC2jydBiragP4w5Y4bDMzG LINLI2ZapuNNUBIA== Received: (qmail 1558659 invoked from network); 1 Apr 2025 11:58:51 +0200 Received: by mail.zeus03.de with UTF8SMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 1 Apr 2025 11:58:51 +0200 X-UD-Smtp-Session: l3s3148p1@NoFxlbQxZK4gAwDPXwSgADIEZgbhJYA3 From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: Ulf Hansson Subject: [RFC PATCH 01/11] mmc: rename mmc_can_discard() to mmc_card_can_discard() Date: Tue, 1 Apr 2025 11:58:37 +0200 Message-ID: <20250401095847.29271-2-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> References: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang --- drivers/mmc/core/core.c | 8 +++----- drivers/mmc/core/core.h | 2 +- drivers/mmc/core/mmc.c | 2 +- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index ce08e0ea7fc1..8bc46ea370e8 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1854,17 +1854,15 @@ int mmc_can_trim(struct mmc_card *card) } EXPORT_SYMBOL(mmc_can_trim); -int mmc_can_discard(struct mmc_card *card) +bool mmc_card_can_discard(struct mmc_card *card) { /* * As there's no way to detect the discard support bit at v4.5 * use the s/w feature support filed. */ - if (card->ext_csd.feature_support & MMC_DISCARD_FEATURE) - return 1; - return 0; + return (card->ext_csd.feature_support & MMC_DISCARD_FEATURE); } -EXPORT_SYMBOL(mmc_can_discard); +EXPORT_SYMBOL(mmc_card_can_discard); int mmc_can_sanitize(struct mmc_card *card) { diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index fc9c066e6468..e88b64379ab0 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -120,7 +120,7 @@ int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq); int mmc_erase(struct mmc_card *card, sector_t from, unsigned int nr, unsigned int arg); int mmc_can_erase(struct mmc_card *card); int mmc_can_trim(struct mmc_card *card); -int mmc_can_discard(struct mmc_card *card); +bool mmc_card_can_discard(struct mmc_card *card); int mmc_can_sanitize(struct mmc_card *card); int mmc_can_secure_erase_trim(struct mmc_card *card); int mmc_erase_group_aligned(struct mmc_card *card, sector_t from, unsigned int nr); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index df5de69b981b..0bcad3ec8c83 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1804,7 +1804,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, } /* set erase_arg */ - if (mmc_can_discard(card)) + if (mmc_card_can_discard(card)) card->erase_arg = MMC_DISCARD_ARG; else if (mmc_can_trim(card)) card->erase_arg = MMC_TRIM_ARG; From patchwork Tue Apr 1 09:58:38 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 14034624 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B9D31EF38A for ; Tue, 1 Apr 2025 09:58:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501538; cv=none; b=OPctsENOiTyu0uB2EUyRIETXdWZUKJDC1jAtsqQ2wFV0ZNN4FWvOa9Ce0eiypR33ykzObJ41LajHkQwUnuVcRjR2hXtgRyqW7VumIKe2BTAf7+Yk3hD6+ykz9qxgty/I3JKjhuhOjfrQbTLwr1bbxf9uwWAOVkJA5PGRORxzBGY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501538; c=relaxed/simple; bh=nFiZdr3AHQKBKv2qvcfykmvEcL2vvtDhIVvXnD5oDao=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=AMyqpYoN6XqCibTCpkLVMedo1w4MkDfLxeHK9WNAayciyCnXwbi8JaAAfA0Uwufe4LoRSllgFL90S/HwNG9TlztAmRohsBIBwYHySjaI8S0oLagNaHLEUJLQoRRWCoj4dmk4mrtfGEzqKcP0OF0aaif1kn8m/DYFOPbDG/C0j18= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=ZkBRwyJ+; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="ZkBRwyJ+" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=1UtJX0sDNZWEFZN3DToVaBSMjOxgYGTgqEFR+p53C4s=; b=ZkBRwy J+IU1wxS2ug9agArRenh5v52fzPPp/Ti+U3N01HZQYmMlPONsVL9+gFxIh69lUU2 7589lz4ryARgmnABaK+V0DsJIv3sU/Oz4myfKTbd3ipfzlGDFOZVVAoVQBANJUIm 18STCTS/3w8ZYlsKfFGP96/aZV/b847LPEHWbRgrgyqBxYmHnAkrOBk3s7QTkdPz ydHDm1vvccj5ovbrISC5qfGTBSNXhzZIV17Ru+UPNy0Ad+psELXJpDmcK26Vq2Ag Nz1ZxcE9+OgJY8eSAa59hnfEpRShUZpLF/PVAJJgu9gzHOYemb+cPm2aFJMZ0Irr h5NhT+1O0ucsPvDQ== Received: (qmail 1558692 invoked from network); 1 Apr 2025 11:58:52 +0200 Received: by mail.zeus03.de with UTF8SMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 1 Apr 2025 11:58:52 +0200 X-UD-Smtp-Session: l3s3148p1@+T15lbQxMIIgAwDPXwSgADIEZgbhJYA3 From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: Ulf Hansson Subject: [RFC PATCH 02/11] mmc: rename mmc_can_erase() to mmc_card_can_erase() Date: Tue, 1 Apr 2025 11:58:38 +0200 Message-ID: <20250401095847.29271-3-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> References: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang --- drivers/mmc/core/block.c | 2 +- drivers/mmc/core/core.c | 10 ++++------ drivers/mmc/core/core.h | 2 +- drivers/mmc/core/mmc_test.c | 8 ++++---- drivers/mmc/core/queue.c | 2 +- 5 files changed, 11 insertions(+), 13 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 4830628510e6..e9213de4a9fe 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1220,7 +1220,7 @@ static void mmc_blk_issue_erase_rq(struct mmc_queue *mq, struct request *req, int err = 0; blk_status_t status = BLK_STS_OK; - if (!mmc_can_erase(card)) { + if (!mmc_card_can_erase(card)) { status = BLK_STS_NOTSUPP; goto fail; } diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 8bc46ea370e8..e7449d03f311 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1837,13 +1837,11 @@ int mmc_erase(struct mmc_card *card, sector_t from, unsigned int nr, } EXPORT_SYMBOL(mmc_erase); -int mmc_can_erase(struct mmc_card *card) +bool mmc_card_can_erase(struct mmc_card *card) { - if (card->csd.cmdclass & CCC_ERASE && card->erase_size) - return 1; - return 0; + return (card->csd.cmdclass & CCC_ERASE && card->erase_size); } -EXPORT_SYMBOL(mmc_can_erase); +EXPORT_SYMBOL(mmc_card_can_erase); int mmc_can_trim(struct mmc_card *card) { @@ -1866,7 +1864,7 @@ EXPORT_SYMBOL(mmc_card_can_discard); int mmc_can_sanitize(struct mmc_card *card) { - if (!mmc_can_trim(card) && !mmc_can_erase(card)) + if (!mmc_can_trim(card) && !mmc_card_can_erase(card)) return 0; if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) return 1; diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index e88b64379ab0..2e66d8321626 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -118,7 +118,7 @@ bool mmc_is_req_done(struct mmc_host *host, struct mmc_request *mrq); int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq); int mmc_erase(struct mmc_card *card, sector_t from, unsigned int nr, unsigned int arg); -int mmc_can_erase(struct mmc_card *card); +bool mmc_card_can_erase(struct mmc_card *card); int mmc_can_trim(struct mmc_card *card); bool mmc_card_can_discard(struct mmc_card *card); int mmc_can_sanitize(struct mmc_card *card); diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c index 4f4286b8e0f2..190ae178da84 100644 --- a/drivers/mmc/core/mmc_test.c +++ b/drivers/mmc/core/mmc_test.c @@ -1510,7 +1510,7 @@ static int mmc_test_area_erase(struct mmc_test_card *test) { struct mmc_test_area *t = &test->area; - if (!mmc_can_erase(test->card)) + if (!mmc_card_can_erase(test->card)) return 0; return mmc_erase(test->card, t->dev_addr, t->max_sz >> 9, @@ -1749,7 +1749,7 @@ static int mmc_test_profile_trim_perf(struct mmc_test_card *test) if (!mmc_can_trim(test->card)) return RESULT_UNSUP_CARD; - if (!mmc_can_erase(test->card)) + if (!mmc_card_can_erase(test->card)) return RESULT_UNSUP_HOST; for (sz = 512; sz < t->max_sz; sz <<= 1) { @@ -1866,7 +1866,7 @@ static int mmc_test_profile_seq_trim_perf(struct mmc_test_card *test) if (!mmc_can_trim(test->card)) return RESULT_UNSUP_CARD; - if (!mmc_can_erase(test->card)) + if (!mmc_card_can_erase(test->card)) return RESULT_UNSUP_HOST; for (sz = 512; sz <= t->max_sz; sz <<= 1) { @@ -2114,7 +2114,7 @@ static int mmc_test_rw_multiple(struct mmc_test_card *test, return 0; /* prepare test area */ - if (mmc_can_erase(test->card) && + if (mmc_card_can_erase(test->card) && tdata->prepare & MMC_TEST_PREP_ERASE) { ret = mmc_erase(test->card, dev_addr, size / 512, test->card->erase_arg); diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c index 3ba62f825b84..099fee86d088 100644 --- a/drivers/mmc/core/queue.c +++ b/drivers/mmc/core/queue.c @@ -352,7 +352,7 @@ static struct gendisk *mmc_alloc_disk(struct mmc_queue *mq, }; struct gendisk *disk; - if (mmc_can_erase(card)) + if (mmc_card_can_erase(card)) mmc_queue_setup_discard(card, &lim); lim.max_hw_sectors = min(host->max_blk_count, host->max_req_size / 512); From patchwork Tue Apr 1 09:58:39 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 14034627 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6BA2F1EFFAB for ; Tue, 1 Apr 2025 09:58:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501539; cv=none; b=qEH8NmQvZ83YiM70/PausfJBUjdy3YE6YXVQ4kjHt/vuufVD6CgXh8A8ZimWY1btF0+qYuugRmxtW97Vqh9SAvvyjfGQqBZkjbiPsqXwj51CmhkBbguz00yu17o+34cvcYF8Pyc5R3rtT03CNoDy2gr2iddAe+39xhKYem/CjC8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501539; c=relaxed/simple; bh=9HWFKM2ae0FnWnEOa6Z5Sm1pPIk1ZbCnpmjmTnE81kc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XZp04oA/DNs6zZlPwWSzoRR8945DjK+n6VdhVTGTYxTADoA5ohrRJYn9kdA1hBYNtqJZ/ufAD0FzCN/zOe8ZN7nmgBAdj+yOJ/ls3/jWeYmi1emMyC209rGogkC1EcX8F3yk+IbktGALMlcUKsTPxZz8NlgKBBWvEpT0vHOWDgw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=DtWMsWig; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="DtWMsWig" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=ePs0YSLtP6xSj65xIgWTtd65+7YiFf5tJg/EBjPox24=; b=DtWMsW ig0WXpigL39w7sf1Aw5ZIZXGPzFzor7am6i4cveAVHCfzszI9MWqDEivYyouJ5BA i0WdNPQmusDQWeprTVHeKZBeUNlpP7kEAuc+SO3ddYckA/aSRtSGIpYS9flpTTdI jt3bRikR6O5VUWT7HboqeQnC/A6GaPKdSNANfLaogQEe+NrNV9nUSIUuIsWMpMRL IrL1Ft6vbk9hizoiQziaUPBUT/UFuviOKi7mbWoYsVD+7V7OjAycfOOn3FWtlzz9 vA1+kyNWbc5VHJ1YA8H4aOgRneGxr2xSvhdPfpw6gvRoKNdjAb5RuFlHn5L6Uue6 9k0JZhVoRyeoh+Ng== Received: (qmail 1558722 invoked from network); 1 Apr 2025 11:58:52 +0200 Received: by mail.zeus03.de with UTF8SMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 1 Apr 2025 11:58:52 +0200 X-UD-Smtp-Session: l3s3148p1@aJOBlbQxOIIgAwDPXwSgADIEZgbhJYA3 From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: Ulf Hansson Subject: [RFC PATCH 03/11] mmc: rename mmc_can_ext_csd() to mmc_card_can_ext_csd() Date: Tue, 1 Apr 2025 11:58:39 +0200 Message-ID: <20250401095847.29271-4-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> References: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang --- drivers/mmc/core/mmc.c | 8 ++++---- drivers/mmc/core/mmc_ops.c | 4 ++-- drivers/mmc/core/mmc_ops.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 0bcad3ec8c83..2b63eb608489 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -680,7 +680,7 @@ static int mmc_read_ext_csd(struct mmc_card *card) u8 *ext_csd; int err; - if (!mmc_can_ext_csd(card)) + if (!mmc_card_can_ext_csd(card)) return 0; err = mmc_get_ext_csd(card, &ext_csd); @@ -959,7 +959,7 @@ static int mmc_select_powerclass(struct mmc_card *card) int err, ddr; /* Power class selection is supported for versions >= 4.0 */ - if (!mmc_can_ext_csd(card)) + if (!mmc_card_can_ext_csd(card)) return 0; bus_width = host->ios.bus_width; @@ -1022,7 +1022,7 @@ static int mmc_select_bus_width(struct mmc_card *card) unsigned idx, bus_width = 0; int err = 0; - if (!mmc_can_ext_csd(card) || + if (!mmc_card_can_ext_csd(card) || !(host->caps & (MMC_CAP_4_BIT_DATA | MMC_CAP_8_BIT_DATA))) return 0; @@ -1543,7 +1543,7 @@ static int mmc_select_timing(struct mmc_card *card) { int err = 0; - if (!mmc_can_ext_csd(card)) + if (!mmc_card_can_ext_csd(card)) goto bus_speed; if (card->mmc_avail_type & EXT_CSD_CARD_TYPE_HS400ES) { diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 5c8e62e8f331..638e87a861bc 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -383,7 +383,7 @@ int mmc_get_ext_csd(struct mmc_card *card, u8 **new_ext_csd) if (!card || !new_ext_csd) return -EINVAL; - if (!mmc_can_ext_csd(card)) + if (!mmc_card_can_ext_csd(card)) return -EOPNOTSUPP; /* @@ -944,7 +944,7 @@ static int mmc_interrupt_hpi(struct mmc_card *card) return err; } -int mmc_can_ext_csd(struct mmc_card *card) +bool mmc_card_can_ext_csd(struct mmc_card *card) { return (card && card->csd.mmca_vsn > CSD_SPEC_VER_3); } diff --git a/drivers/mmc/core/mmc_ops.h b/drivers/mmc/core/mmc_ops.h index 0df3ebd900d1..514c40ff4b4e 100644 --- a/drivers/mmc/core/mmc_ops.h +++ b/drivers/mmc/core/mmc_ops.h @@ -37,7 +37,7 @@ int mmc_send_cid(struct mmc_host *host, u32 *cid); int mmc_spi_read_ocr(struct mmc_host *host, int highcap, u32 *ocrp); int mmc_spi_set_crc(struct mmc_host *host, int use_crc); int mmc_bus_test(struct mmc_card *card, u8 bus_width); -int mmc_can_ext_csd(struct mmc_card *card); +bool mmc_card_can_ext_csd(struct mmc_card *card); int mmc_switch_status(struct mmc_card *card, bool crc_err_fatal); bool mmc_prepare_busy_cmd(struct mmc_host *host, struct mmc_command *cmd, unsigned int timeout_ms); From patchwork Tue Apr 1 09:58:40 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 14034621 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 889A01EFFAE for ; Tue, 1 Apr 2025 09:58:54 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501538; cv=none; b=UePlvVTolQDSg9CVxTwkPnf9vlHDsQXoR05nz0u5UIozdQLbOdkhghHt6VMOQJcMqpt0ier8VzGr+EZ69tEeGG0i25WzJewdQK7jiqZWUThywP1NgAYlbN0tNvXuFWonGxjhyVteAKX9KAYBJvLRfkFixljCacJJVd3BElFns60= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501538; c=relaxed/simple; bh=n0C8AyKo3KFN9TTI5kEm9Fer4f9eTnrwjK7U2XfyK5o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qaT2MiJJcFuZMBhWE/fpZXw1noe/sCgaPgPY8rbB5vBvWYn/Fu8T9/zFMe1W7q0MukuKpDbrfkhojy91Ob6OHGx3SAlawlLVHa9FKcDI34gRRR60Byc204QiPe+eTxzDKHbmnBrOWQx8JjrWOH1YuvT9fHxIyqeNTkPIR2PqLeY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=D7Mrl6M7; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="D7Mrl6M7" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=OajYp0iDsNfE5s7SE7buXINIqcruT/MezuYRuFQzqZo=; b=D7Mrl6 M73ciC9tKexAFqXYvOF50yD7OdIaO2Nlq4GrRLPufI++CdHAbTMf9eTB0XH2Bq1o w6QZx+LfD4h9MGHiIFzXfKZGDL+hrFuSM6PnqTsj9Rub8jh4FZnjideBsbYTtHdj Or7yfzlBQ3ulBmhiGfermmfu+lMgXI6Tmpge4V6vchu8eEgFAI0J/9q4K3Wojmpu yVOpDGRo4iF3+BHJ6wL0NcOxpe+nQjwPrF1QzBuNv3FwcsEmxZT0nS2SbyKywqxf S5cyjRPb4hIMNNncsLhbhzIzh08dAiYmhq9Il20RsojzoeTGHWj0J7uSS068xxRr 3jZCGxB0qMYjDfmw== Received: (qmail 1558739 invoked from network); 1 Apr 2025 11:58:53 +0200 Received: by mail.zeus03.de with UTF8SMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 1 Apr 2025 11:58:53 +0200 X-UD-Smtp-Session: l3s3148p1@r6uJlbQxPoIgAwDPXwSgADIEZgbhJYA3 From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: Ulf Hansson Subject: [RFC PATCH 04/11] mmc: rename mmc_can_poweroff_notify() to mmc_card_can_poweroff_notify() Date: Tue, 1 Apr 2025 11:58:40 +0200 Message-ID: <20250401095847.29271-5-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> References: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Signed-off-by: Wolfram Sang --- drivers/mmc/core/mmc.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 2b63eb608489..8911b2206c45 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -2013,7 +2013,7 @@ static int mmc_sleep(struct mmc_host *host) return err; } -static bool mmc_can_poweroff_notify(const struct mmc_card *card) +static bool mmc_card_can_poweroff_notify(const struct mmc_card *card) { return card && mmc_card_mmc(card) && @@ -2137,7 +2137,7 @@ static int _mmc_suspend(struct mmc_host *host, enum mmc_poweroff_type pm_type) goto out; pr_info("%s: reason %d, may_notify %d\n", mmc_hostname(host), pm_type, mmc_may_poweroff_notify(host, pm_type)); - if (mmc_can_poweroff_notify(host->card) && + if (mmc_card_can_poweroff_notify(host->card) && mmc_may_poweroff_notify(host, pm_type)) err = mmc_poweroff_notify(host->card, notify_type); else if (mmc_can_sleep(host->card)) @@ -2217,7 +2217,7 @@ static int mmc_shutdown(struct mmc_host *host) * In a specific case for poweroff notify, we need to resume the card * before we can shutdown it properly. */ - if (mmc_can_poweroff_notify(host->card) && + if (mmc_card_can_poweroff_notify(host->card) && !mmc_may_poweroff_notify(host, MMC_POWEROFF_SUSPEND)) err = _mmc_resume(host); From patchwork Tue Apr 1 09:58:41 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 14034622 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 889481EFFAD for ; Tue, 1 Apr 2025 09:58:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501538; cv=none; b=l0m5PAD6/C48D9frFqPQZ2oH+68og+ghwfhV5WShUO/Yo5W4dy+b9nGrXlHzBdPFaNf+hs1O9YrKOBKQ0miagUPg446nztDeTWgZTVv40g6FH8/54QgmmgW3v5J3vwufxdYrt2HqD4OEQKRl7N7ni57xrX6JXwEJ0nAZaVMV8XU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501538; c=relaxed/simple; bh=6+5NhkHTOcoMGPS2xi4K6NqovhNCM2vGbbFlnV/BG1s=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QdPCCJ7MH0WmtRRvPSrROGQbUm+1GLhveKkY1v28fBibILohh5SOEQhAfioxhGTnHTtTD8xr9cUb8mErmivWUkIwHrSE5buXpW2ohjUfyU1IQ8EJZl+vaMbnyfWpirSOZGliHQ/QfHg+95hWHnQp7YA7se5bQu6YRL4C6m0kgvQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=awTDnN4M; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="awTDnN4M" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=9u0hzGZFnsDZygBVOxAig1nlvDZUfl9BQwidcgufXRI=; b=awTDnN 4MO6JqyjJtknm9xS3aqOodMZHm0dqXfh+fHtQToLLSF0OqpdMVzqe8RGo8VmTOCo Xd0tIZxsibG8HsMWx8XBvrBCSSKVBPoJobOOY+14mJGRyNuNT6/HqrOBln63nxl7 wD0ODIL0U2yhFhNeQUmFKCyRnoVW+rqr1qEYwlCBSmTZRYopHbURYcSakwUFbNEi wh+qjwt/U0bHs2BpHa2vfUjWIhqPtHUPsUPI8Ccc2n0ttzSuYv4MHsIfMHUT7tP5 j57LU4hMKO/3ae5QciCmlqH35qJd9yY0UUPo6cZZEgz+MEb9zEyo5cNsdIj/yaWu 09v8LL8d5mtQxGXQ== Received: (qmail 1558755 invoked from network); 1 Apr 2025 11:58:53 +0200 Received: by mail.zeus03.de with UTF8SMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 1 Apr 2025 11:58:53 +0200 X-UD-Smtp-Session: l3s3148p1@LqWRlbQxQoIgAwDPXwSgADIEZgbhJYA3 From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: Ulf Hansson Subject: [RFC PATCH 05/11] mmc: rename mmc_can_reset() to mmc_card_can_reset() Date: Tue, 1 Apr 2025 11:58:41 +0200 Message-ID: <20250401095847.29271-6-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> References: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Conversion was simplified by inverting the logic. Signed-off-by: Wolfram Sang --- drivers/mmc/core/mmc.c | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 8911b2206c45..8fde20ba3d95 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -2269,14 +2269,12 @@ static int mmc_runtime_resume(struct mmc_host *host) return 0; } -static int mmc_can_reset(struct mmc_card *card) +static bool mmc_card_can_reset(struct mmc_card *card) { u8 rst_n_function; rst_n_function = card->ext_csd.rst_n_function; - if ((rst_n_function & EXT_CSD_RST_N_EN_MASK) != EXT_CSD_RST_N_ENABLED) - return 0; - return 1; + return ((rst_n_function & EXT_CSD_RST_N_EN_MASK) == EXT_CSD_RST_N_ENABLED); } static int _mmc_hw_reset(struct mmc_host *host) @@ -2290,7 +2288,7 @@ static int _mmc_hw_reset(struct mmc_host *host) _mmc_flush_cache(host); if ((host->caps & MMC_CAP_HW_RESET) && host->ops->card_hw_reset && - mmc_can_reset(card)) { + mmc_card_can_reset(card)) { /* If the card accept RST_n signal, send it. */ mmc_set_clock(host, host->f_init); host->ops->card_hw_reset(host); From patchwork Tue Apr 1 09:58:42 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 14034628 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF6901EFFB2 for ; Tue, 1 Apr 2025 09:58:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501540; cv=none; b=c62yepwgNfAahog8+kXOLx423/8S/Gv1O/0wj9VucL0dQubPDRiuqS0D7Trk3/ZAX2L6h6H6iclcDwgsPF5KG3HhmAuQ0mu4ish273h3s+RXakjTzaOC2NJX0EgWTzbgmCapnu3hXvZrJSH2Knx61NnUeLt2oXmNPlFBOLvfdJ8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501540; c=relaxed/simple; bh=VMjZ2itBT5079vCh2i1l6OAKcdGdKMtRjw7L8zlN1EE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=kgdp9uDvQZ7Q8SpA4y0VTooDs+31qspKe185u2QYub5ygwL7ahsSGw+aWe9UE2chXmRWUvmt3rgrCn+6FZ19lCvk4usHqnEmObtcIUn6YrdyornCkhHzY3Iz2rmDEy8VjgTqJLq1SzHS8Rd6aqzI9nzIJ3U/bQlshCGChy/SzmM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=BozdZuAh; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="BozdZuAh" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=NlGGF6Ty2KBVMuK6zsEhXv+yBKpBK29ytnYhfAG2CFE=; b=BozdZu AhOE61IX+IRcQsaePmGay/SD1Cty4YQGnH0yWPWyDZsQaPMQqGgwaxK8Rqe+CPAS AkJTmPeXRDiSTj8k8H+F8aPkN4dWQbmBepZcm+pBZNIH7HbQV2vmR409GkljKZh9 QHT6S9DBWSTbfKXQKmZl6h+ejn4ZW0309Q5aVdlzJWAxotNQrOi5mTiS3RYENuiC su8GZ6+w/kVC+QzBvLsKd5Mg8mFjqq5qqpty3u+QYUCWAkKvAiBFAR9cu6owkJYe 5CqycKThd3WXmbbYqXXGGbVw1fKFMK2yUaU79ITqlBn9s0bMwaqW2e6rO0gukDPA o11+oVwJ9NCw1zUA== Received: (qmail 1558771 invoked from network); 1 Apr 2025 11:58:54 +0200 Received: by mail.zeus03.de with UTF8SMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 1 Apr 2025 11:58:54 +0200 X-UD-Smtp-Session: l3s3148p1@HVGZlbQxSoIgAwDPXwSgADIEZgbhJYA3 From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: Ulf Hansson Subject: [RFC PATCH 06/11] mmc: rename mmc_can_sanitize() to mmc_card_can_sanitize() Date: Tue, 1 Apr 2025 11:58:42 +0200 Message-ID: <20250401095847.29271-7-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> References: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang --- drivers/mmc/core/core.c | 8 ++++---- drivers/mmc/core/core.h | 2 +- drivers/mmc/core/mmc_ops.c | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index e7449d03f311..ff75336eb1ae 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1862,13 +1862,13 @@ bool mmc_card_can_discard(struct mmc_card *card) } EXPORT_SYMBOL(mmc_card_can_discard); -int mmc_can_sanitize(struct mmc_card *card) +bool mmc_card_can_sanitize(struct mmc_card *card) { if (!mmc_can_trim(card) && !mmc_card_can_erase(card)) - return 0; + return false; if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) - return 1; - return 0; + return true; + return false; } int mmc_can_secure_erase_trim(struct mmc_card *card) diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 2e66d8321626..1f194665499d 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -121,7 +121,7 @@ int mmc_erase(struct mmc_card *card, sector_t from, unsigned int nr, unsigned in bool mmc_card_can_erase(struct mmc_card *card); int mmc_can_trim(struct mmc_card *card); bool mmc_card_can_discard(struct mmc_card *card); -int mmc_can_sanitize(struct mmc_card *card); +bool mmc_card_can_sanitize(struct mmc_card *card); int mmc_can_secure_erase_trim(struct mmc_card *card); int mmc_erase_group_aligned(struct mmc_card *card, sector_t from, unsigned int nr); unsigned int mmc_calc_max_discard(struct mmc_card *card); diff --git a/drivers/mmc/core/mmc_ops.c b/drivers/mmc/core/mmc_ops.c index 638e87a861bc..66283825513c 100644 --- a/drivers/mmc/core/mmc_ops.c +++ b/drivers/mmc/core/mmc_ops.c @@ -1046,7 +1046,7 @@ int mmc_sanitize(struct mmc_card *card, unsigned int timeout_ms) struct mmc_host *host = card->host; int err; - if (!mmc_can_sanitize(card)) { + if (!mmc_card_can_sanitize(card)) { pr_warn("%s: Sanitize not supported\n", mmc_hostname(host)); return -EOPNOTSUPP; } From patchwork Tue Apr 1 09:58:43 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 14034626 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CF6301EFFB1 for ; Tue, 1 Apr 2025 09:58:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501538; cv=none; b=BoD+1xLAN0dY3Pm+XGc7qPjwbYFa55vTaxpBUErwxzFdSqGKge55eeiPrCGMCESGc67/8f2RehLaxBNEBS79jqAipxv6tlis0Vx28/iB8+IUb/v5j/fE+ZgN/5gFTG0grwKyqVVfSFEqSrUZdJT7rg1499gRDVSBgP7dHPFIqHc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501538; c=relaxed/simple; bh=3ZKlCOEWQtpdkwbgKLveQORg2dzTWV4nPNQ8or2JpXk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sJAP9xBwHCBDBJFcJ8TQc59/jjF9mggbT4QPav1iZYRmETP3fUNXsV0jx0og7uEmFinen7Laj56+35HDG8t3gXyUMiP/ifMySbHgt2pCZIbOyN5dVU8fAJrv80v/ab6GlmnNi3eXdkrMVX3IrgknNp5tnjSBJFMBOA0IYrI0/+I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=gjeHpHit; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="gjeHpHit" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=rWV1WR06mLN9WknO7nNc/ABQgKaP6y79DjPZRXHQc2A=; b=gjeHpH itDnRobp+imr8k2x3GGefDs4db7w2Ul8HNfwlX3/qFjiTN2WXM9Vh0UEpr76oGrF sDAl16EILFI3sFO6DOLP9qkAVgPWDwRkFdF2OUB6I0NZM8D/4HHgCfXizj7LW8Ik /jiWhwXILF+Kr2RlR0RJx4f4g6AkbvF1UySWt7zZET4ve9ciUHU0EkWKgZEWKMVo 611WB/i21tM4hkevCLJDL/keP1oBfVRVTNVTe9wvmyvI3slHDLOsN/BeLUAYZJOJ DIojEVfA9+ZV4wY+MloZ1IKaWhJNOX5A/wEXjn41jd0U8Y45ooOMlvSBiyWoKel/ UK0FtKsFeDa5JBeA== Received: (qmail 1558788 invoked from network); 1 Apr 2025 11:58:54 +0200 Received: by mail.zeus03.de with UTF8SMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 1 Apr 2025 11:58:54 +0200 X-UD-Smtp-Session: l3s3148p1@m0KhlbQxTIIgAwDPXwSgADIEZgbhJYA3 From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: Ulf Hansson Subject: [RFC PATCH 07/11] mmc: rename mmc_can_secure_erase_trim() to mmc_card_can_secure_erase_trim() Date: Tue, 1 Apr 2025 11:58:43 +0200 Message-ID: <20250401095847.29271-8-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> References: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang --- drivers/mmc/core/block.c | 2 +- drivers/mmc/core/core.c | 10 ++++------ drivers/mmc/core/core.h | 2 +- drivers/mmc/core/queue.c | 2 +- 4 files changed, 7 insertions(+), 9 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index e9213de4a9fe..02a11a757360 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1276,7 +1276,7 @@ static void mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, int err = 0, type = MMC_BLK_SECDISCARD; blk_status_t status = BLK_STS_OK; - if (!(mmc_can_secure_erase_trim(card))) { + if (!(mmc_card_can_secure_erase_trim(card))) { status = BLK_STS_NOTSUPP; goto out; } diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index ff75336eb1ae..f451903891a1 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1871,14 +1871,12 @@ bool mmc_card_can_sanitize(struct mmc_card *card) return false; } -int mmc_can_secure_erase_trim(struct mmc_card *card) +bool mmc_card_can_secure_erase_trim(struct mmc_card *card) { - if ((card->ext_csd.sec_feature_support & EXT_CSD_SEC_ER_EN) && - !(card->quirks & MMC_QUIRK_SEC_ERASE_TRIM_BROKEN)) - return 1; - return 0; + return ((card->ext_csd.sec_feature_support & EXT_CSD_SEC_ER_EN) && + !(card->quirks & MMC_QUIRK_SEC_ERASE_TRIM_BROKEN)); } -EXPORT_SYMBOL(mmc_can_secure_erase_trim); +EXPORT_SYMBOL(mmc_card_can_secure_erase_trim); int mmc_erase_group_aligned(struct mmc_card *card, sector_t from, unsigned int nr) diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 1f194665499d..3f7bd25e9557 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -122,7 +122,7 @@ bool mmc_card_can_erase(struct mmc_card *card); int mmc_can_trim(struct mmc_card *card); bool mmc_card_can_discard(struct mmc_card *card); bool mmc_card_can_sanitize(struct mmc_card *card); -int mmc_can_secure_erase_trim(struct mmc_card *card); +bool mmc_card_can_secure_erase_trim(struct mmc_card *card); int mmc_erase_group_aligned(struct mmc_card *card, sector_t from, unsigned int nr); unsigned int mmc_calc_max_discard(struct mmc_card *card); diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c index 099fee86d088..f65bf1717bbd 100644 --- a/drivers/mmc/core/queue.c +++ b/drivers/mmc/core/queue.c @@ -184,7 +184,7 @@ static void mmc_queue_setup_discard(struct mmc_card *card, return; lim->max_hw_discard_sectors = max_discard; - if (mmc_can_secure_erase_trim(card)) + if (mmc_card_can_secure_erase_trim(card)) lim->max_secure_erase_sectors = max_discard; if (mmc_can_trim(card) && card->erased_byte == 0) lim->max_write_zeroes_sectors = max_discard; From patchwork Tue Apr 1 09:58:44 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 14034629 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 744B41EFFB3 for ; Tue, 1 Apr 2025 09:58:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501540; cv=none; b=tnB1YloNFBzgEzOipZo8InToknRwa0tasSvFFh1LSe62AAFKj9OSSB+xnpAFBzDF6P1g88eigRpYTcrs6xKvyh99rmbjqre3dzWEzZGDQJzJWWcuHkCVa2hPBjsh9FVvtWLQ2dBzaXt8pytzROCON7p3fKyFGL22EeYQs9AY6jM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501540; c=relaxed/simple; bh=AfOBgpXXlyh+fO3e/6EvM+KIYoZUgmk3i2msn5750PE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fkF6gAJNXXsOYKnxLhCRlvR+U10V7J0jwTR9wJmH8BkRuqahiG2iJznK4CjTQS92/ePAxCLHkdsLxWdnLFmGnkKQya7nL4BaY79YLoPEOuLjCBEWrtwOO08qLL6+yH8BQfHfn/SZqOCbWfwtR5HUmGdgmNBm4g945mCt2c6Sof4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=jwQWjceH; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="jwQWjceH" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=dCX43o3nZTqlv5N0jxis+72e1fW1QqYX1lobgu58ju0=; b=jwQWjc eHpDjEgO7WTxaO66cxBIwckLmKu/4Pf6Hxly2jIxYxYE8ANR6s4h5fpqQ5Z+3hzg KUNmX/5tC4Xct3XLzZKhd6smGpt8k4KntIvCf9floyhSjvs1Q68ihoczCQ0EnQ6r ZoVs0n4YqLdeFXOcBUPFx/J5XJCzJUcE6ZywCmS6YuuZHEQhof1YyWBjJ1mDeFyq fUFXfWJOgOeWYbMW+PRV64ccKmrci3K0QlIiyp41rcv9+lji1FGolDXUZc5Eiem3 UqAWp5GotBFCrYN0OFmuVKCFYxvRy1Oh8leciGs9/jbx742JzTohp3XGjgmrIdX6 x5cLk5Yd5MinxiFQ== Received: (qmail 1558808 invoked from network); 1 Apr 2025 11:58:55 +0200 Received: by mail.zeus03.de with UTF8SMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 1 Apr 2025 11:58:55 +0200 X-UD-Smtp-Session: l3s3148p1@YR+qlbQxVIIgAwDPXwSgADIEZgbhJYA3 From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: Ulf Hansson Subject: [RFC PATCH 08/11] mmc: rename mmc_can_sleep() to mmc_card_can_sleep() Date: Tue, 1 Apr 2025 11:58:44 +0200 Message-ID: <20250401095847.29271-9-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> References: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang --- drivers/mmc/core/mmc.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 8fde20ba3d95..80bb0a68b037 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1955,7 +1955,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, return err; } -static int mmc_can_sleep(struct mmc_card *card) +static bool mmc_card_can_sleep(struct mmc_card *card) { return card->ext_csd.rev >= 3; } @@ -2140,7 +2140,7 @@ pr_info("%s: reason %d, may_notify %d\n", mmc_hostname(host), pm_type, mmc_may_p if (mmc_card_can_poweroff_notify(host->card) && mmc_may_poweroff_notify(host, pm_type)) err = mmc_poweroff_notify(host->card, notify_type); - else if (mmc_can_sleep(host->card)) + else if (mmc_card_can_sleep(host->card)) err = mmc_sleep(host); else if (!mmc_host_is_spi(host)) err = mmc_deselect_cards(host); From patchwork Tue Apr 1 09:58:45 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 14034630 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8738B1EFFB9 for ; Tue, 1 Apr 2025 09:58:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501540; cv=none; b=e7GwM834oW9k5OSkS18glk1h9llB1dWisYT8hSXLyq+lsPk4dwoHZetH/5of2+W+r6LCSey7ZZoVz9mU4pnncSy/FwmWCKUP4BTOG3c5Q8xYHv2sr8CXJvLtIzzc1HcfyisUC/fH6hL/Pl19FxxLp6RPR0WJEf7vnP/6JBm8TsQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501540; c=relaxed/simple; bh=1ndEXG+Fz7i1kj7ApEfdmFCuENrbuziGRLmJ2GiPWWc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=TOvri/3Z1MaEqOK+r90z7++B9sMdAJZvUcCxLprQLEchTtiV5bORXiWPe+rubBnbRfRDlXSheLTqaTkc0EyRQ494+SzHxk1jV9q81n9a009NWZQWMgNWAisNeO2g91TnBXpUE4hN9eSoT1eXHZsBo5N5tT8KCsRfHn+e4UdD+zM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=OMn+sb5Z; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="OMn+sb5Z" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=pVKyXLWp2yZfGHDW27WPPew2Z1HVOjtC8T8Tf0U/5UE=; b=OMn+sb 5ZVRH18pFDSyjhFAB6qcF7f196IOXdTm7jX0PHy/V2gpRlEyX3Tpy6kbK9bZNv2Z tyk33I0gIJw50D/WQl2uLUTm3mrUaxWG+sla3mMSrTm0uKGg4TyAW++iIJzjFCa+ uxsYSptUwSCGZqHAEQ5hW2kbhZkNs7Q63t31Ui5v/V2SzQVLgvQqCojrGci37NZa mhzzg13EULRZyK2t1C/wxrODtx6ki9h4tCzeZFpVHX+yiXRM75/3lO86SukhgXQF cc4oRrWIk+Pn7cXIlqHzjoUX87kbVrrlp3L5OR3i3v3W0FjQ25hCs92yWd9l7v+d Aw0ENvS/Co/Ye4RQ== Received: (qmail 1558824 invoked from network); 1 Apr 2025 11:58:55 +0200 Received: by mail.zeus03.de with UTF8SMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 1 Apr 2025 11:58:55 +0200 X-UD-Smtp-Session: l3s3148p1@uT2ylbQxVoIgAwDPXwSgADIEZgbhJYA3 From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: Ulf Hansson Subject: [RFC PATCH 09/11] mmc: rename mmc_can_trim() to mmc_card_can_trim() Date: Tue, 1 Apr 2025 11:58:45 +0200 Message-ID: <20250401095847.29271-10-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> References: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'card'. Also, convert to proper bool type while we are here. Signed-off-by: Wolfram Sang --- drivers/mmc/core/block.c | 2 +- drivers/mmc/core/core.c | 14 ++++++-------- drivers/mmc/core/core.h | 2 +- drivers/mmc/core/mmc.c | 2 +- drivers/mmc/core/mmc_test.c | 4 ++-- drivers/mmc/core/queue.c | 2 +- 6 files changed, 12 insertions(+), 14 deletions(-) diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index 02a11a757360..63320cc441c1 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -1284,7 +1284,7 @@ static void mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq, from = blk_rq_pos(req); nr = blk_rq_sectors(req); - if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr)) + if (mmc_card_can_trim(card) && !mmc_erase_group_aligned(card, from, nr)) arg = MMC_SECURE_TRIM1_ARG; else arg = MMC_SECURE_ERASE_ARG; diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index f451903891a1..a0e2dce70434 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -1843,14 +1843,12 @@ bool mmc_card_can_erase(struct mmc_card *card) } EXPORT_SYMBOL(mmc_card_can_erase); -int mmc_can_trim(struct mmc_card *card) +bool mmc_card_can_trim(struct mmc_card *card) { - if ((card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) && - (!(card->quirks & MMC_QUIRK_TRIM_BROKEN))) - return 1; - return 0; + return ((card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) && + (!(card->quirks & MMC_QUIRK_TRIM_BROKEN))); } -EXPORT_SYMBOL(mmc_can_trim); +EXPORT_SYMBOL(mmc_card_can_trim); bool mmc_card_can_discard(struct mmc_card *card) { @@ -1864,7 +1862,7 @@ EXPORT_SYMBOL(mmc_card_can_discard); bool mmc_card_can_sanitize(struct mmc_card *card) { - if (!mmc_can_trim(card) && !mmc_card_can_erase(card)) + if (!mmc_card_can_trim(card) && !mmc_card_can_erase(card)) return false; if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE) return true; @@ -1981,7 +1979,7 @@ unsigned int mmc_calc_max_discard(struct mmc_card *card) return card->pref_erase; max_discard = mmc_do_calc_max_discard(card, MMC_ERASE_ARG); - if (mmc_can_trim(card)) { + if (mmc_card_can_trim(card)) { max_trim = mmc_do_calc_max_discard(card, MMC_TRIM_ARG); if (max_trim < max_discard || max_discard == 0) max_discard = max_trim; diff --git a/drivers/mmc/core/core.h b/drivers/mmc/core/core.h index 3f7bd25e9557..622085cd766f 100644 --- a/drivers/mmc/core/core.h +++ b/drivers/mmc/core/core.h @@ -119,7 +119,7 @@ int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq); int mmc_erase(struct mmc_card *card, sector_t from, unsigned int nr, unsigned int arg); bool mmc_card_can_erase(struct mmc_card *card); -int mmc_can_trim(struct mmc_card *card); +bool mmc_card_can_trim(struct mmc_card *card); bool mmc_card_can_discard(struct mmc_card *card); bool mmc_card_can_sanitize(struct mmc_card *card); bool mmc_card_can_secure_erase_trim(struct mmc_card *card); diff --git a/drivers/mmc/core/mmc.c b/drivers/mmc/core/mmc.c index 80bb0a68b037..6bd6fed59b9d 100644 --- a/drivers/mmc/core/mmc.c +++ b/drivers/mmc/core/mmc.c @@ -1806,7 +1806,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr, /* set erase_arg */ if (mmc_card_can_discard(card)) card->erase_arg = MMC_DISCARD_ARG; - else if (mmc_can_trim(card)) + else if (mmc_card_can_trim(card)) card->erase_arg = MMC_TRIM_ARG; else card->erase_arg = MMC_ERASE_ARG; diff --git a/drivers/mmc/core/mmc_test.c b/drivers/mmc/core/mmc_test.c index 190ae178da84..be2d2895b4c4 100644 --- a/drivers/mmc/core/mmc_test.c +++ b/drivers/mmc/core/mmc_test.c @@ -1746,7 +1746,7 @@ static int mmc_test_profile_trim_perf(struct mmc_test_card *test) struct timespec64 ts1, ts2; int ret; - if (!mmc_can_trim(test->card)) + if (!mmc_card_can_trim(test->card)) return RESULT_UNSUP_CARD; if (!mmc_card_can_erase(test->card)) @@ -1863,7 +1863,7 @@ static int mmc_test_profile_seq_trim_perf(struct mmc_test_card *test) struct timespec64 ts1, ts2; int ret; - if (!mmc_can_trim(test->card)) + if (!mmc_card_can_trim(test->card)) return RESULT_UNSUP_CARD; if (!mmc_card_can_erase(test->card)) diff --git a/drivers/mmc/core/queue.c b/drivers/mmc/core/queue.c index f65bf1717bbd..284856c8f655 100644 --- a/drivers/mmc/core/queue.c +++ b/drivers/mmc/core/queue.c @@ -186,7 +186,7 @@ static void mmc_queue_setup_discard(struct mmc_card *card, lim->max_hw_discard_sectors = max_discard; if (mmc_card_can_secure_erase_trim(card)) lim->max_secure_erase_sectors = max_discard; - if (mmc_can_trim(card) && card->erased_byte == 0) + if (mmc_card_can_trim(card) && card->erased_byte == 0) lim->max_write_zeroes_sectors = max_discard; /* granularity must not be greater than max. discard */ From patchwork Tue Apr 1 09:58:46 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 14034631 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 87FD21EFFBF for ; Tue, 1 Apr 2025 09:58:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501540; cv=none; b=KNZbphDtb11uE2nlr+Jys8GXzqMvVdwHPuFPJqPY/3WFhgSx4OZZz2VtuzBNkFfPM3UuIpcS6sfQTNiC8gY5JRPOuiB7sORYbRm4tFFU5JhWCXpJy5D13Un5v0/Dqv5qz0GJ/tTYtt0pGwJXrObBnb3iwEvgEg/79sZGkTy851A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501540; c=relaxed/simple; bh=4MyBN7FIBxopeBKiwITGRdXVZW4wJ5oXni7JOtxJIy0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=qU7/7rtJ5E7m2uFqeNh7rrUcZkvjHiBJnXYNIN4CZCKoSUvmphqrWFERPgjmYdX/ur7FaTqdClz6hjVo6YWlG+T4c2AP5aacMKKiCjDTRhZxR0ZH4T07F312tvo5/NSkZ/cpNu+yLjvduiVl6cuiwWhY+QgMWn0CZYgNiOKrsPs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=jjRVlZlQ; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="jjRVlZlQ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=ChImba1yZvxWxDm9IGWpf6Bs0jfG5/oHLm9Gp6AUrMs=; b=jjRVlZ lQoN/WIDpGcQiE8nuGvlc6eQxvip0aosBXcEzprfUhVEx75PHd8KPpy8QgMqi3bU MCkD86TO58fSBEEI2RjXvHazBcep0rvYWPAhYZHnNVZWO52y+6m5sIfRDZLchP/F fxnE1bz69IQm4WAdmI61Jaf2+tFVbvFYAovlYcQhZRIpMuJUVST02+0YV/8vuBZm Q/N1OjQNZhXuWccJJy39mJCxqkrzwN7QMl+gUkA+d7VPP3/G/KfPhrMlGs8h6yfT hzsXFclQwTWrch+Cj59SrvEcMNwUEpm/OsfgBbtCK4bZpuA1lme6Y8yAB1lGO3T7 Dy0PeGNfKQVdmFbA== Received: (qmail 1558845 invoked from network); 1 Apr 2025 11:58:56 +0200 Received: by mail.zeus03.de with UTF8SMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 1 Apr 2025 11:58:56 +0200 X-UD-Smtp-Session: l3s3148p1@RFy6lbQxYoIgAwDPXwSgADIEZgbhJYA3 From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: Ulf Hansson Subject: [RFC PATCH 10/11] mmc: rename mmc_can_gpio_cd() to mmc_host_can_gpio_cd() Date: Tue, 1 Apr 2025 11:58:46 +0200 Message-ID: <20250401095847.29271-11-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> References: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'host'. Signed-off-by: Wolfram Sang --- drivers/mmc/core/slot-gpio.c | 4 ++-- drivers/mmc/host/dw_mmc.c | 6 +++--- drivers/mmc/host/mtk-sd.c | 2 +- drivers/mmc/host/sdhci.c | 4 ++-- drivers/mmc/host/sunplus-mmc.c | 2 +- drivers/mmc/host/tmio_mmc_core.c | 4 ++-- include/linux/mmc/slot-gpio.h | 2 +- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index 5fd455816393..82a933d86889 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c @@ -228,13 +228,13 @@ int mmc_gpiod_set_cd_config(struct mmc_host *host, unsigned long config) } EXPORT_SYMBOL(mmc_gpiod_set_cd_config); -bool mmc_can_gpio_cd(struct mmc_host *host) +bool mmc_host_can_gpio_cd(struct mmc_host *host) { struct mmc_gpio *ctx = host->slot.handler_priv; return ctx->cd_gpio ? true : false; } -EXPORT_SYMBOL(mmc_can_gpio_cd); +EXPORT_SYMBOL(mmc_host_can_gpio_cd); /** * mmc_gpiod_request_ro - request a gpio descriptor for write protection diff --git a/drivers/mmc/host/dw_mmc.c b/drivers/mmc/host/dw_mmc.c index bb596d169420..8b4d1a3cd178 100644 --- a/drivers/mmc/host/dw_mmc.c +++ b/drivers/mmc/host/dw_mmc.c @@ -3622,7 +3622,7 @@ int dw_mci_runtime_suspend(struct device *dev) clk_disable_unprepare(host->ciu_clk); if (host->slot && - (mmc_can_gpio_cd(host->slot->mmc) || + (mmc_host_can_gpio_cd(host->slot->mmc) || !mmc_card_is_removable(host->slot->mmc))) clk_disable_unprepare(host->biu_clk); @@ -3636,7 +3636,7 @@ int dw_mci_runtime_resume(struct device *dev) struct dw_mci *host = dev_get_drvdata(dev); if (host->slot && - (mmc_can_gpio_cd(host->slot->mmc) || + (mmc_host_can_gpio_cd(host->slot->mmc) || !mmc_card_is_removable(host->slot->mmc))) { ret = clk_prepare_enable(host->biu_clk); if (ret) @@ -3690,7 +3690,7 @@ int dw_mci_runtime_resume(struct device *dev) err: if (host->slot && - (mmc_can_gpio_cd(host->slot->mmc) || + (mmc_host_can_gpio_cd(host->slot->mmc) || !mmc_card_is_removable(host->slot->mmc))) clk_disable_unprepare(host->biu_clk); diff --git a/drivers/mmc/host/mtk-sd.c b/drivers/mmc/host/mtk-sd.c index 345ea91629e0..66da4d7dc550 100644 --- a/drivers/mmc/host/mtk-sd.c +++ b/drivers/mmc/host/mtk-sd.c @@ -2977,7 +2977,7 @@ static int msdc_drv_probe(struct platform_device *pdev) mmc->f_min = DIV_ROUND_UP(host->src_clk_freq, 4 * 4095); if (!(mmc->caps & MMC_CAP_NONREMOVABLE) && - !mmc_can_gpio_cd(mmc) && + !mmc_host_can_gpio_cd(mmc) && host->dev_comp->use_internal_cd) { /* * Is removable but no GPIO declared, so diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 5f91b44891f9..4bffec30c508 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -158,7 +158,7 @@ static void sdhci_set_card_detection(struct sdhci_host *host, bool enable) u32 present; if ((host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) || - !mmc_card_is_removable(host->mmc) || mmc_can_gpio_cd(host->mmc)) + !mmc_card_is_removable(host->mmc) || mmc_host_can_gpio_cd(host->mmc)) return; if (enable) { @@ -3744,7 +3744,7 @@ static bool sdhci_cd_irq_can_wakeup(struct sdhci_host *host) { return mmc_card_is_removable(host->mmc) && !(host->quirks & SDHCI_QUIRK_BROKEN_CARD_DETECTION) && - !mmc_can_gpio_cd(host->mmc); + !mmc_host_can_gpio_cd(host->mmc); } /* diff --git a/drivers/mmc/host/sunplus-mmc.c b/drivers/mmc/host/sunplus-mmc.c index 1cddea615a27..63279760239c 100644 --- a/drivers/mmc/host/sunplus-mmc.c +++ b/drivers/mmc/host/sunplus-mmc.c @@ -791,7 +791,7 @@ static int spmmc_get_cd(struct mmc_host *mmc) { int ret = 0; - if (mmc_can_gpio_cd(mmc)) + if (mmc_host_can_gpio_cd(mmc)) ret = mmc_gpio_get_cd(mmc); if (ret < 0) diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 04c1c54df791..569b66d3d47a 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1179,11 +1179,11 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) if (mmc_can_gpio_ro(mmc)) _host->ops.get_ro = mmc_gpio_get_ro; - if (mmc_can_gpio_cd(mmc)) + if (mmc_host_can_gpio_cd(mmc)) _host->ops.get_cd = mmc_gpio_get_cd; /* must be set before tmio_mmc_reset() */ - _host->native_hotplug = !(mmc_can_gpio_cd(mmc) || + _host->native_hotplug = !(mmc_host_can_gpio_cd(mmc) || mmc->caps & MMC_CAP_NEEDS_POLL || !mmc_card_is_removable(mmc)); diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h index 1ed7b0d1e4f9..4f6a46c636ec 100644 --- a/include/linux/mmc/slot-gpio.h +++ b/include/linux/mmc/slot-gpio.h @@ -24,7 +24,7 @@ int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id, int mmc_gpiod_set_cd_config(struct mmc_host *host, unsigned long config); int mmc_gpio_set_cd_wake(struct mmc_host *host, bool on); void mmc_gpiod_request_cd_irq(struct mmc_host *host); -bool mmc_can_gpio_cd(struct mmc_host *host); +bool mmc_host_can_gpio_cd(struct mmc_host *host); bool mmc_can_gpio_ro(struct mmc_host *host); #endif From patchwork Tue Apr 1 09:58:47 2025 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Wolfram Sang X-Patchwork-Id: 14034632 Received: from mail.zeus03.de (zeus03.de [194.117.254.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DC87C1EFFAE for ; Tue, 1 Apr 2025 09:58:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=194.117.254.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501540; cv=none; b=ZMTyShKps5M0jQ+t4wlkGxaSSPb96q3/g1yVocdVvmQXded06mMYiWpElE2+uUSwUAN5NRlj/RfFcd/sxrKdNHeH+rKbDk8LJhKZ/DVxMkDh6TPx/KHbf6YvvKKfaj1fIgOwHmXPIN+s8oVFBI8YwPc0cX3SBPolf+9H0ICtEIU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1743501540; c=relaxed/simple; bh=0udXzi5kRaCVtu2MSYN76N7YszYT1xQ1mAxssYbGmBQ=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=ClraKGaDuKgAWtd99Ia7OEJrDZY300y8K+M1v9PWEn6Qxn+Iyz0ijTGDVqpauxY1ex1smJx0GY/HGTLwngi9j8vzQ7FRpJYokpQQE8RmIKZqeutrlLi4L2ILvddvXd3m80cbaSGcX+fLjfs5jX9nc072JBRuYCryPwUgRbKOvfw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com; spf=pass smtp.mailfrom=sang-engineering.com; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b=iP/sPI+Y; arc=none smtp.client-ip=194.117.254.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=sang-engineering.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=sang-engineering.com header.i=@sang-engineering.com header.b="iP/sPI+Y" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= sang-engineering.com; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=k1; bh=4qRMpSzQPBAJjla67O8HOW3Ea2/Maln21vohn6Kf9p8=; b=iP/sPI +YiZ50n8xNJ/KpS2V9XJDjbVI6N+k0r06OwMrQB0qNQHYkRVza6vA4+P6rwMirUE 4aFXgQIKmcigeTUgP+5EQjREDT0JHEwT4sxzPdngTRSLJiV9pf/m6vguTynqc3IO SFTcT0xvMEoOmpJwgxGuJrPSaQN5p7cIX8zv3ZwmSZ04Uu/1qvnVniI57tzrjUbK 96fb8uyILBHMEvjPyKZgtljRWnU7dwvwKDxTk9Ucaq9HQRRLaCOpxpDi+ah0p9k1 oj571cFOV0+ZvYD28poGCRDsthJTxeRizYfM0ELRoxR/faldIvjM8yLYsTPVI4xB g9PQqCiovZlGhnyg== Received: (qmail 1558864 invoked from network); 1 Apr 2025 11:58:56 +0200 Received: by mail.zeus03.de with UTF8SMTPSA (TLS_AES_256_GCM_SHA384 encrypted, authenticated); 1 Apr 2025 11:58:56 +0200 X-UD-Smtp-Session: l3s3148p1@DCLClbQxZoIgAwDPXwSgADIEZgbhJYA3 From: Wolfram Sang To: linux-mmc@vger.kernel.org Cc: Ulf Hansson Subject: [RFC PATCH 11/11] mmc: rename mmc_can_gpio_ro() to mmc_host_can_gpio_ro() Date: Tue, 1 Apr 2025 11:58:47 +0200 Message-ID: <20250401095847.29271-12-wsa+renesas@sang-engineering.com> X-Mailer: git-send-email 2.47.2 In-Reply-To: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> References: <20250401095847.29271-1-wsa+renesas@sang-engineering.com> Precedence: bulk X-Mailing-List: linux-mmc@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 mmc_can_* functions sometimes relate to the card and sometimes to the host. Make it obvious by renaming this function to include 'host'. Signed-off-by: Wolfram Sang --- drivers/mmc/core/slot-gpio.c | 4 ++-- drivers/mmc/host/renesas_sdhi_core.c | 2 +- drivers/mmc/host/sdhci-omap.c | 2 +- drivers/mmc/host/sdhci.c | 2 +- drivers/mmc/host/tmio_mmc_core.c | 2 +- include/linux/mmc/slot-gpio.h | 2 +- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/mmc/core/slot-gpio.c b/drivers/mmc/core/slot-gpio.c index 82a933d86889..c5bc6268803e 100644 --- a/drivers/mmc/core/slot-gpio.c +++ b/drivers/mmc/core/slot-gpio.c @@ -275,10 +275,10 @@ int mmc_gpiod_request_ro(struct mmc_host *host, const char *con_id, } EXPORT_SYMBOL(mmc_gpiod_request_ro); -bool mmc_can_gpio_ro(struct mmc_host *host) +bool mmc_host_can_gpio_ro(struct mmc_host *host) { struct mmc_gpio *ctx = host->slot.handler_priv; return ctx->ro_gpio ? true : false; } -EXPORT_SYMBOL(mmc_can_gpio_ro); +EXPORT_SYMBOL(mmc_host_can_gpio_ro); diff --git a/drivers/mmc/host/renesas_sdhi_core.c b/drivers/mmc/host/renesas_sdhi_core.c index 4642fdb8bf65..c66dd85d33c5 100644 --- a/drivers/mmc/host/renesas_sdhi_core.c +++ b/drivers/mmc/host/renesas_sdhi_core.c @@ -1112,7 +1112,7 @@ int renesas_sdhi_probe(struct platform_device *pdev, host->mmc->caps2 &= ~(MMC_CAP2_HS400 | MMC_CAP2_HS400_ES); /* For some SoC, we disable internal WP. GPIO may override this */ - if (mmc_can_gpio_ro(host->mmc)) + if (mmc_host_can_gpio_ro(host->mmc)) mmc_data->capabilities2 &= ~MMC_CAP2_NO_WRITE_PROTECT; /* SDR speeds are only available on Gen2+ */ diff --git a/drivers/mmc/host/sdhci-omap.c b/drivers/mmc/host/sdhci-omap.c index 26a9a8b5682a..8897839ab2aa 100644 --- a/drivers/mmc/host/sdhci-omap.c +++ b/drivers/mmc/host/sdhci-omap.c @@ -1270,7 +1270,7 @@ static int sdhci_omap_probe(struct platform_device *pdev) mmc->f_max = 48000000; } - if (!mmc_can_gpio_ro(mmc)) + if (!mmc_host_can_gpio_ro(mmc)) mmc->caps2 |= MMC_CAP2_NO_WRITE_PROTECT; pltfm_host->clk = devm_clk_get(dev, "fck"); diff --git a/drivers/mmc/host/sdhci.c b/drivers/mmc/host/sdhci.c index 4bffec30c508..821cc916ad98 100644 --- a/drivers/mmc/host/sdhci.c +++ b/drivers/mmc/host/sdhci.c @@ -2571,7 +2571,7 @@ int sdhci_get_ro(struct mmc_host *mmc) is_readonly = 0; } else if (host->ops->get_ro) { is_readonly = host->ops->get_ro(host); - } else if (mmc_can_gpio_ro(mmc)) { + } else if (mmc_host_can_gpio_ro(mmc)) { is_readonly = mmc_gpio_get_ro(mmc); /* Do not invert twice */ allow_invert = !(mmc->caps2 & MMC_CAP2_RO_ACTIVE_HIGH); diff --git a/drivers/mmc/host/tmio_mmc_core.c b/drivers/mmc/host/tmio_mmc_core.c index 569b66d3d47a..b71241f55df5 100644 --- a/drivers/mmc/host/tmio_mmc_core.c +++ b/drivers/mmc/host/tmio_mmc_core.c @@ -1176,7 +1176,7 @@ int tmio_mmc_host_probe(struct tmio_mmc_host *_host) dma_max_mapping_size(&pdev->dev)); mmc->max_seg_size = mmc->max_req_size; - if (mmc_can_gpio_ro(mmc)) + if (mmc_host_can_gpio_ro(mmc)) _host->ops.get_ro = mmc_gpio_get_ro; if (mmc_host_can_gpio_cd(mmc)) diff --git a/include/linux/mmc/slot-gpio.h b/include/linux/mmc/slot-gpio.h index 4f6a46c636ec..23ac5696fa38 100644 --- a/include/linux/mmc/slot-gpio.h +++ b/include/linux/mmc/slot-gpio.h @@ -25,6 +25,6 @@ int mmc_gpiod_set_cd_config(struct mmc_host *host, unsigned long config); int mmc_gpio_set_cd_wake(struct mmc_host *host, bool on); void mmc_gpiod_request_cd_irq(struct mmc_host *host); bool mmc_host_can_gpio_cd(struct mmc_host *host); -bool mmc_can_gpio_ro(struct mmc_host *host); +bool mmc_host_can_gpio_ro(struct mmc_host *host); #endif