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>
---
drivers/mmc/core/block.c | 8 ++++----
drivers/mmc/core/core.c | 3 ++-
2 files changed, 6 insertions(+), 5 deletions(-)
diff --git a/drivers/mmc/core/block.c b/drivers/mmc/core/block.c
index db8c99c..5032f7a 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 860378b..29e80e5 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 */
--
2.7.4