mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: kernel test robot <lkp@intel.com>
To: Aidan MacDonald <aidanmacdonald.0x0@gmail.com>,
	linus.walleij@linaro.org, brgl@bgdev.pl, robh+dt@kernel.org,
	krzysztof.kozlowski+dt@linaro.org, wens@csie.org,
	jic23@kernel.org, lee.jones@linaro.org, sre@kernel.org,
	broonie@kernel.org, gregkh@linuxfoundation.org,
	lgirdwood@gmail.com
Cc: llvm@lists.linux.dev, kbuild-all@lists.01.org, lars@metafoo.de,
	rafael@kernel.org, linux-gpio@vger.kernel.org,
	devicetree@vger.kernel.org, linux-iio@vger.kernel.org,
	linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH 09/10] power: supply: axp20x_usb_power: Add support for AXP192
Date: Sun, 5 Jun 2022 23:13:49 +0800	[thread overview]
Message-ID: <202206052337.XAGi8JAq-lkp@intel.com> (raw)
In-Reply-To: <20220603135714.12007-10-aidanmacdonald.0x0@gmail.com>

Hi Aidan,

Thank you for the patch! Perhaps something to improve:

[auto build test WARNING on lee-mfd/for-mfd-next]
[also build test WARNING on linusw-pinctrl/devel broonie-regmap/for-next jic23-iio/togreg sre-power-supply/for-next v5.18 next-20220603]
[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/intel-lab-lkp/linux/commits/Aidan-MacDonald/Add-support-for-AXP192-PMIC/20220605-165501
base:   https://git.kernel.org/pub/scm/linux/kernel/git/lee/mfd.git for-mfd-next
config: riscv-randconfig-r023-20220605 (https://download.01.org/0day-ci/archive/20220605/202206052337.XAGi8JAq-lkp@intel.com/config)
compiler: clang version 15.0.0 (https://github.com/llvm/llvm-project 416a5080d89066029f9889dc23f94de47c2fa895)
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/intel-lab-lkp/linux/commit/1eaea00a34314bd851023b9feeea16d1219174a3
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Aidan-MacDonald/Add-support-for-AXP192-PMIC/20220605-165501
        git checkout 1eaea00a34314bd851023b9feeea16d1219174a3
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross W=1 O=build_dir ARCH=riscv SHELL=/bin/bash drivers/power/supply/

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

All warnings (new ones prefixed by >>):

   In file included from drivers/power/supply/axp20x_usb_power.c:13:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:464:31: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __raw_readb(PCI_IOBASE + addr);
                             ~~~~~~~~~~ ^
   include/asm-generic/io.h:477:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le16_to_cpu((__le16 __force)__raw_readw(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:37:51: note: expanded from macro '__le16_to_cpu'
   #define __le16_to_cpu(x) ((__force __u16)(__le16)(x))
                                                     ^
   In file included from drivers/power/supply/axp20x_usb_power.c:13:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:490:61: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           val = __le32_to_cpu((__le32 __force)__raw_readl(PCI_IOBASE + addr));
                                                           ~~~~~~~~~~ ^
   include/uapi/linux/byteorder/little_endian.h:35:51: note: expanded from macro '__le32_to_cpu'
   #define __le32_to_cpu(x) ((__force __u32)(__le32)(x))
                                                     ^
   In file included from drivers/power/supply/axp20x_usb_power.c:13:
   In file included from include/linux/interrupt.h:11:
   In file included from include/linux/hardirq.h:11:
   In file included from ./arch/riscv/include/generated/asm/hardirq.h:1:
   In file included from include/asm-generic/hardirq.h:17:
   In file included from include/linux/irq.h:20:
   In file included from include/linux/io.h:13:
   In file included from arch/riscv/include/asm/io.h:136:
   include/asm-generic/io.h:501:33: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writeb(value, PCI_IOBASE + addr);
                               ~~~~~~~~~~ ^
   include/asm-generic/io.h:511:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writew((u16 __force)cpu_to_le16(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:521:59: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           __raw_writel((u32 __force)cpu_to_le32(value), PCI_IOBASE + addr);
                                                         ~~~~~~~~~~ ^
   include/asm-generic/io.h:1024:55: warning: performing pointer arithmetic on a null pointer has undefined behavior [-Wnull-pointer-arithmetic]
           return (port > MMIO_UPPER_LIMIT) ? NULL : PCI_IOBASE + port;
                                                     ~~~~~~~~~~ ^
>> drivers/power/supply/axp20x_usb_power.c:300:3: warning: unannotated fall-through between switch labels [-Wimplicit-fallthrough]
                   default:
                   ^
   drivers/power/supply/axp20x_usb_power.c:300:3: note: insert 'break;' to avoid fall-through
                   default:
                   ^
                   break; 
   8 warnings generated.

Kconfig warnings: (for reference only)
   WARNING: unmet direct dependencies detected for RISCV_SBI_CPUIDLE
   Depends on CPU_IDLE && RISCV && RISCV_SBI
   Selected by
   - SOC_VIRT && CPU_IDLE


vim +300 drivers/power/supply/axp20x_usb_power.c

   198	
   199	static int axp20x_usb_power_get_property(struct power_supply *psy,
   200		enum power_supply_property psp, union power_supply_propval *val)
   201	{
   202		struct axp20x_usb_power *power = power_supply_get_drvdata(psy);
   203		unsigned int input, v, reg;
   204		int ret;
   205	
   206		switch (psp) {
   207		case POWER_SUPPLY_PROP_VOLTAGE_MIN:
   208			ret = regmap_read(power->regmap, AXP20X_VBUS_IPSOUT_MGMT, &v);
   209			if (ret)
   210				return ret;
   211	
   212			val->intval = AXP20X_VBUS_VHOLD_uV(v);
   213			return 0;
   214		case POWER_SUPPLY_PROP_VOLTAGE_NOW:
   215			if (IS_ENABLED(CONFIG_AXP20X_ADC)) {
   216				ret = iio_read_channel_processed(power->vbus_v,
   217								 &val->intval);
   218				if (ret)
   219					return ret;
   220	
   221				/*
   222				 * IIO framework gives mV but Power Supply framework
   223				 * gives uV.
   224				 */
   225				val->intval *= 1000;
   226				return 0;
   227			}
   228	
   229			ret = axp20x_read_variable_width(power->regmap,
   230							 AXP20X_VBUS_V_ADC_H, 12);
   231			if (ret < 0)
   232				return ret;
   233	
   234			val->intval = ret * 1700; /* 1 step = 1.7 mV */
   235			return 0;
   236		case POWER_SUPPLY_PROP_CURRENT_MAX:
   237			if (power->axp20x_id == AXP813_ID)
   238				return axp813_get_current_max(power, &val->intval);
   239			else if (power->axp20x_id == AXP192_ID)
   240				return axp192_get_current_max(power, &val->intval);
   241			return axp20x_get_current_max(power, &val->intval);
   242		case POWER_SUPPLY_PROP_CURRENT_NOW:
   243			if (IS_ENABLED(CONFIG_AXP20X_ADC)) {
   244				ret = iio_read_channel_processed(power->vbus_i,
   245								 &val->intval);
   246				if (ret)
   247					return ret;
   248	
   249				/*
   250				 * IIO framework gives mA but Power Supply framework
   251				 * gives uA.
   252				 */
   253				val->intval *= 1000;
   254				return 0;
   255			}
   256	
   257			ret = axp20x_read_variable_width(power->regmap,
   258							 AXP20X_VBUS_I_ADC_H, 12);
   259			if (ret < 0)
   260				return ret;
   261	
   262			val->intval = ret * 375; /* 1 step = 0.375 mA */
   263			return 0;
   264		default:
   265			break;
   266		}
   267	
   268		/* All the properties below need the input-status reg value */
   269		ret = regmap_read(power->regmap, AXP20X_PWR_INPUT_STATUS, &input);
   270		if (ret)
   271			return ret;
   272	
   273		switch (psp) {
   274		case POWER_SUPPLY_PROP_HEALTH:
   275			if (!(input & AXP20X_PWR_STATUS_VBUS_PRESENT)) {
   276				val->intval = POWER_SUPPLY_HEALTH_UNKNOWN;
   277				break;
   278			}
   279	
   280			val->intval = POWER_SUPPLY_HEALTH_GOOD;
   281	
   282			switch (power->axp20x_id) {
   283			case AXP192_ID:
   284				/* Same layout as the AXP202, but different address */
   285				reg = AXP192_USB_OTG_STATUS;
   286				fallthrough;
   287	
   288			case AXP202_ID:
   289				if (power->axp20x_id == AXP202_ID)
   290					reg = AXP20X_USB_OTG_STATUS;
   291	
   292				ret = regmap_read(power->regmap, reg, &v);
   293				if (ret)
   294					return ret;
   295	
   296				if (!(v & AXP20X_USB_STATUS_VBUS_VALID))
   297					val->intval =
   298						POWER_SUPPLY_HEALTH_UNSPEC_FAILURE;
   299	
 > 300			default:
   301				break;
   302			}
   303			break;
   304		case POWER_SUPPLY_PROP_PRESENT:
   305			val->intval = !!(input & AXP20X_PWR_STATUS_VBUS_PRESENT);
   306			break;
   307		case POWER_SUPPLY_PROP_ONLINE:
   308			val->intval = !!(input & AXP20X_PWR_STATUS_VBUS_USED);
   309			break;
   310		default:
   311			return -EINVAL;
   312		}
   313	
   314		return 0;
   315	}
   316	

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp

  reply	other threads:[~2022-06-05 15:15 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-03 13:57 [PATCH 00/10] Add support for AXP192 PMIC Aidan MacDonald
2022-06-03 13:57 ` [PATCH 01/10] regmap-irq: Add get_irq_reg to support unusual register layouts Aidan MacDonald
2022-06-06 17:43   ` Guru Das Srinagesh
2022-06-07 10:46     ` Aidan MacDonald
2022-06-03 13:57 ` [PATCH 02/10] dt-bindings: mfd: add bindings for AXP192 MFD device Aidan MacDonald
2022-06-05 22:49   ` Rob Herring
2022-06-27 11:47   ` Lee Jones
2022-06-03 13:57 ` [PATCH 03/10] dt-bindings: iio: adc: axp209: Add AXP192 compatible Aidan MacDonald
2022-06-03 16:34   ` Jonathan Cameron
2022-06-04 11:33     ` Aidan MacDonald
2022-06-05 22:50   ` Rob Herring
2022-06-03 13:57 ` [PATCH 04/10] dt-bindings: power: supply: axp20x: " Aidan MacDonald
2022-06-05 22:50   ` Rob Herring
2022-06-03 13:57 ` [PATCH 05/10] dt-bindings: gpio: Add AXP192 GPIO bindings Aidan MacDonald
2022-06-05 22:55   ` Rob Herring
2022-06-07 10:34     ` Aidan MacDonald
2022-06-07 15:17       ` Rob Herring
2022-06-07 15:40         ` Aidan MacDonald
2022-06-03 13:57 ` [PATCH 06/10] mfd: axp20x: Add support for AXP192 Aidan MacDonald
2022-06-27 11:54   ` Lee Jones
2022-06-27 13:02     ` Aidan MacDonald
2022-06-03 13:57 ` [PATCH 07/10] regulator: " Aidan MacDonald
2022-06-06 14:36   ` Mark Brown
2022-06-03 13:57 ` [PATCH 08/10] iio: adc: axp20x_adc: " Aidan MacDonald
2022-06-03 16:47   ` Jonathan Cameron
2022-06-04 11:47     ` Aidan MacDonald
2022-06-04 14:27       ` Jonathan Cameron
2022-06-07 10:49         ` Aidan MacDonald
2022-06-03 13:57 ` [PATCH 09/10] power: supply: axp20x_usb_power: " Aidan MacDonald
2022-06-05 15:13   ` kernel test robot [this message]
2022-06-03 13:57 ` [PATCH 10/10] pinctrl: Add AXP192 pin control driver Aidan MacDonald
2022-06-15 13:44   ` Linus Walleij
2022-06-15 18:06     ` Michael Walle
2022-06-15 14:51   ` Andy Shevchenko
2022-06-17 12:15     ` Aidan MacDonald
2022-06-17 16:08       ` Andy Shevchenko

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=202206052337.XAGi8JAq-lkp@intel.com \
    --to=lkp@intel.com \
    --cc=aidanmacdonald.0x0@gmail.com \
    --cc=brgl@bgdev.pl \
    --cc=broonie@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=kbuild-all@lists.01.org \
    --cc=krzysztof.kozlowski+dt@linaro.org \
    --cc=lars@metafoo.de \
    --cc=lee.jones@linaro.org \
    --cc=lgirdwood@gmail.com \
    --cc=linus.walleij@linaro.org \
    --cc=linux-gpio@vger.kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=llvm@lists.linux.dev \
    --cc=rafael@kernel.org \
    --cc=robh+dt@kernel.org \
    --cc=sre@kernel.org \
    --cc=wens@csie.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®