linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] hwmon: (pmbus) Expose PEC debugfs attribute
@ 2020-09-09 13:24 Andrew Jeffery
  2020-09-09 15:31 ` Guenter Roeck
  2020-09-10 10:05 ` Dan Carpenter
  0 siblings, 2 replies; 7+ messages in thread
From: Andrew Jeffery @ 2020-09-09 13:24 UTC (permalink / raw)
  To: linux-hwmon; +Cc: linux, jdelvare, openbmc, linux-kernel

Enable runtime debug control of whether the PEC byte is exchanged with
the PMBus device.

Some manufacturers have asked for the PEC to be disabled as part of
debugging driver communication issues with devices.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
---
 drivers/hwmon/pmbus/pmbus_core.c | 39 ++++++++++++++++++++++++++++++++
 1 file changed, 39 insertions(+)

diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
index 44535add3a4a..51c8502b35e9 100644
--- a/drivers/hwmon/pmbus/pmbus_core.c
+++ b/drivers/hwmon/pmbus/pmbus_core.c
@@ -2346,6 +2346,42 @@ static int pmbus_debugfs_get_status(void *data, u64 *val)
 DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_status, pmbus_debugfs_get_status,
 			 NULL, "0x%04llx\n");
 
+static int pmbus_debugfs_get_pec(void *data, u64 *val)
+{
+	struct i2c_client *client = data;
+
+	*val = !!(client->flags & I2C_CLIENT_PEC);
+
+	return 0;
+}
+
+static int pmbus_debugfs_set_pec(void *data, u64 val)
+{
+	int rc;
+	struct i2c_client *client = data;
+
+	if (!val) {
+		client->flags &= ~I2C_CLIENT_PEC;
+		return 0;
+	}
+
+	if (val != 1)
+		return -EINVAL;
+
+	rc = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
+	if (rc < 0)
+		return rc;
+
+	if (!(rc & PB_CAPABILITY_ERROR_CHECK))
+		return -ENOTSUPP;
+
+	client->flags |= I2C_CLIENT_PEC;
+
+	return 0;
+}
+DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_pec, pmbus_debugfs_get_pec,
+			 pmbus_debugfs_set_pec, "0x%1llu\n");
+
 static int pmbus_init_debugfs(struct i2c_client *client,
 			      struct pmbus_data *data)
 {
@@ -2374,6 +2410,9 @@ static int pmbus_init_debugfs(struct i2c_client *client,
 	if (!entries)
 		return -ENOMEM;
 
+	debugfs_create_file("pec", 0664, data->debugfs, client,
+			    &pmbus_debugfs_ops_pec);
+
 	for (i = 0; i < data->info->pages; ++i) {
 		/* Check accessibility of status register if it's not page 0 */
 		if (!i || pmbus_check_status_register(client, i)) {
-- 
2.25.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH] hwmon: (pmbus) Expose PEC debugfs attribute
  2020-09-09 13:24 [PATCH] hwmon: (pmbus) Expose PEC debugfs attribute Andrew Jeffery
@ 2020-09-09 15:31 ` Guenter Roeck
  2020-09-10  2:12   ` Andrew Jeffery
  2020-09-10 10:05 ` Dan Carpenter
  1 sibling, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2020-09-09 15:31 UTC (permalink / raw)
  To: Andrew Jeffery, linux-hwmon; +Cc: jdelvare, openbmc, linux-kernel

On 9/9/20 6:24 AM, Andrew Jeffery wrote:
> Enable runtime debug control of whether the PEC byte is exchanged with
> the PMBus device.
> 
> Some manufacturers have asked for the PEC to be disabled as part of
> debugging driver communication issues with devices.
> 
> Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> ---
>  drivers/hwmon/pmbus/pmbus_core.c | 39 ++++++++++++++++++++++++++++++++
>  1 file changed, 39 insertions(+)
> 
> diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> index 44535add3a4a..51c8502b35e9 100644
> --- a/drivers/hwmon/pmbus/pmbus_core.c
> +++ b/drivers/hwmon/pmbus/pmbus_core.c
> @@ -2346,6 +2346,42 @@ static int pmbus_debugfs_get_status(void *data, u64 *val)
>  DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_status, pmbus_debugfs_get_status,
>  			 NULL, "0x%04llx\n");
>  
> +static int pmbus_debugfs_get_pec(void *data, u64 *val)
> +{
> +	struct i2c_client *client = data;
> +
> +	*val = !!(client->flags & I2C_CLIENT_PEC);
> +
> +	return 0;
> +}
> +
> +static int pmbus_debugfs_set_pec(void *data, u64 val)
> +{
> +	int rc;
> +	struct i2c_client *client = data;
> +
> +	if (!val) {
> +		client->flags &= ~I2C_CLIENT_PEC;
> +		return 0;
> +	}
> +
> +	if (val != 1)
> +		return -EINVAL;
> +
> +	rc = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
> +	if (rc < 0)
> +		return rc;
> +
> +	if (!(rc & PB_CAPABILITY_ERROR_CHECK))
> +		return -ENOTSUPP;

WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP

> +
> +	client->flags |= I2C_CLIENT_PEC;
> +
> +	return 0;
> +}
> +DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_pec, pmbus_debugfs_get_pec,
> +			 pmbus_debugfs_set_pec, "0x%1llu\n");

ERROR: Prefixing 0x with decimal output is defective

(since the displayed value is a boolean, it is also quite useless).

> +
>  static int pmbus_init_debugfs(struct i2c_client *client,
>  			      struct pmbus_data *data)
>  {
> @@ -2374,6 +2410,9 @@ static int pmbus_init_debugfs(struct i2c_client *client,
>  	if (!entries)
>  		return -ENOMEM;
>  
> +	debugfs_create_file("pec", 0664, data->debugfs, client,
> +			    &pmbus_debugfs_ops_pec);
> +
>  	for (i = 0; i < data->info->pages; ++i) {
>  		/* Check accessibility of status register if it's not page 0 */
>  		if (!i || pmbus_check_status_register(client, i)) {
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hwmon: (pmbus) Expose PEC debugfs attribute
  2020-09-09 15:31 ` Guenter Roeck
@ 2020-09-10  2:12   ` Andrew Jeffery
  0 siblings, 0 replies; 7+ messages in thread
From: Andrew Jeffery @ 2020-09-10  2:12 UTC (permalink / raw)
  To: Guenter Roeck, linux-hwmon; +Cc: Jean Delvare, openbmc, linux-kernel



On Thu, 10 Sep 2020, at 01:01, Guenter Roeck wrote:
> On 9/9/20 6:24 AM, Andrew Jeffery wrote:
> > Enable runtime debug control of whether the PEC byte is exchanged with
> > the PMBus device.
> > 
> > Some manufacturers have asked for the PEC to be disabled as part of
> > debugging driver communication issues with devices.
> > 
> > Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
> > ---
> >  drivers/hwmon/pmbus/pmbus_core.c | 39 ++++++++++++++++++++++++++++++++
> >  1 file changed, 39 insertions(+)
> > 
> > diff --git a/drivers/hwmon/pmbus/pmbus_core.c b/drivers/hwmon/pmbus/pmbus_core.c
> > index 44535add3a4a..51c8502b35e9 100644
> > --- a/drivers/hwmon/pmbus/pmbus_core.c
> > +++ b/drivers/hwmon/pmbus/pmbus_core.c
> > @@ -2346,6 +2346,42 @@ static int pmbus_debugfs_get_status(void *data, u64 *val)
> >  DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_status, pmbus_debugfs_get_status,
> >  			 NULL, "0x%04llx\n");
> >  
> > +static int pmbus_debugfs_get_pec(void *data, u64 *val)
> > +{
> > +	struct i2c_client *client = data;
> > +
> > +	*val = !!(client->flags & I2C_CLIENT_PEC);
> > +
> > +	return 0;
> > +}
> > +
> > +static int pmbus_debugfs_set_pec(void *data, u64 val)
> > +{
> > +	int rc;
> > +	struct i2c_client *client = data;
> > +
> > +	if (!val) {
> > +		client->flags &= ~I2C_CLIENT_PEC;
> > +		return 0;
> > +	}
> > +
> > +	if (val != 1)
> > +		return -EINVAL;
> > +
> > +	rc = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
> > +	if (rc < 0)
> > +		return rc;
> > +
> > +	if (!(rc & PB_CAPABILITY_ERROR_CHECK))
> > +		return -ENOTSUPP;
> 
> WARNING: ENOTSUPP is not a SUSV4 error code, prefer EOPNOTSUPP
> 
> > +
> > +	client->flags |= I2C_CLIENT_PEC;
> > +
> > +	return 0;
> > +}
> > +DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_pec, pmbus_debugfs_get_pec,
> > +			 pmbus_debugfs_set_pec, "0x%1llu\n");
> 
> ERROR: Prefixing 0x with decimal output is defective
> 
> (since the displayed value is a boolean, it is also quite useless).

Indeed. I overlooked running checkpatch, sorry for the noise.

I've sent v2 which checkpatch claims to be clean.

Andrew

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hwmon: (pmbus) Expose PEC debugfs attribute
  2020-09-09 13:24 [PATCH] hwmon: (pmbus) Expose PEC debugfs attribute Andrew Jeffery
  2020-09-09 15:31 ` Guenter Roeck
@ 2020-09-10 10:05 ` Dan Carpenter
  2020-09-10 10:34   ` Guenter Roeck
  1 sibling, 1 reply; 7+ messages in thread
From: Dan Carpenter @ 2020-09-10 10:05 UTC (permalink / raw)
  To: kbuild, Andrew Jeffery, linux-hwmon
  Cc: lkp, kbuild-all, linux, jdelvare, openbmc, linux-kernel

[-- Attachment #1: Type: text/plain, Size: 3106 bytes --]

Hi Andrew,

url:    https://github.com/0day-ci/linux/commits/Andrew-Jeffery/hwmon-pmbus-Expose-PEC-debugfs-attribute/20200910-010642
base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
config: x86_64-randconfig-m001-20200909 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@intel.com>
Reported-by: Dan Carpenter <dan.carpenter@oracle.com>

smatch warnings:
drivers/hwmon/pmbus/pmbus_core.c:2415 pmbus_debugfs_ops_pec_open() warn: '0x' prefix is confusing together with '%1llu' specifier

# https://github.com/0day-ci/linux/commit/705b8b5588d4102256d0954086ed16c9bdf9804f
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Andrew-Jeffery/hwmon-pmbus-Expose-PEC-debugfs-attribute/20200910-010642
git checkout 705b8b5588d4102256d0954086ed16c9bdf9804f
vim +2415 drivers/hwmon/pmbus/pmbus_core.c

705b8b5588d410 Andrew Jeffery 2020-09-09  2391  static int pmbus_debugfs_set_pec(void *data, u64 val)
705b8b5588d410 Andrew Jeffery 2020-09-09  2392  {
705b8b5588d410 Andrew Jeffery 2020-09-09  2393  	int rc;
705b8b5588d410 Andrew Jeffery 2020-09-09  2394  	struct i2c_client *client = data;
705b8b5588d410 Andrew Jeffery 2020-09-09  2395  
705b8b5588d410 Andrew Jeffery 2020-09-09  2396  	if (!val) {
705b8b5588d410 Andrew Jeffery 2020-09-09  2397  		client->flags &= ~I2C_CLIENT_PEC;
705b8b5588d410 Andrew Jeffery 2020-09-09  2398  		return 0;
705b8b5588d410 Andrew Jeffery 2020-09-09  2399  	}
705b8b5588d410 Andrew Jeffery 2020-09-09  2400  
705b8b5588d410 Andrew Jeffery 2020-09-09  2401  	if (val != 1)
705b8b5588d410 Andrew Jeffery 2020-09-09  2402  		return -EINVAL;
705b8b5588d410 Andrew Jeffery 2020-09-09  2403  
705b8b5588d410 Andrew Jeffery 2020-09-09  2404  	rc = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
705b8b5588d410 Andrew Jeffery 2020-09-09  2405  	if (rc < 0)
705b8b5588d410 Andrew Jeffery 2020-09-09  2406  		return rc;
705b8b5588d410 Andrew Jeffery 2020-09-09  2407  
705b8b5588d410 Andrew Jeffery 2020-09-09  2408  	if (!(rc & PB_CAPABILITY_ERROR_CHECK))
705b8b5588d410 Andrew Jeffery 2020-09-09  2409  		return -ENOTSUPP;
705b8b5588d410 Andrew Jeffery 2020-09-09  2410  
705b8b5588d410 Andrew Jeffery 2020-09-09  2411  	client->flags |= I2C_CLIENT_PEC;
705b8b5588d410 Andrew Jeffery 2020-09-09  2412  
705b8b5588d410 Andrew Jeffery 2020-09-09  2413  	return 0;
705b8b5588d410 Andrew Jeffery 2020-09-09  2414  }
705b8b5588d410 Andrew Jeffery 2020-09-09 @2415  DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_pec, pmbus_debugfs_get_pec,
705b8b5588d410 Andrew Jeffery 2020-09-09  2416  			 pmbus_debugfs_set_pec, "0x%1llu\n");
                                                                                                 ^^^^^^^
Was the 1 intentional?  Anyway, you probably want to remove the 0x so
it doesn't look like hex.

705b8b5588d410 Andrew Jeffery 2020-09-09  2417  

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 49877 bytes --]

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hwmon: (pmbus) Expose PEC debugfs attribute
  2020-09-10 10:05 ` Dan Carpenter
@ 2020-09-10 10:34   ` Guenter Roeck
  2020-09-10 10:51     ` Andrew Jeffery
  0 siblings, 1 reply; 7+ messages in thread
From: Guenter Roeck @ 2020-09-10 10:34 UTC (permalink / raw)
  To: Dan Carpenter, kbuild, Andrew Jeffery, linux-hwmon
  Cc: lkp, kbuild-all, jdelvare, openbmc, linux-kernel

On 9/10/20 3:05 AM, Dan Carpenter wrote:
> Hi Andrew,
> 
> url:    https://github.com/0day-ci/linux/commits/Andrew-Jeffery/hwmon-pmbus-Expose-PEC-debugfs-attribute/20200910-010642
> base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
> config: x86_64-randconfig-m001-20200909 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@intel.com>
> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> 
> smatch warnings:
> drivers/hwmon/pmbus/pmbus_core.c:2415 pmbus_debugfs_ops_pec_open() warn: '0x' prefix is confusing together with '%1llu' specifier
> 
> # https://github.com/0day-ci/linux/commit/705b8b5588d4102256d0954086ed16c9bdf9804f
> git remote add linux-review https://github.com/0day-ci/linux
> git fetch --no-tags linux-review Andrew-Jeffery/hwmon-pmbus-Expose-PEC-debugfs-attribute/20200910-010642
> git checkout 705b8b5588d4102256d0954086ed16c9bdf9804f
> vim +2415 drivers/hwmon/pmbus/pmbus_core.c
> 
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2391  static int pmbus_debugfs_set_pec(void *data, u64 val)
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2392  {
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2393  	int rc;
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2394  	struct i2c_client *client = data;
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2395  
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2396  	if (!val) {
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2397  		client->flags &= ~I2C_CLIENT_PEC;
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2398  		return 0;
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2399  	}
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2400  
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2401  	if (val != 1)
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2402  		return -EINVAL;
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2403  
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2404  	rc = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2405  	if (rc < 0)
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2406  		return rc;
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2407  
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2408  	if (!(rc & PB_CAPABILITY_ERROR_CHECK))
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2409  		return -ENOTSUPP;
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2410  
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2411  	client->flags |= I2C_CLIENT_PEC;
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2412  
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2413  	return 0;
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2414  }
> 705b8b5588d410 Andrew Jeffery 2020-09-09 @2415  DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_pec, pmbus_debugfs_get_pec,
> 705b8b5588d410 Andrew Jeffery 2020-09-09  2416  			 pmbus_debugfs_set_pec, "0x%1llu\n");
>                                                                                                  ^^^^^^^
> Was the 1 intentional?  Anyway, you probably want to remove the 0x so
> it doesn't look like hex.
> 

Nice catch; I didn't notice the 1. It is still there in v2, but it does seem quite useless.

Guenter

> 705b8b5588d410 Andrew Jeffery 2020-09-09  2417  
> 
> ---
> 0-DAY CI Kernel Test Service, Intel Corporation
> https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
> 


^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hwmon: (pmbus) Expose PEC debugfs attribute
  2020-09-10 10:34   ` Guenter Roeck
@ 2020-09-10 10:51     ` Andrew Jeffery
  2020-09-10 13:32       ` Guenter Roeck
  0 siblings, 1 reply; 7+ messages in thread
From: Andrew Jeffery @ 2020-09-10 10:51 UTC (permalink / raw)
  To: Guenter Roeck, Dan Carpenter, kbuild, linux-hwmon
  Cc: kbuild test robot, kbuild-all, Jean Delvare, openbmc, linux-kernel



On Thu, 10 Sep 2020, at 20:04, Guenter Roeck wrote:
> On 9/10/20 3:05 AM, Dan Carpenter wrote:
> > Hi Andrew,
> > 
> > url:    https://github.com/0day-ci/linux/commits/Andrew-Jeffery/hwmon-pmbus-Expose-PEC-debugfs-attribute/20200910-010642
> > base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
> > config: x86_64-randconfig-m001-20200909 (attached as .config)
> > compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
> > 
> > If you fix the issue, kindly add following tag as appropriate
> > Reported-by: kernel test robot <lkp@intel.com>
> > Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
> > 
> > smatch warnings:
> > drivers/hwmon/pmbus/pmbus_core.c:2415 pmbus_debugfs_ops_pec_open() warn: '0x' prefix is confusing together with '%1llu' specifier
> > 
> > # https://github.com/0day-ci/linux/commit/705b8b5588d4102256d0954086ed16c9bdf9804f
> > git remote add linux-review https://github.com/0day-ci/linux
> > git fetch --no-tags linux-review Andrew-Jeffery/hwmon-pmbus-Expose-PEC-debugfs-attribute/20200910-010642
> > git checkout 705b8b5588d4102256d0954086ed16c9bdf9804f
> > vim +2415 drivers/hwmon/pmbus/pmbus_core.c
> > 
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2391  static int pmbus_debugfs_set_pec(void *data, u64 val)
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2392  {
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2393  	int rc;
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2394  	struct i2c_client *client = data;
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2395  
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2396  	if (!val) {
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2397  		client->flags &= ~I2C_CLIENT_PEC;
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2398  		return 0;
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2399  	}
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2400  
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2401  	if (val != 1)
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2402  		return -EINVAL;
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2403  
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2404  	rc = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2405  	if (rc < 0)
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2406  		return rc;
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2407  
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2408  	if (!(rc & PB_CAPABILITY_ERROR_CHECK))
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2409  		return -ENOTSUPP;
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2410  
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2411  	client->flags |= I2C_CLIENT_PEC;
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2412  
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2413  	return 0;
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2414  }
> > 705b8b5588d410 Andrew Jeffery 2020-09-09 @2415  DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_pec, pmbus_debugfs_get_pec,
> > 705b8b5588d410 Andrew Jeffery 2020-09-09  2416  			 pmbus_debugfs_set_pec, "0x%1llu\n");
> >                                                                                                  ^^^^^^^
> > Was the 1 intentional?  Anyway, you probably want to remove the 0x so
> > it doesn't look like hex.
> > 
> 
> Nice catch; I didn't notice the 1. It is still there in v2, but it does 
> seem quite useless.

Do you want to just rebase it out, or would you like me to send
a patch removing the stray 1 from v2?

Andrew

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH] hwmon: (pmbus) Expose PEC debugfs attribute
  2020-09-10 10:51     ` Andrew Jeffery
@ 2020-09-10 13:32       ` Guenter Roeck
  0 siblings, 0 replies; 7+ messages in thread
