From: Matthew Wilcox (Oracle) Date: Wed, 18 May 2022 03:36:55 +0000 (-0400) Subject: block: Simplify read_part_sector() X-Git-Tag: baikal/mips/sdk6.1~5169^2~34 X-Git-Url: https://git.baikalelectronics.ru/?a=commitdiff_plain;h=0ece9b0903d59388631713e0f713a99638ab0e1c;p=kernel.git block: Simplify read_part_sector() That rather complicated expression is just trying to find the offset of this sector within a page, and there are easier ways to express that. Signed-off-by: Matthew Wilcox (Oracle) --- diff --git a/block/partitions/core.c b/block/partitions/core.c index a9a51bac42df8..52871fa224eeb 100644 --- a/block/partitions/core.c +++ b/block/partitions/core.c @@ -718,8 +718,7 @@ void *read_part_sector(struct parsed_partitions *state, sector_t n, Sector *p) goto out; p->v = page; - return (unsigned char *)page_address(page) + - ((n & ((1 << (PAGE_SHIFT - 9)) - 1)) << SECTOR_SHIFT); + return page_address(page) + offset_in_page(n * SECTOR_SIZE); out: p->v = NULL; return NULL;