public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com>
Cc: Mark Brown <broonie@kernel.org>,
	linux-spi@vger.kernel.org, linux-kernel@vger.kernel.org,
	David Lechner <dlechner@baylibre.com>
Subject: Re: [PATCH v1 1/2] spi: Add spi_bpw_to_bytes() helper and use it
Date: Wed, 16 Apr 2025 10:09:33 +0300	[thread overview]
Message-ID: <Z_9XrXweruMZ1LvE@smile.fi.intel.com> (raw)
In-Reply-To: <db36c119-c6f6-42e9-b8a0-f09e9e5a2585@quicinc.com>

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



  reply	other threads:[~2025-04-16  7:09 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-16  6:16 [PATCH v1 0/2] spi: Introduce and use spi_bpw_to_bytes() Andy Shevchenko
2025-04-16  6:16 ` [PATCH v1 1/2] spi: Add spi_bpw_to_bytes() helper and use it Andy Shevchenko
2025-04-16  7:03   ` Mukesh Kumar Savaliya
2025-04-16  7:09     ` Andy Shevchenko [this message]
2025-04-16  7:34       ` Mukesh Kumar Savaliya
2025-04-16 14:56   ` David Lechner
2025-04-16 15:14     ` Andy Shevchenko
2025-04-16  6:16 ` [PATCH v1 2/2] spi: dw: Use spi_bpw_to_bytes() helper Andy Shevchenko
2025-04-18  5:25 ` [PATCH v1 0/2] spi: Introduce and use spi_bpw_to_bytes() Mark Brown

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Z_9XrXweruMZ1LvE@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=broonie@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=quic_msavaliy@quicinc.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox