]> www.infradead.org Git - users/hch/misc.git/commitdiff
memstick: drop nth_page() usage within SG entry
authorDavid Hildenbrand <david@redhat.com>
Mon, 1 Sep 2025 15:03:49 +0000 (17:03 +0200)
committerAndrew Morton <akpm@linux-foundation.org>
Sun, 21 Sep 2025 21:22:07 +0000 (14:22 -0700)
It's no longer required to use nth_page() when iterating pages within a
single SG entry, so let's drop the nth_page() usage.

Link: https://lkml.kernel.org/r/20250901150359.867252-29-david@redhat.com
Signed-off-by: David Hildenbrand <david@redhat.com>
Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Reviewed-by: Lorenzo Stoakes <lorenzo.stoakes@oracle.com>
Cc: Maxim Levitsky <maximlevitsky@gmail.com>
Cc: Alex Dubov <oakad@yahoo.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
drivers/memstick/host/jmb38x_ms.c
drivers/memstick/host/tifm_ms.c

index cddddb3a5a27f56d3a8c515c2ae6ae9e5f10733c..79e66e30417c15a8e1518758a49f7323907f0dd9 100644 (file)
@@ -317,8 +317,7 @@ static int jmb38x_ms_transfer_data(struct jmb38x_ms_host *host)
                unsigned int p_off;
 
                if (host->req->long_data) {
-                       pg = nth_page(sg_page(&host->req->sg),
-                                     off >> PAGE_SHIFT);
+                       pg = sg_page(&host->req->sg) + (off >> PAGE_SHIFT);
                        p_off = offset_in_page(off);
                        p_cnt = PAGE_SIZE - p_off;
                        p_cnt = min(p_cnt, length);
index db7f3a088fb093c12e354898acec329ea9cf2977..0b6a90661eee599990a3100552928914a9150d13 100644 (file)
@@ -201,8 +201,7 @@ static unsigned int tifm_ms_transfer_data(struct tifm_ms *host)
                unsigned int p_off;
 
                if (host->req->long_data) {
-                       pg = nth_page(sg_page(&host->req->sg),
-                                     off >> PAGE_SHIFT);
+                       pg = sg_page(&host->req->sg) + (off >> PAGE_SHIFT);
                        p_off = offset_in_page(off);
                        p_cnt = PAGE_SIZE - p_off;
                        p_cnt = min(p_cnt, length);