hwmon: (pmbus) Support 4th PSU temperature sensor
RFC PATCH 1/1 hwmon: (pmbus) Support 4th PSU temperature sensor
From: Madhava Reddy Siddareddygari <[email protected]>
PSU650W has four temperature sensors, while the pmbus driver currently only support three temperature sensors.
So, support a fourth temp sensor, i. e. PSU outlet temperature sensor, by copying what is done for temperature sensor 3, and use register 0xDF.
PSU650W is based on LITE-ON vendor.
LITE-ON MFG part numbers for the PSU are PS-2651-3SB5 Z and PS-2651-3SA5 Z.
---
This as a RFC, as we know 0xDF is a manufacturer specific register, and cannot be added to the PMBus core driver. It was submitted to SONiC [1] by Cisco engineers.
It’d be great if the maintainers good suggest how to easily implement a custom driver for that PSU?
[1]: https://github.com/Azure/sonic-linux-kernel/pull/214
drivers/hwmon/pmbus/pmbus.c | 4 +++- drivers/hwmon/pmbus/pmbus.h | 3 +++ drivers/hwmon/pmbus/pmbus_core.c | 38 ++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-)
drivers/hwmon/pmbus/pmbus.c +3 -1
@@ -60,8 +60,10 @@ static void pmbus_find_sensor_groups(struct i2c_client *client, info->func[0 ] |=PMBUS_HAVE_TEMP2 ;if (pmbus_check_word_register (client,0 ,PMBUS_READ_TEMPERATURE_3 )) info->func[0 ] |=PMBUS_HAVE_TEMP3 ; +if (pmbus_check_word_register (client,0 ,PMBUS_READ_TEMPERATURE_4 )) + info->func[0 ] |=PMBUS_HAVE_TEMP4 ;if (info->func[0 ] & (PMBUS_HAVE_TEMP |PMBUS_HAVE_TEMP2 - |PMBUS_HAVE_TEMP3 ) + |PMBUS_HAVE_TEMP3 |PMBUS_HAVE_TEMP4 ) &&pmbus_check_byte_register (client,0 ,PMBUS_STATUS_TEMPERATURE )) info->func[0 ] |=PMBUS_HAVE_STATUS_TEMP ;
drivers/hwmon/pmbus/pmbus.h +3 -0
@@ -135,6 +135,8 @@ enum pmbus_regs {PMBUS_MFR_MAX_TEMP_2 =0xC1 ,PMBUS_MFR_MAX_TEMP_3 =0xC2 , + PMBUS_READ_TEMPERATURE_4 = 0xDF, +/* * Virtual registers. * Useful to support attributes which are not supported by standard PMBus
@@ -401,6 +403,7 @@ enum pmbus_sensor_classes {#define PMBUS_HAVE_PWM12 BIT(20)#define PMBUS_HAVE_PWM34 BIT(21)#define PMBUS_HAVE_SAMPLES BIT(22) +#define PMBUS_HAVE_TEMP4 BIT(23)#define PMBUS_PHASE_VIRTUAL BIT(30)/* Phases on this page are virtual */ #define PMBUS_PAGE_VIRTUAL BIT(31)/* Page is virtual */
drivers/hwmon/pmbus/pmbus_core.c +38 -0
@@ -1810,6 +1810,32 @@ static const struct pmbus_limit_attr temp_limit_attrs3[] = { }, }; +static const struct pmbus_limit_attr temp_limit_attrs4[] = { + { + .reg =PMBUS_UT_WARN_LIMIT , + .low = true, + .attr ="min" , + .alarm ="min_alarm" , + .sbit =PB_TEMP_UT_WARNING , + }, { + .reg =PMBUS_UT_FAULT_LIMIT , + .low = true, + .attr ="lcrit" , + .alarm ="lcrit_alarm" , + .sbit =PB_TEMP_UT_FAULT , + }, { + .reg =PMBUS_OT_WARN_LIMIT , + .attr ="max" , + .alarm ="max_alarm" , + .sbit =PB_TEMP_OT_WARNING , + }, { + .reg =PMBUS_OT_FAULT_LIMIT , + .attr ="crit" , + .alarm ="crit_alarm" , + .sbit =PB_TEMP_OT_FAULT , + } +}; +static const struct pmbus_sensor_attr temp_attributes[] = { { .reg =PMBUS_READ_TEMPERATURE_1 ,
@@ -1847,6 +1873,18 @@ static const struct pmbus_sensor_attr temp_attributes[] = { .gbit = PB_STATUS_TEMPERATURE, .limit = temp_limit_attrs3, .nlimit = ARRAY_SIZE(temp_limit_attrs3), + }, { + .reg = PMBUS_READ_TEMPERATURE_4, + .class = PSC_TEMPERATURE, + .paged = true, + .update = true, + .compare = true, + .func = PMBUS_HAVE_TEMP4, + .sfunc = PMBUS_HAVE_STATUS_TEMP, + .sbase = PB_STATUS_TEMP_BASE, + .gbit = PB_STATUS_TEMPERATURE, + .limit = temp_limit_attrs4, + .nlimit = ARRAY_SIZE(temp_limit_attrs4), } };
Signature · 1 line
2.32.0
Dear Linux folks,
Am 28.07.21 um 11:38 schrieb Paul Menzel:
Quoted 15 lines
From: Madhava Reddy Siddareddygari <[email protected]>
PSU650W has four temperature sensors, while the pmbus driver currently only support three temperature sensors.
So, support a fourth temp sensor, i. e. PSU outlet temperature sensor, by copying what is done for temperature sensor 3, and use register
0xDF.PSU650W is based on LITE-ON vendor.
LITE-ON MFG part numbers for the PSU are PS-2651-3SB5 Z and PS-2651-3SA5 Z.Signed-off-by Madhava Reddy Siddareddygari <[email protected]>Signed-off-by Venkat Garigipati <[email protected]>Cc Billie Alsup <[email protected]>Signed-off-by Paul Menzel <[email protected]>
Quoted 6 lines
---
This as a RFC, as we know0xDFis a manufacturer specific register, and cannot be added to the PMBus core driver. It was submitted to SONiC [1] by Cisco engineers.It’d be great if the maintainers [could] suggest how to easily implement a
I meant *could* instead of *good*.
Quoted 1 line
custom driver for that PSU?
Kind regards,
Paul
Quoted 101 lines
[1]: https://github.com/Azure/sonic-linux-kernel/pull/214
drivers/hwmon/pmbus/pmbus.c | 4 +++- drivers/hwmon/pmbus/pmbus.h | 3 +++ drivers/hwmon/pmbus/pmbus_core.c | 38 ++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-)drivers/hwmon/pmbus/pmbus.c +3
-1@@ -60,8 +60,10 @@ static void pmbus_find_sensor_groups(struct i2c_client *client, info->func[0 ] |=PMBUS_HAVE_TEMP2 ;if (pmbus_check_word_register (client,0 ,PMBUS_READ_TEMPERATURE_3 )) info->func[0 ] |=PMBUS_HAVE_TEMP3 ; +if (pmbus_check_word_register (client,0 ,PMBUS_READ_TEMPERATURE_4 )) + info->func[0 ] |=PMBUS_HAVE_TEMP4 ;if (info->func[0 ] & (PMBUS_HAVE_TEMP |PMBUS_HAVE_TEMP2 - |PMBUS_HAVE_TEMP3 ) + |PMBUS_HAVE_TEMP3 |PMBUS_HAVE_TEMP4 ) &&pmbus_check_byte_register (client,0 ,PMBUS_STATUS_TEMPERATURE )) info->func[0 ] |=PMBUS_HAVE_STATUS_TEMP ;drivers/hwmon/pmbus/pmbus.h +3
-0@@ -135,6 +135,8 @@ enum pmbus_regs {PMBUS_MFR_MAX_TEMP_2 =0xC1 ,PMBUS_MFR_MAX_TEMP_3 =0xC2 , + PMBUS_READ_TEMPERATURE_4 = 0xDF, +/* * Virtual registers. * Useful to support attributes which are not supported by standard PMBus @@ -401,6 +403,7 @@ enum pmbus_sensor_classes {#define PMBUS_HAVE_PWM12 BIT(20)#define PMBUS_HAVE_PWM34 BIT(21)#define PMBUS_HAVE_SAMPLES BIT(22) +#define PMBUS_HAVE_TEMP4 BIT(23)#define PMBUS_PHASE_VIRTUAL BIT(30)/* Phases on this page are virtual */ #define PMBUS_PAGE_VIRTUAL BIT(31)/* Page is virtual */ drivers/hwmon/pmbus/pmbus_core.c +38
-0@@ -1810,6 +1810,32 @@ static const struct pmbus_limit_attr temp_limit_attrs3[] = { }, }; +static const struct pmbus_limit_attr temp_limit_attrs4[] = { + { + .reg =PMBUS_UT_WARN_LIMIT , + .low = true, + .attr ="min" , + .alarm ="min_alarm" , + .sbit =PB_TEMP_UT_WARNING , + }, { + .reg =PMBUS_UT_FAULT_LIMIT , + .low = true, + .attr ="lcrit" , + .alarm ="lcrit_alarm" , + .sbit =PB_TEMP_UT_FAULT , + }, { + .reg =PMBUS_OT_WARN_LIMIT , + .attr ="max" , + .alarm ="max_alarm" , + .sbit =PB_TEMP_OT_WARNING , + }, { + .reg =PMBUS_OT_FAULT_LIMIT , + .attr ="crit" , + .alarm ="crit_alarm" , + .sbit =PB_TEMP_OT_FAULT , + } +}; +static const struct pmbus_sensor_attr temp_attributes[] = { { .reg =PMBUS_READ_TEMPERATURE_1 ,@@ -1847,6 +1873,18 @@ static const struct pmbus_sensor_attr temp_attributes[] = { .gbit = PB_STATUS_TEMPERATURE, .limit = temp_limit_attrs3, .nlimit = ARRAY_SIZE(temp_limit_attrs3), + }, { + .reg = PMBUS_READ_TEMPERATURE_4, + .class = PSC_TEMPERATURE, + .paged = true, + .update = true, + .compare = true, + .func = PMBUS_HAVE_TEMP4, + .sfunc = PMBUS_HAVE_STATUS_TEMP, + .sbase = PB_STATUS_TEMP_BASE, + .gbit = PB_STATUS_TEMPERATURE, + .limit = temp_limit_attrs4, + .nlimit = ARRAY_SIZE(temp_limit_attrs4), } };
Guenter Roeck
maintainerQuoted 15 lines · Paul Menzel
From: Madhava Reddy Siddareddygari <[email protected]>
PSU650W has four temperature sensors, while the pmbus driver currently only support three temperature sensors.
So, support a fourth temp sensor, i. e. PSU outlet temperature sensor, by copying what is done for temperature sensor 3, and use register
0xDF.PSU650W is based on LITE-ON vendor.
LITE-ON MFG part numbers for the PSU are PS-2651-3SB5 Z and PS-2651-3SA5 Z.Signed-off-by Madhava Reddy Siddareddygari <[email protected]>Signed-off-by Venkat Garigipati <[email protected]>Cc Billie Alsup <[email protected]>Signed-off-by Paul Menzel <[email protected]>
Quoted 8 lines
---
This as a RFC, as we know0xDFis a manufacturer specific register, and cannot be added to the PMBus core driver. It was submitted to SONiC [1] by Cisco engineers.It’d be great if the maintainers good suggest how to easily implement a custom driver for that PSU?
Implement a chip driver with a set of read/write functions. Claim it has two pages, with the second page only implementing a single temperature sensor. In the read/write functions, handle page 0 normally, and access the second sensor whenever page 1 is accessed.
Quoted 1 line
The comments there are a bit concerning.
"* Virtual registers.
* Useful to support attributes which are not supported by standard PMBus
* registers but exist as manufacturer specific registers on individual chips.
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
* Must be mapped to real registers in device specific code. ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
"
Then,
"... is Manufacturer specific command. These are not Virtual registers."
Isn't that exactly what the "Virtual registers" description states ? How can that be explained better ?
Either case, I see no need to define a virtual register for a 4th temperature sensor. This can easily be implemented with the mechanism described above.
Guenter
Quoted 100 lines
drivers/hwmon/pmbus/pmbus.c | 4 +++- drivers/hwmon/pmbus/pmbus.h | 3 +++ drivers/hwmon/pmbus/pmbus_core.c | 38 ++++++++++++++++++++++++++++++++ 3 files changed, 44 insertions(+), 1 deletion(-)drivers/hwmon/pmbus/pmbus.c +3
-1@@ -60,8 +60,10 @@ static void pmbus_find_sensor_groups(struct i2c_client *client, info->func[0 ] |=PMBUS_HAVE_TEMP2 ;if (pmbus_check_word_register (client,0 ,PMBUS_READ_TEMPERATURE_3 )) info->func[0 ] |=PMBUS_HAVE_TEMP3 ; +if (pmbus_check_word_register (client,0 ,PMBUS_READ_TEMPERATURE_4 )) + info->func[0 ] |=PMBUS_HAVE_TEMP4 ;if (info->func[0 ] & (PMBUS_HAVE_TEMP |PMBUS_HAVE_TEMP2 - |PMBUS_HAVE_TEMP3 ) + |PMBUS_HAVE_TEMP3 |PMBUS_HAVE_TEMP4 ) &&pmbus_check_byte_register (client,0 ,PMBUS_STATUS_TEMPERATURE )) info->func[0 ] |=PMBUS_HAVE_STATUS_TEMP ;drivers/hwmon/pmbus/pmbus.h +3
-0@@ -135,6 +135,8 @@ enum pmbus_regs {PMBUS_MFR_MAX_TEMP_2 =0xC1 ,PMBUS_MFR_MAX_TEMP_3 =0xC2 , + PMBUS_READ_TEMPERATURE_4 = 0xDF, +/* * Virtual registers. * Useful to support attributes which are not supported by standard PMBus @@ -401,6 +403,7 @@ enum pmbus_sensor_classes {#define PMBUS_HAVE_PWM12 BIT(20)#define PMBUS_HAVE_PWM34 BIT(21)#define PMBUS_HAVE_SAMPLES BIT(22) +#define PMBUS_HAVE_TEMP4 BIT(23)#define PMBUS_PHASE_VIRTUAL BIT(30)/* Phases on this page are virtual */ #define PMBUS_PAGE_VIRTUAL BIT(31)/* Page is virtual */ drivers/hwmon/pmbus/pmbus_core.c +38
-0@@ -1810,6 +1810,32 @@ static const struct pmbus_limit_attr temp_limit_attrs3[] = { }, }; +static const struct pmbus_limit_attr temp_limit_attrs4[] = { + { + .reg =PMBUS_UT_WARN_LIMIT , + .low = true, + .attr ="min" , + .alarm ="min_alarm" , + .sbit =PB_TEMP_UT_WARNING , + }, { + .reg =PMBUS_UT_FAULT_LIMIT , + .low = true, + .attr ="lcrit" , + .alarm ="lcrit_alarm" , + .sbit =PB_TEMP_UT_FAULT , + }, { + .reg =PMBUS_OT_WARN_LIMIT , + .attr ="max" , + .alarm ="max_alarm" , + .sbit =PB_TEMP_OT_WARNING , + }, { + .reg =PMBUS_OT_FAULT_LIMIT , + .attr ="crit" , + .alarm ="crit_alarm" , + .sbit =PB_TEMP_OT_FAULT , + } +}; +static const struct pmbus_sensor_attr temp_attributes[] = { { .reg =PMBUS_READ_TEMPERATURE_1 ,@@ -1847,6 +1873,18 @@ static const struct pmbus_sensor_attr temp_attributes[] = { .gbit = PB_STATUS_TEMPERATURE, .limit = temp_limit_attrs3, .nlimit = ARRAY_SIZE(temp_limit_attrs3), + }, { + .reg = PMBUS_READ_TEMPERATURE_4, + .class = PSC_TEMPERATURE, + .paged = true, + .update = true, + .compare = true, + .func = PMBUS_HAVE_TEMP4, + .sfunc = PMBUS_HAVE_STATUS_TEMP, + .sbase = PB_STATUS_TEMP_BASE, + .gbit = PB_STATUS_TEMPERATURE, + .limit = temp_limit_attrs4, + .nlimit = ARRAY_SIZE(temp_limit_attrs4), } };
kernel test robot
build bot[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi Paul,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on hwmon/hwmon-next]
[also build test ERROR on v5.14-rc3 next-20210727]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Paul-Menzel/hwmon-pmbus-Support-4th-PSU-temperature-sensor/20210728-174022 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next config: powerpc-randconfig-s031-20210728 (attached as .config) compiler: powerpc-linux-gcc (GCC) 10.3.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.3-341-g8af24329-dirty
# https://github.com/0day-ci/linux/commit/a5972c52662d165d963025cb03ebc14bf638e310
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Paul-Menzel/hwmon-pmbus-Support-4th-PSU-temperature-sensor/20210728-174022
git checkout a5972c52662d165d963025cb03ebc14bf638e310
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-10.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=powerpc SHELL=/bin/bash drivers/hwmon/pmbus/
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
>> drivers/hwmon/pmbus/pmbus_core.c:1884:4: error: 'const struct pmbus_sensor_attr' has no member named 'sbase'
1884 | .sbase = PB_STATUS_TEMP_BASE,
| ^~~~~
>> drivers/hwmon/pmbus/pmbus_core.c:1884:12: error: 'PB_STATUS_TEMP_BASE' undeclared here (not in a function); did you mean 'PB_STATUS_TEMPERATURE'?
1884 | .sbase = PB_STATUS_TEMP_BASE,
| ^~~~~~~~~~~~~~~~~~~
| PB_STATUS_TEMPERATUREvim +1884 drivers/hwmon/pmbus/pmbus_core.c
1838
1839 static const struct pmbus_sensor_attr temp_attributes[] = {
1840 {
1841 .reg = PMBUS_READ_TEMPERATURE_1,
1842 .class = PSC_TEMPERATURE,
1843 .paged = true,
1844 .update = true,
1845 .compare = true,
1846 .func = PMBUS_HAVE_TEMP,
1847 .sfunc = PMBUS_HAVE_STATUS_TEMP,
1848 .sreg = PMBUS_STATUS_TEMPERATURE,
1849 .gbit = PB_STATUS_TEMPERATURE,
1850 .limit = temp_limit_attrs,
1851 .nlimit = ARRAY_SIZE(temp_limit_attrs),
1852 }, {
1853 .reg = PMBUS_READ_TEMPERATURE_2,
1854 .class = PSC_TEMPERATURE,
1855 .paged = true,
1856 .update = true,
1857 .compare = true,
1858 .func = PMBUS_HAVE_TEMP2,
1859 .sfunc = PMBUS_HAVE_STATUS_TEMP,
1860 .sreg = PMBUS_STATUS_TEMPERATURE,
1861 .gbit = PB_STATUS_TEMPERATURE,
1862 .limit = temp_limit_attrs2,
1863 .nlimit = ARRAY_SIZE(temp_limit_attrs2),
1864 }, {
1865 .reg = PMBUS_READ_TEMPERATURE_3,
1866 .class = PSC_TEMPERATURE,
1867 .paged = true,
1868 .update = true,
1869 .compare = true,
1870 .func = PMBUS_HAVE_TEMP3,
1871 .sfunc = PMBUS_HAVE_STATUS_TEMP,
1872 .sreg = PMBUS_STATUS_TEMPERATURE,
1873 .gbit = PB_STATUS_TEMPERATURE,
1874 .limit = temp_limit_attrs3,
1875 .nlimit = ARRAY_SIZE(temp_limit_attrs3),
1876 }, {
1877 .reg = PMBUS_READ_TEMPERATURE_4,
1878 .class = PSC_TEMPERATURE,
1879 .paged = true,
1880 .update = true,
1881 .compare = true,
1882 .func = PMBUS_HAVE_TEMP4,
1883 .sfunc = PMBUS_HAVE_STATUS_TEMP,
> 1884 .sbase = PB_STATUS_TEMP_BASE,
1885 .gbit = PB_STATUS_TEMPERATURE,
1886 .limit = temp_limit_attrs4,
1887 .nlimit = ARRAY_SIZE(temp_limit_attrs4),
1888 }
1889 };
1890
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org
kernel test robot
build bot[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in https://git-scm.com/docs/git-format-patch]
Hi Paul,
[FYI, it's a private test report for your RFC patch.]
[auto build test ERROR on hwmon/hwmon-next]
[also build test ERROR on v5.14-rc3 next-20210728]
[If your patch is applied to the wrong git tree, kindly drop us a note. And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]
url: https://github.com/0day-ci/linux/commits/Paul-Menzel/hwmon-pmbus-Support-4th-PSU-temperature-sensor/20210728-174022 base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next config: x86_64-randconfig-a011-20210728 (attached as .config) compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project c49df15c278857adecd12db6bb1cdc96885f7079)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross chmod +x ~/bin/make.cross
# https://github.com/0day-ci/linux/commit/a5972c52662d165d963025cb03ebc14bf638e310
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Paul-Menzel/hwmon-pmbus-Support-4th-PSU-temperature-sensor/20210728-174022 git checkout a5972c52662d165d963025cb03ebc14bf638e310
# save the attached .config to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross O=build_dir ARCH=x86_64 SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
All errors (new ones prefixed by >>):
>> drivers/hwmon/pmbus/pmbus_core.c:1884:12: error: use of undeclared identifier 'PB_STATUS_TEMP_BASE'
.sbase = PB_STATUS_TEMP_BASE,
^
>> drivers/hwmon/pmbus/pmbus_core.c:2169:10: error: invalid application of 'sizeof' to an incomplete type 'const struct pmbus_sensor_attr []'
ARRAY_SIZE(temp_attributes));
^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:44:32: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~~~
drivers/hwmon/pmbus/pmbus_core.c:2216:12: error: invalid application of 'sizeof' to an incomplete type 'const struct pmbus_sensor_attr []'
.nattr = ARRAY_SIZE(temp_attributes),
^~~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:44:32: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~~~
>> drivers/hwmon/pmbus/pmbus_core.c:2264:18: error: invalid application of 'sizeof' to an incomplete type 'const struct pmbus_class_attr_map []'
for (i = 0; i < ARRAY_SIZE(class_attr_map); i++) {
^~~~~~~~~~~~~~~~~~~~~~~~~~
include/linux/kernel.h:44:32: note: expanded from macro 'ARRAY_SIZE'
#define ARRAY_SIZE(arr) (sizeof(arr) / sizeof((arr)[0]) + __must_be_array(arr))
^~~~~4 errors generated.
vim +/PB_STATUS_TEMP_BASE +1884 drivers/hwmon/pmbus/pmbus_core.c
1838
1839 static const struct pmbus_sensor_attr temp_attributes[] = {
1840 {
1841 .reg = PMBUS_READ_TEMPERATURE_1,
1842 .class = PSC_TEMPERATURE,
1843 .paged = true,
1844 .update = true,
1845 .compare = true,
1846 .func = PMBUS_HAVE_TEMP,
1847 .sfunc = PMBUS_HAVE_STATUS_TEMP,
1848 .sreg = PMBUS_STATUS_TEMPERATURE,
1849 .gbit = PB_STATUS_TEMPERATURE,
1850 .limit = temp_limit_attrs,
1851 .nlimit = ARRAY_SIZE(temp_limit_attrs),
1852 }, {
1853 .reg = PMBUS_READ_TEMPERATURE_2,
1854 .class = PSC_TEMPERATURE,
1855 .paged = true,
1856 .update = true,
1857 .compare = true,
1858 .func = PMBUS_HAVE_TEMP2,
1859 .sfunc = PMBUS_HAVE_STATUS_TEMP,
1860 .sreg = PMBUS_STATUS_TEMPERATURE,
1861 .gbit = PB_STATUS_TEMPERATURE,
1862 .limit = temp_limit_attrs2,
1863 .nlimit = ARRAY_SIZE(temp_limit_attrs2),
1864 }, {
1865 .reg = PMBUS_READ_TEMPERATURE_3,
1866 .class = PSC_TEMPERATURE,
1867 .paged = true,
1868 .update = true,
1869 .compare = true,
1870 .func = PMBUS_HAVE_TEMP3,
1871 .sfunc = PMBUS_HAVE_STATUS_TEMP,
1872 .sreg = PMBUS_STATUS_TEMPERATURE,
1873 .gbit = PB_STATUS_TEMPERATURE,
1874 .limit = temp_limit_attrs3,
1875 .nlimit = ARRAY_SIZE(temp_limit_attrs3),
1876 }, {
1877 .reg = PMBUS_READ_TEMPERATURE_4,
1878 .class = PSC_TEMPERATURE,
1879 .paged = true,
1880 .update = true,
1881 .compare = true,
1882 .func = PMBUS_HAVE_TEMP4,
1883 .sfunc = PMBUS_HAVE_STATUS_TEMP,
> 1884 .sbase = PB_STATUS_TEMP_BASE,
1885 .gbit = PB_STATUS_TEMPERATURE,
1886 .limit = temp_limit_attrs4,
1887 .nlimit = ARRAY_SIZE(temp_limit_attrs4),
1888 }
1889 };
1890
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org