Commit 4526cdaf authored by Adrian Hunter's avatar Adrian Hunter Committed by Ulf Hansson
Browse files

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: default avatarAdrian Hunter <adrian.hunter@intel.com>
Link: https://lore.kernel.org/r/20221005101951.3165-11-adrian.hunter@intel.com


Signed-off-by: default avatarUlf Hansson <ulf.hansson@linaro.org>
parent 36bbdc30
Loading
Loading
Loading
Loading
+8 −8
Original line number Diff line number Diff line
@@ -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)