Skip to contentSkip to conversation

power: bq24190_charger: mark PM functions as __maybe_unused

PATCH In review Arnd Bergmann 5 participants 5 messages Mar 20, 2017 – Mar 21, 2017 Power supply

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 power: bq24190_charger: mark PM functions as __maybe_unused

Without CONFIG_PM, we get a harmless warning:

drivers/power/supply/bq24190_charger.c:1514:12: error: 'bq24190_runtime_resume' defined but not used [-Werror=unused-function] drivers/power/supply/bq24190_charger.c:1501:12: error: 'bq24190_runtime_suspend' defined but not used [-Werror=unused-function]

To avoid the warning, we can mark all four PM functions as __maybe_unused, which also lets us remove the incorrect #ifdef.

Fixes 3d8090cba638 ("power: bq24190_charger: Check the interrupt status on resume")
---
 drivers/power/supply/bq24190_charger.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/power/supply/bq24190_charger.c +4 -6
index 6d80670586eb..451f2bc05ea5 100644
@@ -1498,7 +1498,7 @@ static int bq24190_remove(struct i2c_client *client)
 	return 0;
 }
 
-static int bq24190_runtime_suspend(struct device *dev)
+static __maybe_unused int bq24190_runtime_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
@@ -1511,7 +1511,7 @@ static int bq24190_runtime_suspend(struct device *dev)
 	return 0;
 }
 
-static int bq24190_runtime_resume(struct device *dev)
+static __maybe_unused int bq24190_runtime_resume(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
@@ -1527,8 +1527,7 @@ static int bq24190_runtime_resume(struct device *dev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int bq24190_pm_suspend(struct device *dev)
+static __maybe_unused int bq24190_pm_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
@@ -1550,7 +1549,7 @@ static int bq24190_pm_suspend(struct device *dev)
 	return 0;
 }
 
-static int bq24190_pm_resume(struct device *dev)
+static __maybe_unused int bq24190_pm_resume(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
@@ -1580,7 +1579,6 @@ static int bq24190_pm_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static const struct dev_pm_ops bq24190_pm_ops = {
 	SET_RUNTIME_PM_OPS(bq24190_runtime_suspend, bq24190_runtime_resume,
Signature · 1 line
2.9.0
Acked-by on v1 1/1
#1 lore raw
Quoted 10 lines · Arnd Bergmann

Without CONFIG_PM, we get a harmless warning:

drivers/power/supply/bq24190_charger.c:1514:12: error: 'bq24190_runtime_resume' defined but not used [-Werror=unused-function] drivers/power/supply/bq24190_charger.c:1501:12: error: 'bq24190_runtime_suspend' defined but not used [-Werror=unused-function]

To avoid the warning, we can mark all four PM functions as __maybe_unused, which also lets us remove the incorrect #ifdef.

Fixes 3d8090cba638 ("power: bq24190_charger: Check the interrupt status on resume")

Thanks for fixing that:

Acked-by on v1 1/1
#2 lore raw
In reply to Arnd Bergmann
Quoted 10 lines · Arnd Bergmann

Without CONFIG_PM, we get a harmless warning:

drivers/power/supply/bq24190_charger.c:1514:12: error: 'bq24190_runtime_resume' defined but not used [-Werror=unused-function] drivers/power/supply/bq24190_charger.c:1501:12: error: 'bq24190_runtime_suspend' defined but not used [-Werror=unused-function]

To avoid the warning, we can mark all four PM functions as __maybe_unused, which also lets us remove the incorrect #ifdef.

Fixes 3d8090cba638 ("power: bq24190_charger: Check the interrupt status on resume")

Cool, thx!

Quoted 56 lines
---
 drivers/power/supply/bq24190_charger.c | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)
drivers/power/supply/bq24190_charger.c +4 -7
index 6d80670586eb..451f2bc05ea5 100644
@@ -1498,7 +1498,7 @@ static int bq24190_remove(struct i2c_client *client)
        return 0;
 }
 
-static int bq24190_runtime_suspend(struct device *dev)
+static __maybe_unused int bq24190_runtime_suspend(struct device *dev)
 {
        struct i2c_client *client = to_i2c_client(dev);
        struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
@@ -1511,7 +1511,7 @@ static int bq24190_runtime_suspend(struct device *dev)
        return 0;
 }
 
-static int bq24190_runtime_resume(struct device *dev)
+static __maybe_unused int bq24190_runtime_resume(struct device *dev)
 {
        struct i2c_client *client = to_i2c_client(dev);
        struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
@@ -1527,8 +1527,7 @@ static int bq24190_runtime_resume(struct device *dev)
        return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int bq24190_pm_suspend(struct device *dev)
+static __maybe_unused int bq24190_pm_suspend(struct device *dev)
 {
        struct i2c_client *client = to_i2c_client(dev);
        struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
@@ -1550,7 +1549,7 @@ static int bq24190_pm_suspend(struct device *dev)
        return 0;
 }
 
-static int bq24190_pm_resume(struct device *dev)
+static __maybe_unused int bq24190_pm_resume(struct device *dev)
 {
        struct i2c_client *client = to_i2c_client(dev);
        struct bq24190_dev_info *bdi = i2c_get_clientdata(client);
@@ -1580,7 +1579,6 @@ static int bq24190_pm_resume(struct device *dev)
 
        return 0;
 }
-#endif
 
 static const struct dev_pm_ops bq24190_pm_ops = {
        SET_RUNTIME_PM_OPS(bq24190_runtime_suspend, bq24190_runtime_resume,
--

2.9.0

#3 lore raw
In reply to Arnd Bergmann

Hi,

Quoted 10 lines · Arnd Bergmann

Without CONFIG_PM, we get a harmless warning:

drivers/power/supply/bq24190_charger.c:1514:12: error: 'bq24190_runtime_resume' defined but not used [-Werror=unused-function] drivers/power/supply/bq24190_charger.c:1501:12: error: 'bq24190_runtime_suspend' defined but not used [-Werror=unused-function]

To avoid the warning, we can mark all four PM functions as __maybe_unused, which also lets us remove the incorrect #ifdef.

Fixes 3d8090cba638 ("power: bq24190_charger: Check the interrupt status on resume")

Thanks, queued.

-- Sebastian

Acked-by on v1 1/1
#4 lore raw
In reply to Arnd Bergmann
Quoted 11 lines · Arnd Bergmann

Without CONFIG_PM, we get a harmless warning:

drivers/power/supply/bq24190_charger.c:1514:12: error: 'bq24190_runtime_resume' defined but not used [-Werror=unused-function] drivers/power/supply/bq24190_charger.c:1501:12: error: 'bq24190_runtime_suspend' defined but not used [-Werror=unused-function]

To avoid the warning, we can mark all four PM functions as __maybe_unused, which also lets us remove the incorrect #ifdef.

Fixes 3d8090cba638 ("power: bq24190_charger: Check the interrupt status on resume")

---

Probably too late but if it isn't...