Re: [PATCH v9 05/10] regulator: IRQ based event/error notification helpers

From: kernel test robot
Date: Mon May 10 2021 - 13:36:22 EST


Hi Matti,

I love your patch! Yet something to improve:

[auto build test ERROR on 6efb943b8616ec53a5e444193dccf1af9ad627b5]

url: https://github.com/0day-ci/linux/commits/Matti-Vaittinen/Extend-regulator-notification-support/20210510-203125
base: 6efb943b8616ec53a5e444193dccf1af9ad627b5
config: x86_64-randconfig-a015-20210510 (attached as .config)
compiler: clang version 13.0.0 (https://github.com/llvm/llvm-project 492173d42b32cb91d5d0d72d5ed84fcab80d059a)
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
# install x86_64 cross compiling tool for clang build
# apt-get install binutils-x86-64-linux-gnu
# https://github.com/0day-ci/linux/commit/904edb46fa37ac86bc1e7a1629141e037f45ebed
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Matti-Vaittinen/Extend-regulator-notification-support/20210510-203125
git checkout 904edb46fa37ac86bc1e7a1629141e037f45ebed
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 ARCH=x86_64

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All errors (new ones prefixed by >>):

>> drivers/regulator/irq_helpers.c:244:4: error: implicit declaration of function 'pr_dbg' [-Werror,-Wimplicit-function-declaration]
pr_dbg("Sending regulator notification EVT 0x%lx\r\n",
^
1 error generated.


vim +/pr_dbg +244 drivers/regulator/irq_helpers.c

153
154 static irqreturn_t regulator_notifier_isr(int irq, void *data)
155 {
156 struct regulator_irq *h = data;
157 struct regulator_irq_desc *d;
158 struct regulator_irq_data *rid;
159 unsigned long rdev_map = 0;
160 int num_rdevs;
161 int ret, i, j;
162
163 d = &h->desc;
164 rid = &h->rdata;
165 num_rdevs = rid->num_states;
166
167 if (d->fatal_cnt)
168 h->retry_cnt++;
169
170 /*
171 * we spare a few cycles by not clearing statuses prior to this call.
172 * The IC driver must initialize the status buffers for rdevs
173 * which it indicates having active events via rdev_map.
174 *
175 * Maybe we should just to be on a safer side(?)
176 */
177 ret = d->map_event(irq, rid, &rdev_map);
178
179 /*
180 * If status reading fails (which is unlikely) we don't ack/disable
181 * IRQ but just increase fail count and retry when IRQ fires again.
182 * If retry_count exceeds the given safety limit we call IC specific die
183 * handler which can try disabling regulator(s).
184 *
185 * If no die handler is given we will just bug() as a last resort.
186 *
187 * We could try disabling all associated rdevs - but we might shoot
188 * ourselves in the head and leave the problematic regulator enabled. So
189 * if IC has no die-handler populated we just assume the regulator
190 * can't be disabled.
191 */
192 if (unlikely(ret == REGULATOR_FAILED_RETRY))
193 goto fail_out;
194
195 h->retry_cnt = 0;
196 /*
197 * Let's not disable IRQ if there were no status bits for us. We'd
198 * better leave spurious IRQ handling to genirq
199 */
200 if (ret || !rdev_map)
201 return IRQ_NONE;
202
203 /*
204 * Some events are bogus if the regulator is disabled. Skip such events
205 * if all relevant regulators are disabled
206 */
207 if (d->skip_off) {
208 for_each_set_bit(i, &rdev_map, num_rdevs) {
209 struct regulator_dev *rdev;
210 const struct regulator_ops *ops;
211
212 rdev = rid->states[i].rdev;
213 ops = rdev->desc->ops;
214
215 /*
216 * If any of the flagged regulators is enabled we do
217 * handle this
218 */
219 if (ops->is_enabled(rdev))
220 break;
221 }
222 if (i == num_rdevs)
223 return IRQ_NONE;
224 }
225
226 /* Disable IRQ if HW keeps line asserted */
227 if (d->irq_off_ms)
228 disable_irq_nosync(irq);
229
230 /*
231 * IRQ seems to be for us. Let's fire correct notifiers / store error
232 * flags
233 */
234 for_each_set_bit(i, &rdev_map, num_rdevs) {
235 unsigned long evt;
236 struct regulator_err_state *stat;
237 struct regulator_dev *rdev;
238
239 stat = &rid->states[i];
240 rdev = stat->rdev;
241
242 for_each_set_bit(j, &stat->notifs, BITS_PER_TYPE(stat->notifs))
243 evt = BIT(j);
> 244 pr_dbg("Sending regulator notification EVT 0x%lx\r\n",
245 stat->notifs, evt);
246 regulator_notifier_call_chain(rdev, evt, NULL);
247
248 rdev_flag_err(rdev, stat->errors);
249 }
250
251 if (d->irq_off_ms) {
252 if (!d->high_prio)
253 schedule_delayed_work(&h->isr_work,
254 msecs_to_jiffies(d->irq_off_ms));
255 else
256 mod_delayed_work(system_highpri_wq,
257 &h->isr_work,
258 msecs_to_jiffies(d->irq_off_ms));
259 }
260
261 return IRQ_HANDLED;
262
263 fail_out:
264 if (d->fatal_cnt && h->retry_cnt > d->fatal_cnt) {
265 /* If we have no recovery, just try shut down straight away */
266 if (!d->die) {
267 hw_protection_shutdown("Regulator failure. Retry count exceeded",
268 REGULATOR_FORCED_SAFETY_SHUTDOWN_WAIT_MS);
269 } else {
270 ret = d->die(rid);
271 /* If die() failed shut down as a last attempt to save the HW */
272 if (ret)
273 hw_protection_shutdown("Regulator failure. Recovery failed",
274 REGULATOR_FORCED_SAFETY_SHUTDOWN_WAIT_MS);
275 }
276 }
277
278 return IRQ_NONE;
279 }
280

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip