hwmon: occ: Display info about the OCC code level and sensors found
PATCH 1/3 hwmon: occ: Display info about the OCC code level and sensors found
--- drivers/hwmon/occ/common.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-)
drivers/hwmon/occ/common.c +11 -1
@@ -1296,7 +1296,7 @@ static void occ_sysfs_notify(struct occ *occ)/* only need to do this once at startup, as OCC won't change sensors on us */ static void occ_parse_poll_response (struct occ *occ) { -unsigned int i, offset =0 , size =0 ; +unsigned int i, offset =0 , size =0 , old_offset;struct occ_sensor *sensor;struct occ_sensors *sensors = &occ->sensors;struct occ_response *resp = &occ->resp;
@@ -1305,8 +1305,12 @@ static void occ_parse_poll_response(struct occ *occ)struct occ_poll_response_header *header = &poll->header;struct occ_sensor_data_block *block = &poll->block; +dev_info (occ->bus_dev,"OCC found, code level: %.16s\n" , + header->occ_code_level); +for (i =0 ; i < header->num_sensor_data_blocks; ++i) { block = (struct occ_sensor_data_block *)((u8 *)block + offset); + old_offset = offset; offset = (block->header.num_sensors * block->header.sensor_length) +sizeof (block->header); size += offset;
@@ -1317,6 +1321,10 @@ static void occ_parse_poll_response(struct occ *occ)return ; } +dev_dbg (occ->bus_dev," %04x..%04x: %.4s (%d sensors)\n" , + old_offset, offset -1 , block->header.eye_catcher, + block->header.num_sensors); +/* match sensor block type */ if (strncmp (block->header.eye_catcher,"TEMP" ,4 ) ==0 ) sensor = &sensors->temp;
@@ -1338,6 +1346,8 @@ static void occ_parse_poll_response(struct occ *occ) sensor->version = block->header.sensor_format; sensor->data = &block->data; } +dev_dbg (occ->bus_dev,"Max resp size: %d+%d=%d\n" , + size,sizeof (*header), size +sizeof (*header)); }int occ_setup (struct occ *occ,const char *name)
Signature · 1 line
2.17.0
PATCH 2/3 hwmon: occ: Avoid displaying an error when host is down
Instead display a much less scary informational message as this can happen in normal circumstances.
--- drivers/hwmon/occ/common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)
drivers/hwmon/occ/common.c +4 -1
@@ -1359,7 +1359,10 @@ int occ_setup(struct occ *occ, const char *name)/* no need to lock */ rc =occ_poll (occ); -if (rc <0 ) { +if (rc == -ESHUTDOWN ) { +dev_info (occ->bus_dev,"Host is not ready\n" ); +return rc; + }else if (rc <0 ) {dev_err (occ->bus_dev,"failed to get OCC poll response: %d\n" , rc);return rc;
Signature · 1 line
2.17.0
Re: [PATCH linux dev-4.13 2/3] hwmon: occ: Avoid displaying an error when host is down
Quoted 13 lines · Benjamin Herrenschmidt
Instead display a much less scary informational message as this can happen in normal circumstances.
Signed-off-by Benjamin Herrenschmidt <[email protected]>--- drivers/hwmon/occ/common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/hwmon/occ/common.c +0
-0
drivers/hwmon/occ/common.c int occ_setup(struct occ *occ, const char *name) · line 1363
Quoted 6 lines
drivers/hwmon/occ/common.c +2
-1@@ -1359,7 +1359,10 @@ int occ_setup(struct occ *occ, const char *name)/* no need to lock */ rc =occ_poll (occ); -if (rc <0 ) { +if (rc == -ESHUTDOWN ) { +dev_info (occ->bus_dev,"Host is not ready\n" );
Given this is normal, should we make this dev_dbg?
Otherwise we see it on the bmc serial console every time we boot the machine.
Re: [PATCH linux dev-4.13 2/3] hwmon: occ: Avoid displaying an error when host is down
Quoted 24 lines · Joel Stanley
Quoted 13 lines · Benjamin Herrenschmidt
Instead display a much less scary informational message as this can happen in normal circumstances.
Signed-off-by Benjamin Herrenschmidt <[email protected]>--- drivers/hwmon/occ/common.c | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-)drivers/hwmon/occ/common.c +0
-0drivers/hwmon/occ/common.c int occ_setup(struct occ *occ, const char *name) · line 1363
Quoted 6 lines
drivers/hwmon/occ/common.c +2
-1@@ -1359,7 +1359,10 @@ int occ_setup(struct occ *occ, const char *name)/* no need to lock */ rc =occ_poll (occ); -if (rc <0 ) { +if (rc == -ESHUTDOWN ) { +dev_info (occ->bus_dev,"Host is not ready\n" );Given this is normal, should we make this
dev_dbg?
Quoted 1 line
Otherwise we see it on the bmc serial console every time we boot the machine.
Up to you, feel free to tweak it as you merge :-)
Cheers,
Ben.
PATCH 3/3 hwmon: occ: Properly initialize sysfs attributes
In reply to Benjamin HerrenschmidtOtherwise, lockdep will complain
--- drivers/hwmon/occ/common.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/hwmon/occ/common.c +3 -1
@@ -1166,8 +1166,10 @@ static int occ_setup_sensor_attrs(struct occ *occ) }/* put the sensors in the group */ -for (i =0 ; i < num_attrs; ++i) +for (i =0 ; i < num_attrs; ++i) { +sysfs_attr_init (&occ->attrs[i].sensor.dev_attr.attr); occ->group.attrs[i] = &occ->attrs[i].sensor.dev_attr.attr; + }return 0 ; }
Signature · 1 line
2.17.0