# Re: \[PATCH 7/9\] Input: n64joy - Fix DMA buffer alignment.

- From: Lauri Kasanen \<hidden\>
- Date: 2022-11-27 16:47:34 
- List: linux-input
- Page: https://ratatoskr.run/linux-input/2022/11/8934798
- Thread: https://ratatoskr.run/linux-input/2022/11/8934787/t.md

```text
On Sun, 27 Nov 2022 14:41:14 +0000
Jonathan Cameron [ref] wrote:

> From: Jonathan Cameron <redacted>
> 
> The use of ____cacheline_aligned to ensure a buffer is DMA safe only
> enforces the start of the buffer alignment. In this case, sufficient
> alignment is already ensured by the use of kzalloc().
> ____cacheline_aligned does not ensure that no other members of the
> structure are placed in the same cacheline after the end of the
> buffer marked.  Thus to ensure a DMA safe buffer it must be at the end
> of the structure.

This move is unnecessary, because the cacheline is 16 bytes and the
buffer is 64 bytes.

> Whilst here switch from ____cacheline_aligned to
> __aligned(ARCH_KMALLOC_MINALIGN) as on some architectures, with variable
> sized cacheline lines across their cache hierarchy, require this
> greater alignment guarantee for DMA safety.  Make this change throughout
> the driver as it reduces need for a reader to know about the particular
> architecture.

This change looks ok.

- Lauri
```
