linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Andreas Klinger <ak@it-klinger.de>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: jic23@kernel.org, robh@kernel.org, krzk+dt@kernel.org,
	conor+dt@kernel.org, lars@metafoo.de,
	javier.carrasco.cruz@gmail.com, arthur.becker@sentec.com,
	perdaniel.olsson@axis.com, mgonellabolduc@dimonoff.com,
	muditsharma.info@gmail.com, clamor95@gmail.com,
	emil.gedenryd@axis.com, devicetree@vger.kernel.org,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 2/3] iio: light: add support for veml6046x00 RGBIR color sensor
Date: Fri, 22 Aug 2025 08:39:35 +0300	[thread overview]
Message-ID: <4d4120fa-3a20-4cc4-a078-ee94e03229f9@gmail.com> (raw)
In-Reply-To: <aKdrO7DE8ky2DBu2@mail.your-server.de>

On 21/08/2025 21:53, Andreas Klinger wrote:
> Hi Andy,
> 
> Andy Shevchenko <andriy.shevchenko@linux.intel.com> schrieb am Do, 21. Aug 12:43:
>>>>> +	part_id = le16_to_cpu(reg);
>>>>> +	if (part_id != 0x0001)
>>>>> +		dev_info(dev, "Unknown ID %#04x\n", part_id);
>>>>
>>>> For 0 it will print 0 and not 0x0000. Is it okay?
>>>
>>> I just tried and it prints 0x00 if the part_id is 0.
>>
>> This is interesting... So it's not 0, nor 0x0000?
> 
> No. It prints 0x00 on my BeagleBoneBlack with kernel 6.16.0-rc5.

I think this makes sense because of the '#' -flag. The "0x" is appended 
because of it, and this consumes 2 characters from the 4 character 
field, leaving only 2 chars left for the value.

What I find interesting is that gcc on my PC does:

         printf("%#04x\n", 0);
         printf("%#04x\n", 1);
         printf("%#04x\n", 10);
         printf("%#04x\n", 17);

0000
0x01
0x0a
0x11

gcc version 15.2.1 20250808 (Red Hat 15.2.1-1) (GCC)

It'd be nice to learn why the zero is treated differently? Andy, did you 
have some insight as you asked this?

Yours,
	-- Matti

  reply	other threads:[~2025-08-22  5:39 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-07-15  8:58 [PATCH v6 0/3] iio:light: add driver for veml6046x00 RGBIR color sensor Andreas Klinger
2025-07-15  8:58 ` [PATCH v6 1/3] dt-bindings: iio: light: veml6046x00: add " Andreas Klinger
2025-07-15  8:58 ` [PATCH v6 2/3] iio: light: add support for veml6046x00 RGBIR " Andreas Klinger
2025-07-16  7:34   ` Andy Shevchenko
2025-07-25  7:32     ` Andreas Klinger
2025-08-21  9:43       ` Andy Shevchenko
2025-08-21 18:53         ` Andreas Klinger
2025-08-22  5:39           ` Matti Vaittinen [this message]
2025-08-22  7:23             ` Andy Shevchenko
2025-08-22  7:59               ` Andy Shevchenko
2025-07-19 17:13   ` Jonathan Cameron
2025-07-15  8:58 ` [PATCH v6 3/3] MAINTAINER: add maintainer for veml6046x00 Andreas Klinger

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=4d4120fa-3a20-4cc4-a078-ee94e03229f9@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=ak@it-klinger.de \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arthur.becker@sentec.com \
    --cc=clamor95@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=emil.gedenryd@axis.com \
    --cc=javier.carrasco.cruz@gmail.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mgonellabolduc@dimonoff.com \
    --cc=muditsharma.info@gmail.com \
    --cc=perdaniel.olsson@axis.com \
    --cc=robh@kernel.org \
    /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;
as well as URLs for NNTP newsgroup(s).