diff mbox

pm: Fix build issues in ds278* (thinkpad_acpi)

Message ID 20171224100647.GA13797@thinkpad (mailing list archive)
State Changes Requested, archived
Delegated to: Andy Shevchenko
Headers show

Commit Message

Ognjen Galic Dec. 24, 2017, 10:06 a.m. UTC
This patch fixes a issue introduced by the thinkpad_acpi
and battery patch series for charging thresholds.

In that series, a new macro has been added to
"include/linux/power_supply.h:374" called to_power_supply
which is used to upcast from a struct device to a struct
power_supply. That change conflicts with the private
implementation of to_power_supply inside the ds2780
and ds2781 battery modules.

This patch removes those private implementations and
uses the new header one.

After applying the thinkpad_acpi and battery patch
series this must be applied to fix the build issues.

This patch depends on:

"[PATCH v10 2/4] pm: add to_power_supply macro to the API"

Signed-off-by: Ognjen Galic <smclt30p@gmail.com>
---
 drivers/power/supply/ds2780_battery.c | 5 -----
 drivers/power/supply/ds2781_battery.c | 5 -----
 2 files changed, 10 deletions(-)

Comments

kernel test robot Dec. 24, 2017, 10:57 a.m. UTC | #1
Hi Ognjen,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on battery/master]
[also build test ERROR on v4.15-rc5 next-20171222]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ognjen-Galic/pm-Fix-build-issues-in-ds278-thinkpad_acpi/20171224-181540
base:   git://git.infradead.org/battery-2.6.git master
config: i386-randconfig-x007-201752 (attached as .config)
compiler: gcc-7 (Debian 7.2.0-12) 7.2.1 20171025
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All error/warnings (new ones prefixed by >>):

   drivers/power//supply/ds2780_battery.c: In function 'ds2780_get_pmod_enabled':
>> drivers/power//supply/ds2780_battery.c:453:29: error: implicit declaration of function 'to_power_supply'; did you mean 'power_supply_put'? [-Werror=implicit-function-declaration]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
                                power_supply_put
>> drivers/power//supply/ds2780_battery.c:453:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
   drivers/power//supply/ds2780_battery.c: In function 'ds2780_set_pmod_enabled':
   drivers/power//supply/ds2780_battery.c:472:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2780_battery.c: In function 'ds2780_get_sense_resistor_value':
   drivers/power//supply/ds2780_battery.c:507:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2780_battery.c: In function 'ds2780_set_sense_resistor_value':
   drivers/power//supply/ds2780_battery.c:525:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2780_battery.c: In function 'ds2780_get_rsgain_setting':
   drivers/power//supply/ds2780_battery.c:545:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2780_battery.c: In function 'ds2780_set_rsgain_setting':
   drivers/power//supply/ds2780_battery.c:562:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2780_battery.c: In function 'ds2780_get_pio_pin':
   drivers/power//supply/ds2780_battery.c:588:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2780_battery.c: In function 'ds2780_set_pio_pin':
   drivers/power//supply/ds2780_battery.c:606:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2780_battery.c: In function 'ds2780_read_param_eeprom_bin':
   drivers/power//supply/ds2780_battery.c:632:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2780_battery.c: In function 'ds2780_write_param_eeprom_bin':
   drivers/power//supply/ds2780_battery.c:645:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2780_battery.c: In function 'ds2780_read_user_eeprom_bin':
   drivers/power//supply/ds2780_battery.c:677:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2780_battery.c: In function 'ds2780_write_user_eeprom_bin':
   drivers/power//supply/ds2780_battery.c:690:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors
--
   drivers/power//supply/ds2781_battery.c: In function 'ds2781_get_pmod_enabled':
>> drivers/power//supply/ds2781_battery.c:455:29: error: implicit declaration of function 'to_power_supply'; did you mean 'power_supply_put'? [-Werror=implicit-function-declaration]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
                                power_supply_put
