Skip to contentSkip to conversation

Input: mcs5000_ts - Protect PM functions with CONFIG_PM_SLEEP

PATCH Applied Fabio Estevam 2 participants 3 messages Jul 30, 2014 – Jul 31, 2014

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/2 Input: mcs5000_ts - Protect PM functions with CONFIG_PM_SLEEP

From: Fabio Estevam <[email protected]>

When a kernel has CONFIG_PM=y and CONFIG_PM_SLEEP=n the following warnings are
seen:
drivers/input/touchscreen/mcs5000_ts.c:252:12: warning: 'mcs5000_ts_suspend' defined but not used [-Wunused-function]
static int mcs5000_ts_suspend(struct device *dev)

            ^

drivers/input/touchscreen/mcs5000_ts.c:262:12: warning: 'mcs5000_ts_resume' defined but not used [-Wunused-function]
static int mcs5000_ts_resume(struct device *dev)

Protect the suspend/resume functions with CONFIG_PM_SLEEP in order to fix these build warnings.

---
 drivers/input/touchscreen/mcs5000_ts.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/input/touchscreen/mcs5000_ts.c +1 -1
index 00510a9..1fb760c 100644
@@ -248,7 +248,7 @@ static int mcs5000_ts_probe(struct i2c_client *client,
 	return 0;
 }
 
-#ifdef CONFIG_PM
+#ifdef CONFIG_PM_SLEEP
 static int mcs5000_ts_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
Signature · 1 line
1.9.1
#1 lore raw

PATCH 2/2 Input: mcs5000_ts - Remove ifdef

From: Fabio Estevam <[email protected]>

We can annonate the suspend/resume functions with '__maybe_unused' and get rid of the ifdef, which makes the code smaller and simpler.

---
 drivers/input/touchscreen/mcs5000_ts.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/input/touchscreen/mcs5000_ts.c +2 -4
index 1fb760c..8b47e1f 100644
@@ -248,8 +248,7 @@ static int mcs5000_ts_probe(struct i2c_client *client,
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int mcs5000_ts_suspend(struct device *dev)
+static int __maybe_unused mcs5000_ts_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 
@@ -259,7 +258,7 @@ static int mcs5000_ts_suspend(struct device *dev)
 	return 0;
 }
 
-static int mcs5000_ts_resume(struct device *dev)
+static int __maybe_unused mcs5000_ts_resume(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct mcs5000_ts_data *data = i2c_get_clientdata(client);
@@ -269,7 +268,6 @@ static int mcs5000_ts_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(mcs5000_ts_pm, mcs5000_ts_suspend, mcs5000_ts_resume);
 
Signature · 1 line
1.9.1
maintainer Applied
#2 lore raw

Re: [PATCH 2/2] Input: mcs5000_ts - Remove ifdef

Quoted 6 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

We can annonate the suspend/resume functions with '__maybe_unused' and get rid of the ifdef, which makes the code smaller and simpler.

Applied both, thank you.

Quoted 38 lines
---
 drivers/input/touchscreen/mcs5000_ts.c | 6 ++----
 1 file changed, 2 insertions(+), 4 deletions(-)
drivers/input/touchscreen/mcs5000_ts.c +2 -4
index 1fb760c..8b47e1f 100644
@@ -248,8 +248,7 @@ static int mcs5000_ts_probe(struct i2c_client *client,
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-static int mcs5000_ts_suspend(struct device *dev)
+static int __maybe_unused mcs5000_ts_suspend(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 
@@ -259,7 +258,7 @@ static int mcs5000_ts_suspend(struct device *dev)
 	return 0;
 }
 
-static int mcs5000_ts_resume(struct device *dev)
+static int __maybe_unused mcs5000_ts_resume(struct device *dev)
 {
 	struct i2c_client *client = to_i2c_client(dev);
 	struct mcs5000_ts_data *data = i2c_get_clientdata(client);
@@ -269,7 +268,6 @@ static int mcs5000_ts_resume(struct device *dev)
 
 	return 0;
 }
-#endif
 
 static SIMPLE_DEV_PM_OPS(mcs5000_ts_pm, mcs5000_ts_suspend, mcs5000_ts_resume);
 
Signature · 1 line
1.9.1
Signature · 1 line
Dmitry