[1/2,media] adv7180: Simplify PM hooks

Message ID 1418748547-12308-1-git-send-email-fabio.estevam@freescale.com (mailing list archive)
State Rejected, archived
Delegated to: Hans Verkuil
Headers

Commit Message

Fabio Estevam Dec. 16, 2014, 4:49 p.m. UTC
  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(-)
  

Comments

Lars-Peter Clausen Dec. 16, 2014, 9:20 p.m. UTC | #1
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.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
  

Patch

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,