>> drivers/power//supply/ds2781_battery.c:455:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
   drivers/power//supply/ds2781_battery.c: In function 'ds2781_set_pmod_enabled':
   drivers/power//supply/ds2781_battery.c:474:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2781_battery.c: In function 'ds2781_get_sense_resistor_value':
   drivers/power//supply/ds2781_battery.c:509:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2781_battery.c: In function 'ds2781_set_sense_resistor_value':
   drivers/power//supply/ds2781_battery.c:527:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2781_battery.c: In function 'ds2781_get_rsgain_setting':
   drivers/power//supply/ds2781_battery.c:547:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2781_battery.c: In function 'ds2781_set_rsgain_setting':
   drivers/power//supply/ds2781_battery.c:564:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2781_battery.c: In function 'ds2781_get_pio_pin':
   drivers/power//supply/ds2781_battery.c:590:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2781_battery.c: In function 'ds2781_set_pio_pin':
   drivers/power//supply/ds2781_battery.c:608:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2781_battery.c: In function 'ds2781_read_param_eeprom_bin':
   drivers/power//supply/ds2781_battery.c:634:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2781_battery.c: In function 'ds2781_write_param_eeprom_bin':
   drivers/power//supply/ds2781_battery.c:647:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2781_battery.c: In function 'ds2781_read_user_eeprom_bin':
   drivers/power//supply/ds2781_battery.c:679:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power//supply/ds2781_battery.c: In function 'ds2781_write_user_eeprom_bin':
   drivers/power//supply/ds2781_battery.c:693:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +453 drivers/power//supply/ds2780_battery.c

275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  446  
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  447  static ssize_t ds2780_get_pmod_enabled(struct device *dev,
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  448  	struct device_attribute *attr,
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  449  	char *buf)
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  450  {
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  451  	int ret;
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  452  	u8 control_reg;
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26 @453  	struct power_supply *psy = to_power_supply(dev);
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  454  	struct ds2780_device_info *dev_info = to_ds2780_device_info(psy);
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  455  
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  456  	/* Get power mode */
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  457  	ret = ds2780_get_control_register(dev_info, &control_reg);
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  458  	if (ret < 0)
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  459  		return ret;
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  460  
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  461  	return sprintf(buf, "%d\n",
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  462  		 !!(control_reg & DS2780_CONTROL_REG_PMOD));
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  463  }
275ac746 drivers/power/ds2780_battery.c Clifton Barnes 2011-05-26  464  

:::::: The code at line 453 was first introduced by commit
:::::: 275ac74629c4d8ec430d7edecb16d936f46a47c5 w1: add Maxim/Dallas DS2780 Stand-Alone Fuel Gauge IC support

:::::: TO: Clifton Barnes <cabarnes@indesign-llc.com>
:::::: CC: Linus Torvalds <torvalds@linux-foundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
kernel test robot Dec. 24, 2017, 11:09 a.m. UTC | #2
Hi Ognjen,

Thank you for the patch! Yet something to improve:

[auto build test ERROR on battery/master]
[also build test ERROR on v4.15-rc5 next-20171222]
[if your patch is applied to the wrong git tree, please drop us a note to help improve the system]

url:    https://github.com/0day-ci/linux/commits/Ognjen-Galic/pm-Fix-build-issues-in-ds278-thinkpad_acpi/20171224-181540
base:   git://git.infradead.org/battery-2.6.git master
config: i386-randconfig-s1-201752 (attached as .config)
compiler: gcc-6 (Debian 6.4.0-9) 6.4.0 20171026
reproduce:
        # save the attached .config to linux build tree
        make ARCH=i386 

All errors (new ones prefixed by >>):

   drivers/power/supply/ds2781_battery.c: In function 'ds2781_get_pmod_enabled':
