Having a non-const cdev parameter for cdev_get_block_device() limits its use as a user may want to just read struct block_device members without change. Allow this by changing parameter to be pointer to const instead. Signed-off-by: Ahmad Fatoum <a.fatoum@xxxxxxxxxxxxxx> --- common/block.c | 2 +- include/block.h | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/common/block.c b/common/block.c index 19bb81df2c3d..6290a45b7c46 100644 --- a/common/block.c +++ b/common/block.c @@ -361,7 +361,7 @@ static struct cdev_operations block_ops = { .discard_range = block_op_discard_range, }; -struct block_device *cdev_get_block_device(struct cdev *cdev) +struct block_device *cdev_get_block_device(const struct cdev *cdev) { if (!cdev || cdev->ops != &block_ops) return NULL; diff --git a/include/block.h b/include/block.h index 1fb40e942f9f..8740a03d36bc 100644 --- a/include/block.h +++ b/include/block.h @@ -50,9 +50,9 @@ static inline int block_flush(struct block_device *blk) } #ifdef CONFIG_BLOCK -struct block_device *cdev_get_block_device(struct cdev *cdev); +struct block_device *cdev_get_block_device(const struct cdev *cdev); #else -static inline struct block_device *cdev_get_block_device(struct cdev *cdev) +static inline struct block_device *cdev_get_block_device(const struct cdev *cdev) { return NULL; } -- 2.30.2