]> git.ipfire.org Git - thirdparty/kernel/linux.git/commitdiff
mmc: core: Replace the hard-coded shift value 9 with SECTOR_SHIFT
authorShawn Lin <shawn.lin@rock-chips.com>
Mon, 30 Mar 2026 03:28:29 +0000 (11:28 +0800)
committerUlf Hansson <ulf.hansson@linaro.org>
Tue, 31 Mar 2026 10:41:31 +0000 (12:41 +0200)
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>
drivers/mmc/core/block.c
drivers/mmc/core/core.c

index db8c99c73a61739b35f94049a73e074d48e3c26d..5032f7a8ead0663a62f95942817381410d4d12a7 100644 (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);
index 860378bea557b306e7a931a94302060e96528f49..29e80e5f928e953b5f3914b3a9863a4dd89fac74 100644 (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 */