From: Christoph Hellwig Date: Mon, 23 Nov 2020 15:38:15 +0000 (+0100) Subject: block: simplify part_to_disk X-Git-Tag: v5.15~2163^2~45 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=c64dc3bd87097e7f08b9437819440f8bfddef995;p=platform%2Fkernel%2Flinux-starfive.git block: simplify part_to_disk Now that struct hd_struct has a block_device pointer use that to find the disk. Signed-off-by: Christoph Hellwig Reviewed-by: Jan Kara Reviewed-by: Hannes Reinecke Acked-by: Tejun Heo Signed-off-by: Jens Axboe --- diff --git a/include/linux/genhd.h b/include/linux/genhd.h index 42a5165..6ba91ee 100644 --- a/include/linux/genhd.h +++ b/include/linux/genhd.h @@ -218,13 +218,9 @@ struct gendisk { static inline struct gendisk *part_to_disk(struct hd_struct *part) { - if (likely(part)) { - if (part->partno) - return dev_to_disk(part_to_dev(part)->parent); - else - return dev_to_disk(part_to_dev(part)); - } - return NULL; + if (unlikely(!part)) + return NULL; + return part->bdev->bd_disk; } static inline int disk_max_parts(struct gendisk *disk)