lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <WVehAlzjh6tqHumVgSPQaBJ2HyS2440oKiqR96qmMbXIv1Z0h_HQuGZf-6xh1KgeCXIGFmTg1Vym3ekryjnKUB8pEN3Hdm-PJBVakHg1FDo=@wujek.eu>
Date:   Wed, 01 Jun 2022 01:34:00 +0000
From:   wujek dev <dev_public@...ek.eu>
To:     Guenter Roeck <linux@...ck-us.net>
Cc:     Jean Delvare <jdelvare@...e.com>, linux-hwmon@...r.kernel.org,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] hwmon: (pmbus) add a function to check the presence of a block register


On Tuesday, May 24th, 2022 at 15:32, Guenter Roeck <linux@...ck-us.net> wrote:


>
>
> On 5/24/22 03:43, Adam Wujek wrote:
>
> > Other functions (like pmbus_check_byte_register) cannot be used to check
> > the presence of a block register, because it will generate error when PEC
> > is used.
> >
> > Signed-off-by: Adam Wujek dev_public@...ek.eu
> > ---
> > Notes:
> > Changes in v2:
> > - Use Phase 0xff when setting the page
> >
> > drivers/hwmon/pmbus/pmbus_core.c | 26 ++++++++++++++++++++++++++
> > 1 file changed, 26 insertions(+)
> >
> > diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> > index acf78d0829d9..2ff66f133d95 100644
> > --- a/drivers/hwmon/pmbus/pmbus_core.c
> > +++ b/drivers/hwmon/pmbus/pmbus_core.c
> > @@ -421,6 +421,18 @@ static int _pmbus_read_byte_data(struct i2c_client *client, int page, int reg)
> > return pmbus_read_byte_data(client, page, reg);
> > }
> >
> > +static int pmbus_read_block_data(struct i2c_client *client, int page, u8 reg,
> > + char *data_buf)
> > +{
> > + int rv;
> > +
> > + rv = pmbus_set_page(client, page, 0xff);
> > + if (rv < 0)
> > + return rv;
> > +
> > + return i2c_smbus_read_block_data(client, reg, data_buf);
> > +}
> > +
> > static struct pmbus_sensor *pmbus_find_sensor(struct pmbus_data *data, int page,
> > int reg)
> > {
> > @@ -558,6 +570,20 @@ bool pmbus_check_word_register(struct i2c_client *client, int page, int reg)
> > }
> > EXPORT_SYMBOL_NS_GPL(pmbus_check_word_register, PMBUS);
> >
> > +static bool pmbus_check_block_register(struct i2c_client *client, int page,
> > + int reg)
> > +{
> > + int rv;
> > + struct pmbus_data *data = i2c_get_clientdata(client);
> > + char data_buf[I2C_SMBUS_BLOCK_MAX + 2] = { 0 };
>
>
> Unnecessary initialization.
Agree
>
> > +
> > + rv = pmbus_read_block_data(client, page, reg, data_buf);
> > + if (rv >= 0 && !(data->flags & PMBUS_SKIP_STATUS_CHECK))
> > + rv = pmbus_check_status_cml(client);
>
>
> How about PMBUS_READ_STATUS_AFTER_FAILED_CHECK ?
added in the next version
>
> Thanks,
> Guenter
BR,
Adam
>
> > + pmbus_clear_fault_page(client, -1);
> > + return rv >= 0;
> > +}
> > +
> > const struct pmbus_driver_info *pmbus_get_driver_info(struct i2c_client *client)
> > {
> > struct pmbus_data *data = i2c_get_clientdata(client);
> > --
> > 2.17.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