diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2009-10-10 17:40:35 +0200 |
---|---|---|
committer | Lars-Peter Clausen <lars@metafoo.de> | 2009-10-10 17:41:32 +0200 |
commit | 7494c1bb09bc96533e4eab23fe4153f9a531caed (patch) | |
tree | b4cb17275061e301ef01f76518fe8203d39d7387 /drivers/mfd | |
parent | 106c8ed811d3b26661d5061bfcaecc9bf10ebed4 (diff) |
glamo-mci: do_pio_{read,write}: Use sg_mapping_iter to iterate through the sg list.
Diffstat (limited to 'drivers/mfd')
-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"); } |