From: Shawn Lin Date: Mon, 30 Mar 2026 03:28:29 +0000 (+0800) Subject: mmc: core: Replace the hard-coded shift value 9 with SECTOR_SHIFT X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a38ad7e173bc68c54f7afae7f669a824e313b1bb;p=thirdparty%2Flinux.git 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 Signed-off-by: Ulf Hansson --- diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c index db8c99c73a617..5032f7a8ead06 100644 --- a/drivers/mmc/core/block.c +++ b/drivers/mmc/core/block.c @@ -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); diff --git a/drivers/mmc/core/core.c b/drivers/mmc/core/core.c index 860378bea557b..29e80e5f928e9 100644 --- a/drivers/mmc/core/core.c +++ b/drivers/mmc/core/core.c @@ -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 */