Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

mmc: tifm_sd: Replace kmap_atomic() with kmap_local_page()

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>

authored by

Adrian Hunter and committed by
Ulf Hansson
4526cdaf 36bbdc30

+8 -8
+8 -8
drivers/mmc/host/tifm_sd.c
··· 116 116 unsigned char *buf; 117 117 unsigned int pos = 0, val; 118 118 119 - buf = kmap_atomic(pg) + off; 119 + buf = kmap_local_page(pg) + off; 120 120 if (host->cmd_flags & DATA_CARRY) { 121 121 buf[pos++] = host->bounce_buf_data[0]; 122 122 host->cmd_flags &= ~DATA_CARRY; ··· 132 132 } 133 133 buf[pos++] = (val >> 8) & 0xff; 134 134 } 135 - kunmap_atomic(buf - off); 135 + kunmap_local(buf - off); 136 136 } 137 137 138 138 static void tifm_sd_write_fifo(struct tifm_sd *host, struct page *pg, ··· 142 142 unsigned char *buf; 143 143 unsigned int pos = 0, val; 144 144 145 - buf = kmap_atomic(pg) + off; 145 + buf = kmap_local_page(pg) + off; 146 146 if (host->cmd_flags & DATA_CARRY) { 147 147 val = host->bounce_buf_data[0] | ((buf[pos++] << 8) & 0xff00); 148 148 writel(val, sock->addr + SOCK_MMCSD_DATA); ··· 159 159 val |= (buf[pos++] << 8) & 0xff00; 160 160 writel(val, sock->addr + SOCK_MMCSD_DATA); 161 161 } 162 - kunmap_atomic(buf - off); 162 + kunmap_local(buf - off); 163 163 } 164 164 165 165 static void tifm_sd_transfer_data(struct tifm_sd *host) ··· 210 210 struct page *src, unsigned int src_off, 211 211 unsigned int count) 212 212 { 213 - unsigned char *src_buf = kmap_atomic(src) + src_off; 214 - unsigned char *dst_buf = kmap_atomic(dst) + dst_off; 213 + unsigned char *src_buf = kmap_local_page(src) + src_off; 214 + unsigned char *dst_buf = kmap_local_page(dst) + dst_off; 215 215 216 216 memcpy(dst_buf, src_buf, count); 217 217 218 - kunmap_atomic(dst_buf - dst_off); 219 - kunmap_atomic(src_buf - src_off); 218 + kunmap_local(dst_buf - dst_off); 219 + kunmap_local(src_buf - src_off); 220 220 } 221 221 222 222 static void tifm_sd_bounce_block(struct tifm_sd *host, struct mmc_data *r_data)