From: kernel test robot <lkp@intel.com>
To: Leo Yang <leo.yang.sy0@gmail.com>,
jdelvare@suse.com, linux@roeck-us.net, robh@kernel.org,
krzk+dt@kernel.org, conor+dt@kernel.org, Leo-Yang@quantatw.com,
corbet@lwn.net, Delphine_CC_Chiu@wiwynn.com,
linux-hwmon@vger.kernel.org, devicetree@vger.kernel.org,
linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org
Cc: llvm@lists.linux.dev, oe-kbuild-all@lists.linux.dev,
Leo Yang <leo.yang.sy0@gmail.com>
Subject: Re: [PATCH v3 2/2] hwmon: Add driver for TI INA233 Current and Power Monitor
Date: Sat, 18 Jan 2025 07:07:16 +0800 [thread overview]
Message-ID: <202501180656.96daAp3W-lkp@intel.com> (raw)
In-Reply-To: <20250115015519.950795-3-leo.yang.sy0@gmail.com>
Hi Leo,
kernel test robot noticed the following build warnings:
[auto build test WARNING on groeck-staging/hwmon-next]
[also build test WARNING on linus/master v6.13-rc7 next-20250117]
[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#_base_tree_information]
url: https://github.com/intel-lab-lkp/linux/commits/Leo-Yang/dt-bindings-hwmon-ti-ina2xx-Add-INA233-device/20250115-095801
base: https://git.kernel.org/pub/scm/linux/kernel/git/groeck/linux-staging.git hwmon-next
patch link: https://lore.kernel.org/r/20250115015519.950795-3-leo.yang.sy0%40gmail.com
patch subject: [PATCH v3 2/2] hwmon: Add driver for TI INA233 Current and Power Monitor
config: s390-allmodconfig (https://download.01.org/0day-ci/archive/20250118/202501180656.96daAp3W-lkp@intel.com/config)
compiler: clang version 19.1.3 (https://github.com/llvm/llvm-project ab51eccf88f5321e7c60591c5546b254b6afab99)
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20250118/202501180656.96daAp3W-lkp@intel.com/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@intel.com>
| Closes: https://lore.kernel.org/oe-kbuild-all/202501180656.96daAp3W-lkp@intel.com/
All warnings (new ones prefixed by >>):
In file included from drivers/hwmon/pmbus/ina233.c:9:
In file included from include/linux/i2c.h:13:
In file included from include/linux/acpi.h:14:
In file included from include/linux/device.h:32:
In file included from include/linux/device/driver.h:21:
In file included from include/linux/module.h:19:
In file included from include/linux/elf.h:6:
In file included from arch/s390/include/asm/elf.h:181:
In file included from arch/s390/include/asm/mmu_context.h:11:
In file included from arch/s390/include/asm/pgalloc.h:18:
In file included from include/linux/mm.h:2223:
include/linux/vmstat.h:504:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
504 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
505 | item];
| ~~~~
include/linux/vmstat.h:511:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
511 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
512 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
include/linux/vmstat.h:518:36: warning: arithmetic between different enumeration types ('enum node_stat_item' and 'enum lru_list') [-Wenum-enum-conversion]
518 | return node_stat_name(NR_LRU_BASE + lru) + 3; // skip "nr_"
| ~~~~~~~~~~~ ^ ~~~
include/linux/vmstat.h:524:43: warning: arithmetic between different enumeration types ('enum zone_stat_item' and 'enum numa_stat_item') [-Wenum-enum-conversion]
524 | return vmstat_text[NR_VM_ZONE_STAT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~ ^
525 | NR_VM_NUMA_EVENT_ITEMS +
| ~~~~~~~~~~~~~~~~~~~~~~
>> drivers/hwmon/pmbus/ina233.c:147:10: warning: format specifies type 'unsigned long' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
146 | "The product of Current_LSB %lu and shunt resistor %lu exceed MFR_CALIBRATION register limit.\n",
| ~~~
| %u
147 | current_lsb, rshunt);
| ^~~~~~~~~~~
drivers/hwmon/pmbus/ina233.c:147:23: warning: format specifies type 'unsigned long' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
146 | "The product of Current_LSB %lu and shunt resistor %lu exceed MFR_CALIBRATION register limit.\n",
| ~~~
| %u
147 | current_lsb, rshunt);
| ^~~~~~
drivers/hwmon/pmbus/ina233.c:153:17: warning: format specifies type 'unsigned long' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
152 | dev_dbg(dev, "power monitor %s (Rshunt = %lu uOhm, Current_LSB = %lu uA/bit)\n",
| ~~~
| %u
153 | client->name, rshunt, current_lsb);
| ^~~~~~
include/linux/dev_printk.h:165:39: note: expanded from macro 'dev_dbg'
165 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dynamic_debug.h:274:19: note: expanded from macro 'dynamic_dev_dbg'
274 | dev, fmt, ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dynamic_debug.h:250:59: note: expanded from macro '_dynamic_func_call'
250 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:248:65: note: expanded from macro '_dynamic_func_call_cls'
248 | __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:224:15: note: expanded from macro '__dynamic_func_call_cls'
224 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
drivers/hwmon/pmbus/ina233.c:153:25: warning: format specifies type 'unsigned long' but the argument has type 'u32' (aka 'unsigned int') [-Wformat]
152 | dev_dbg(dev, "power monitor %s (Rshunt = %lu uOhm, Current_LSB = %lu uA/bit)\n",
| ~~~
| %u
153 | client->name, rshunt, current_lsb);
| ^~~~~~~~~~~
include/linux/dev_printk.h:165:39: note: expanded from macro 'dev_dbg'
165 | dynamic_dev_dbg(dev, dev_fmt(fmt), ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dynamic_debug.h:274:19: note: expanded from macro 'dynamic_dev_dbg'
274 | dev, fmt, ##__VA_ARGS__)
| ~~~ ^~~~~~~~~~~
include/linux/dynamic_debug.h:250:59: note: expanded from macro '_dynamic_func_call'
250 | _dynamic_func_call_cls(_DPRINTK_CLASS_DFLT, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:248:65: note: expanded from macro '_dynamic_func_call_cls'
248 | __dynamic_func_call_cls(__UNIQUE_ID(ddebug), cls, fmt, func, ##__VA_ARGS__)
| ^~~~~~~~~~~
include/linux/dynamic_debug.h:224:15: note: expanded from macro '__dynamic_func_call_cls'
224 | func(&id, ##__VA_ARGS__); \
| ^~~~~~~~~~~
8 warnings generated.
vim +147 drivers/hwmon/pmbus/ina233.c
81
82 static int ina233_probe(struct i2c_client *client)
83 {
84 struct device *dev = &client->dev;
85 int ret, m, R;
86 u32 rshunt;
87 u32 current_lsb;
88 u16 calibration;
89 struct pmbus_driver_info *info;
90
91 info = devm_kzalloc(dev, sizeof(struct pmbus_driver_info),
92 GFP_KERNEL);
93 if (!info)
94 return -ENOMEM;
95
96 info->pages = 1;
97 info->format[PSC_VOLTAGE_IN] = direct;
98 info->format[PSC_VOLTAGE_OUT] = direct;
99 info->format[PSC_CURRENT_OUT] = direct;
100 info->format[PSC_POWER] = direct;
101 info->func[0] = PMBUS_HAVE_VIN | PMBUS_HAVE_VOUT | PMBUS_HAVE_STATUS_INPUT
102 | PMBUS_HAVE_IOUT | PMBUS_HAVE_STATUS_IOUT
103 | PMBUS_HAVE_POUT
104 | PMBUS_HAVE_VMON | PMBUS_HAVE_STATUS_VMON;
105 info->m[PSC_VOLTAGE_IN] = 8;
106 info->R[PSC_VOLTAGE_IN] = 2;
107 info->m[PSC_VOLTAGE_OUT] = 8;
108 info->R[PSC_VOLTAGE_OUT] = 2;
109 info->read_word_data = ina233_read_word_data;
110
111 /* If INA233 skips current/power, shunt-resistor and current-lsb aren't needed. */
112 /* read rshunt value (uOhm) */
113 ret = device_property_read_u32(dev, "shunt-resistor", &rshunt);
114 if (ret) {
115 if (ret != -EINVAL)
116 return dev_err_probe(dev, ret, "Shunt resistor property read fail.\n");
117 rshunt = INA233_RSHUNT_DEFAULT;
118 }
119
120 /* read current_lsb value (uA) */
121 ret = device_property_read_u32(dev, "ti,current-lsb-microamp", ¤t_lsb);
122 if (ret) {
123 if (ret != -EINVAL)
124 return dev_err_probe(dev, ret, "Current_LSB property read fail.\n");
125 current_lsb = INA233_CURRENT_LSB_DEFAULT;
126 }
127
128 if (!rshunt || !current_lsb)
129 return dev_err_probe(dev, -EINVAL,
130 "Shunt resistor and Current_LSB cannot be zero.\n");
131
132 /* calculate current coefficient */
133 calculate_coef(&m, &R, current_lsb, 1);
134 info->m[PSC_CURRENT_OUT] = m;
135 info->R[PSC_CURRENT_OUT] = R;
136
137 /* calculate power coefficient */
138 calculate_coef(&m, &R, current_lsb, 25);
139 info->m[PSC_POWER] = m;
140 info->R[PSC_POWER] = R;
141
142 /* write MFR_CALIBRATION register, Apply formula from spec with unit scaling. */
143 calibration = div64_u64(5120000000ULL, (u64)rshunt * current_lsb);
144 if (calibration > 0x7FFF)
145 return dev_err_probe(dev, -EINVAL,
146 "The product of Current_LSB %lu and shunt resistor %lu exceed MFR_CALIBRATION register limit.\n",
> 147 current_lsb, rshunt);
148 ret = i2c_smbus_write_word_data(client, MFR_CALIBRATION, calibration);
149 if (ret < 0)
150 return dev_err_probe(dev, ret, "Unable to write calibration.\n");
151
152 dev_dbg(dev, "power monitor %s (Rshunt = %lu uOhm, Current_LSB = %lu uA/bit)\n",
153 client->name, rshunt, current_lsb);
154
155 return pmbus_do_probe(client, info);
156 }
157
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki
next prev parent reply other threads:[~2025-01-17 23:07 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-01-15 1:55 [PATCH v3 0/2] hwmon: Add support for INA233 Leo Yang
2025-01-15 1:55 ` [PATCH v3 1/2] dt-bindings: hwmon: ti,ina2xx: Add INA233 device Leo Yang
2025-01-15 9:42 ` Krzysztof Kozlowski
2025-01-15 1:55 ` [PATCH v3 2/2] hwmon: Add driver for TI INA233 Current and Power Monitor Leo Yang
2025-01-17 23:07 ` kernel test robot [this message]
2025-01-18 1:35 ` kernel test robot
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=202501180656.96daAp3W-lkp@intel.com \
--to=lkp@intel.com \
--cc=Delphine_CC_Chiu@wiwynn.com \
--cc=Leo-Yang@quantatw.com \
--cc=conor+dt@kernel.org \
--cc=corbet@lwn.net \
--cc=devicetree@vger.kernel.org \
--cc=jdelvare@suse.com \
--cc=krzk+dt@kernel.org \
--cc=leo.yang.sy0@gmail.com \
--cc=linux-doc@vger.kernel.org \
--cc=linux-hwmon@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@roeck-us.net \
--cc=llvm@lists.linux.dev \
--cc=oe-kbuild-all@lists.linux.dev \
--cc=robh@kernel.org \
/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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox