Skip to contentSkip to conversation

usb: chipidea: core: fix when building without CONFIG_PM support

PATCH In review Felipe F. Tonello 2 participants 4 messages Sep 23, 2015 – Sep 25, 2015

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

PATCH v2 1/3 usb: chipidea: core: fix when building without CONFIG_PM support

If CONFIG_PM or CONFIG_PM_SLEEP is not set, driver will not compile properly.

---

Changes for v2:
* removed unnecessary #ifdef CONFIG_PM_SLEEP.

 drivers/usb/chipidea/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/chipidea/core.c +3 -1
index 3ad48e1..382b4af 100644
@@ -1009,18 +1009,20 @@ static int ci_runtime_resume(struct device *dev)
 	return ci_controller_resume(dev);
 }
 
-#endif /* CONFIG_PM */
 static const struct dev_pm_ops ci_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(ci_suspend, ci_resume)
 	SET_RUNTIME_PM_OPS(ci_runtime_suspend, ci_runtime_resume, NULL)
 };
+#endif /* CONFIG_PM */
 
 static struct platform_driver ci_hdrc_driver = {
 	.probe	= ci_hdrc_probe,
 	.remove	= ci_hdrc_remove,
 	.driver	= {
 		.name	= "ci_hdrc",
+#ifdef CONFIG_PM
 		.pm	= &ci_pm_ops,
+#endif
 	},
 };
 
Signature · 1 line
2.1.4
#1 lore raw
Quoted 3 lines · Felipe F. Tonello

If CONFIG_PM or CONFIG_PM_SLEEP is not set, driver will not compile properly.

Would you post the warning or error messages?

I just tried at v4.3-rc1 (v4.2 should be same), without any problems.

Peter

Quoted 38 lines

---

Changes for v2:
* removed unnecessary #ifdef CONFIG_PM_SLEEP.

 drivers/usb/chipidea/core.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)
drivers/usb/chipidea/core.c +3 -1
index 3ad48e1..382b4af 100644
@@ -1009,18 +1009,20 @@ static int ci_runtime_resume(struct device *dev)
 	return ci_controller_resume(dev);
 }
 
-#endif /* CONFIG_PM */
 static const struct dev_pm_ops ci_pm_ops = {
 	SET_SYSTEM_SLEEP_PM_OPS(ci_suspend, ci_resume)
 	SET_RUNTIME_PM_OPS(ci_runtime_suspend, ci_runtime_resume, NULL)
 };
+#endif /* CONFIG_PM */
 
 static struct platform_driver ci_hdrc_driver = {
 	.probe	= ci_hdrc_probe,
 	.remove	= ci_hdrc_remove,
 	.driver	= {
 		.name	= "ci_hdrc",
+#ifdef CONFIG_PM
 		.pm	= &ci_pm_ops,
+#endif
 	},
 };
 
Signature · 1 line
2.1.4
Signature · 2 lines
Best Regards,
Peter Chen
#2 lore raw

Hi Peter,

Quoted 8 lines · Peter Chen
Quoted 3 lines · Felipe F. Tonello

If CONFIG_PM or CONFIG_PM_SLEEP is not set, driver will not compile properly.

Would you post the warning or error messages?

I just tried at v4.3-rc1 (v4.2 should be same), without any problems.

Actually I tested again with the latest and it doesn't break. But still I believe it is the right thing to do, even though it builds. Just good practice to make sure the ifdefs are correct on driver code.

Felipe

#3 lore raw
Quoted 8 lines · Felipe Tonello

Hi Peter,

Quoted 5 lines · Peter Chen
Quoted 3 lines · Felipe F. Tonello

If CONFIG_PM or CONFIG_PM_SLEEP is not set, driver will not compile properly.

Quoted 8 lines
Quoted 3 lines

Would you post the warning or error messages?

I just tried at v4.3-rc1 (v4.2 should be same), without any problems.

Actually I tested again with the latest and it doesn't break. But still I believe it is the right thing to do, even though it builds. Just good practice to make sure the ifdefs are correct on driver code.

We need to decrease #ifdefs as less as possible, only add it if it really needs.

Signature · 2 lines
Best Regards,
Peter Chen