Switch SPI code to using the macro. No functional changes intended. Signed-off-by: Yury Norov --- drivers/spi/spi-pl022.c | 3 +-- drivers/spi/spi.c | 4 +--- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index c82cc522776d..78fce33ff422 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -761,8 +761,7 @@ static void setup_dma_scatter(struct pl022 *pl022, * we just feed in this, else we stuff in as much * as we can. */ - mapbytes = min_t(int, bytesleft, - PAGE_SIZE - offset_in_page(bufp)); + mapbytes = min_t(int, bytesleft, rest_of_page(bufp)); sg_set_page(sg, virt_to_page(bufp), mapbytes, offset_in_page(bufp)); diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c index 61f7bde8c7fb..cd4a18f3afaf 100644 --- a/drivers/spi/spi.c +++ b/drivers/spi/spi.c @@ -1162,9 +1162,7 @@ static int spi_map_buf_attrs(struct spi_controller *ctlr, struct device *dev, * the desc_len and the remaining buffer length that * fits in a page. */ - min = min_t(size_t, desc_len, - min_t(size_t, len, - PAGE_SIZE - offset_in_page(buf))); + min = min_t(size_t, desc_len, min_t(size_t, len, rest_of_page(buf))); if (vmalloced_buf) vm_page = vmalloc_to_page(buf); else -- 2.43.0