From: Corey Minyard <minyard@acm.org>
To: Titus Rwantare <titusr@google.com>
Cc: wuhaotsh@google.com, venture@google.com, qemu-arm@nongnu.org,
qemu-devel@nongnu.org, f4bug@amsat.org
Subject: Re: [PATCH v2 4/9] hw/i2c: pmbus: refactor uint handling and update MAINTAINERS
Date: Tue, 1 Mar 2022 18:38:34 -0600 [thread overview]
Message-ID: <20220302003834.GF3457@minyard.net> (raw)
In-Reply-To: <20220302002307.1895616-5-titusr@google.com>
On Tue, Mar 01, 2022 at 04:23:02PM -0800, Titus Rwantare wrote:
> Signed-off-by: Titus Rwantare <titusr@google.com>
> ---
> MAINTAINERS | 10 ++++++++++
> hw/i2c/pmbus_device.c | 18 +++++++++---------
> 2 files changed, 19 insertions(+), 9 deletions(-)
This makes sense, but can you split it into two patches and give a bit
more explaination about the uint handling. Usually patches without
explaination are frowned upon, even if it's kind of obvious.
-corey
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index fa8adc2618..3601984b5d 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -3135,6 +3135,16 @@ F: include/hw/i2c/smbus_master.h
> F: include/hw/i2c/smbus_slave.h
> F: include/hw/i2c/smbus_eeprom.h
>
> +PMBus
> +M: Titus Rwantare <titusr@google.com>
> +S: Maintained
> +F: hw/i2c/pmbus_device.c
> +F: hw/sensor/adm1272.c
> +F: hw/sensor/max34451.c
> +F: include/hw/i2c/pmbus_device.h
> +F: tests/qtest/adm1272-test.c
> +F: tests/qtest/max34451-test.c
> +
> Firmware schema specifications
> M: Philippe Mathieu-Daudé <f4bug@amsat.org>
> R: Daniel P. Berrange <berrange@redhat.com>
> diff --git a/hw/i2c/pmbus_device.c b/hw/i2c/pmbus_device.c
> index 6eeb0731d7..3beb02afad 100644
> --- a/hw/i2c/pmbus_device.c
> +++ b/hw/i2c/pmbus_device.c
> @@ -89,16 +89,16 @@ void pmbus_send_string(PMBusDevice *pmdev, const char *data)
> }
>
>
> -static uint64_t pmbus_receive_uint(const uint8_t *buf, uint8_t len)
> +static uint64_t pmbus_receive_uint(PMBusDevice *pmdev)
> {
> uint64_t ret = 0;
>
> /* Exclude command code from return value */
> - buf++;
> - len--;
> + pmdev->in_buf++;
> + pmdev->in_buf_len--;
>
> - for (int i = len - 1; i >= 0; i--) {
> - ret = ret << 8 | buf[i];
> + for (int i = pmdev->in_buf_len - 1; i >= 0; i--) {
> + ret = ret << 8 | pmdev->in_buf[i];
> }
> return ret;
> }
> @@ -110,7 +110,7 @@ uint8_t pmbus_receive8(PMBusDevice *pmdev)
> "%s: length mismatch. Expected 1 byte, got %d bytes\n",
> __func__, pmdev->in_buf_len - 1);
> }
> - return pmbus_receive_uint(pmdev->in_buf, pmdev->in_buf_len);
> + return pmbus_receive_uint(pmdev);
> }
>
> uint16_t pmbus_receive16(PMBusDevice *pmdev)
> @@ -120,7 +120,7 @@ uint16_t pmbus_receive16(PMBusDevice *pmdev)
> "%s: length mismatch. Expected 2 bytes, got %d bytes\n",
> __func__, pmdev->in_buf_len - 1);
> }
> - return pmbus_receive_uint(pmdev->in_buf, pmdev->in_buf_len);
> + return pmbus_receive_uint(pmdev);
> }
>
> uint32_t pmbus_receive32(PMBusDevice *pmdev)
> @@ -130,7 +130,7 @@ uint32_t pmbus_receive32(PMBusDevice *pmdev)
> "%s: length mismatch. Expected 4 bytes, got %d bytes\n",
> __func__, pmdev->in_buf_len - 1);
> }
> - return pmbus_receive_uint(pmdev->in_buf, pmdev->in_buf_len);
> + return pmbus_receive_uint(pmdev);
> }
>
> uint64_t pmbus_receive64(PMBusDevice *pmdev)
> @@ -140,7 +140,7 @@ uint64_t pmbus_receive64(PMBusDevice *pmdev)
> "%s: length mismatch. Expected 8 bytes, got %d bytes\n",
> __func__, pmdev->in_buf_len - 1);
> }
> - return pmbus_receive_uint(pmdev->in_buf, pmdev->in_buf_len);
> + return pmbus_receive_uint(pmdev);
> }
>
> static uint8_t pmbus_out_buf_pop(PMBusDevice *pmdev)
> --
> 2.35.1.616.g0bdcbb4464-goog
>
next prev parent reply other threads:[~2022-03-02 0:52 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-02 0:22 [PATCH v2 0/9] Fixups for PMBus and new sensors Titus Rwantare
2022-03-02 0:22 ` [PATCH v2 1/9] hw/i2c: pmbus: add registers Titus Rwantare
2022-03-02 0:23 ` [PATCH v2 2/9] hw/i2c: pmbus: guard against out of range accesses Titus Rwantare
2022-03-02 0:23 ` [PATCH v2 3/9] hw/i2c: pmbus: add PEC unsupported warning Titus Rwantare
2022-03-02 0:23 ` [PATCH v2 4/9] hw/i2c: pmbus: refactor uint handling and update MAINTAINERS Titus Rwantare
2022-03-02 0:38 ` Corey Minyard [this message]
2022-03-02 0:23 ` [PATCH v2 5/9] hw/i2c: Added linear mode translation for pmbus devices Titus Rwantare
2022-03-02 0:23 ` [PATCH v2 6/9] hw/sensor: add Intersil ISL69260 device model Titus Rwantare
2022-03-02 0:23 ` [PATCH v2 7/9] hw/sensor: add Renesas raa229004 PMBus device Titus Rwantare
2022-03-02 0:23 ` [PATCH v2 8/9] hw/sensor: add Renesas raa228000 device Titus Rwantare
2022-03-02 0:23 ` [PATCH v2 9/9] hw/sensor: rename isl_pmbus to isl_pmbus_vr Titus Rwantare
2022-03-02 0:43 ` Corey Minyard
2022-03-02 0:48 ` Titus Rwantare
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=20220302003834.GF3457@minyard.net \
--to=minyard@acm.org \
--cc=f4bug@amsat.org \
--cc=qemu-arm@nongnu.org \
--cc=qemu-devel@nongnu.org \
--cc=titusr@google.com \
--cc=venture@google.com \
--cc=wuhaotsh@google.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.