Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1509800 > unrolled thread

[PATCH] [media] smiapp: make PM functions as __maybe_unused

Started byArnd Bergmann <arnd@arndb.de>
First post2016-10-26 22:40 +0200
Last post2016-10-27 16:10 +0200
Articles 4 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] [media] smiapp: make PM functions as __maybe_unused Arnd Bergmann <arnd@arndb.de> - 2016-10-26 22:40 +0200
    Re: [PATCH] [media] smiapp: make PM functions as __maybe_unused Sakari Ailus <sakari.ailus@iki.fi> - 2016-10-27 09:30 +0200
      Re: [PATCH] [media] smiapp: make PM functions as __maybe_unused Arnd Bergmann <arnd@arndb.de> - 2016-10-27 09:50 +0200
        Re: [PATCH] [media] smiapp: make PM functions as __maybe_unused Sakari Ailus <sakari.ailus@iki.fi> - 2016-10-27 16:10 +0200

#1509800 — [PATCH] [media] smiapp: make PM functions as __maybe_unused

FromArnd Bergmann <arnd@arndb.de>
Date2016-10-26 22:40 +0200
Subject[PATCH] [media] smiapp: make PM functions as __maybe_unused
Message-ID<swD9o-nA-17@gated-at.bofh.it>
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.

Fixes: cbba45d43631 ("[media] smiapp: Use runtime PM")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/media/i2c/smiapp/smiapp-core.c | 17 ++++-------------
 1 file changed, 4 insertions(+), 13 deletions(-)

diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c
index 59872b31f832..fc0142838834 100644
--- a/drivers/media/i2c/smiapp/smiapp-core.c
+++ b/drivers/media/i2c/smiapp/smiapp-core.c
@@ -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;
-- 
2.9.0

[toc] | [next] | [standalone]


#1510115

FromSakari Ailus <sakari.ailus@iki.fi>
Date2016-10-27 09:30 +0200
Message-ID<swNiq-7bf-19@gated-at.bofh.it>
In reply to#1509800
Hi Arnd,

On Wed, Oct 26, 2016 at 10:38:01PM +0200, Arnd Bergmann wrote:
> 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.
> 
> Fixes: cbba45d43631 ("[media] smiapp: Use runtime PM")
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>

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.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

[toc] | [prev] | [next] | [standalone]


#1510127

FromArnd Bergmann <arnd@arndb.de>
Date2016-10-27 09:50 +0200
Message-ID<swNBL-7i8-17@gated-at.bofh.it>
In reply to#1510115
On Thursday, October 27, 2016 10:28:18 AM CEST Sakari Ailus wrote:
> 
> On Wed, Oct 26, 2016 at 10:38:01PM +0200, Arnd Bergmann wrote:
> > 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.
> > 
> > Fixes: cbba45d43631 ("[media] smiapp: Use runtime PM")
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> 
> 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

[toc] | [prev] | [next] | [standalone]


#1510223

FromSakari Ailus <sakari.ailus@iki.fi>
Date2016-10-27 16:10 +0200
Message-ID<swTxy-2VB-89@gated-at.bofh.it>
In reply to#1510127
Hi Arnd,

On Thu, Oct 27, 2016 at 09:43:16AM +0200, Arnd Bergmann wrote:
> On Thursday, October 27, 2016 10:28:18 AM CEST Sakari Ailus wrote:
> > 
> > On Wed, Oct 26, 2016 at 10:38:01PM +0200, Arnd Bergmann wrote:
> > > 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.
> > > 
> > > Fixes: cbba45d43631 ("[media] smiapp: Use runtime PM")
> > > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > 
> > 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?

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.

-- 
Kind regards,

Sakari Ailus
e-mail: sakari.ailus@iki.fi	XMPP: sailus@retiisi.org.uk

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web