Re: [PATCH v2 2/4] spi: rzv2m-csi: Improve data types, casting and alignment

From: Andy Shevchenko
Date: Tue Jul 18 2023 - 15:59:28 EST


On Tue, Jul 18, 2023 at 10:25 PM Fabrizio Castro
<fabrizio.castro.jz@xxxxxxxxxxx> wrote:
>
> "unsigned int" is more appropriate than "int" for the members
> of "struct rzv2m_csi_priv".
> Using void* rather than u8* for txbuf and rxbuf allows for
> the removal of some type casting.
> Remove the unnecessary casting of "data" to "struct rzv2m_csi_priv*"
> in function "rzv2m_csi_irq_handler".
> Also, members "bytes_per_word" and "errors" introduce gaps
> in the structure.
> Adjust "struct rzv2m_csi_priv" and its members usage accordingly.

Hmm... A bit of fancy indentation. Why is each sentence separated?

...

> wait_queue_head_t wait;
> - u8 errors;
> + u32 errors;
> u32 status;

As far as I understand Geert he wanted something like

u32 status;
u8 errors;

...

> - u16 *buf = (u16 *)csi->txbuf;
> + const u16 *buf = csi->txbuf;

> - u8 *buf = (u8 *)csi->txbuf;
> + const u8 *buf = csi->txbuf;

> - u16 *buf = (u16 *)csi->rxbuf;
> + u16 *buf = csi->rxbuf;

> - u8 *buf = (u8 *)csi->rxbuf;
> + u8 *buf = csi->rxbuf;

Yep, these look much better now.

--
With Best Regards,
Andy Shevchenko