Re: [PATCH 04/14] power: supply: ab8500: use power_supply_for_each_psy()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Thomas,

kernel test robot noticed the following build warnings:

[auto build test WARNING on 39f3bd9c9a27d526858da153090376decdf7bfea]

url:    https://github.com/intel-lab-lkp/linux/commits/Thomas-Wei-schuh/power-supply-mm8013-use-accessor-for-driver-data/20241208-210605
base:   39f3bd9c9a27d526858da153090376decdf7bfea
patch link:    https://lore.kernel.org/r/20241208-power-supply-dev_to_psy-v1-4-f95de9117558%40weissschuh.net
patch subject: [PATCH 04/14] power: supply: ab8500: use power_supply_for_each_psy()
config: arm-allyesconfig (https://download.01.org/0day-ci/archive/20241209/202412092219.bRJmBwIP-lkp@xxxxxxxxx/config)
compiler: arm-linux-gnueabi-gcc (GCC) 14.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20241209/202412092219.bRJmBwIP-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202412092219.bRJmBwIP-lkp@xxxxxxxxx/

All warnings (new ones prefixed by >>):

>> drivers/power/supply/ab8500_btemp.c:543:49: warning: 'struct power_supply_ext' declared inside parameter list will not be visible outside of this definition or declaration
     543 | static int ab8500_btemp_get_ext_psy_data(struct power_supply_ext *ext, void *data)
         |                                                 ^~~~~~~~~~~~~~~~
   drivers/power/supply/ab8500_btemp.c: In function 'ab8500_btemp_get_ext_psy_data':
   drivers/power/supply/ab8500_btemp.c:546:54: error: invalid use of undefined type 'struct power_supply_ext'
     546 |         const char **supplicants = (const char **)ext->supplied_to;
         |                                                      ^~
   drivers/power/supply/ab8500_btemp.c:558:42: error: invalid use of undefined type 'struct power_supply_ext'
     558 |         j = match_string(supplicants, ext->num_supplicants, psy->desc->name);
         |                                          ^~
   drivers/power/supply/ab8500_btemp.c:563:28: error: invalid use of undefined type 'struct power_supply_ext'
     563 |         for (j = 0; j < ext->desc->num_properties; j++) {
         |                            ^~
   drivers/power/supply/ab8500_btemp.c:565:27: error: invalid use of undefined type 'struct power_supply_ext'
     565 |                 prop = ext->desc->properties[j];
         |                           ^~
   drivers/power/supply/ab8500_btemp.c:567:47: error: passing argument 1 of 'power_supply_get_property' from incompatible pointer type [-Wincompatible-pointer-types]
     567 |                 if (power_supply_get_property(ext, prop, &ret))
         |                                               ^~~
         |                                               |
         |                                               struct power_supply_ext *
   In file included from drivers/power/supply/ab8500_btemp.c:21:
   include/linux/power_supply.h:855:59: note: expected 'struct power_supply *' but argument is of type 'struct power_supply_ext *'
     855 | extern int power_supply_get_property(struct power_supply *psy,
         |                                      ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/power/supply/ab8500_btemp.c:572:36: error: invalid use of undefined type 'struct power_supply_ext'
     572 |                         switch (ext->desc->type) {
         |                                    ^~
   drivers/power/supply/ab8500_btemp.c: In function 'ab8500_btemp_external_power_changed':
   drivers/power/supply/ab8500_btemp.c:619:40: error: passing argument 2 of 'power_supply_for_each_psy' from incompatible pointer type [-Wincompatible-pointer-types]
     619 |         power_supply_for_each_psy(psy, ab8500_btemp_get_ext_psy_data);
         |                                        ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                        |
         |                                        int (*)(struct power_supply_ext *, void *)
   include/linux/power_supply.h:885:56: note: expected 'int (*)(struct power_supply *, void *)' but argument is of type 'int (*)(struct power_supply_ext *, void *)'
     885 | extern int power_supply_for_each_psy(void *data, int (*fn)(struct power_supply *psy, void *data));
         |                                                  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--
>> drivers/power/supply/ab8500_chargalg.c:847:52: warning: 'struct power_supply_ext' declared inside parameter list will not be visible outside of this definition or declaration
     847 | static int ab8500_chargalg_get_ext_psy_data(struct power_supply_ext *ext, void *data)
         |                                                    ^~~~~~~~~~~~~~~~
   drivers/power/supply/ab8500_chargalg.c: In function 'ab8500_chargalg_get_ext_psy_data':
   drivers/power/supply/ab8500_chargalg.c:850:54: error: invalid use of undefined type 'struct power_supply_ext'
     850 |         const char **supplicants = (const char **)ext->supplied_to;
         |                                                      ^~
   drivers/power/supply/ab8500_chargalg.c:859:42: error: invalid use of undefined type 'struct power_supply_ext'
     859 |         j = match_string(supplicants, ext->num_supplicants, psy->desc->name);
         |                                          ^~
   drivers/power/supply/ab8500_chargalg.c:868:40: error: passing argument 1 of 'power_supply_get_property' from incompatible pointer type [-Wincompatible-pointer-types]
     868 |         if (!power_supply_get_property(ext, POWER_SUPPLY_PROP_CAPACITY, &ret)) {
         |                                        ^~~
         |                                        |
         |                                        struct power_supply_ext *
   In file included from drivers/power/supply/ab8500_chargalg.c:24:
   include/linux/power_supply.h:855:59: note: expected 'struct power_supply *' but argument is of type 'struct power_supply_ext *'
     855 | extern int power_supply_get_property(struct power_supply *psy,
         |                                      ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/power/supply/ab8500_chargalg.c:874:28: error: invalid use of undefined type 'struct power_supply_ext'
     874 |         for (j = 0; j < ext->desc->num_properties; j++) {
         |                            ^~
   drivers/power/supply/ab8500_chargalg.c:876:27: error: invalid use of undefined type 'struct power_supply_ext'
     876 |                 prop = ext->desc->properties[j];
         |                           ^~
   drivers/power/supply/ab8500_chargalg.c:882:28: error: invalid use of undefined type 'struct power_supply_ext'
     882 |                         ext->desc->type == POWER_SUPPLY_TYPE_MAINS)
         |                            ^~
   In file included from drivers/power/supply/ab8500_chargalg.c:35:
   drivers/power/supply/ab8500_chargalg.c:883:59: error: passing argument 1 of 'power_supply_get_drvdata' from incompatible pointer type [-Wincompatible-pointer-types]
     883 |                         di->ac_chg = psy_to_ux500_charger(ext);
         |                                                           ^~~
         |                                                           |
         |                                                           struct power_supply_ext *
   drivers/power/supply/ab8500-chargalg.h:18:58: note: in definition of macro 'psy_to_ux500_charger'
      18 | #define psy_to_ux500_charger(x) power_supply_get_drvdata(x)
         |                                                          ^
   include/linux/power_supply.h:883:60: note: expected 'struct power_supply *' but argument is of type 'struct power_supply_ext *'
     883 | extern void *power_supply_get_drvdata(struct power_supply *psy);
         |                                       ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/power/supply/ab8500_chargalg.c:885:28: error: invalid use of undefined type 'struct power_supply_ext'
     885 |                         ext->desc->type == POWER_SUPPLY_TYPE_USB)
         |                            ^~
   drivers/power/supply/ab8500_chargalg.c:886:60: error: passing argument 1 of 'power_supply_get_drvdata' from incompatible pointer type [-Wincompatible-pointer-types]
     886 |                         di->usb_chg = psy_to_ux500_charger(ext);
         |                                                            ^~~
         |                                                            |
         |                                                            struct power_supply_ext *
   drivers/power/supply/ab8500-chargalg.h:18:58: note: in definition of macro 'psy_to_ux500_charger'
      18 | #define psy_to_ux500_charger(x) power_supply_get_drvdata(x)
         |                                                          ^
   include/linux/power_supply.h:883:60: note: expected 'struct power_supply *' but argument is of type 'struct power_supply_ext *'
     883 | extern void *power_supply_get_drvdata(struct power_supply *psy);
         |                                       ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/power/supply/ab8500_chargalg.c:888:47: error: passing argument 1 of 'power_supply_get_property' from incompatible pointer type [-Wincompatible-pointer-types]
     888 |                 if (power_supply_get_property(ext, prop, &ret))
         |                                               ^~~
         |                                               |
         |                                               struct power_supply_ext *
   include/linux/power_supply.h:855:59: note: expected 'struct power_supply *' but argument is of type 'struct power_supply_ext *'
     855 | extern int power_supply_get_property(struct power_supply *psy,
         |                                      ~~~~~~~~~~~~~~~~~~~~~^~~
   drivers/power/supply/ab8500_chargalg.c:892:36: error: invalid use of undefined type 'struct power_supply_ext'
     892 |                         switch (ext->desc->type) {
         |                                    ^~
   drivers/power/supply/ab8500_chargalg.c:939:36: error: invalid use of undefined type 'struct power_supply_ext'
     939 |                         switch (ext->desc->type) {
         |                                    ^~
   drivers/power/supply/ab8500_chargalg.c:984:36: error: invalid use of undefined type 'struct power_supply_ext'
     984 |                         switch (ext->desc->type) {
         |                                    ^~
   drivers/power/supply/ab8500_chargalg.c:1068:36: error: invalid use of undefined type 'struct power_supply_ext'
    1068 |                         switch (ext->desc->type) {
         |                                    ^~
   drivers/power/supply/ab8500_chargalg.c:1084:36: error: invalid use of undefined type 'struct power_supply_ext'
    1084 |                         switch (ext->desc->type) {
         |                                    ^~
   drivers/power/supply/ab8500_chargalg.c:1109:36: error: invalid use of undefined type 'struct power_supply_ext'
    1109 |                         switch (ext->desc->type) {
         |                                    ^~
   drivers/power/supply/ab8500_chargalg.c:1127:36: error: invalid use of undefined type 'struct power_supply_ext'
    1127 |                         switch (ext->desc->type) {
         |                                    ^~
   drivers/power/supply/ab8500_chargalg.c:1143:36: error: invalid use of undefined type 'struct power_supply_ext'
    1143 |                         switch (ext->desc->type) {
         |                                    ^~
   drivers/power/supply/ab8500_chargalg.c: In function 'ab8500_chargalg_algorithm':
   drivers/power/supply/ab8500_chargalg.c:1233:53: error: passing argument 2 of 'power_supply_for_each_psy' from incompatible pointer type [-Wincompatible-pointer-types]
    1233 |         power_supply_for_each_psy(di->chargalg_psy, ab8500_chargalg_get_ext_psy_data);
         |                                                     ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
         |                                                     |
         |                                                     int (*)(struct power_supply_ext *, void *)
   include/linux/power_supply.h:885:56: note: expected 'int (*)(struct power_supply *, void *)' but argument is of type 'int (*)(struct power_supply_ext *, void *)'
     885 | extern int power_supply_for_each_psy(void *data, int (*fn)(struct power_supply *psy, void *data));
         |                                                  ~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~


vim +543 drivers/power/supply/ab8500_btemp.c

   542	
 > 543	static int ab8500_btemp_get_ext_psy_data(struct power_supply_ext *ext, void *data)
   544	{
   545		struct power_supply *psy;
   546		const char **supplicants = (const char **)ext->supplied_to;
   547		struct ab8500_btemp *di;
   548		union power_supply_propval ret;
   549		int j;
   550	
   551		psy = (struct power_supply *)data;
   552		di = power_supply_get_drvdata(psy);
   553	
   554		/*
   555		 * For all psy where the name of your driver
   556		 * appears in any supplied_to
   557		 */
   558		j = match_string(supplicants, ext->num_supplicants, psy->desc->name);
   559		if (j < 0)
   560			return 0;
   561	
   562		/* Go through all properties for the psy */
   563		for (j = 0; j < ext->desc->num_properties; j++) {
   564			enum power_supply_property prop;
   565			prop = ext->desc->properties[j];
   566	
   567			if (power_supply_get_property(ext, prop, &ret))
   568				continue;
   569	
   570			switch (prop) {
   571			case POWER_SUPPLY_PROP_PRESENT:
   572				switch (ext->desc->type) {
   573				case POWER_SUPPLY_TYPE_MAINS:
   574					/* AC disconnected */
   575					if (!ret.intval && di->events.ac_conn) {
   576						di->events.ac_conn = false;
   577					}
   578					/* AC connected */
   579					else if (ret.intval && !di->events.ac_conn) {
   580						di->events.ac_conn = true;
   581						if (!di->events.usb_conn)
   582							ab8500_btemp_periodic(di, true);
   583					}
   584					break;
   585				case POWER_SUPPLY_TYPE_USB:
   586					/* USB disconnected */
   587					if (!ret.intval && di->events.usb_conn) {
   588						di->events.usb_conn = false;
   589					}
   590					/* USB connected */
   591					else if (ret.intval && !di->events.usb_conn) {
   592						di->events.usb_conn = true;
   593						if (!di->events.ac_conn)
   594							ab8500_btemp_periodic(di, true);
   595					}
   596					break;
   597				default:
   598					break;
   599				}
   600				break;
   601			default:
   602				break;
   603			}
   604		}
   605		return 0;
   606	}
   607	

-- 
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki




[Index of Archives]     [Linux Kernel Development]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux