[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20181108110653.21063-7-tudor.ambarus@microchip.com>
Date: Thu, 8 Nov 2018 11:07:18 +0000
From: <Tudor.Ambarus@...rochip.com>
To: <boris.brezillon@...tlin.com>, <marek.vasut@...il.com>,
<dwmw2@...radead.org>, <computersforpeace@...il.com>,
<richard@....at>
CC: <linux-mtd@...ts.infradead.org>, <linux-kernel@...r.kernel.org>,
<yogeshnarayan.gaur@....com>, <cyrille.pitchen@...ev4u.fr>,
<Tudor.Ambarus@...rochip.com>
Subject: [PATCH 6/7] mtd: spi-nor: ensure memory used for nor->read() is DMA
safe
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@...rochip.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
Powered by blists - more mailing lists