>> drivers/power/supply/ds2781_battery.c:455:29: error: implicit declaration of function 'to_power_supply' [-Werror=implicit-function-declaration]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power/supply/ds2781_battery.c:455:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
   drivers/power/supply/ds2781_battery.c: In function 'ds2781_set_pmod_enabled':
   drivers/power/supply/ds2781_battery.c:474:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power/supply/ds2781_battery.c: In function 'ds2781_get_sense_resistor_value':
   drivers/power/supply/ds2781_battery.c:509:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power/supply/ds2781_battery.c: In function 'ds2781_set_sense_resistor_value':
   drivers/power/supply/ds2781_battery.c:527:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power/supply/ds2781_battery.c: In function 'ds2781_get_rsgain_setting':
   drivers/power/supply/ds2781_battery.c:547:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power/supply/ds2781_battery.c: In function 'ds2781_set_rsgain_setting':
   drivers/power/supply/ds2781_battery.c:564:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power/supply/ds2781_battery.c: In function 'ds2781_get_pio_pin':
   drivers/power/supply/ds2781_battery.c:590:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power/supply/ds2781_battery.c: In function 'ds2781_set_pio_pin':
   drivers/power/supply/ds2781_battery.c:608:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power/supply/ds2781_battery.c: In function 'ds2781_read_param_eeprom_bin':
   drivers/power/supply/ds2781_battery.c:634:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power/supply/ds2781_battery.c: In function 'ds2781_write_param_eeprom_bin':
   drivers/power/supply/ds2781_battery.c:647:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power/supply/ds2781_battery.c: In function 'ds2781_read_user_eeprom_bin':
   drivers/power/supply/ds2781_battery.c:679:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   drivers/power/supply/ds2781_battery.c: In function 'ds2781_write_user_eeprom_bin':
   drivers/power/supply/ds2781_battery.c:693:29: warning: initialization makes pointer from integer without a cast [-Wint-conversion]
     struct power_supply *psy = to_power_supply(dev);
                                ^~~~~~~~~~~~~~~
   cc1: some warnings being treated as errors

vim +/to_power_supply +455 drivers/power/supply/ds2781_battery.c

fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  448  
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  449  static ssize_t ds2781_get_pmod_enabled(struct device *dev,
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  450  	struct device_attribute *attr,
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  451  	char *buf)
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  452  {
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  453  	int ret;
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  454  	u8 control_reg;
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29 @455  	struct power_supply *psy = to_power_supply(dev);
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  456  	struct ds2781_device_info *dev_info = to_ds2781_device_info(psy);
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  457  
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  458  	/* Get power mode */
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  459  	ret = ds2781_get_control_register(dev_info, &control_reg);
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  460  	if (ret < 0)
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  461  		return ret;
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  462  
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  463  	return sprintf(buf, "%d\n",
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  464  		 !!(control_reg & DS2781_CONTROL_PMOD));
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  465  }
fef37e9a drivers/power/ds2781_battery.c Renata Sayakhova 2012-02-29  466  

:::::: The code at line 455 was first introduced by commit
:::::: fef37e9a47b9927ce2817fe1a0fa8cf40f6eefb6 DS2781 Maxim Stand-Alone Fuel Gauge battery and w1 slave drivers

:::::: TO: Renata Sayakhova <rsayakhova@gmail.com>
:::::: CC: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

---
0-DAY kernel test infrastructure                Open Source Technology Center
https://lists.01.org/pipermail/kbuild-all                   Intel Corporation
diff mbox

Patch

diff --git a/drivers/power/supply/ds2780_battery.c b/drivers/power/supply/ds2780_battery.c
index e5d81b4..370e910 100644
--- a/drivers/power/supply/ds2780_battery.c
+++ b/drivers/power/supply/ds2780_battery.c
@@ -56,11 +56,6 @@  to_ds2780_device_info(struct power_supply *psy)
 	return power_supply_get_drvdata(psy);
 }
 
-static inline struct power_supply *to_power_supply(struct device *dev)
-{
-	return dev_get_drvdata(dev);
-}
-
 static inline int ds2780_battery_io(struct ds2780_device_info *dev_info,
 	char *buf, int addr, size_t count, int io)
 {
diff --git a/drivers/power/supply/ds2781_battery.c b/drivers/power/supply/ds2781_battery.c
index efe83ef..d1b5a19 100644
--- a/drivers/power/supply/ds2781_battery.c
+++ b/drivers/power/supply/ds2781_battery.c
@@ -54,11 +54,6 @@  to_ds2781_device_info(struct power_supply *psy)
 	return power_supply_get_drvdata(psy);
 }
 
-static inline struct power_supply *to_power_supply(struct device *dev)
-{
-	return dev_get_drvdata(dev);
-}
-
 static inline int ds2781_battery_io(struct ds2781_device_info *dev_info,
 	char *buf, int addr, size_t count, int io)
 {