[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <Z_9XrXweruMZ1LvE@smile.fi.intel.com>
Date: Wed, 16 Apr 2025 10:09:33 +0300
From: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
To: Mukesh Kumar Savaliya <quic_msavaliy@...cinc.com>
Cc: Mark Brown <broonie@...nel.org>, linux-spi@...r.kernel.org,
linux-kernel@...r.kernel.org, David Lechner <dlechner@...libre.com>
Subject: Re: [PATCH v1 1/2] spi: Add spi_bpw_to_bytes() helper and use it
On Wed, Apr 16, 2025 at 12:33:24PM +0530, Mukesh Kumar Savaliya wrote:
> On 4/16/2025 11:46 AM, Andy Shevchenko wrote:
Thanks for the prompt review, my answers below.
...
> > +/**
> > + * spi_bpw_to_bytes - Covert bits per word to bytes
> > + * @bpw: Bits per word
> > + *
> > + * This function converts the given @bpw to bytes. The result is always
> > + * power-of-two (e.g. for 37 bits it returns 8 bytes) or 0 for 0 input.
> Would it be good to say in 4 byte aligned /Multiples ?
It's not correct. The said wording describes the current behaviour.
> > + * Returns:
> > + * Bytes for the given @bpw.
> Returns: Bytes for the given @bpw.
> Good to keep in one line.
Aligned with the style of the other function in the same header, so I prefer to
leave the style the same.
> > + */> +static inline u32 spi_bpw_to_bytes(u32 bpw)
> u8 bpw ?
Nope. See below why.
> struct spi_device {
> u8 bits_per_word;
> }
> so arg should be u8.
It's aligned with the above bpw related function.
Also note, that this helper might be moved to the global header at some point
as some other subsystems may utilise it, so I don't want to limit this to u8.
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists