Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1481464 > unrolled thread
| Started by | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| First post | 2016-09-12 17:40 +0200 |
| Last post | 2016-09-13 10:40 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH 1/2] [media] ad5820: use __maybe_unused for PM functions Arnd Bergmann <arnd@arndb.de> - 2016-09-12 17:40 +0200
Re: [PATCH 1/2] [media] ad5820: use __maybe_unused for PM functions Pavel Machek <pavel@ucw.cz> - 2016-09-12 20:00 +0200
Re: [PATCH 1/2] [media] ad5820: use __maybe_unused for PM functions Sakari Ailus <sakari.ailus@iki.fi> - 2016-09-13 10:40 +0200
| From | Arnd Bergmann <arnd@arndb.de> |
|---|---|
| Date | 2016-09-12 17:40 +0200 |
| Subject | [PATCH 1/2] [media] ad5820: use __maybe_unused for PM functions |
| Message-ID | <sgBuX-58A-53@gated-at.bofh.it> |
The new ad5820 driver uses #ifdef to hide the suspend/resume functions,
but gets it wrong when CONFIG_PM_SLEEP is disabled:
drivers/media/i2c/ad5820.c:286:12: error: 'ad5820_resume' defined but not used [-Werror=unused-function]
drivers/media/i2c/ad5820.c:274:12: error: 'ad5820_suspend' defined but not used [-Werror=unused-function]
This replaces the #ifdef with a __maybe_unused annotation that is
simpler and harder to get wrong, avoiding the warning.
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Fixes: bee3d5115611 ("[media] ad5820: Add driver for auto-focus coil")
---
drivers/media/i2c/ad5820.c | 13 ++-----------
1 file changed, 2 insertions(+), 11 deletions(-)
diff --git a/drivers/media/i2c/ad5820.c b/drivers/media/i2c/ad5820.c
index fd4c5f67163d..beab2f381b81 100644
--- a/drivers/media/i2c/ad5820.c
+++ b/drivers/media/i2c/ad5820.c
@@ -269,9 +269,7 @@ static const struct v4l2_subdev_internal_ops ad5820_internal_ops = {
/*
* I2C driver
*/
-#ifdef CONFIG_PM
-
-static int ad5820_suspend(struct device *dev)
+static int __maybe_unused ad5820_suspend(struct device *dev)
{
struct i2c_client *client = container_of(dev, struct i2c_client, dev);
struct v4l2_subdev *subdev = i2c_get_clientdata(client);
@@ -283,7 +281,7 @@ static int ad5820_suspend(struct device *dev)
return ad5820_power_off(coil, false);
}
-static int ad5820_resume(struct device *dev)
+static int __maybe_unused ad5820_resume(struct device *dev)
{
struct i2c_client *client = container_of(dev, struct i2c_client, dev);
struct v4l2_subdev *subdev = i2c_get_clientdata(client);
@@ -295,13 +293,6 @@ static int ad5820_resume(struct device *dev)
return ad5820_power_on(coil, true);
}
-#else
-
-#define ad5820_suspend NULL
-#define ad5820_resume NULL
-
-#endif /* CONFIG_PM */
-
static int ad5820_probe(struct i2c_client *client,
const struct i2c_device_id *devid)
{
--
2.9.0
[toc] | [next] | [standalone]
| From | Pavel Machek <pavel@ucw.cz> |
|---|---|
| Date | 2016-09-12 20:00 +0200 |
| Message-ID | <sgDGq-6uu-47@gated-at.bofh.it> |
| In reply to | #1481464 |
On Mon 2016-09-12 17:32:57, Arnd Bergmann wrote:
> The new ad5820 driver uses #ifdef to hide the suspend/resume functions,
> but gets it wrong when CONFIG_PM_SLEEP is disabled:
>
> drivers/media/i2c/ad5820.c:286:12: error: 'ad5820_resume' defined but not used [-Werror=unused-function]
> drivers/media/i2c/ad5820.c:274:12: error: 'ad5820_suspend' defined but not used [-Werror=unused-function]
>
> This replaces the #ifdef with a __maybe_unused annotation that is
> simpler and harder to get wrong, avoiding the warning.
>
> Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> Fixes: bee3d5115611 ("[media] ad5820: Add driver for auto-focus
coil")
Thanks!
Acked-by: Pavel Machek <pavel@ucw.cz>
--
(english) http://www.livejournal.com/~pavelmachek
(cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blog.html
[toc] | [prev] | [next] | [standalone]
| From | Sakari Ailus <sakari.ailus@iki.fi> |
|---|---|
| Date | 2016-09-13 10:40 +0200 |
| Message-ID | <sgRq1-7PG-17@gated-at.bofh.it> |
| In reply to | #1481770 |
On Mon, Sep 12, 2016 at 07:52:08PM +0200, Pavel Machek wrote:
> On Mon 2016-09-12 17:32:57, Arnd Bergmann wrote:
> > The new ad5820 driver uses #ifdef to hide the suspend/resume functions,
> > but gets it wrong when CONFIG_PM_SLEEP is disabled:
> >
> > drivers/media/i2c/ad5820.c:286:12: error: 'ad5820_resume' defined but not used [-Werror=unused-function]
> > drivers/media/i2c/ad5820.c:274:12: error: 'ad5820_suspend' defined but not used [-Werror=unused-function]
> >
> > This replaces the #ifdef with a __maybe_unused annotation that is
> > simpler and harder to get wrong, avoiding the warning.
> >
> > Signed-off-by: Arnd Bergmann <arnd@arndb.de>
> > Fixes: bee3d5115611 ("[media] ad5820: Add driver for auto-focus
> coil")
>
> Thanks!
>
> Acked-by: Pavel Machek <pavel@ucw.cz>
Thanks, Arnd and Pavel!
Added to my ad5820 branch.
--
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