The Linux Kernel Mailing List
 help / color / mirror / Atom feed
* [PATCH linux-next] atm: lanai: Use dma_zalloc_coherent()
@ 2023-01-17  9:21 ye.xingchen
  2023-01-17 15:37 ` David Laight
  0 siblings, 1 reply; 3+ messages in thread
From: ye.xingchen @ 2023-01-17  9:21 UTC (permalink / raw)
  To: 3chas3; +Cc: linux-atm-general, netdev, linux-kernel

From: ye xingchen <ye.xingchen@zte.com.cn>

Instead of using dma_alloc_coherent() and memset() directly use
dma_zalloc_coherent().

Signed-off-by: ye xingchen <ye.xingchen@zte.com.cn>
---
 drivers/atm/lanai.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)

diff --git a/drivers/atm/lanai.c b/drivers/atm/lanai.c
index 32d7aa141d96..b7e0199ce642 100644
--- a/drivers/atm/lanai.c
+++ b/drivers/atm/lanai.c
@@ -342,8 +342,8 @@ static void lanai_buf_allocate(struct lanai_buffer *buf,
 		 * everything, but the way the lanai uses DMA memory would
 		 * make that a terrific pain.  This is much simpler.
 		 */
-		buf->start = dma_alloc_coherent(&pci->dev,
-						size, &buf->dmaaddr, GFP_KERNEL);
+		buf->start = dma_zalloc_coherent(&pci->dev,
+						 size, &buf->dmaaddr, GFP_KERNEL);
 		if (buf->start != NULL) {	/* Success */
 			/* Lanai requires 256-byte alignment of DMA bufs */
 			APRINTK((buf->dmaaddr & ~0xFFFFFF00) == 0,
@@ -352,7 +352,6 @@ static void lanai_buf_allocate(struct lanai_buffer *buf,
 			buf->ptr = buf->start;
 			buf->end = (u32 *)
 			    (&((unsigned char *) buf->start)[size]);
-			memset(buf->start, 0, size);
 			break;
 		}
 		size /= 2;
-- 
2.25.1

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* RE: [PATCH linux-next] atm: lanai: Use dma_zalloc_coherent()
  2023-01-17  9:21 [PATCH linux-next] atm: lanai: Use dma_zalloc_coherent() ye.xingchen
@ 2023-01-17 15:37 ` David Laight
  2023-01-17 18:42   ` Christophe JAILLET
  0 siblings, 1 reply; 3+ messages in thread
From: David Laight @ 2023-01-17 15:37 UTC (permalink / raw)
  To: 'ye.xingchen@zte.com.cn', 3chas3@gmail.com
  Cc: linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org

From: ye.xingchen@zte.com.cn
> Sent: 17 January 2023 09:21
> 
> Instead of using dma_alloc_coherent() and memset() directly use
> dma_zalloc_coherent().

I'm sure I've a brain cell that remembers that dma_alloc_coherent()
always zeros the buffer.
So the 'zalloc' variant isn't needed and the memset() can just
be deleted.
OTOH is it really worth the churn.

	David

-
Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
Registration No: 1397386 (Wales)

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: RE: [PATCH linux-next] atm: lanai: Use dma_zalloc_coherent()
  2023-01-17 15:37 ` David Laight
@ 2023-01-17 18:42   ` Christophe JAILLET
  0 siblings, 0 replies; 3+ messages in thread
From: Christophe JAILLET @ 2023-01-17 18:42 UTC (permalink / raw)
  To: David Laight, 'ye.xingchen@zte.com.cn', 3chas3@gmail.com
  Cc: linux-atm-general@lists.sourceforge.net, netdev@vger.kernel.org,
	linux-kernel@vger.kernel.org

Le 17/01/2023 à 16:37, David Laight a écrit :
> From: ye.xingchen@zte.com.cn
>> Sent: 17 January 2023 09:21
>>
>> Instead of using dma_alloc_coherent() and memset() directly use
>> dma_zalloc_coherent().
> 
> I'm sure I've a brain cell that remembers that dma_alloc_coherent()
> always zeros the buffer.
> So the 'zalloc' variant isn't needed and the memset() can just
> be deleted.
> OTOH is it really worth the churn.

More-over, dma_zalloc_coherent() has been removed at the very beginning 
of 2019 in commit dfd32cad146e.

It is not existing since v5.0-rc2.

\o/


CJ

> 
> 	David
> 
> -
> Registered Address Lakeside, Bramley Road, Mount Farm, Milton Keynes, MK1 1PT, UK
> Registration No: 1397386 (Wales)


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-01-17 19:42 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-01-17  9:21 [PATCH linux-next] atm: lanai: Use dma_zalloc_coherent() ye.xingchen
2023-01-17 15:37 ` David Laight
2023-01-17 18:42   ` Christophe JAILLET

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox