smiapp: make PM functions as __maybe_unused
PATCH 1/1 smiapp: make PM functions as __maybe_unused
The rework of the PM support has caused two functions to be orphaned when CONFIG_PM is disabled:
media/i2c/smiapp/smiapp-core.c:1352:12: error: 'smiapp_power_off' defined but not used [-Werror=unused-function] media/i2c/smiapp/smiapp-core.c:1206:12: error: 'smiapp_power_on' defined but not used [-Werror=unused-function]
This changes all four PM entry points to __maybe_unused and removes the #ifdef markers for consistency. This avoids the warnings even when something changes again.
--- drivers/media/i2c/smiapp/smiapp-core.c | 17 ++++------------- 1 file changed, 4 insertions(+), 13 deletions(-)
drivers/media/i2c/smiapp/smiapp-core.c +4 -13
@@ -1203,7 +1203,7 @@ static int smiapp_setup_flash_strobe(struct smiapp_sensor *sensor)* Power management */ -static int smiapp_power_on (struct device *dev) +static int __maybe_unused smiapp_power_on (struct device *dev) {struct i2c_client *client =to_i2c_client (dev);struct v4l2_subdev *subdev =i2c_get_clientdata (client);
@@ -1349,7 +1349,7 @@ static int smiapp_power_on(struct device *dev)return rval; } -static int smiapp_power_off (struct device *dev) +static int __maybe_unused smiapp_power_off (struct device *dev) {struct i2c_client *client =to_i2c_client (dev);struct v4l2_subdev *subdev =i2c_get_clientdata (client);
@@ -2741,9 +2741,7 @@ static const struct v4l2_subdev_internal_ops smiapp_internal_ops = {* I2C Driver */ -#ifdef CONFIG_PM - -static int smiapp_suspend (struct device *dev) +static int __maybe_unused smiapp_suspend (struct device *dev) {struct i2c_client *client =to_i2c_client (dev);struct v4l2_subdev *subdev =i2c_get_clientdata (client);
@@ -2768,7 +2766,7 @@ static int smiapp_suspend(struct device *dev)return 0 ; } -static int smiapp_resume (struct device *dev) +static int __maybe_unused smiapp_resume (struct device *dev) {struct i2c_client *client =to_i2c_client (dev);struct v4l2_subdev *subdev =i2c_get_clientdata (client);
@@ -2783,13 +2781,6 @@ static int smiapp_resume(struct device *dev)return rval; } -#else - -#define smiapp_suspend NULL -#define smiapp_resume NULL - -#endif /* CONFIG_PM */ -static struct smiapp_hwconfig *smiapp_get_hwconfig (struct device *dev) {struct smiapp_hwconfig *hwcfg;
Signature · 1 line
2.9.0
Hi Arnd,
Quoted 6 lines · Arnd Bergmann
The rework of the PM support has caused two functions to be orphaned when
CONFIG_PMis disabled:
media/i2c/smiapp/smiapp-core.c:1352:12: error: 'smiapp_power_off' defined but not used [-Werror=unused-function]media/i2c/smiapp/smiapp-core.c:1206:12: error: 'smiapp_power_on' defined but not used [-Werror=unused-function]
Quoted 6 lines
This changes all four PM entry points to
__maybe_unusedand removes the #ifdef markers for consistency. This avoids the warnings even when something changes again.Fixes cbba45d43631 ("[media] smiapp: Use runtime PM")Signed-off-by Arnd Bergmann <[email protected]>
The power-on sequence is in fact mandatory as it involves writing the initial configuration to the sensor as well.
Instead, I believe the correct fix is to make the driver depend on CONFIG_PM.
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]
Quoted 12 lines · CEST Sakari Ailus
Quoted 10 lines · Arnd Bergmann
The rework of the PM support has caused two functions to be orphaned when
CONFIG_PMis disabled:
media/i2c/smiapp/smiapp-core.c:1352:12: error: 'smiapp_power_off' defined but not used [-Werror=unused-function]media/i2c/smiapp/smiapp-core.c:1206:12: error: 'smiapp_power_on' defined but not used [-Werror=unused-function]This changes all four PM entry points to
__maybe_unusedand removes the #ifdef markers for consistency. This avoids the warnings even when something changes again.
Quoted 8 lines
Quoted 2 lines
Fixes cbba45d43631 ("[media] smiapp: Use runtime PM")Signed-off-by Arnd Bergmann <[email protected]>The power-on sequence is in fact mandatory as it involves writing the initial configuration to the sensor as well.
Instead, I believe the correct fix is to make the driver depend on
CONFIG_PM.
(adding linux-pm list)
That would be a rather unusual dependency, though it's possible that a lot of drivers in fact need it but never listed this explictly in Kconfig.
What do other drivers do that need to have their runtime_resume function called at probe time when CONFIG_PM is disabled?
Arnd
Hi Arnd,
Quoted 22 lines · Arnd Bergmann
Quoted 12 lines · CEST Sakari Ailus
Quoted 10 lines · Arnd Bergmann
The rework of the PM support has caused two functions to be orphaned when
CONFIG_PMis disabled:
media/i2c/smiapp/smiapp-core.c:1352:12: error: 'smiapp_power_off' defined but not used [-Werror=unused-function]media/i2c/smiapp/smiapp-core.c:1206:12: error: 'smiapp_power_on' defined but not used [-Werror=unused-function]This changes all four PM entry points to
__maybe_unusedand removes the #ifdef markers for consistency. This avoids the warnings even when something changes again.Quoted 8 lines
Quoted 2 lines
Fixes cbba45d43631 ("[media] smiapp: Use runtime PM")Signed-off-by Arnd Bergmann <[email protected]>The power-on sequence is in fact mandatory as it involves writing the initial configuration to the sensor as well.
Instead, I believe the correct fix is to make the driver depend on
CONFIG_PM.
Quoted 8 lines
(adding linux-pm list)
That would be a rather unusual dependency, though it's possible that a lot of drivers in fact need it but never listed this explictly in
Kconfig.What do other drivers do that need to have their
runtime_resumefunction called at probe time whenCONFIG_PMis disabled?
That's certainly possible as well.
V4L2 sub-device core operation s_power() no longer works (as it now uses runtime PM) but I don't think that's an issue if PM is disabled anyway --- we should really get rid of that in most drivers.
I can submit a patch.
Signature · 4 lines
Kind regards, Sakari Ailus e-mail: [email protected] XMPP: [email protected]