mmc: core: Replace the hard-coded shift value 9 with SECTOR_SHIFT

These shift-by-9 operations are for converting between bytes and sectors.
Use the SECTOR_SHIFT macro to improve code readability and maintainability.

No functional changes intended.

Signed-off-by: Shawn Lin <shawn.lin@rock-chips.com>
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
This commit is contained in:
Shawn Lin
2026-03-30 11:28:29 +08:00
committed by Ulf Hansson
parent 257373c25e
commit a38ad7e173
2 changed files with 6 additions and 5 deletions
+4 -4
View File
@@ -1458,7 +1458,7 @@ static void mmc_blk_data_prep(struct mmc_queue *mq, struct mmc_queue_req *mqrq,
* sectors can be read successfully.
*/
if (recovery_mode)
brq->data.blocks = queue_physical_block_size(mq->queue) >> 9;
brq->data.blocks = queue_physical_block_size(mq->queue) >> SECTOR_SHIFT;
/*
* Some controllers have HW issues while operating
@@ -1976,7 +1976,7 @@ static void mmc_blk_mq_rw_recovery(struct mmc_queue *mq, struct request *req)
}
if (rq_data_dir(req) == READ && brq->data.blocks >
queue_physical_block_size(mq->queue) >> 9) {
queue_physical_block_size(mq->queue) >> SECTOR_SHIFT) {
/* Read one (native) sector at a time */
mmc_blk_read_single(mq, req);
return;
@@ -3025,14 +3025,14 @@ static int mmc_blk_alloc_parts(struct mmc_card *card, struct mmc_blk_data *md)
*/
ret = mmc_blk_alloc_rpmb_part(card, md,
card->part[idx].part_cfg,
card->part[idx].size >> 9,
card->part[idx].size >> SECTOR_SHIFT,
card->part[idx].name);
if (ret)
return ret;
} else if (card->part[idx].size) {
ret = mmc_blk_alloc_part(card, md,
card->part[idx].part_cfg,
card->part[idx].size >> 9,
card->part[idx].size >> SECTOR_SHIFT,
card->part[idx].force_ro,
card->part[idx].name,
card->part[idx].area_type);
+2 -1
View File
@@ -97,7 +97,8 @@ static void mmc_should_fail_request(struct mmc_host *host,
return;
data->error = data_errors[get_random_u32_below(ARRAY_SIZE(data_errors))];
data->bytes_xfered = get_random_u32_below(data->bytes_xfered >> 9) << 9;
data->bytes_xfered = get_random_u32_below(data->bytes_xfered >> SECTOR_SHIFT)
<< SECTOR_SHIFT;
}
#else /* CONFIG_FAIL_MMC_REQUEST */