[xilinx-xlnx:xlnx_rebase_v5.15 439/907] drivers/hwmon/pmbus/tps544.c:67:16: error: too few arguments to function 'pmbus_read_word_data'
kernel test robot
lkp at intel.com
Wed Feb 9 19:23:53 PST 2022
tree: https://github.com/Xilinx/linux-xlnx xlnx_rebase_v5.15
head: 423a108a01e05e84b59a4c4885c16bf3cd8c90c7
commit: 270d60faa80afd4bdbb1c523372d902eaecd34cf [439/907] pmbus: Add new tps544 power regulator driver
config: arc-allyesconfig (https://download.01.org/0day-ci/archive/20220210/202202101135.qfEi02y2-lkp@intel.com/config)
compiler: arceb-elf-gcc (GCC) 11.2.0
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/Xilinx/linux-xlnx/commit/270d60faa80afd4bdbb1c523372d902eaecd34cf
git remote add xilinx-xlnx https://github.com/Xilinx/linux-xlnx
git fetch --no-tags xilinx-xlnx xlnx_rebase_v5.15
git checkout 270d60faa80afd4bdbb1c523372d902eaecd34cf
# save the config file to linux build tree
mkdir build_dir
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross O=build_dir ARCH=arc SHELL=/bin/bash
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp at intel.com>
Note: the xilinx-xlnx/xlnx_rebase_v5.15 HEAD 423a108a01e05e84b59a4c4885c16bf3cd8c90c7 builds fine.
It only hurts bisectability.
All errors (new ones prefixed by >>):
drivers/hwmon/pmbus/tps544.c: In function 'tps544_read_word_data':
>> drivers/hwmon/pmbus/tps544.c:67:16: error: too few arguments to function 'pmbus_read_word_data'
67 | return pmbus_read_word_data(client, page, reg);
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/hwmon/pmbus/tps544.c:16:
drivers/hwmon/pmbus/pmbus.h:480:5: note: declared here
480 | int pmbus_read_word_data(struct i2c_client *client, int page, int phase,
| ^~~~~~~~~~~~~~~~~~~~
drivers/hwmon/pmbus/tps544.c: In function 'tps544_regulator_get_voltage':
drivers/hwmon/pmbus/tps544.c:98:16: error: too few arguments to function 'pmbus_read_word_data'
98 | return pmbus_read_word_data(client, page, PMBUS_READ_VOUT);
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/hwmon/pmbus/tps544.c:16:
drivers/hwmon/pmbus/pmbus.h:480:5: note: declared here
480 | int pmbus_read_word_data(struct i2c_client *client, int page, int phase,
| ^~~~~~~~~~~~~~~~~~~~
drivers/hwmon/pmbus/tps544.c: In function 'tps544_geti_show':
drivers/hwmon/pmbus/tps544.c:203:20: error: too few arguments to function 'pmbus_read_word_data'
203 | reg_iout = pmbus_read_word_data(client, 0, PMBUS_READ_IOUT) &
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/hwmon/pmbus/tps544.c:16:
drivers/hwmon/pmbus/pmbus.h:480:5: note: declared here
480 | int pmbus_read_word_data(struct i2c_client *client, int page, int phase,
| ^~~~~~~~~~~~~~~~~~~~
drivers/hwmon/pmbus/tps544.c: In function 'tps544_setcali_show':
drivers/hwmon/pmbus/tps544.c:217:20: error: too few arguments to function 'pmbus_read_word_data'
217 | reg_cali = pmbus_read_word_data(client, 0, TPS544_MFR_IOUT_CAL_OFFSET);
| ^~~~~~~~~~~~~~~~~~~~
In file included from drivers/hwmon/pmbus/tps544.c:16:
drivers/hwmon/pmbus/pmbus.h:480:5: note: declared here
480 | int pmbus_read_word_data(struct i2c_client *client, int page, int phase,
| ^~~~~~~~~~~~~~~~~~~~
drivers/hwmon/pmbus/tps544.c: In function 'tps544_probe':
>> drivers/hwmon/pmbus/tps544.c:287:30: error: assignment to 'int (*)(struct i2c_client *, int, int, int)' from incompatible pointer type 'int (*)(struct i2c_client *, int, int)' [-Werror=incompatible-pointer-types]
287 | info->read_word_data = tps544_read_word_data;
| ^
>> drivers/hwmon/pmbus/tps544.c:320:39: error: passing argument 2 of 'pmbus_do_probe' from incompatible pointer type [-Werror=incompatible-pointer-types]
320 | return pmbus_do_probe(client, id, info);
| ^~
| |
| const struct i2c_device_id *
In file included from drivers/hwmon/pmbus/tps544.c:16:
drivers/hwmon/pmbus/pmbus.h:493:73: note: expected 'struct pmbus_driver_info *' but argument is of type 'const struct i2c_device_id *'
493 | int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);
| ~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~
>> drivers/hwmon/pmbus/tps544.c:320:16: error: too many arguments to function 'pmbus_do_probe'
320 | return pmbus_do_probe(client, id, info);
| ^~~~~~~~~~~~~~
In file included from drivers/hwmon/pmbus/tps544.c:16:
drivers/hwmon/pmbus/pmbus.h:493:5: note: declared here
493 | int pmbus_do_probe(struct i2c_client *client, struct pmbus_driver_info *info);
| ^~~~~~~~~~~~~~
drivers/hwmon/pmbus/tps544.c: In function 'tps544_remove':
>> drivers/hwmon/pmbus/tps544.c:331:9: error: implicit declaration of function 'pmbus_do_remove'; did you mean 'pmbus_do_probe'? [-Werror=implicit-function-declaration]
331 | pmbus_do_remove(client);
| ^~~~~~~~~~~~~~~
| pmbus_do_probe
drivers/hwmon/pmbus/tps544.c: In function 'tps544_regulator_get_voltage':
drivers/hwmon/pmbus/tps544.c:99:1: error: control reaches end of non-void function [-Werror=return-type]
99 | }
| ^
drivers/hwmon/pmbus/tps544.c: In function 'tps544_read_word_data':
drivers/hwmon/pmbus/tps544.c:68:1: error: control reaches end of non-void function [-Werror=return-type]
68 | }
| ^
cc1: some warnings being treated as errors
vim +/pmbus_read_word_data +67 drivers/hwmon/pmbus/tps544.c
> 16 #include "pmbus.h"
17
18 #define TPS544_NUM_PAGES 1
19
20 struct tps544_data {
21 struct device *dev;
22 u16 vout_min[TPS544_NUM_PAGES], vout_max[TPS544_NUM_PAGES];
23 struct pmbus_driver_info info;
24 };
25
26 struct vlut {
27 int vol;
28 u16 vloop;
29 u16 v_ovfault;
30 u16 v_ovwarn;
31 u16 vmax;
32 u16 mfr_vmin;
33 u16 v_uvwarn;
34 u16 v_uvfault;
35 };
36
37 #if IS_ENABLED(CONFIG_SENSORS_TPS544_REGULATOR)
38 #define TPS544_MFR_VOUT_MIN 0xA4
39 #define TPS544_MFR_RESTORE_DEF_ALL 0x12
40 #define TPS544_MFR_IOUT_CAL_OFFSET 0x39
41
42 #define TPS544_VOUTREAD_MULTIPLIER 1950
43 #define TPS544_IOUTREAD_MULTIPLIER 62500
44 #define TPS544_IOUTREAD_MASK GENMASK(9, 0)
45
46 #define TPS544_VOUT_LIMIT 5300000
47
48 #define to_tps544_data(x) container_of(x, struct tps544_data, info)
49
50 /*
51 * This currently supports 3 voltage out buckets:
52 * 0.5V to 1.3V
53 * 1.3V to 2.6V
54 * 2.6V to 5.3V
55 * Any requested voltage will be mapped to one of these buckets and
56 * VOUT will be programmed with 0.1V granularity.
57 */
58 static const struct vlut tps544_vout[3] = {
59 {500000, 0xF004, 0x0290, 0x0285, 0x0300, 0x0100, 0x00CD, 0x009A},
60 {1300000, 0xF002, 0x059A, 0x0566, 0x0600, 0x0100, 0x0143, 0x0130},
61 {2600000, 0xF001, 0x0B00, 0x0A9A, 0x0A00, 0x0100, 0x0143, 0x0130}
62 };
63 #endif
64
65 static int tps544_read_word_data(struct i2c_client *client, int page, int reg)
66 {
> 67 return pmbus_read_word_data(client, page, reg);
68 }
69
70 static int tps544_read_byte_data(struct i2c_client *client, int page, int reg)
71 {
72 return pmbus_read_byte_data(client, page, reg);
73 }
74
75 static int tps544_write_byte(struct i2c_client *client, int page, u8 byte)
76 {
77 return pmbus_write_byte(client, page, byte);
78 }
79
80 static int tps544_write_word_data(struct i2c_client *client, int page,
81 int reg, u16 word)
82 {
83 int ret;
84
85 ret = pmbus_write_word_data(client, page, reg, word);
86 /* TODO - Define new PMBUS virtual register entries for these */
87
88 return ret;
89 }
90
91 #if IS_ENABLED(CONFIG_SENSORS_TPS544_REGULATOR)
92 static int tps544_regulator_get_voltage(struct regulator_dev *rdev)
93 {
94 struct device *dev = rdev_get_dev(rdev);
95 struct i2c_client *client = to_i2c_client(dev->parent);
96 int page = 0;
97
98 return pmbus_read_word_data(client, page, PMBUS_READ_VOUT);
99 }
100
101 static int tps544_regulator_set_voltage(struct regulator_dev *rdev, int min_uV,
102 int max_uV, unsigned int *selector)
103 {
104 struct device *dev = rdev_get_dev(rdev);
105 struct i2c_client *client = to_i2c_client(dev->parent);
106 const struct pmbus_driver_info *info = pmbus_get_driver_info(client);
107 struct tps544_data *data = to_tps544_data(info);
108 int index, page = 0;
109 u16 vout;
110
111 /* voltage will be set close to min value requested */
112 vout = (u16)((min_uV * 512) / 1000000);
113
114 /* Check voltage bucket */
115 if (min_uV >= tps544_vout[2].vol)
116 index = 2;
117 else if (min_uV >= tps544_vout[1].vol)
118 index = 1;
119 else if (min_uV >= tps544_vout[0].vol)
120 index = 0;
121 else
122 return -EINVAL;
123
124 pmbus_write_word_data(client, page, PMBUS_VOUT_SCALE_LOOP,
125 tps544_vout[index].vloop);
126 /* Use delay after setting scale loop; this is derived from testing */
127 msleep(2000);
128 pmbus_write_word_data(client, page, PMBUS_VOUT_OV_FAULT_LIMIT,
129 tps544_vout[index].v_ovfault);
130 pmbus_write_word_data(client, page, PMBUS_VOUT_OV_WARN_LIMIT,
131 tps544_vout[index].v_ovwarn);
132 pmbus_write_word_data(client, page, PMBUS_VOUT_MAX,
133 tps544_vout[index].vmax);
134 pmbus_write_word_data(client, page, PMBUS_VOUT_COMMAND, vout);
135 tps544_write_word_data(client, page, TPS544_MFR_VOUT_MIN,
136 tps544_vout[index].mfr_vmin);
137 pmbus_write_word_data(client, page, PMBUS_VOUT_UV_WARN_LIMIT,
138 tps544_vout[index].v_uvwarn);
139 pmbus_write_word_data(client, page, PMBUS_VOUT_UV_FAULT_LIMIT,
140 tps544_vout[index].v_uvfault);
141
142 data->vout_min[page] = min_uV;
143 data->vout_max[page] = max_uV;
144
145 return 0;
146 }
147
148 static ssize_t tps544_setv_show(struct device *dev,
149 struct device_attribute *attr, char *buf)
150 {
151 struct regulator_dev *rdev = dev_get_drvdata(dev);
152 int vout;
153
154 vout = tps544_regulator_get_voltage(rdev) * TPS544_VOUTREAD_MULTIPLIER;
155 return sprintf(buf, "%d\n", vout);
156 }
157
158 static ssize_t tps544_setv_store(struct device *dev,
159 struct device_attribute *attr,
160 const char *buf, size_t count)
161 {
162 struct regulator_dev *rdev = dev_get_drvdata(dev);
163 int val;
164 int err;
165
166 err = kstrtoint(buf, 0, &val);
167 if (err)
168 return err;
169 if (val > TPS544_VOUT_LIMIT)
170 return -EINVAL;
171
172 err = tps544_regulator_set_voltage(rdev, val, val, NULL);
173 if (err)
174 return err;
175
176 return count;
177 }
178
179 static DEVICE_ATTR_RW(tps544_setv);
180
181 static ssize_t tps544_restorev_store(struct device *dev,
182 struct device_attribute *attr,
183 const char *buf, size_t count)
184 {
185 struct i2c_client *client = to_i2c_client(dev->parent);
186 int err;
187
188 err = pmbus_write_byte(client, 0, TPS544_MFR_RESTORE_DEF_ALL);
189 if (err)
190 return err;
191
192 return count;
193 }
194
195 static DEVICE_ATTR_WO(tps544_restorev);
196
197 static ssize_t tps544_geti_show(struct device *dev,
198 struct device_attribute *attr, char *buf)
199 {
200 struct i2c_client *client = to_i2c_client(dev->parent);
201 u16 reg_iout;
202
203 reg_iout = pmbus_read_word_data(client, 0, PMBUS_READ_IOUT) &
204 TPS544_IOUTREAD_MASK;
205
206 return sprintf(buf, "%d\n", reg_iout * TPS544_IOUTREAD_MULTIPLIER);
207 }
208
209 static DEVICE_ATTR_RO(tps544_geti);
210
211 static ssize_t tps544_setcali_show(struct device *dev,
212 struct device_attribute *attr, char *buf)
213 {
214 struct i2c_client *client = to_i2c_client(dev->parent);
215 int reg_cali;
216
> 217 reg_cali = pmbus_read_word_data(client, 0, TPS544_MFR_IOUT_CAL_OFFSET);
218
219 return sprintf(buf, "Current: 0x%x; Set value in hex to calibrate\n",
220 reg_cali);
221 }
222
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
More information about the linux-arm-kernel
mailing list