From: Guenter Roeck <linux@roeck-us.net>
To: Dan Carpenter <dan.carpenter@linaro.org>,
oe-kbuild@lists.linux.dev, Eddie James <eajames@linux.ibm.com>,
linux-hwmon@vger.kernel.org
Cc: lkp@intel.com, oe-kbuild-all@lists.linux.dev,
linux-kernel@vger.kernel.org, jdelvare@suse.com,
lakshmiy@us.ibm.com
Subject: Re: [PATCH] hwmon: (pmbus/acbel-fsg032) Add firmware version debugfs attribute
Date: Thu, 29 Jun 2023 12:09:17 -0700 [thread overview]
Message-ID: <1a27469a-4cdb-8cf0-c539-05103f2e0b8f@roeck-us.net> (raw)
In-Reply-To: <45a29025-4c06-4f88-b82f-a8002c25c376@kadam.mountain>
On 6/29/23 11:59, Dan Carpenter wrote:
> On Thu, Jun 29, 2023 at 09:53:16AM +0300, Dan Carpenter wrote:
>> d2c6444389b625 Eddie James 2023-06-27 22 char out[8];
>> d2c6444389b625 Eddie James 2023-06-27 23 int rc;
>> d2c6444389b625 Eddie James 2023-06-27 24 int i;
>> d2c6444389b625 Eddie James 2023-06-27 25
>> d2c6444389b625 Eddie James 2023-06-27 26 rc = pmbus_lock_interruptible(client);
>> d2c6444389b625 Eddie James 2023-06-27 27 if (rc)
>> d2c6444389b625 Eddie James 2023-06-27 28 return rc;
>> d2c6444389b625 Eddie James 2023-06-27 29
>> d2c6444389b625 Eddie James 2023-06-27 30 rc = i2c_smbus_read_block_data(client, ACBEL_MFR_FW_REVISION, data);
>> d2c6444389b625 Eddie James 2023-06-27 31 pmbus_unlock(client);
>> d2c6444389b625 Eddie James 2023-06-27 32 if (rc < 0)
>> d2c6444389b625 Eddie James 2023-06-27 33 return rc;
>> d2c6444389b625 Eddie James 2023-06-27 34
>> d2c6444389b625 Eddie James 2023-06-27 35 for (i = 0; i < rc && i < 3; ++i)
>> d2c6444389b625 Eddie James 2023-06-27 @36 snprintf(&out[i * 2], 3, "%02X", data[i]);
>>
>> If data[i] is negative this will print FFFFFFF1 etc. (This is an x86
>> config... Did we ever merge that patch to make char signed by default?)
>
> I meant unsigned not signed. But actually we debated both ways...
> Signed by default would annoy PowerPC devs since they try to really
> lean into the fact that char is unsigned on that arch. :P
>
> https://lwn.net/Articles/911914/
>
As if anything would be easy nowadays ;-). Anyway, in this case, the array
should be explicitly unsigned, so changing the type to u8 was the right
thing to do. Also, the driver should be usable on non-Intel systems,
which is another reason to make the type sign-specific (even more so in
the context of the above discussion).
Thanks,
Guenter
next prev parent reply other threads:[~2023-06-29 19:18 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-06-27 18:40 Eddie James
2023-06-27 22:19 ` Guenter Roeck
2023-06-28 14:50 ` Eddie James
2023-06-29 6:53 ` Dan Carpenter
2023-06-29 18:05 ` Guenter Roeck
2023-06-29 18:59 ` Dan Carpenter
2023-06-29 19:09 ` Guenter Roeck [this message]
2023-06-30 6:18 ` Dan Carpenter
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=1a27469a-4cdb-8cf0-c539-05103f2e0b8f@roeck-us.net \
--to=linux@roeck-us.net \
--cc=dan.carpenter@linaro.org \
--cc=eajames@linux.ibm.com \
--cc=jdelvare@suse.com \
--cc=lakshmiy@us.ibm.com \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=lkp@intel.com \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=oe-kbuild@lists.linux.dev \
/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
all inboxes | Powered by JetHome®