Skip to contentSkip to conversation

Input: st1232 - switch to using SIMPLE_DEV_PM_OPS

PATCH In review Dmitry Torokhov 3 participants 5 messages Mar 31, 2012 – Apr 2, 2012

Subsystems (3)
lore
Share & tools
lore

Dmitry Torokhov

author maintainer
#0 lore raw

PATCH 1/1 Input: st1232 - switch to using SIMPLE_DEV_PM_OPS

---

Just compiled, not tested...

 drivers/input/touchscreen/st1232.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
drivers/input/touchscreen/st1232.c +4 -7
index e22e27e..a9be39f 100644
@@ -218,7 +218,7 @@ static int __devexit st1232_ts_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int st1232_ts_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -243,12 +243,11 @@ static int st1232_ts_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops st1232_ts_pm_ops = {
-	.suspend	= st1232_ts_suspend,
-	.resume		= st1232_ts_resume,
-};
 #endif
 
+static SIMPLE_DEV_PM_OPS(st1232_ts_pm_ops,
+			 st1232_ts_suspend, st1232_ts_resume);
+
 static const struct i2c_device_id st1232_ts_id[] = {
 	{ ST1232_TS_NAME, 0 },
 	{ }
@@ -269,9 +268,7 @@ static struct i2c_driver st1232_ts_driver = {
 		.name	= ST1232_TS_NAME,
 		.owner	= THIS_MODULE,
 		.of_match_table = st1232_ts_dt_ids,
-#ifdef CONFIG_PM
 		.pm	= &st1232_ts_pm_ops,
-#endif
 	},
 };
 
Signature · 5 lines
1.7.7.6


-- 
Dmitry
Acked-by on v1 1/1
#1 lore raw
Quoted 1 line · Dmitry Torokhov

Looks good.

Quoted 47 lines

---

Just compiled, not tested...

 drivers/input/touchscreen/st1232.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
drivers/input/touchscreen/st1232.c +4 -7
index e22e27e..a9be39f 100644
@@ -218,7 +218,7 @@ static int __devexit st1232_ts_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int st1232_ts_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -243,12 +243,11 @@ static int st1232_ts_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops st1232_ts_pm_ops = {
-	.suspend	= st1232_ts_suspend,
-	.resume		= st1232_ts_resume,
-};
 #endif
 
+static SIMPLE_DEV_PM_OPS(st1232_ts_pm_ops,
+			 st1232_ts_suspend, st1232_ts_resume);
+
 static const struct i2c_device_id st1232_ts_id[] = {
 	{ ST1232_TS_NAME, 0 },
 	{ }
@@ -269,9 +268,7 @@ static struct i2c_driver st1232_ts_driver = {
 		.name	= ST1232_TS_NAME,
 		.owner	= THIS_MODULE,
 		.of_match_table = st1232_ts_dt_ids,
-#ifdef CONFIG_PM
 		.pm	= &st1232_ts_pm_ops,
-#endif
 	},
 };
 
#2 lore raw
In reply to Dmitry Torokhov

Hi,

I'm not sure that I follow why st1232_ts_pm_ops is needed if CONFIG_PM_SLEEP isn't defined.

Quoted 58 lines · Dmitry Torokhov

---

Just compiled, not tested...

 drivers/input/touchscreen/st1232.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
drivers/input/touchscreen/st1232.c +4 -7
index e22e27e..a9be39f 100644
@@ -218,7 +218,7 @@ static int __devexit st1232_ts_remove(struct i2c_client *client)
 	return 0;
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int st1232_ts_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -243,12 +243,11 @@ static int st1232_ts_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops st1232_ts_pm_ops = {
-	.suspend	= st1232_ts_suspend,
-	.resume		= st1232_ts_resume,
-};
 #endif
 
+static SIMPLE_DEV_PM_OPS(st1232_ts_pm_ops,
+			 st1232_ts_suspend, st1232_ts_resume);
+
 static const struct i2c_device_id st1232_ts_id[] = {
 	{ ST1232_TS_NAME, 0 },
 	{ }
@@ -269,9 +268,7 @@ static struct i2c_driver st1232_ts_driver = {
 		.name	= ST1232_TS_NAME,
 		.owner	= THIS_MODULE,
 		.of_match_table = st1232_ts_dt_ids,
-#ifdef CONFIG_PM
 		.pm	= &st1232_ts_pm_ops,
-#endif
 	},
 };
 
Signature · 9 lines
1.7.7.6


-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-sh" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
author maintainer
#3 lore raw

Hi Simon,

Quoted 5 lines · Simon Horman

Hi,

I'm not sure that I follow why st1232_ts_pm_ops is needed if CONFIG_PM_SLEEP isn't defined.

In case of !CONFIG_PM_SLEEP dev_pm_ops is an empty structure; having it allows us to drop some ifdefs.

Thanks.

Quoted 62 lines · Dmitry Torokhov

Review

Quoted 9 lines

---

Just compiled, not tested...

 drivers/input/touchscreen/st1232.c |   11 ++++-------
 1 files changed, 4 insertions(+), 7 deletions(-)
(quoted diff) +0 -0

b/drivers/input/touchscreen/st1232.c

drivers/input/touchscreen/st1232.c static int __devexit st1232_ts_remove(struct

Quoted 4 lines

index e22e27e..a9be39f 100644

drivers/input/touchscreen/st1232.c +0 -0
@@ -218,7 +218,7 @@ static int __devexit st1232_ts_remove(struct

i2c_client *client)

Quoted 42 lines
drivers/input/touchscreen/st1232.c +4 -7
 	return 0;
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int st1232_ts_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
@@ -243,12 +243,11 @@ static int st1232_ts_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops st1232_ts_pm_ops = {
-	.suspend	= st1232_ts_suspend,
-	.resume		= st1232_ts_resume,
-};
 #endif
 
+static SIMPLE_DEV_PM_OPS(st1232_ts_pm_ops,
+			 st1232_ts_suspend, st1232_ts_resume);
+
 static const struct i2c_device_id st1232_ts_id[] = {
 	{ ST1232_TS_NAME, 0 },
 	{ }
@@ -269,9 +268,7 @@ static struct i2c_driver st1232_ts_driver = {
 		.name	= ST1232_TS_NAME,
 		.owner	= THIS_MODULE,
 		.of_match_table = st1232_ts_dt_ids,
-#ifdef CONFIG_PM
 		.pm	= &st1232_ts_pm_ops,
-#endif
 	},
 };
 
Signature · 7 lines
1.7.7.6


-- 
Dmitry
--
To unsubscribe from this list: send the line "unsubscribe linux-sh"

in

Quoted 3 lines

the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html

Signature · 1 line
Sent from my Android phone with K-9 Mail. Please excuse my brevity.
Reviewed-by
#4 lore raw
Quoted 6 lines · Dmitry Torokhov

Hi Simon,

Simon Horman <[email protected]> wrote:

Quoted 7 lines
Quoted 5 lines

Hi,

I'm not sure that I follow why st1232_ts_pm_ops is needed if CONFIG_PM_SLEEP isn't defined.

In case of !CONFIG_PM_SLEEP dev_pm_ops is an empty structure; having it allows us to drop some ifdefs.

Thanks, understood.