linux-input.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] Input: bfin_rotary - mark suspend and resume code as __maybe_unused
@ 2015-02-06  6:09 Dmitry Torokhov
  2015-02-06  9:06 ` Sonic Zhang
  2015-02-10  3:17 ` Sonic Zhang
  0 siblings, 2 replies; 4+ messages in thread
From: Dmitry Torokhov @ 2015-02-06  6:09 UTC (permalink / raw)
  To: Sonic Zhang; +Cc: linux-input, linux-kernel

Instead of using #ifdef to guard potentially unused suspend and resume code
let's mark them as __maybe_unused so they still get discarded if they are
not used but we do not get warning. This allows for better compile coverage.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/input/misc/bfin_rotary.c | 14 ++++----------
 1 file changed, 4 insertions(+), 10 deletions(-)

diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
index a39793c..09d7612 100644
--- a/drivers/input/misc/bfin_rotary.c
+++ b/drivers/input/misc/bfin_rotary.c
@@ -232,8 +232,7 @@ static int bfin_rotary_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM
-static int bfin_rotary_suspend(struct device *dev)
+static int __maybe_unused bfin_rotary_suspend(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct bfin_rot *rotary = platform_get_drvdata(pdev);
@@ -248,7 +247,7 @@ static int bfin_rotary_suspend(struct device *dev)
 	return 0;
 }
 
-static int bfin_rotary_resume(struct device *dev)
+static int __maybe_unused bfin_rotary_resume(struct device *dev)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct bfin_rot *rotary = platform_get_drvdata(pdev);
@@ -266,20 +265,15 @@ static int bfin_rotary_resume(struct device *dev)
 	return 0;
 }
 
-static const struct dev_pm_ops bfin_rotary_pm_ops = {
-	.suspend	= bfin_rotary_suspend,
-	.resume		= bfin_rotary_resume,
-};
-#endif
+static SIMPLE_DEV_PM_OPS(bfin_rotary_pm_ops,
+			 bfin_rotary_suspend, bfin_rotary_resume);
 
 static struct platform_driver bfin_rotary_device_driver = {
 	.probe		= bfin_rotary_probe,
 	.remove		= bfin_rotary_remove,
 	.driver		= {
 		.name	= "bfin-rotary",
-#ifdef CONFIG_PM
 		.pm	= &bfin_rotary_pm_ops,
-#endif
 	},
 };
 module_platform_driver(bfin_rotary_device_driver);
-- 
2.2.0.rc0.207.ga3a616c


-- 
Dmitry

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

* Re: [PATCH] Input: bfin_rotary - mark suspend and resume code as __maybe_unused
  2015-02-06  6:09 [PATCH] Input: bfin_rotary - mark suspend and resume code as __maybe_unused Dmitry Torokhov
@ 2015-02-06  9:06 ` Sonic Zhang
  2015-02-06 15:41   ` Geert Uytterhoeven
  2015-02-10  3:17 ` Sonic Zhang
  1 sibling, 1 reply; 4+ messages in thread
From: Sonic Zhang @ 2015-02-06  9:06 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Sonic Zhang, linux-input, Linux Kernel

Hi Dmitry,

On Fri, Feb 6, 2015 at 2:09 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> Instead of using #ifdef to guard potentially unused suspend and resume code
> let's mark them as __maybe_unused so they still get discarded if they are
> not used but we do not get warning. This allows for better compile coverage.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/misc/bfin_rotary.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
> index a39793c..09d7612 100644
> --- a/drivers/input/misc/bfin_rotary.c
> +++ b/drivers/input/misc/bfin_rotary.c
> @@ -232,8 +232,7 @@ static int bfin_rotary_remove(struct platform_device *pdev)
>         return 0;
>  }
>
> -#ifdef CONFIG_PM
> -static int bfin_rotary_suspend(struct device *dev)
> +static int __maybe_unused bfin_rotary_suspend(struct device *dev)
>  {
>         struct platform_device *pdev = to_platform_device(dev);
>         struct bfin_rot *rotary = platform_get_drvdata(pdev);
> @@ -248,7 +247,7 @@ static int bfin_rotary_suspend(struct device *dev)
>         return 0;
>  }
>
> -static int bfin_rotary_resume(struct device *dev)
> +static int __maybe_unused bfin_rotary_resume(struct device *dev)
>  {
>         struct platform_device *pdev = to_platform_device(dev);
>         struct bfin_rot *rotary = platform_get_drvdata(pdev);
> @@ -266,20 +265,15 @@ static int bfin_rotary_resume(struct device *dev)
>         return 0;
>  }
>
> -static const struct dev_pm_ops bfin_rotary_pm_ops = {
> -       .suspend        = bfin_rotary_suspend,
> -       .resume         = bfin_rotary_resume,
> -};
> -#endif
> +static SIMPLE_DEV_PM_OPS(bfin_rotary_pm_ops,
> +                        bfin_rotary_suspend, bfin_rotary_resume);
>
>  static struct platform_driver bfin_rotary_device_driver = {
>         .probe          = bfin_rotary_probe,
>         .remove         = bfin_rotary_remove,
>         .driver         = {
>                 .name   = "bfin-rotary",

You missed
                   .owner  = THIS_MODULE,
here.


> -#ifdef CONFIG_PM
>                 .pm     = &bfin_rotary_pm_ops,
> -#endif
>         },
>  };
>  module_platform_driver(bfin_rotary_device_driver);
> --
> 2.2.0.rc0.207.ga3a616c
>
>

Regards,

Sonic

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

* Re: [PATCH] Input: bfin_rotary - mark suspend and resume code as __maybe_unused
  2015-02-06  9:06 ` Sonic Zhang
@ 2015-02-06 15:41   ` Geert Uytterhoeven
  0 siblings, 0 replies; 4+ messages in thread
From: Geert Uytterhoeven @ 2015-02-06 15:41 UTC (permalink / raw)
  To: Sonic Zhang
  Cc: Dmitry Torokhov, Sonic Zhang, linux-input@vger.kernel.org,
	Linux Kernel

On Fri, Feb 6, 2015 at 10:06 AM, Sonic Zhang <sonic.adi@gmail.com> wrote:
>>  static struct platform_driver bfin_rotary_device_driver = {
>>         .probe          = bfin_rotary_probe,
>>         .remove         = bfin_rotary_remove,
>>         .driver         = {
>>                 .name   = "bfin-rotary",
>
> You missed
>                    .owner  = THIS_MODULE,
> here.

That line was removed in v3.19-rc1 by commit 776bd315a7721574
("input: misc: drop owner assignment from platform_drivers").

Gr{oetje,eeting}s,

                        Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
                                -- Linus Torvalds

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

* Re: [PATCH] Input: bfin_rotary - mark suspend and resume code as __maybe_unused
  2015-02-06  6:09 [PATCH] Input: bfin_rotary - mark suspend and resume code as __maybe_unused Dmitry Torokhov
  2015-02-06  9:06 ` Sonic Zhang
@ 2015-02-10  3:17 ` Sonic Zhang
  1 sibling, 0 replies; 4+ messages in thread
From: Sonic Zhang @ 2015-02-10  3:17 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: Sonic Zhang, linux-input, Linux Kernel

Hi Dmitry,

Since the line I mentioned was removed in v3.19-rc1, I am fine with this patch.

Acked-by: Sonic Zhang <sonic.zhang@analog.com>

On Fri, Feb 6, 2015 at 2:09 PM, Dmitry Torokhov
<dmitry.torokhov@gmail.com> wrote:
> Instead of using #ifdef to guard potentially unused suspend and resume code
> let's mark them as __maybe_unused so they still get discarded if they are
> not used but we do not get warning. This allows for better compile coverage.
>
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/input/misc/bfin_rotary.c | 14 ++++----------
>  1 file changed, 4 insertions(+), 10 deletions(-)
>
> diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
> index a39793c..09d7612 100644
> --- a/drivers/input/misc/bfin_rotary.c
> +++ b/drivers/input/misc/bfin_rotary.c
> @@ -232,8 +232,7 @@ static int bfin_rotary_remove(struct platform_device *pdev)
>         return 0;
>  }
>
> -#ifdef CONFIG_PM
> -static int bfin_rotary_suspend(struct device *dev)
> +static int __maybe_unused bfin_rotary_suspend(struct device *dev)
>  {
>         struct platform_device *pdev = to_platform_device(dev);
>         struct bfin_rot *rotary = platform_get_drvdata(pdev);
> @@ -248,7 +247,7 @@ static int bfin_rotary_suspend(struct device *dev)
>         return 0;
>  }
>
> -static int bfin_rotary_resume(struct device *dev)
> +static int __maybe_unused bfin_rotary_resume(struct device *dev)
>  {
>         struct platform_device *pdev = to_platform_device(dev);
>         struct bfin_rot *rotary = platform_get_drvdata(pdev);
> @@ -266,20 +265,15 @@ static int bfin_rotary_resume(struct device *dev)
>         return 0;
>  }
>
> -static const struct dev_pm_ops bfin_rotary_pm_ops = {
> -       .suspend        = bfin_rotary_suspend,
> -       .resume         = bfin_rotary_resume,
> -};
> -#endif
> +static SIMPLE_DEV_PM_OPS(bfin_rotary_pm_ops,
> +                        bfin_rotary_suspend, bfin_rotary_resume);
>
>  static struct platform_driver bfin_rotary_device_driver = {
>         .probe          = bfin_rotary_probe,
>         .remove         = bfin_rotary_remove,
>         .driver         = {
>                 .name   = "bfin-rotary",
> -#ifdef CONFIG_PM
>                 .pm     = &bfin_rotary_pm_ops,
> -#endif
>         },
>  };
>  module_platform_driver(bfin_rotary_device_driver);
> --
> 2.2.0.rc0.207.ga3a616c
>
>
> --
> Dmitry
> --
> To unsubscribe from this list: send the line "unsubscribe linux-input" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

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

end of thread, other threads:[~2015-02-10  3:17 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-02-06  6:09 [PATCH] Input: bfin_rotary - mark suspend and resume code as __maybe_unused Dmitry Torokhov
2015-02-06  9:06 ` Sonic Zhang
2015-02-06 15:41   ` Geert Uytterhoeven
2015-02-10  3:17 ` Sonic Zhang

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).