Re: [PATCH v3 2/2] power: supply: bq25790: Introduce the BQ25790 charger driver

kernel test robot
2020-10-09T00:52:03Z

[-- Attachment #1: Type: text/plain, Size: 7756 bytes --]

Hi Dan,

I love your patch! Perhaps something to improve:

[auto build test WARNING on power-supply/for-next]
[also build test WARNING on linus/master v5.9-rc8 next-20201008]
[cannot apply to linux/master]
[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]

url: https://github.com/0day-ci/linux/commits/Dan-Murphy/dt-bindings-power-Add-the-bq25790-dt-bindings/20201008-234450
base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
config: riscv-randconfig-r031-20201009 (attached as .config)
compiler: clang version 12.0.0 (https://github.com/llvm/llvm-project 8da0df3d6dcc0dd42740be60b0da4ec201190904)
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 riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://github.com/0day-ci/linux/commit/bc435a97ea513a3f4baa45b167b623a82187f9d3
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Dan-Murphy/dt-bindings-power-Add-the-bq25790-dt-bindings/20201008-234450
git checkout bc435a97ea513a3f4baa45b167b623a82187f9d3
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv

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

All warnings (new ones prefixed by >>):

>> drivers/power/supply/bq25790_charger.c:624:21: warning: use of logical '&&' with constant operand [-Wconstant-logical-operand]
if (state.fault_1 && (BQ25790_OTG_OVP | BQ25790_VSYS_OVP))
^ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
drivers/power/supply/bq25790_charger.c:624:21: note: use '&' for a bitwise operation
if (state.fault_1 && (BQ25790_OTG_OVP | BQ25790_VSYS_OVP))
^~
&
drivers/power/supply/bq25790_charger.c:624:21: note: remove constant to silence this warning
if (state.fault_1 && (BQ25790_OTG_OVP | BQ25790_VSYS_OVP))
~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/power/supply/bq25790_charger.c:1102:36: warning: unused variable 'bq25790_acpi_match' [-Wunused-const-variable]
static const struct acpi_device_id bq25790_acpi_match[] = {
^
2 warnings generated.

vim +624 drivers/power/supply/bq25790_charger.c

537
538 static int bq25790_get_property(struct power_supply *psy,
539 enum power_supply_property psp,
540 union power_supply_propval *val)
541 {
542 struct bq25790_device *bq = power_supply_get_drvdata(psy);
543 struct bq25790_state state;
544 int ret = 0;
545
546 mutex_lock(&bq->lock);
547 ret = bq25790_get_state(bq, &state);
548 mutex_unlock(&bq->lock);
549 if (ret)
550 return ret;
551
552 switch (psp) {
553 case POWER_SUPPLY_PROP_STATUS:
554 if (!state.chrg_type || (state.chrg_type == BQ25790_OTG_MODE))
555 val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
556 else if (!state.chrg_status)
557 val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
558 else if (state.chrg_status == BQ25790_TERM_CHRG)
559 val->intval = POWER_SUPPLY_STATUS_FULL;
560 else
561 val->intval = POWER_SUPPLY_STATUS_CHARGING;
562 break;
563 case POWER_SUPPLY_PROP_CHARGE_TYPE:
564 switch (state.chrg_status) {
565 case BQ25790_TRICKLE_CHRG:
566 val->intval = POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
567 break;
568 case BQ25790_PRECHRG:
569 val->intval = POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
570 break;
571 case BQ25790_FAST_CHRG:
572 val->intval = POWER_SUPPLY_CHARGE_TYPE_FAST;
573 break;
574 case BQ25790_TAPER_CHRG:
575 val->intval = POWER_SUPPLY_CHARGE_TYPE_STANDARD;
576 break;
577 case BQ25790_TOP_OFF_CHRG:
578 val->intval = POWER_SUPPLY_CHARGE_TYPE_TRICKLE;
579 break;
580 case BQ25790_NOT_CHRGING:
581 val->intval = POWER_SUPPLY_CHARGE_TYPE_NONE;
582 break;
583 default:
584 val->intval = POWER_SUPPLY_CHARGE_TYPE_UNKNOWN;
585 }
586 break;
587 case POWER_SUPPLY_PROP_MANUFACTURER:
588 val->strval = BQ25790_MANUFACTURER;
589 break;
590
591 case POWER_SUPPLY_PROP_MODEL_NAME:
592 val->strval = BQ25790_NAME;
593 break;
594
595 case POWER_SUPPLY_PROP_ONLINE:
596 val->intval = state.online;
597 break;
598 case POWER_SUPPLY_PROP_USB_TYPE:
599 if (!state.chrg_type) {
600 val->intval = POWER_SUPPLY_USB_TYPE_UNKNOWN;
601 break;
602 }
603 switch (state.chrg_type) {
604 case BQ25790_USB_SDP:
605 val->intval = POWER_SUPPLY_USB_TYPE_SDP;
606 break;
607 case BQ25790_USB_CDP:
608 val->intval = POWER_SUPPLY_USB_TYPE_CDP;
609 break;
610 case BQ25790_USB_DCP:
611 val->intval = POWER_SUPPLY_USB_TYPE_DCP;
612 break;
613 case BQ25790_OTG_MODE:
614 val->intval = POWER_SUPPLY_USB_TYPE_PD_DRP;
615 break;
616
617 default:
618 val->intval = POWER_SUPPLY_USB_TYPE_UNKNOWN;
619 break;
620 }
621 break;
622
623 case POWER_SUPPLY_PROP_HEALTH:
> 624 if (state.fault_1 && (BQ25790_OTG_OVP | BQ25790_VSYS_OVP))
625 val->intval = POWER_SUPPLY_HEALTH_OVERVOLTAGE;
626 else
627 val->intval = POWER_SUPPLY_HEALTH_GOOD;
628
629 switch (state.health) {
630 case BQ25790_TEMP_HOT:
631 val->intval = POWER_SUPPLY_HEALTH_HOT;
632 break;
633 case BQ25790_TEMP_WARM:
634 val->intval = POWER_SUPPLY_HEALTH_WARM;
635 break;
636 case BQ25790_TEMP_COOL:
637 val->intval = POWER_SUPPLY_HEALTH_COOL;
638 break;
639 case BQ25790_TEMP_COLD:
640 val->intval = POWER_SUPPLY_HEALTH_COLD;
641 break;
642 }
643 break;
644 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_CURRENT:
645 ret = bq25790_get_ichg_curr(bq);
646 if (ret < 0)
647 return ret;
648
649 val->intval = ret;
650 break;
651
652 case POWER_SUPPLY_PROP_CONSTANT_CHARGE_VOLTAGE:
653 ret = bq25790_get_chrg_volt(bq);
654 if (ret < 0)
655 return ret;
656
657 val->intval = ret;
658 break;
659
660 case POWER_SUPPLY_PROP_PRECHARGE_CURRENT:
661 ret = bq25790_get_prechrg_curr(bq);
662 if (ret < 0)
663 return ret;
664
665 val->intval = ret;
666 break;
667 case POWER_SUPPLY_PROP_CHARGE_TERM_CURRENT:
668 ret = bq25790_get_term_curr(bq);
669 if (ret < 0)
670 return ret;
671
672 val->intval = ret;
673 break;
674 case POWER_SUPPLY_PROP_VOLTAGE_NOW:
675 val->intval = state.vbus_adc;
676 break;
677 case POWER_SUPPLY_PROP_INPUT_VOLTAGE_LIMIT:
678 ret = bq25790_get_input_volt_lim(bq);
679 if (ret < 0)
680 return ret;
681
682 val->intval = ret;
683 break;
684 case POWER_SUPPLY_PROP_INPUT_CURRENT_LIMIT:
685 ret = bq25790_get_input_curr_lim(bq);
686 if (ret < 0)
687 return ret;
688
689 val->intval = ret;
690 break;
691 default:
692 return -EINVAL;
693 }
694
695 return ret;
696 }
697

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

[-- Attachment #2: .config.gz --]
[-- Type: application/gzip, Size: 25743 bytes --]