2022-11-14 15:07:24

by Elijah Conners

[permalink] [raw]
Subject: [PATCH] drivers: undo simplify POWER_SUPPLY_PROP_ONLINE

Per the work done by arturo182, the value of max17040() with LiPo
batteries will always be 1, even if it's not connected. This is
ambiguous and setting the return value to 1 presents complications for
anyone working with LiPo batteries, and does not result in significant
overhead.

Signed-off-by: Elijah Conners <[email protected]>
---
drivers/power/supply/max17040_battery.c | 3 ++-
1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/power/supply/max17040_battery.c b/drivers/power/supply/max17040_battery.c
index a9aef1e8b186..5284f2bf735c 100644
--- a/drivers/power/supply/max17040_battery.c
+++ b/drivers/power/supply/max17040_battery.c
@@ -217,7 +217,8 @@ static int max17040_get_version(struct max17040_chip *chip)

static int max17040_get_online(struct max17040_chip *chip)
{
- return 1;
+ return chip->pdata && chip->pdata->battery_online ?
+ chip->pdata->battery_online() : 1;
}

static int max17040_get_of_data(struct max17040_chip *chip)
--
2.29.2.windows.2


2022-11-14 23:59:15

by kernel test robot

[permalink] [raw]
Subject: Re: [PATCH] drivers: undo simplify POWER_SUPPLY_PROP_ONLINE

Hi Elijah,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on sre-power-supply/for-next]
[also build test ERROR on linus/master v6.1-rc5 next-20221114]
[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#_base_tree_information]

url: https://github.com/intel-lab-lkp/linux/commits/Elijah-Conners/drivers-undo-simplify-POWER_SUPPLY_PROP_ONLINE/20221114-222633
base: https://git.kernel.org/pub/scm/linux/kernel/git/sre/linux-power-supply.git for-next
patch link: https://lore.kernel.org/r/184767a4f60.d9a0c3da334147.3171681720569322283%40elijahpepe.com
patch subject: [PATCH] drivers: undo simplify POWER_SUPPLY_PROP_ONLINE
config: m68k-randconfig-r022-20221114
compiler: m68k-linux-gcc (GCC) 12.1.0
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
# https://github.com/intel-lab-lkp/linux/commit/3cd836a257978f45593135825f6886891b9dac54
git remote add linux-review https://github.com/intel-lab-lkp/linux
git fetch --no-tags linux-review Elijah-Conners/drivers-undo-simplify-POWER_SUPPLY_PROP_ONLINE/20221114-222633
git checkout 3cd836a257978f45593135825f6886891b9dac54
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross W=1 O=build_dir ARCH=m68k SHELL=/bin/bash

If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <[email protected]>

All errors (new ones prefixed by >>):

drivers/power/supply/max17040_battery.c: In function 'max17040_get_online':
>> drivers/power/supply/max17040_battery.c:220:22: error: 'struct max17040_chip' has no member named 'pdata'; did you mean 'data'?
220 | return chip->pdata && chip->pdata->battery_online ?
| ^~~~~
| data
drivers/power/supply/max17040_battery.c:220:37: error: 'struct max17040_chip' has no member named 'pdata'; did you mean 'data'?
220 | return chip->pdata && chip->pdata->battery_online ?
| ^~~~~
| data
drivers/power/supply/max17040_battery.c:221:23: error: 'struct max17040_chip' has no member named 'pdata'; did you mean 'data'?
221 | chip->pdata->battery_online() : 1;
| ^~~~~
| data
drivers/power/supply/max17040_battery.c:222:1: error: control reaches end of non-void function [-Werror=return-type]
222 | }
| ^
cc1: some warnings being treated as errors


vim +220 drivers/power/supply/max17040_battery.c

217
218 static int max17040_get_online(struct max17040_chip *chip)
219 {
> 220 return chip->pdata && chip->pdata->battery_online ?
221 chip->pdata->battery_online() : 1;
222 }
223

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


Attachments:
(No filename) (3.17 kB)
config (138.82 kB)
Download all attachments