From: Mark Brown <broonie@kernel.org>
To: Vignesh R <vigneshr@ti.com>
Cc: linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-omap@vger.kernel.org
Subject: Re: [PATCH v5] spi: spi-ti-qspi: Add DMA support for QSPI mmap read
Date: Tue, 9 Aug 2016 12:33:29 +0100 [thread overview]
Message-ID: <20160809113329.GA9347@sirena.org.uk> (raw)
In-Reply-To: <20160809110311.13521-1-vigneshr@ti.com>
[-- Attachment #1: Type: text/plain, Size: 970 bytes --]
On Tue, Aug 09, 2016 at 04:33:11PM +0530, Vignesh R wrote:
> +static int ti_qspi_map_buf(struct ti_qspi *qspi, void *buf,
> + unsigned int len, struct sg_table *sgt)
> +{
> + unsigned int max_seg_size =
> + dma_get_max_seg_size(qspi->rx_chan->device->dev);
> + unsigned int desc_len = min_t(int, max_seg_size, PAGE_SIZE);
> + int sgs = DIV_ROUND_UP(len + offset_in_page(buf), desc_len);
> + struct page *vm_page;
> + size_t min;
> + int i, ret;
> +
> + ret = sg_alloc_table(sgt, sgs, GFP_KERNEL);
> + if (ret)
> + return ret;
> +
> + for (i = 0; i < sgs; i++) {
> + min = min_t(size_t, len, desc_len -
> + offset_in_page(buf));
> + vm_page = kmap_to_page(buf);
> + if (!vm_page) {
> + sg_free_table(sgt);
> + return -ENOMEM;
> + }
> + sg_set_page(&sgt->sgl[i], vm_page, min,
> + offset_in_page(buf));
> + buf += min;
> + len -= min;
This looks a lot like the core code for mapping the buffers - why is
this open coded rather than reused?
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 473 bytes --]
next prev parent reply other threads:[~2016-08-09 11:33 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-08-09 11:03 [PATCH v5] spi: spi-ti-qspi: Add DMA support for QSPI mmap read Vignesh R
2016-08-09 11:33 ` Mark Brown [this message]
[not found] ` <20160809113329.GA9347-GFdadSzt00ze9xe1eoZjHA@public.gmane.org>
2016-08-09 12:50 ` Vignesh R
[not found] ` <13e676c2-7e2f-d1c5-5312-bc2e11a6b6a1-l0cyMroinI0@public.gmane.org>
2016-08-16 18:42 ` Mark Brown
2016-08-17 5:13 ` Vignesh R
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160809113329.GA9347@sirena.org.uk \
--to=broonie@kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-omap@vger.kernel.org \
--cc=linux-spi@vger.kernel.org \
--cc=vigneshr@ti.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).