From: Guenter Roeck @ 2020-09-10 13:32 UTC (permalink / raw)
  To: Andrew Jeffery, Dan Carpenter, kbuild, linux-hwmon
  Cc: kbuild test robot, kbuild-all, Jean Delvare, openbmc, linux-kernel

On 9/10/20 3:51 AM, Andrew Jeffery wrote:
> 
> 
> On Thu, 10 Sep 2020, at 20:04, Guenter Roeck wrote:
>> On 9/10/20 3:05 AM, Dan Carpenter wrote:
>>> Hi Andrew,
>>>
>>> url:    https://github.com/0day-ci/linux/commits/Andrew-Jeffery/hwmon-pmbus-Expose-PEC-debugfs-attribute/20200910-010642
>>> base:   https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
>>> config: x86_64-randconfig-m001-20200909 (attached as .config)
>>> compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
>>>
>>> If you fix the issue, kindly add following tag as appropriate
>>> Reported-by: kernel test robot <lkp@intel.com>
>>> Reported-by: Dan Carpenter <dan.carpenter@oracle.com>
>>>
>>> smatch warnings:
>>> drivers/hwmon/pmbus/pmbus_core.c:2415 pmbus_debugfs_ops_pec_open() warn: '0x' prefix is confusing together with '%1llu' specifier
>>>
>>> # https://github.com/0day-ci/linux/commit/705b8b5588d4102256d0954086ed16c9bdf9804f
>>> git remote add linux-review https://github.com/0day-ci/linux
>>> git fetch --no-tags linux-review Andrew-Jeffery/hwmon-pmbus-Expose-PEC-debugfs-attribute/20200910-010642
>>> git checkout 705b8b5588d4102256d0954086ed16c9bdf9804f
>>> vim +2415 drivers/hwmon/pmbus/pmbus_core.c
>>>
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2391  static int pmbus_debugfs_set_pec(void *data, u64 val)
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2392  {
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2393  	int rc;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2394  	struct i2c_client *client = data;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2395  
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2396  	if (!val) {
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2397  		client->flags &= ~I2C_CLIENT_PEC;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2398  		return 0;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2399  	}
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2400  
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2401  	if (val != 1)
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2402  		return -EINVAL;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2403  
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2404  	rc = i2c_smbus_read_byte_data(client, PMBUS_CAPABILITY);
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2405  	if (rc < 0)
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2406  		return rc;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2407  
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2408  	if (!(rc & PB_CAPABILITY_ERROR_CHECK))
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2409  		return -ENOTSUPP;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2410  
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2411  	client->flags |= I2C_CLIENT_PEC;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2412  
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2413  	return 0;
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2414  }
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09 @2415  DEFINE_DEBUGFS_ATTRIBUTE(pmbus_debugfs_ops_pec, pmbus_debugfs_get_pec,
>>> 705b8b5588d410 Andrew Jeffery 2020-09-09  2416  			 pmbus_debugfs_set_pec, "0x%1llu\n");
>>>                                                                                                  ^^^^^^^
>>> Was the 1 intentional?  Anyway, you probably want to remove the 0x so
>>> it doesn't look like hex.
>>>
>>
>> Nice catch; I didn't notice the 1. It is still there in v2, but it does 
>> seem quite useless.
> 
> Do you want to just rebase it out, or would you like me to send
> a patch removing the stray 1 from v2?
> 

I'll rebase it.

Thanks,
Guenter


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2020-09-10 21:38 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-09-09 13:24 [PATCH] hwmon: (pmbus) Expose PEC debugfs attribute Andrew Jeffery
2020-09-09 15:31 ` Guenter Roeck
2020-09-10  2:12   ` Andrew Jeffery
2020-09-10 10:05 ` Dan Carpenter
2020-09-10 10:34   ` Guenter Roeck
2020-09-10 10:51     ` Andrew Jeffery
2020-09-10 13:32       ` Guenter Roeck

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).