Skip to contentSkip to conversation

Input: imx_keypad - Place SIMPLE_DEV_PM_OPS inside CONFIG_PM_SLEEP if block

PATCH In review Fabio Estevam 2 participants 5 messages Apr 11, 2013

Subsystems (3)
lore
Share & tools
lore

Fabio Estevam

author reviewer
#0 lore raw

PATCH 1/1 Input: imx_keypad - Place SIMPLE_DEV_PM_OPS inside CONFIG_PM_SLEEP if block

From: Fabio Estevam <[email protected]>

SIMPLE_DEV_PM_OPS should be inside the CONFIG_PM_SLEEP 'if' block because imx_kbd_suspend and imx_kbd_resume definitions are inside this block.

While at it, also add a definition for IMX_KBD_PM_OPS, which can handle the case when CONFIG_PM_SLEEP is not selected.

---
 drivers/input/keyboard/imx_keypad.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)
drivers/input/keyboard/imx_keypad.c +5 -3
index 03c8cc5..2663c91 100644
@@ -580,15 +580,17 @@ err_clk:
 
 	return ret;
 }
-#endif
-
 static SIMPLE_DEV_PM_OPS(imx_kbd_pm_ops, imx_kbd_suspend, imx_kbd_resume);
+#define IMX_KBD_PM_OPS (&imx_kbd_pm_ops)
+#else
+#define IMX_KBD_PM_OPS NULL
+#endif /* CONFIG_PM_SLEEP */
 
 static struct platform_driver imx_keypad_driver = {
 	.driver		= {
 		.name	= "imx-keypad",
 		.owner	= THIS_MODULE,
-		.pm	= &imx_kbd_pm_ops,
+		.pm	= IMX_KBD_PM_OPS,
 		.of_match_table = of_match_ptr(imx_keypad_of_match),
 	},
 	.probe		= imx_keypad_probe,
Signature · 1 line
1.7.9.5
maintainer
#1 lore raw
Quoted 5 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

SIMPLE_DEV_PM_OPS should be inside the CONFIG_PM_SLEEP 'if' block because
imx_kbd_suspend and imx_kbd_resume definitions are inside this block.

No, it does not. It compiles just fine if CONFIG_PM_SLEEP is not defined.

Quoted 36 lines

While at it, also add a definition for IMX_KBD_PM_OPS, which can handle the case
when CONFIG_PM_SLEEP is not selected.

---
drivers/input/keyboard/imx_keypad.c | 8 +++++---

1 file changed, 5 insertions(+), 3 deletions(-)
drivers/input/keyboard/imx_keypad.c +5 -3
index 03c8cc5..2663c91 100644
@@ -580,15 +580,17 @@ err_clk:
 
 	return ret;
 }
-#endif
-
 static SIMPLE_DEV_PM_OPS(imx_kbd_pm_ops, imx_kbd_suspend,
 imx_kbd_resume);
+#define IMX_KBD_PM_OPS (&imx_kbd_pm_ops)
+#else
+#define IMX_KBD_PM_OPS NULL
+#endif /* CONFIG_PM_SLEEP */
 
 static struct platform_driver imx_keypad_driver = {
 	.driver		= {
 		.name	= "imx-keypad",
 		.owner	= THIS_MODULE,
-		.pm	= &imx_kbd_pm_ops,
+		.pm	= IMX_KBD_PM_OPS,
 		.of_match_table = of_match_ptr(imx_keypad_of_match),
 	},
Quoted 1 line
	.probe		= imx_keypad_probe,

Hi Fabio,
Thanks.

Signature · 1 line
Dmitry
maintainer
#2 lore raw
Quoted 49 lines · Dmitry Torokhov
Quoted 5 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

SIMPLE_DEV_PM_OPS should be inside the CONFIG_PM_SLEEP 'if' block because
imx_kbd_suspend and imx_kbd_resume definitions are inside this block.

No, it does not. It compiles just fine if CONFIG_PM_SLEEP is not defined.

Quoted 40 lines

While at it, also add a definition for IMX_KBD_PM_OPS, which can handle the case
when CONFIG_PM_SLEEP is not selected.

---

drivers/input/keyboard/imx_keypad.c | 8 +++++---

1 file changed, 5 insertions(+), 3 deletions(-)
drivers/input/keyboard/imx_keypad.c +5 -3
index 03c8cc5..2663c91 100644
@@ -580,15 +580,17 @@ err_clk:
 	return ret;
 
 }
 
