public inbox for linux-i2c@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Jarkko Nikula <jarkko.nikula@linux.intel.com>
Cc: Shyam Sundar S K <Shyam-sundar.S-k@amd.com>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Jan Dabros <jsd@semihalf.com>,
	linux-i2c@vger.kernel.org
Subject: Re: [PATCH v1] i2c: designware: Change from u32 to unsigned int for regmap_read() calls
Date: Tue, 24 Jan 2023 15:02:41 +0200	[thread overview]
Message-ID: <Y8/W8ebLVoN0WHQq@smile.fi.intel.com> (raw)
In-Reply-To: <e32d5647-530c-80d0-e7e5-a92e5f5a82dd@linux.intel.com>

On Tue, Jan 24, 2023 at 02:54:52PM +0200, Jarkko Nikula wrote:
> On 1/24/23 13:47, Shyam Sundar S K wrote:
> > regmap_read() API signature expects the caller to send "unsigned int"
> > type to return back the read value, but there are some occurrences of 'u32'
> > across i2c-designware-* files.
> > 
> > Change them to match the regmap_read() signature.

...

> Hmm.. I'm not sure about these. We know registers are 32-bit and change to
> unsigned int is a step being more ambiguous. I'm wearing my old embedded
> developer hat who likes to see explicit types when dealing with HW.
> 
> Andy: what was your rationale to propose changing u32 to unsigned int in
> another i2c-designware patch? Has gcc started complaining if regmap_read()
> is used with u32 type?

To be the same type as regmap API is expecting.

What you are talking about makes sense for the direct IO accessor calls.
Actually something like this had to be done when driver was converted to
regmap APIs.

Here we might have 16-bit registers, they are fine when variable is u32,
but goes over boundaries if we declare it as u16. So unsigned int makes
more sense to me.

OTOH I agree that this change is subjective since there is no functional
or other changes as long as we have unsigned int == u32.

So, up to you, guys. But I'm fine with the change.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2023-01-24 13:02 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-01-24 11:47 [PATCH v1] i2c: designware: Change from u32 to unsigned int for regmap_read() calls Shyam Sundar S K
2023-01-24 12:54 ` Jarkko Nikula
2023-01-24 13:02   ` Andy Shevchenko [this message]
2023-01-26 13:44     ` Jarkko Nikula
2023-01-24 12:58 ` Andy Shevchenko
2023-01-28 18:47 ` Wolfram Sang

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=Y8/W8ebLVoN0WHQq@smile.fi.intel.com \
    --to=andriy.shevchenko@linux.intel.com \
    --cc=Shyam-sundar.S-k@amd.com \
    --cc=jarkko.nikula@linux.intel.com \
    --cc=jsd@semihalf.com \
    --cc=linux-i2c@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.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