lkml.org 
[lkml]   [2018]   [Nov]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 6/7] mtd: spi-nor: ensure memory used for nor->read() is DMA safe
Date
Use GFP_DMA to ensure that the memory we allocate for transfers in
nor->read() can be DMAed.

spi_nor_read_sfdp() calls spi_nor_read_raw(), which calls nor-read().
The latter might be implemented by the m25p80 driver which is on top
of the spi-mem layer. spi-mem requires DMA-able in/out buffers, let's
make sure they are.

Signed-off-by: Tudor Ambarus <tudor.ambarus@microchip.com>
---
drivers/mtd/spi-nor/spi-nor.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/mtd/spi-nor/spi-nor.c b/drivers/mtd/spi-nor/spi-nor.c
index 2eaa21c85483..a13fc82bade5 100644
--- a/drivers/mtd/spi-nor/spi-nor.c
+++ b/drivers/mtd/spi-nor/spi-nor.c
@@ -2238,7 +2238,7 @@ static int spi_nor_read_sfdp_dma_unsafe(struct spi_nor *nor, u32 addr,
void *dma_safe_buf;
int ret;

- dma_safe_buf = kmalloc(len, GFP_KERNEL);
+ dma_safe_buf = kmalloc(len, GFP_KERNEL | GFP_DMA);
if (!dma_safe_buf)
return -ENOMEM;

@@ -3053,7 +3053,7 @@ static int spi_nor_parse_smpt(struct spi_nor *nor,

/* Read the Sector Map Parameter Table. */
len = smpt_header->length * sizeof(*smpt);
- smpt = kzalloc(len, GFP_KERNEL);
+ smpt = kzalloc(len, GFP_KERNEL | GFP_DMA);
if (!smpt)
return -ENOMEM;

@@ -3140,7 +3140,7 @@ static int spi_nor_parse_sfdp(struct spi_nor *nor,
if (header.nph) {
psize = header.nph * sizeof(*param_headers);

- param_headers = kmalloc(psize, GFP_KERNEL);
+ param_headers = kmalloc(psize, GFP_KERNEL | GFP_DMA);
if (!param_headers)
return -ENOMEM;

--
2.9.4
\
 
 \ /
  Last update: 2018-11-08 12:08    [W:0.142 / U:3.292 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site