提交 b189e758 编写于 作者: C Christoph Hellwig 提交者: Ulf Hansson

mmc: mxcmmc: handle highmem pages

Use kmap_atomic to map the scatterlist entry before using it.
Signed-off-by: NChristoph Hellwig <hch@lst.de>
Signed-off-by: NUlf Hansson <ulf.hansson@linaro.org>
上级 5b427781
...@@ -291,8 +291,10 @@ static void mxcmci_swap_buffers(struct mmc_data *data) ...@@ -291,8 +291,10 @@ static void mxcmci_swap_buffers(struct mmc_data *data)
struct scatterlist *sg; struct scatterlist *sg;
int i; int i;
for_each_sg(data->sg, sg, data->sg_len, i) for_each_sg(data->sg, sg, data->sg_len, i) {
buffer_swap32(sg_virt(sg), sg->length); void *buf = kmap_atomic(sg_page(sg) + sg->offset;
buffer_swap32(buf, sg->length);
kunmap_atomic(buf);
} }
#else #else
static inline void mxcmci_swap_buffers(struct mmc_data *data) {} static inline void mxcmci_swap_buffers(struct mmc_data *data) {}
...@@ -609,6 +611,7 @@ static int mxcmci_transfer_data(struct mxcmci_host *host) ...@@ -609,6 +611,7 @@ static int mxcmci_transfer_data(struct mxcmci_host *host)
{ {
struct mmc_data *data = host->req->data; struct mmc_data *data = host->req->data;
struct scatterlist *sg; struct scatterlist *sg;
void *buf;
int stat, i; int stat, i;
host->data = data; host->data = data;
...@@ -616,14 +619,18 @@ static int mxcmci_transfer_data(struct mxcmci_host *host) ...@@ -616,14 +619,18 @@ static int mxcmci_transfer_data(struct mxcmci_host *host)
if (data->flags & MMC_DATA_READ) { if (data->flags & MMC_DATA_READ) {
for_each_sg(data->sg, sg, data->sg_len, i) { for_each_sg(data->sg, sg, data->sg_len, i) {
stat = mxcmci_pull(host, sg_virt(sg), sg->length); buf = kmap_atomic(sg_page(sg) + sg->offset);
stat = mxcmci_pull(host, buf, sg->length);
kunmap(buf);
if (stat) if (stat)
return stat; return stat;
host->datasize += sg->length; host->datasize += sg->length;
} }
} else { } else {
for_each_sg(data->sg, sg, data->sg_len, i) { for_each_sg(data->sg, sg, data->sg_len, i) {
stat = mxcmci_push(host, sg_virt(sg), sg->length); buf = kmap_atomic(sg_page(sg) + sg->offset);
stat = mxcmci_push(host, buf, sg->length);
kunmap(buf);
if (stat) if (stat)
return stat; return stat;
host->datasize += sg->length; host->datasize += sg->length;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册