diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2009-10-10 17:40:35 +0200 |
---|---|---|
committer | Lars-Peter Clausen <lars@metafoo.de> | 2009-12-06 08:46:43 +0100 |
commit | 89738ae9c8a18326f88f020cfab78b982d6ddaef (patch) | |
tree | 8a032911cae905b52832c44d39bc1e1317f0c13d /drivers | |
parent | 32deca472cc122a50507901419a57057a1ea51d6 (diff) |
glamo-mci: do_pio_{read,write}: Use sg_mapping_iter to iterate through the sg list.
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/mfd/glamo/glamo-mci.c | 29 |
1 files changed, 15 insertions, 14 deletions
diff --git a/drivers/mfd/glamo/glamo-mci.c b/drivers/mfd/glamo/glamo-mci.c index 7401e35c39a..9404f540fe4 100644 --- a/drivers/mfd/glamo/glamo-mci.c +++ b/drivers/mfd/glamo/glamo-mci.c @@ -167,41 +167,42 @@ static void glamo_mci_disable_timer(unsigned long data) static void do_pio_read(struct glamo_mci_host *host, struct mmc_data *data) { - struct scatterlist *sg; + struct sg_mapping_iter miter; uint16_t __iomem *from_ptr = host->data_base; - void *sg_pointer; dev_dbg(&host->pdev->dev, "pio_read():\n"); - for (sg = data->sg; sg; sg = sg_next(sg)) { - sg_pointer = page_address(sg_page(sg)) + sg->offset; + sg_miter_start(&miter, data->sg, data->sg_len, SG_MITER_TO_SG); - memcpy(sg_pointer, from_ptr, sg->length); - from_ptr += sg->length >> 1; + while (sg_miter_next(&miter)) { + memcpy(miter.addr, from_ptr, miter.length); + from_ptr += miter.length >> 1; - data->bytes_xfered += sg->length; + data->bytes_xfered += miter.length; } + sg_miter_stop(&miter); + dev_dbg(&host->pdev->dev, "pio_read(): " "complete (no more data).\n"); } static void do_pio_write(struct glamo_mci_host *host, struct mmc_data *data) { - struct scatterlist *sg; + struct sg_mapping_iter miter; uint16_t __iomem *to_ptr = host->data_base; - void *sg_pointer; dev_dbg(&host->pdev->dev, "pio_write():\n"); - for (sg = data->sg; sg; sg = sg_next(sg)) { - sg_pointer = page_address(sg_page(sg)) + sg->offset; + sg_miter_start(&miter, data->sg, data->sg_len, SG_MITER_FROM_SG); - data->bytes_xfered += sg->length; + while (sg_miter_next(&miter)) { + memcpy(to_ptr, miter.addr, miter.length); + to_ptr += miter.length >> 1; - memcpy(to_ptr, sg_pointer, sg->length); - to_ptr += sg->length >> 1; + data->bytes_xfered += miter.length; } + sg_miter_stop(&miter); dev_dbg(&host->pdev->dev, "pio_write(): complete\n"); } |