* [PATCH 1/2] [media] adv7180: Simplify PM hooks
@ 2014-12-16 16:49 Fabio Estevam
2014-12-16 16:49 ` [PATCH 2/2] [media] adv7180: Remove the unneeded 'err' label Fabio Estevam
2014-12-16 21:20 ` [PATCH 1/2] [media] adv7180: Simplify PM hooks Lars-Peter Clausen
0 siblings, 2 replies; 4+ messages in thread
From: Fabio Estevam @ 2014-12-16 16:49 UTC (permalink / raw)
To: mchehab; +Cc: hans.verkuil, linux-media, Fabio Estevam
The macro SIMPLE_DEV_PM_OPS already takes care of the CONFIG_PM_SLEEP=n case, so
move it out of the CONFIG_PM_SLEEP 'if' block and remove the unneeded
ADV7180_PM_OPS definition to make the code simpler.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/media/i2c/adv7180.c | 9 ++-------
1 file changed, 2 insertions(+), 7 deletions(-)
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index bffe6eb..0c1268a 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -700,13 +700,8 @@ static int adv7180_resume(struct device *dev)
return ret;
return 0;
}
-
-static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume);
-#define ADV7180_PM_OPS (&adv7180_pm_ops)
-
-#else
-#define ADV7180_PM_OPS NULL
#endif
+static SIMPLE_DEV_PM_OPS(adv7180_pm_ops, adv7180_suspend, adv7180_resume);
MODULE_DEVICE_TABLE(i2c, adv7180_id);
@@ -714,7 +709,7 @@ static struct i2c_driver adv7180_driver = {
.driver = {
.owner = THIS_MODULE,
.name = KBUILD_MODNAME,
- .pm = ADV7180_PM_OPS,
+ .pm = &adv7180_pm_ops,
},
.probe = adv7180_probe,
.remove = adv7180_remove,
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH 2/2] [media] adv7180: Remove the unneeded 'err' label
2014-12-16 16:49 [PATCH 1/2] [media] adv7180: Simplify PM hooks Fabio Estevam
@ 2014-12-16 16:49 ` Fabio Estevam
2015-01-16 11:30 ` Lars-Peter Clausen
2014-12-16 21:20 ` [PATCH 1/2] [media] adv7180: Simplify PM hooks Lars-Peter Clausen
1 sibling, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2014-12-16 16:49 UTC (permalink / raw)
To: mchehab; +Cc: hans.verkuil, linux-media, Fabio Estevam
There is no need to jump to the 'err' label as we can simply return the error
code directly and make the code shorter.
Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
drivers/media/i2c/adv7180.c | 7 ++-----
1 file changed, 2 insertions(+), 5 deletions(-)
diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c
index 0c1268a..456bf2d 100644
--- a/drivers/media/i2c/adv7180.c
+++ b/drivers/media/i2c/adv7180.c
@@ -616,10 +616,8 @@ static int adv7180_probe(struct i2c_client *client,
client->addr, client->adapter->name);
state = devm_kzalloc(&client->dev, sizeof(*state), GFP_KERNEL);
- if (state == NULL) {
- ret = -ENOMEM;
- goto err;
- }
+ if (state == NULL)
+ return -ENOMEM;
state->irq = client->irq;
mutex_init(&state->mutex);
@@ -649,7 +647,6 @@ err_free_ctrl:
adv7180_exit_controls(state);
err_unreg_subdev:
mutex_destroy(&state->mutex);
-err:
return ret;
}
--
1.9.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH 1/2] [media] adv7180: Simplify PM hooks
2014-12-16 16:49 [PATCH 1/2] [media] adv7180: Simplify PM hooks Fabio Estevam
2014-12-16 16:49 ` [PATCH 2/2] [media] adv7180: Remove the unneeded 'err' label Fabio Estevam
@ 2014-12-16 21:20 ` Lars-Peter Clausen
1 sibling, 0 replies; 4+ messages in thread
From: Lars-Peter Clausen @ 2014-12-16 21:20 UTC (permalink / raw)
To: Fabio Estevam, mchehab; +Cc: hans.verkuil, linux-media
On 12/16/2014 05:49 PM, Fabio Estevam wrote:
> The macro SIMPLE_DEV_PM_OPS already takes care of the CONFIG_PM_SLEEP=n case.
I guess that's kind of debatable. The purpose of ifdef-ing stuff out is to
decrease the driver size if PM support is disabled. With this change you are
adding a rather large struct which is all NULL to the driver even if PM is
disabled. Previously this was not the case.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH 2/2] [media] adv7180: Remove the unneeded 'err' label
2014-12-16 16:49 ` [PATCH 2/2] [media] adv7180: Remove the unneeded 'err' label Fabio Estevam
@ 2015-01-16 11:30 ` Lars-Peter Clausen
0 siblings, 0 replies; 4+ messages in thread
From: Lars-Peter Clausen @ 2015-01-16 11:30 UTC (permalink / raw)
To: Fabio Estevam, mchehab; +Cc: hans.verkuil, linux-media
On 12/16/2014 05:49 PM, Fabio Estevam wrote:
> There is no need to jump to the 'err' label as we can simply return the error
> code directly and make the code shorter.
>
> Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
Acked-by: Lars-Peter Clausen <lars@metafoo.de>
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-01-16 11:30 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-16 16:49 [PATCH 1/2] [media] adv7180: Simplify PM hooks Fabio Estevam
2014-12-16 16:49 ` [PATCH 2/2] [media] adv7180: Remove the unneeded 'err' label Fabio Estevam
2015-01-16 11:30 ` Lars-Peter Clausen
2014-12-16 21:20 ` [PATCH 1/2] [media] adv7180: Simplify PM hooks Lars-Peter Clausen
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).