tree: thermal/next head: 4d14235baa2b4aa64aed40805dd3db47dbc6f3b3 commit: a7ff82976122eb6d1fd286dc34f09b6ecd756b60 [43/50] drivers: thermal: tsens: Merge tsens-common.c into tsens.c config: x86_64-allyesconfig (attached as .config) compiler: clang version 11.0.0 (https://github.com/llvm/llvm-project 3393cc4cebf9969db94dc424b7a2b6195589c33b) 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 git checkout a7ff82976122eb6d1fd286dc34f09b6ecd756b60 # save the attached .config to linux build tree COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=x86_64 If you fix the issue, kindly add following tag as appropriate Reported-by: kbuild test robot All warnings (new ones prefixed by >>, old ones prefixed by <<): >> drivers/thermal/qcom/tsens.c:385:13: warning: no previous prototype for function 'tsens_critical_irq_thread' [-Wmissing-prototypes] irqreturn_t tsens_critical_irq_thread(int irq, void *data) ^ drivers/thermal/qcom/tsens.c:385:1: note: declare 'static' if the function is not intended to be used outside of this translation unit irqreturn_t tsens_critical_irq_thread(int irq, void *data) ^ static >> drivers/thermal/qcom/tsens.c:455:13: warning: no previous prototype for function 'tsens_irq_thread' [-Wmissing-prototypes] irqreturn_t tsens_irq_thread(int irq, void *data) ^ drivers/thermal/qcom/tsens.c:455:1: note: declare 'static' if the function is not intended to be used outside of this translation unit irqreturn_t tsens_irq_thread(int irq, void *data) ^ static >> drivers/thermal/qcom/tsens.c:523:5: warning: no previous prototype for function 'tsens_set_trips' [-Wmissing-prototypes] int tsens_set_trips(void *_sensor, int low, int high) ^ drivers/thermal/qcom/tsens.c:523:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int tsens_set_trips(void *_sensor, int low, int high) ^ static >> drivers/thermal/qcom/tsens.c:560:5: warning: no previous prototype for function 'tsens_enable_irq' [-Wmissing-prototypes] int tsens_enable_irq(struct tsens_priv *priv) ^ drivers/thermal/qcom/tsens.c:560:1: note: declare 'static' if the function is not intended to be used outside of this translation unit int tsens_enable_irq(struct tsens_priv *priv) ^ static >> drivers/thermal/qcom/tsens.c:573:6: warning: no previous prototype for function 'tsens_disable_irq' [-Wmissing-prototypes] void tsens_disable_irq(struct tsens_priv *priv) ^ drivers/thermal/qcom/tsens.c:573:1: note: declare 'static' if the function is not intended to be used outside of this translation unit void tsens_disable_irq(struct tsens_priv *priv) ^ static 5 warnings generated. vim +/tsens_critical_irq_thread +385 drivers/thermal/qcom/tsens.c 369 370 /** 371 * tsens_critical_irq_thread() - Threaded handler for critical interrupts 372 * @irq: irq number 373 * @data: tsens controller private data 374 * 375 * Check FSM watchdog bark status and clear if needed. 376 * Check all sensors to find ones that violated their critical threshold limits. 377 * Clear and then re-enable the interrupt. 378 * 379 * The level-triggered interrupt might deassert if the temperature returned to 380 * within the threshold limits by the time the handler got scheduled. We 381 * consider the irq to have been handled in that case. 382 * 383 * Return: IRQ_HANDLED 384 */ > 385 irqreturn_t tsens_critical_irq_thread(int irq, void *data) 386 { 387 struct tsens_priv *priv = data; 388 struct tsens_irq_data d; 389 int temp, ret, i; 390 u32 wdog_status, wdog_count; 391 392 if (priv->feat->has_watchdog) { 393 ret = regmap_field_read(priv->rf[WDOG_BARK_STATUS], 394 &wdog_status); 395 if (ret) 396 return ret; 397 398 if (wdog_status) { 399 /* Clear WDOG interrupt */ 400 regmap_field_write(priv->rf[WDOG_BARK_CLEAR], 1); 401 regmap_field_write(priv->rf[WDOG_BARK_CLEAR], 0); 402 ret = regmap_field_read(priv->rf[WDOG_BARK_COUNT], 403 &wdog_count); 404 if (ret) 405 return ret; 406 if (wdog_count) 407 dev_dbg(priv->dev, "%s: watchdog count: %d\n", 408 __func__, wdog_count); 409 410 /* Fall through to handle critical interrupts if any */ 411 } 412 } 413 414 for (i = 0; i < priv->num_sensors; i++) { 415 const struct tsens_sensor *s = &priv->sensor[i]; 416 u32 hw_id = s->hw_id; 417 418 if (IS_ERR(s->tzd)) 419 continue; 420 if (!tsens_threshold_violated(priv, hw_id, &d)) 421 continue; 422 ret = get_temp_tsens_valid(s, &temp); 423 if (ret) { 424 dev_err(priv->dev, "[%u] %s: error reading sensor\n", 425 hw_id, __func__); 426 continue; 427 } 428 429 tsens_read_irq_state(priv, hw_id, s, &d); 430 if (d.crit_viol && 431 !masked_irq(hw_id, d.crit_irq_mask, tsens_version(priv))) { 432 /* Mask critical interrupts, unused on Linux */ 433 tsens_set_interrupt(priv, hw_id, CRITICAL, false); 434 } 435 } 436 437 return IRQ_HANDLED; 438 } 439 440 /** 441 * tsens_irq_thread - Threaded interrupt handler for uplow interrupts 442 * @irq: irq number 443 * @data: tsens controller private data 444 * 445 * Check all sensors to find ones that violated their threshold limits. If the 446 * temperature is still outside the limits, call thermal_zone_device_update() to 447 * update the thresholds, else re-enable the interrupts. 448 * 449 * The level-triggered interrupt might deassert if the temperature returned to 450 * within the threshold limits by the time the handler got scheduled. We 451 * consider the irq to have been handled in that case. 452 * 453 * Return: IRQ_HANDLED 454 */ > 455 irqreturn_t tsens_irq_thread(int irq, void *data) 456 { 457 struct tsens_priv *priv = data; 458 struct tsens_irq_data d; 459 bool enable = true, disable = false; 460 unsigned long flags; 461 int temp, ret, i; 462 463 for (i = 0; i < priv->num_sensors; i++) { 464 bool trigger = false; 465 const struct tsens_sensor *s = &priv->sensor[i]; 466 u32 hw_id = s->hw_id; 467 468 if (IS_ERR(s->tzd)) 469 continue; 470 if (!tsens_threshold_violated(priv, hw_id, &d)) 471 continue; 472 ret = get_temp_tsens_valid(s, &temp); 473 if (ret) { 474 dev_err(priv->dev, "[%u] %s: error reading sensor\n", 475 hw_id, __func__); 476 continue; 477 } 478 479 spin_lock_irqsave(&priv->ul_lock, flags); 480 481 tsens_read_irq_state(priv, hw_id, s, &d); 482 483 if (d.up_viol && 484 !masked_irq(hw_id, d.up_irq_mask, tsens_version(priv))) { 485 tsens_set_interrupt(priv, hw_id, UPPER, disable); 486 if (d.up_thresh > temp) { 487 dev_dbg(priv->dev, "[%u] %s: re-arm upper\n", 488 hw_id, __func__); 489 tsens_set_interrupt(priv, hw_id, UPPER, enable); 490 } else { 491 trigger = true; 492 /* Keep irq masked */ 493 } 494 } else if (d.low_viol && 495 !masked_irq(hw_id, d.low_irq_mask, tsens_version(priv))) { 496 tsens_set_interrupt(priv, hw_id, LOWER, disable); 497 if (d.low_thresh < temp) { 498 dev_dbg(priv->dev, "[%u] %s: re-arm low\n", 499 hw_id, __func__); 500 tsens_set_interrupt(priv, hw_id, LOWER, enable); 501 } else { 502 trigger = true; 503 /* Keep irq masked */ 504 } 505 } 506 507 spin_unlock_irqrestore(&priv->ul_lock, flags); 508 509 if (trigger) { 510 dev_dbg(priv->dev, "[%u] %s: TZ update trigger (%d mC)\n", 511 hw_id, __func__, temp); 512 thermal_zone_device_update(s->tzd, 513 THERMAL_EVENT_UNSPECIFIED); 514 } else { 515 dev_dbg(priv->dev, "[%u] %s: no violation: %d\n", 516 hw_id, __func__, temp); 517 } 518 } 519 520 return IRQ_HANDLED; 521 } 522 > 523 int tsens_set_trips(void *_sensor, int low, int high) 524 { 525 struct tsens_sensor *s = _sensor; 526 struct tsens_priv *priv = s->priv; 527 struct device *dev = priv->dev; 528 struct tsens_irq_data d; 529 unsigned long flags; 530 int high_val, low_val, cl_high, cl_low; 531 u32 hw_id = s->hw_id; 532 533 dev_dbg(dev, "[%u] %s: proposed thresholds: (%d:%d)\n", 534 hw_id, __func__, low, high); 535 536 cl_high = clamp_val(high, -40000, 120000); 537 cl_low = clamp_val(low, -40000, 120000); 538 539 high_val = tsens_mC_to_hw(s, cl_high); 540 low_val = tsens_mC_to_hw(s, cl_low); 541 542 spin_lock_irqsave(&priv->ul_lock, flags); 543 544 tsens_read_irq_state(priv, hw_id, s, &d); 545 546 /* Write the new thresholds and clear the status */ 547 regmap_field_write(priv->rf[LOW_THRESH_0 + hw_id], low_val); 548 regmap_field_write(priv->rf[UP_THRESH_0 + hw_id], high_val); 549 tsens_set_interrupt(priv, hw_id, LOWER, true); 550 tsens_set_interrupt(priv, hw_id, UPPER, true); 551 552 spin_unlock_irqrestore(&priv->ul_lock, flags); 553 554 dev_dbg(dev, "[%u] %s: (%d:%d)->(%d:%d)\n", 555 hw_id, __func__, d.low_thresh, d.up_thresh, cl_low, cl_high); 556 557 return 0; 558 } 559 > 560 int tsens_enable_irq(struct tsens_priv *priv) 561 { 562 int ret; 563 int val = tsens_version(priv) > VER_1_X ? 7 : 1; 564 565 ret = regmap_field_write(priv->rf[INT_EN], val); 566 if (ret < 0) 567 dev_err(priv->dev, "%s: failed to enable interrupts\n", 568 __func__); 569 570 return ret; 571 } 572 > 573 void tsens_disable_irq(struct tsens_priv *priv) 574 { 575 regmap_field_write(priv->rf[INT_EN], 0); 576 } 577 --- 0-DAY CI Kernel Test Service, Intel Corporation https://lists.01.org/hyperkitty/list/kbuild-all(a)lists.01.org