Skip to content

Commit b89d05f

Browse files
Wolfram Sangstorulf
authored andcommitted
mmc: rename mmc_can_trim() to mmc_card_can_trim()
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 <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Ulf Hansson <[email protected]>
1 parent e3df5ae commit b89d05f

File tree

6 files changed

+12
-14
lines changed

6 files changed

+12
-14
lines changed

drivers/mmc/core/block.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1284,7 +1284,7 @@ static void mmc_blk_issue_secdiscard_rq(struct mmc_queue *mq,
12841284
from = blk_rq_pos(req);
12851285
nr = blk_rq_sectors(req);
12861286

1287-
if (mmc_can_trim(card) && !mmc_erase_group_aligned(card, from, nr))
1287+
if (mmc_card_can_trim(card) && !mmc_erase_group_aligned(card, from, nr))
12881288
arg = MMC_SECURE_TRIM1_ARG;
12891289
else
12901290
arg = MMC_SECURE_ERASE_ARG;

drivers/mmc/core/core.c

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1843,14 +1843,12 @@ bool mmc_card_can_erase(struct mmc_card *card)
18431843
}
18441844
EXPORT_SYMBOL(mmc_card_can_erase);
18451845

1846-
int mmc_can_trim(struct mmc_card *card)
1846+
bool mmc_card_can_trim(struct mmc_card *card)
18471847
{
1848-
if ((card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) &&
1849-
(!(card->quirks & MMC_QUIRK_TRIM_BROKEN)))
1850-
return 1;
1851-
return 0;
1848+
return ((card->ext_csd.sec_feature_support & EXT_CSD_SEC_GB_CL_EN) &&
1849+
(!(card->quirks & MMC_QUIRK_TRIM_BROKEN)));
18521850
}
1853-
EXPORT_SYMBOL(mmc_can_trim);
1851+
EXPORT_SYMBOL(mmc_card_can_trim);
18541852

18551853
bool mmc_card_can_discard(struct mmc_card *card)
18561854
{
@@ -1864,7 +1862,7 @@ EXPORT_SYMBOL(mmc_card_can_discard);
18641862

18651863
bool mmc_card_can_sanitize(struct mmc_card *card)
18661864
{
1867-
if (!mmc_can_trim(card) && !mmc_card_can_erase(card))
1865+
if (!mmc_card_can_trim(card) && !mmc_card_can_erase(card))
18681866
return false;
18691867
if (card->ext_csd.sec_feature_support & EXT_CSD_SEC_SANITIZE)
18701868
return true;
@@ -1981,7 +1979,7 @@ unsigned int mmc_calc_max_discard(struct mmc_card *card)
19811979
return card->pref_erase;
19821980

19831981
max_discard = mmc_do_calc_max_discard(card, MMC_ERASE_ARG);
1984-
if (mmc_can_trim(card)) {
1982+
if (mmc_card_can_trim(card)) {
19851983
max_trim = mmc_do_calc_max_discard(card, MMC_TRIM_ARG);
19861984
if (max_trim < max_discard || max_discard == 0)
19871985
max_discard = max_trim;

drivers/mmc/core/core.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ int mmc_start_request(struct mmc_host *host, struct mmc_request *mrq);
119119

120120
int mmc_erase(struct mmc_card *card, sector_t from, unsigned int nr, unsigned int arg);
121121
bool mmc_card_can_erase(struct mmc_card *card);
122-
int mmc_can_trim(struct mmc_card *card);
122+
bool mmc_card_can_trim(struct mmc_card *card);
123123
bool mmc_card_can_discard(struct mmc_card *card);
124124
bool mmc_card_can_sanitize(struct mmc_card *card);
125125
bool mmc_card_can_secure_erase_trim(struct mmc_card *card);

drivers/mmc/core/mmc.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1806,7 +1806,7 @@ static int mmc_init_card(struct mmc_host *host, u32 ocr,
18061806
/* set erase_arg */
18071807
if (mmc_card_can_discard(card))
18081808
card->erase_arg = MMC_DISCARD_ARG;
1809-
else if (mmc_can_trim(card))
1809+
else if (mmc_card_can_trim(card))
18101810
card->erase_arg = MMC_TRIM_ARG;
18111811
else
18121812
card->erase_arg = MMC_ERASE_ARG;

drivers/mmc/core/mmc_test.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1746,7 +1746,7 @@ static int mmc_test_profile_trim_perf(struct mmc_test_card *test)
17461746
struct timespec64 ts1, ts2;
17471747
int ret;
17481748

1749-
if (!mmc_can_trim(test->card))
1749+
if (!mmc_card_can_trim(test->card))
17501750
return RESULT_UNSUP_CARD;
17511751

17521752
if (!mmc_card_can_erase(test->card))
@@ -1863,7 +1863,7 @@ static int mmc_test_profile_seq_trim_perf(struct mmc_test_card *test)
18631863
struct timespec64 ts1, ts2;
18641864
int ret;
18651865

1866-
if (!mmc_can_trim(test->card))
1866+
if (!mmc_card_can_trim(test->card))
18671867
return RESULT_UNSUP_CARD;
18681868

18691869
if (!mmc_card_can_erase(test->card))

drivers/mmc/core/queue.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ static void mmc_queue_setup_discard(struct mmc_card *card,
186186
lim->max_hw_discard_sectors = max_discard;
187187
if (mmc_card_can_secure_erase_trim(card))
188188
lim->max_secure_erase_sectors = max_discard;
189-
if (mmc_can_trim(card) && card->erased_byte == 0)
189+
if (mmc_card_can_trim(card) && card->erased_byte == 0)
190190
lim->max_write_zeroes_sectors = max_discard;
191191

192192
/* granularity must not be greater than max. discard */

0 commit comments

Comments
 (0)