From: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> 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. 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. Signed-off-by: Jonathan Cameron <Jonathan.Cameron@xxxxxxxxxx> Cc: Lauri Kasanen <cand@xxxxxxx> -- Only partly compile tested as I don't have a mips toolchain set up. Would be great to add the stubs to be able to build these drivers with COMPILE_TEST. --- drivers/input/joystick/n64joy.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/input/joystick/n64joy.c b/drivers/input/joystick/n64joy.c index 9dbca366613e..d8c50103c108 100644 --- a/drivers/input/joystick/n64joy.c +++ b/drivers/input/joystick/n64joy.c @@ -44,12 +44,12 @@ static const char *n64joy_phys[MAX_CONTROLLERS] = { }; struct n64joy_priv { - u64 si_buf[8] ____cacheline_aligned; struct timer_list timer; struct mutex n64joy_mutex; struct input_dev *n64joy_dev[MAX_CONTROLLERS]; u32 __iomem *reg_base; u8 n64joy_opened; + u64 si_buf[8] __aligned(ARCH_KMALLOC_MINALIGN); }; struct joydata { @@ -129,7 +129,7 @@ static void n64joy_exec_pif(struct n64joy_priv *priv, const u64 in[8]) local_irq_restore(flags); } -static const u64 polldata[] ____cacheline_aligned = { +static const u64 polldata[] __aligned(ARCH_KMALLOC_MINALIGN) = { 0xff010401ffffffff, 0xff010401ffffffff, 0xff010401ffffffff, @@ -222,7 +222,7 @@ static void n64joy_close(struct input_dev *dev) mutex_unlock(&priv->n64joy_mutex); } -static const u64 __initconst scandata[] ____cacheline_aligned = { +static const u64 __initconst scandata[] __aligned(ARCH_KMALLOC_MINALIGN) = { 0xff010300ffffffff, 0xff010300ffffffff, 0xff010300ffffffff, -- 2.38.1