@@ -319,20 +319,19 @@ static void s3cmci_check_sdio_irq(struct s3cmci_host *host)
static inline int get_data_buffer(struct s3cmci_host *host)
{
- if (host->pio_sgptr >= host->mrq->data->sg_len) {
- dbg(host, dbg_debug, "no more buffers (%i/%i)\n",
- host->pio_sgptr, host->mrq->data->sg_len);
+ if (!host->next_sg) {
+ dbg(host, dbg_debug, "no more buffers (%i)\n",
+ host->mrq->data->sg_len);
return -EBUSY;
}
- host->cur_sg = &host->mrq->data->sg[host->pio_sgptr];
+ host->cur_sg = host->next_sg;
+ host->next_sg = sg_next(host->next_sg);
host->pio_bytes = host->cur_sg->length;
host->pio_offset = host->cur_sg->offset;
- host->pio_sgptr++;
-
- dbg(host, dbg_sg, "new buffer (%i/%i)\n",
- host->pio_sgptr, host->mrq->data->sg_len);
+ dbg(host, dbg_sg, "new buffer (%i)\n",
+ host->mrq->data->sg_len);
return 0;
}
@@ -1051,8 +1050,8 @@ static int s3cmci_prepare_pio(struct s3cmci_host *host, struct mmc_data *data)
BUG_ON((data->flags & BOTH_DIR) == BOTH_DIR);
- host->pio_sgptr = 0;
- host->cur_sg = &host->mrq->data->sg[host->pio_sgptr];
+ host->cur_sg = host->mrq->data->sg;
+ host->next_sg = sg_next(host->cur_sg);
host->pio_bytes = 0;
host->pio_count = 0;
host->pio_active = rw ? XFER_WRITE : XFER_READ;
@@ -51,7 +51,7 @@ struct s3cmci_host {
int dma_complete;
struct scatterlist *cur_sg;
- u32 pio_sgptr;
+ struct scatterlist *next_sg;
u32 pio_bytes;
u32 pio_count;
u32 pio_offset;
Use the proper sg_next() helper to move to the next scatterlist element to support chained scatterlists. Signed-off-by: Christoph Hellwig <hch@lst.de> --- drivers/mmc/host/s3cmci.c | 19 +++++++++---------- drivers/mmc/host/s3cmci.h | 2 +- 2 files changed, 10 insertions(+), 11 deletions(-)