Skip to content

Commit b189e75

Browse files
Christoph Hellwigstorulf
Christoph Hellwig
authored andcommitted
mmc: mxcmmc: handle highmem pages
Use kmap_atomic to map the scatterlist entry before using it. Signed-off-by: Christoph Hellwig <hch@lst.de> Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org>
1 parent 5b42778 commit b189e75

File tree

1 file changed

+11
-4
lines changed

1 file changed

+11
-4
lines changed

drivers/mmc/host/mxcmmc.c

+11-4
Original file line numberDiff line numberDiff line change
@@ -291,8 +291,10 @@ static void mxcmci_swap_buffers(struct mmc_data *data)
291291
struct scatterlist *sg;
292292
int i;
293293

294-
for_each_sg(data->sg, sg, data->sg_len, i)
295-
buffer_swap32(sg_virt(sg), sg->length);
294+
for_each_sg(data->sg, sg, data->sg_len, i) {
295+
void *buf = kmap_atomic(sg_page(sg) + sg->offset;
296+
buffer_swap32(buf, sg->length);
297+
kunmap_atomic(buf);
296298
}
297299
#else
298300
static inline void mxcmci_swap_buffers(struct mmc_data *data) {}
@@ -609,21 +611,26 @@ static int mxcmci_transfer_data(struct mxcmci_host *host)
609611
{
610612
struct mmc_data *data = host->req->data;
611613
struct scatterlist *sg;
614+
void *buf;
612615
int stat, i;
613616

614617
host->data = data;
615618
host->datasize = 0;
616619

617620
if (data->flags & MMC_DATA_READ) {
618621
for_each_sg(data->sg, sg, data->sg_len, i) {
619-
stat = mxcmci_pull(host, sg_virt(sg), sg->length);
622+
buf = kmap_atomic(sg_page(sg) + sg->offset);
623+
stat = mxcmci_pull(host, buf, sg->length);
624+
kunmap(buf);
620625
if (stat)
621626
return stat;
622627
host->datasize += sg->length;
623628
}
624629
} else {
625630
for_each_sg(data->sg, sg, data->sg_len, i) {
626-
stat = mxcmci_push(host, sg_virt(sg), sg->length);
631+
buf = kmap_atomic(sg_page(sg) + sg->offset);
632+
stat = mxcmci_push(host, buf, sg->length);
633+
kunmap(buf);
627634
if (stat)
628635
return stat;
629636
host->datasize += sg->length;

0 commit comments

Comments
 (0)