]> git.itanic.dy.fi Git - linux-stable/commitdiff
mmc: tifm_sd: Replace kmap_atomic() with kmap_local_page()
authorAdrian Hunter <adrian.hunter@intel.com>
Wed, 5 Oct 2022 10:19:47 +0000 (13:19 +0300)
committerUlf Hansson <ulf.hansson@linaro.org>
Wed, 7 Dec 2022 12:22:32 +0000 (13:22 +0100)
kmap_local_page() is equivalent to kmap_atomic() except that it does not
disable page faults or preemption. Where possible kmap_local_page() is
preferred to kmap_atomic() - refer kernel highmem documentation.

In this case, there is no need to disable page faults or preemption, so
replace kmap_atomic() with kmap_local_page(), and, correspondingly,
kunmap_atomic() with kunmap_local().

Signed-off-by: Adrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20221005101951.3165-11-adrian.hunter@intel.com
Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
drivers/mmc/host/tifm_sd.c

index d539f9b48422f87dffee275d318938a3bd087282..b5a2f2f25ad94f47de02b9c575c0ad340f3b3440 100644 (file)
@@ -116,7 +116,7 @@ static void tifm_sd_read_fifo(struct tifm_sd *host, struct page *pg,
        unsigned char *buf;
        unsigned int pos = 0, val;
 
-       buf = kmap_atomic(pg) + off;
+       buf = kmap_local_page(pg) + off;
        if (host->cmd_flags & DATA_CARRY) {
                buf[pos++] = host->bounce_buf_data[0];
                host->cmd_flags &= ~DATA_CARRY;
@@ -132,7 +132,7 @@ static void tifm_sd_read_fifo(struct tifm_sd *host, struct page *pg,
                }
                buf[pos++] = (val >> 8) & 0xff;
        }
-       kunmap_atomic(buf - off);
+       kunmap_local(buf - off);
 }
 
 static void tifm_sd_write_fifo(struct tifm_sd *host, struct page *pg,
@@ -142,7 +142,7 @@ static void tifm_sd_write_fifo(struct tifm_sd *host, struct page *pg,
        unsigned char *buf;
        unsigned int pos = 0, val;
 
-       buf = kmap_atomic(pg) + off;
+       buf = kmap_local_page(pg) + off;
        if (host->cmd_flags & DATA_CARRY) {
                val = host->bounce_buf_data[0] | ((buf[pos++] << 8) & 0xff00);
                writel(val, sock->addr + SOCK_MMCSD_DATA);
@@ -159,7 +159,7 @@ static void tifm_sd_write_fifo(struct tifm_sd *host, struct page *pg,
                val |= (buf[pos++] << 8) & 0xff00;
                writel(val, sock->addr + SOCK_MMCSD_DATA);
        }
-       kunmap_atomic(buf - off);
+       kunmap_local(buf - off);
 }
 
 static void tifm_sd_transfer_data(struct tifm_sd *host)
@@ -210,13 +210,13 @@ static void tifm_sd_copy_page(struct page *dst, unsigned int dst_off,
                              struct page *src, unsigned int src_off,
                              unsigned int count)
 {
-       unsigned char *src_buf = kmap_atomic(src) + src_off;
-       unsigned char *dst_buf = kmap_atomic(dst) + dst_off;
+       unsigned char *src_buf = kmap_local_page(src) + src_off;
+       unsigned char *dst_buf = kmap_local_page(dst) + dst_off;
 
        memcpy(dst_buf, src_buf, count);
 
-       kunmap_atomic(dst_buf - dst_off);
-       kunmap_atomic(src_buf - src_off);
+       kunmap_local(dst_buf - dst_off);
+       kunmap_local(src_buf - src_off);
 }
 
 static void tifm_sd_bounce_block(struct tifm_sd *host, struct mmc_data *r_data)