-#endif
-
 static SIMPLE_DEV_PM_OPS(imx_kbd_pm_ops, imx_kbd_suspend,
 imx_kbd_resume);
+#define IMX_KBD_PM_OPS (&imx_kbd_pm_ops)
+#else
+#define IMX_KBD_PM_OPS NULL
+#endif /* CONFIG_PM_SLEEP */
 
 static struct platform_driver imx_keypad_driver = {
 
 	.driver		= {
 
 		.name	= "imx-keypad",
 		.owner	= THIS_MODULE,
 
-		.pm	= &imx_kbd_pm_ops,
+		.pm	= IMX_KBD_PM_OPS,
Quoted 7 lines
Quoted 4 lines
		.of_match_table = of_match_ptr(imx_keypad_of_match),
	
	},
	.probe		= imx_keypad_probe,

Hi Fabio,
Thanks.

Hmm, K-9's quoting style is really peculiar...

Signature · 1 line
Dmitry
author reviewer
#3 lore raw
In reply to Dmitry Torokhov

Hi Dmitry,

Quoted 9 lines · Dmitry Torokhov
Quoted 5 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

SIMPLE_DEV_PM_OPS should be inside the CONFIG_PM_SLEEP 'if' block because
imx_kbd_suspend and imx_kbd_resume definitions are inside this block.

No, it does not. It compiles just fine if CONFIG_PM_SLEEP is not defined.

I am not sure how to disable CONFIG_PM_SLEEP properly in the defconfig, but I did this quick test to simulate it:

drivers/input/keyboard/imx_keypad.c +1 -1
@@ -536,7 +536,7 @@ static int imx_keypad_probe(struct platform_device *pdev)
        return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
+#if 0
 static int imx_kbd_suspend(struct device *dev)
 {
        struct platform_device *pdev = to_platform_device(dev);

and then I see:

CC drivers/input/keyboard/imx_keypad.o
drivers/input/keyboard/imx_keypad.c:585: error: 'imx_kbd_suspend' undeclared here (not in a function) drivers/input/keyboard/imx_keypad.c:585: error: 'imx_kbd_resume' undeclared here (not in a function)
make[3]: *** [drivers/input/keyboard/imx_keypad.o] Error 1 make[2]: *** [drivers/input/keyboard] Error 2

maintainer
#4 lore raw
Quoted 21 lines · Fabio Estevam

Hi Dmitry,

Quoted 9 lines · Dmitry Torokhov
Quoted 5 lines · Fabio Estevam

From: Fabio Estevam <[email protected]>

SIMPLE_DEV_PM_OPS should be inside the CONFIG_PM_SLEEP 'if' block because
imx_kbd_suspend and imx_kbd_resume definitions are inside this block.

No, it does not. It compiles just fine if CONFIG_PM_SLEEP is not

defined.

I am not sure how to disable CONFIG_PM_SLEEP properly in the defconfig, but I did this quick test to simulate it:

drivers/input/keyboard/imx_keypad.c static int imx_keypad_probe(struct platform_device · line 540

Quoted 6 lines
drivers/input/keyboard/imx_keypad.c +1 -1
@@ -536,7 +536,7 @@ static int imx_keypad_probe(struct platform_device
 *pdev)
       return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
+#if 0

This is not the same thing as SIMPLE_DEV_PM_OPS change their definition depending on CONFIG_PM_SLEEP.

Thanks.

Signature · 1 line
Dmitry