Linux Input/HID development
 help / color / mirror / Atom feed
* [PATCH] Input: imx_keypad - Place SIMPLE_DEV_PM_OPS inside CONFIG_PM_SLEEP if block
@ 2013-04-11  5:16 Fabio Estevam
  2013-04-11  5:28 ` Dmitry Torokhov
  0 siblings, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2013-04-11  5:16 UTC (permalink / raw)
  To: dmitry.torokhov; +Cc: kernel, linux-input, Fabio Estevam

From: Fabio Estevam <fabio.estevam@freescale.com>

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.

Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
---
 drivers/input/keyboard/imx_keypad.c |    8 +++++---
 1 file changed, 5 insertions(+), 3 deletions(-)

diff --git a/drivers/input/keyboard/imx_keypad.c b/drivers/input/keyboard/imx_keypad.c
index 03c8cc5..2663c91 100644
--- a/drivers/input/keyboard/imx_keypad.c
+++ b/drivers/input/keyboard/imx_keypad.c
@@ -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,
-- 
1.7.9.5


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH] Input: imx_keypad - Place SIMPLE_DEV_PM_OPS inside CONFIG_PM_SLEEP if block
  2013-04-11  5:16 [PATCH] Input: imx_keypad - Place SIMPLE_DEV_PM_OPS inside CONFIG_PM_SLEEP if block Fabio Estevam
@ 2013-04-11  5:28 ` Dmitry Torokhov
  2013-04-11  6:15   ` Dmitry Torokhov
  2013-04-11 14:17   ` Fabio Estevam
  0 siblings, 2 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2013-04-11  5:28 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: kernel, linux-input, Fabio Estevam

Fabio Estevam <festevam@gmail.com> wrote:

>From: Fabio Estevam <fabio.estevam@freescale.com>
>
>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.

>
>While at it, also add a definition for IMX_KBD_PM_OPS, which can handle
>the case
>when CONFIG_PM_SLEEP is not selected.
>
>Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
>---
> drivers/input/keyboard/imx_keypad.c |    8 +++++---
> 1 file changed, 5 insertions(+), 3 deletions(-)
>
>diff --git a/drivers/input/keyboard/imx_keypad.c
>b/drivers/input/keyboard/imx_keypad.c
>index 03c8cc5..2663c91 100644
>--- a/drivers/input/keyboard/imx_keypad.c
>+++ b/drivers/input/keyboard/imx_keypad.c
>@@ -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,

Hi Fabio,
Thanks.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Input: imx_keypad - Place SIMPLE_DEV_PM_OPS inside CONFIG_PM_SLEEP if block
  2013-04-11  5:28 ` Dmitry Torokhov
@ 2013-04-11  6:15   ` Dmitry Torokhov
  2013-04-11 14:17   ` Fabio Estevam
  1 sibling, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2013-04-11  6:15 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: kernel, linux-input, Fabio Estevam

On Wednesday, April 10, 2013 10:28:22 PM Dmitry Torokhov wrote:
> Fabio Estevam <festevam@gmail.com> wrote:
> >From: Fabio Estevam <fabio.estevam@freescale.com>
> >
> >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.
> 
> >While at it, also add a definition for IMX_KBD_PM_OPS, which can handle
> >the case
> >when CONFIG_PM_SLEEP is not selected.
> >
> >Signed-off-by: Fabio Estevam <fabio.estevam@freescale.com>
> >---
> >
> > drivers/input/keyboard/imx_keypad.c |    8 +++++---
> > 1 file changed, 5 insertions(+), 3 deletions(-)
> >
> >diff --git a/drivers/input/keyboard/imx_keypad.c
> >b/drivers/input/keyboard/imx_keypad.c
> >index 03c8cc5..2663c91 100644
> >--- a/drivers/input/keyboard/imx_keypad.c
> >+++ b/drivers/input/keyboard/imx_keypad.c
> >
> >@@ -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,
> 
> Hi Fabio,
> Thanks.

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

-- 
Dmitry

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Input: imx_keypad - Place SIMPLE_DEV_PM_OPS inside CONFIG_PM_SLEEP if block
  2013-04-11  5:28 ` Dmitry Torokhov
  2013-04-11  6:15   ` Dmitry Torokhov
@ 2013-04-11 14:17   ` Fabio Estevam
  2013-04-11 14:45     ` Dmitry Torokhov
  1 sibling, 1 reply; 5+ messages in thread
From: Fabio Estevam @ 2013-04-11 14:17 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: kernel, linux-input, Fabio Estevam

Hi Dmitry,

On Thu, Apr 11, 2013 at 2:28 AM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> Fabio Estevam <festevam@gmail.com> wrote:
>
>>From: Fabio Estevam <fabio.estevam@freescale.com>
>>
>>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:

--- a/drivers/input/keyboard/imx_keypad.c
+++ b/drivers/input/keyboard/imx_keypad.c
@@ -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

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH] Input: imx_keypad - Place SIMPLE_DEV_PM_OPS inside CONFIG_PM_SLEEP if block
  2013-04-11 14:17   ` Fabio Estevam
@ 2013-04-11 14:45     ` Dmitry Torokhov
  0 siblings, 0 replies; 5+ messages in thread
From: Dmitry Torokhov @ 2013-04-11 14:45 UTC (permalink / raw)
  To: Fabio Estevam; +Cc: kernel, linux-input, Fabio Estevam

Fabio Estevam <festevam@gmail.com> wrote:

>Hi Dmitry,
>
>On Thu, Apr 11, 2013 at 2:28 AM, Dmitry Torokhov
><dmitry.torokhov@gmail.com> wrote:
>> Fabio Estevam <festevam@gmail.com> wrote:
>>
>>>From: Fabio Estevam <fabio.estevam@freescale.com>
>>>
>>>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:
>
>--- a/drivers/input/keyboard/imx_keypad.c
>+++ b/drivers/input/keyboard/imx_keypad.c
>@@ -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.

-- 
Dmitry

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2013-04-11 14:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-04-11  5:16 [PATCH] Input: imx_keypad - Place SIMPLE_DEV_PM_OPS inside CONFIG_PM_SLEEP if block Fabio Estevam
2013-04-11  5:28 ` Dmitry Torokhov
2013-04-11  6:15   ` Dmitry Torokhov
2013-04-11 14:17   ` Fabio Estevam
2013-04-11 14:45     ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox