Re: [PATCH v2 2/2] iio: temperature: add support for Analog Devices MAX30210

From: kernel test robot

Date: Wed Mar 04 2026 - 19:47:26 EST


Hi John,

kernel test robot noticed the following build errors:

[auto build test ERROR on 70a9ae59c5b1f2f5501e78e2d85bfeefd153f854]

url: https://github.com/intel-lab-lkp/linux/commits/John-Erasmus-Mari-Geronimo/dt-bindings-iio-temperature-add-ADI-MAX30210/20260304-202920
base: 70a9ae59c5b1f2f5501e78e2d85bfeefd153f854
patch link: https://lore.kernel.org/r/20260304122509.67931-3-johnerasmusmari.geronimo%40analog.com
patch subject: [PATCH v2 2/2] iio: temperature: add support for Analog Devices MAX30210
config: i386-randconfig-r071-20260305 (https://download.01.org/0day-ci/archive/20260305/202603050822.weVzrjhU-lkp@xxxxxxxxx/config)
compiler: gcc-14 (Debian 14.2.0-19) 14.2.0
smatch: v0.5.0-9004-gb810ac53
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20260305/202603050822.weVzrjhU-lkp@xxxxxxxxx/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@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202603050822.weVzrjhU-lkp@xxxxxxxxx/

All errors (new ones prefixed by >>):

drivers/iio/temperature/max30210.c: In function 'max30210_fifo_read':
>> drivers/iio/temperature/max30210.c:136:27: error: implicit declaration of function 'get_unaligned_be24' [-Wimplicit-function-declaration]
136 | u32 raw = get_unaligned_be24(&st->fifo_buf[3 * i]);
| ^~~~~~~~~~~~~~~~~~
drivers/iio/temperature/max30210.c: In function 'max30210_read_event_config':
>> drivers/iio/temperature/max30210.c:272:32: error: implicit declaration of function 'FIELD_GET' [-Wimplicit-function-declaration]
272 | return FIELD_GET(MAX30210_STATUS_TEMP_HI_MASK, val);
| ^~~~~~~~~
drivers/iio/temperature/max30210.c: In function 'max30210_write_raw':
>> drivers/iio/temperature/max30210.c:418:49: error: implicit declaration of function 'FIELD_PREP' [-Wimplicit-function-declaration]
418 | FIELD_PREP(MAX30210_TEMPCONF2_TEMP_PERIOD_MASK, i));
| ^~~~~~~~~~


vim +/get_unaligned_be24 +136 drivers/iio/temperature/max30210.c

122
123 static void max30210_fifo_read(struct iio_dev *indio_dev)
124 {
125 struct max30210_state *st = iio_priv(indio_dev);
126 int ret;
127
128 ret = regmap_bulk_read(st->regmap, MAX30210_FIFO_DATA_REG,
129 st->fifo_buf, 3 * st->watermark);
130 if (ret) {
131 dev_err(&indio_dev->dev, "Failed to read from fifo.\n");
132 return;
133 }
134
135 for (unsigned int i = 0; i < st->watermark; i++) {
> 136 u32 raw = get_unaligned_be24(&st->fifo_buf[3 * i]);
137
138 if (raw == MAX30210_FIFO_INVAL_DATA) {
139 dev_err_ratelimited(&indio_dev->dev, "Invalid data\n");
140 continue;
141 }
142
143 s16 temp = (s16)(raw & 0xFFFF);
144
145 iio_push_to_buffers(indio_dev, &temp);
146 }
147 }
148
149 static irqreturn_t max30210_irq_handler(int irq, void *dev_id)
150 {
151 struct iio_dev *indio_dev = dev_id;
152 struct max30210_state *st = iio_priv(indio_dev);
153 unsigned int status;
154 int ret;
155
156 ret = regmap_read(st->regmap, MAX30210_STATUS_REG, &status);
157 if (ret) {
158 dev_err(&indio_dev->dev, "Status read failed\n");
159 return IRQ_NONE;
160 }
161
162 if (status & MAX30210_STATUS_A_FULL_MASK)
163 max30210_fifo_read(indio_dev);
164
165 if (status & MAX30210_STATUS_TEMP_HI_MASK)
166 iio_push_event(indio_dev,
167 IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0,
168 IIO_EV_TYPE_THRESH,
169 IIO_EV_DIR_RISING),
170 iio_get_time_ns(indio_dev));
171
172 if (status & MAX30210_STATUS_TEMP_LO_MASK)
173 iio_push_event(indio_dev,
174 IIO_UNMOD_EVENT_CODE(IIO_TEMP, 0,
175 IIO_EV_TYPE_THRESH,
176 IIO_EV_DIR_FALLING),
177 iio_get_time_ns(indio_dev));
178
179 return IRQ_HANDLED;
180 }
181
182 static int max30210_reg_access(struct iio_dev *indio_dev, unsigned int reg,
183 unsigned int writeval, unsigned int *readval)
184 {
185 struct max30210_state *st = iio_priv(indio_dev);
186
187 if (!readval)
188 return regmap_write(st->regmap, reg, writeval);
189
190 return regmap_read(st->regmap, reg, readval);
191 }
192
193 static int max30210_read_event(struct iio_dev *indio_dev,
194 const struct iio_chan_spec *chan,
195 enum iio_event_type type,
196 enum iio_event_direction dir,
197 enum iio_event_info info, int *val, int *val2)
198 {
199 struct max30210_state *st = iio_priv(indio_dev);
200
201 if (info != IIO_EV_INFO_VALUE)
202 return -EINVAL;
203
204 switch (dir) {
205 case IIO_EV_DIR_RISING:
206 switch (type) {
207 case IIO_EV_TYPE_THRESH:
208 return max30210_read_temp(st->regmap, MAX30210_TEMP_ALM_HI_REG, val);
209 default:
210 return -EINVAL;
211 }
212 case IIO_EV_DIR_FALLING:
213 switch (type) {
214 case IIO_EV_TYPE_THRESH:
215 return max30210_read_temp(st->regmap, MAX30210_TEMP_ALM_LO_REG, val);
216 default:
217 return -EINVAL;
218 }
219 default:
220 return -EINVAL;
221 }
222 }
223
224 static int max30210_write_event(struct iio_dev *indio_dev,
225 const struct iio_chan_spec *chan,
226 enum iio_event_type type,
227 enum iio_event_direction dir,
228 enum iio_event_info info, int val, int val2)
229 {
230 struct max30210_state *st = iio_priv(indio_dev);
231
232 if (info != IIO_EV_INFO_VALUE)
233 return -EINVAL;
234
235 switch (dir) {
236 case IIO_EV_DIR_RISING:
237 switch (type) {
238 case IIO_EV_TYPE_THRESH:
239 return max30210_write_temp(st->regmap, MAX30210_TEMP_ALM_HI_REG, val);
240 default:
241 return -EINVAL;
242 }
243 case IIO_EV_DIR_FALLING:
244 switch (type) {
245 case IIO_EV_TYPE_THRESH:
246 return max30210_write_temp(st->regmap, MAX30210_TEMP_ALM_LO_REG, val);
247 default:
248 return -EINVAL;
249 }
250 default:
251 return -EINVAL;
252 }
253 }
254
255 static int max30210_read_event_config(struct iio_dev *indio_dev,
256 const struct iio_chan_spec *chan,
257 enum iio_event_type type,
258 enum iio_event_direction dir)
259 {
260 struct max30210_state *st = iio_priv(indio_dev);
261 unsigned int val;
262 int ret;
263
264 ret = regmap_read(st->regmap, MAX30210_INT_EN_REG, &val);
265 if (ret)
266 return ret;
267
268 switch (dir) {
269 case IIO_EV_DIR_RISING:
270 switch (type) {
271 case IIO_EV_TYPE_THRESH:
> 272 return FIELD_GET(MAX30210_STATUS_TEMP_HI_MASK, val);
273 default:
274 return -EINVAL;
275 }
276 case IIO_EV_DIR_FALLING:
277 switch (type) {
278 case IIO_EV_TYPE_THRESH:
279 return FIELD_GET(MAX30210_STATUS_TEMP_LO_MASK, val);
280 default:
281 return -EINVAL;
282 }
283 default:
284 return -EINVAL;
285 }
286 }
287

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki