diff options
| author | Viresh Kumar <viresh.kumar@st.com> | 2011-08-10 17:12:11 +0530 |
|---|---|---|
| committer | Linus WALLEIJ <linus.walleij@stericsson.com> | 2011-10-17 15:19:42 +0200 |
| commit | 4270f4413fde489ff54619fd5aebcad05a5fd9de (patch) | |
| tree | 253c85bca78195af313f7640794496a148a151a4 /drivers | |
| parent | 9bfb020a15f4bdc2bc095761ca66cc148a6829ed (diff) | |
spi/spi-pl022: Don't allocate more sg than required.
In routine configure_dma(), if transfer->len = PAGE_SIZE, then pages is one more
than required. While leads to one more sg getting allocated.
This is wrong. Correct this to allocate correct number of sg.
Signed-off-by: Viresh Kumar <viresh.kumar@st.com>
Tested-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Grant Likely <grant.likely@secretlab.ca>
Change-Id: I853c92d0efae2dab32a76e21d4319fa172317331
Reviewed-on: http://gerrit.lud.stericsson.com/gerrit/34213
Reviewed-by: Linus WALLEIJ <linus.walleij@stericsson.com>
Tested-by: Linus WALLEIJ <linus.walleij@stericsson.com>
Diffstat (limited to 'drivers')
| -rw-r--r-- | drivers/spi/spi-pl022.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/spi/spi-pl022.c b/drivers/spi/spi-pl022.c index 01e9aa45ea8..248674c8a8c 100644 --- a/drivers/spi/spi-pl022.c +++ b/drivers/spi/spi-pl022.c @@ -1016,7 +1016,7 @@ static int configure_dma(struct pl022 *pl022) dmaengine_slave_config(txchan, &tx_conf); /* Create sglists for the transfers */ - pages = (pl022->cur_transfer->len >> PAGE_SHIFT) + 1; + pages = DIV_ROUND_UP(pl022->cur_transfer->len, PAGE_SIZE); dev_dbg(&pl022->adev->dev, "using %d pages for transfer\n", pages); ret = sg_alloc_table(&pl022->sgt_rx, pages, GFP_ATOMIC); |
