All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] hwrng: omap - remove incorrect __exit markups
@ 2015-03-09 17:36 Dmitry Torokhov
  2015-03-09 17:36 ` [PATCH 2/4] hwrng: omap - remove #ifdefery around PM methods Dmitry Torokhov
                   ` (3 more replies)
  0 siblings, 4 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2015-03-09 17:36 UTC (permalink / raw)
  To: linux-crypto, Deepak Saxena; +Cc: linux-kernel, Herbert Xu

Even if bus is not hot-pluggable, the devices can be unbound from the
driver via sysfs, so we should not be using __exit annotations on
remove() methods. The only exception is drivers registered with
platform_driver_probe() which specifically disables sysfs bind/unbind
attributes.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/char/hw_random/omap-rng.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index d14dcf7..7f3597d 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -408,7 +408,7 @@ err_ioremap:
 	return ret;
 }
 
-static int __exit omap_rng_remove(struct platform_device *pdev)
+static int omap_rng_remove(struct platform_device *pdev)
 {
 	struct omap_rng_dev *priv = platform_get_drvdata(pdev);
 
@@ -460,7 +460,7 @@ static struct platform_driver omap_rng_driver = {
 		.of_match_table = of_match_ptr(omap_rng_of_match),
 	},
 	.probe		= omap_rng_probe,
-	.remove		= __exit_p(omap_rng_remove),
+	.remove		= omap_rng_remove,
 };
 
 module_platform_driver(omap_rng_driver);
-- 
2.2.0.rc0.207.ga3a616c

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

* [PATCH 2/4] hwrng: omap - remove #ifdefery around PM methods
  2015-03-09 17:36 [PATCH 1/4] hwrng: omap - remove incorrect __exit markups Dmitry Torokhov
@ 2015-03-09 17:36 ` Dmitry Torokhov
  2015-03-11 10:59   ` Herbert Xu
  2015-03-09 17:36 ` [PATCH 3/4] hwrng: octeon - remove incorrect __exit markups Dmitry Torokhov
                   ` (2 subsequent siblings)
  3 siblings, 1 reply; 9+ messages in thread
From: Dmitry Torokhov @ 2015-03-09 17:36 UTC (permalink / raw)
  To: linux-crypto, Deepak Saxena; +Cc: linux-kernel, Herbert Xu

Instead of using #ifdefs let's mark suspend and resume methods as
__maybe_unused which will suppress compiler warnings about them being
unused and provide better compile coverage. This will not increase image
size.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/char/hw_random/omap-rng.c | 15 +++------------
 1 file changed, 3 insertions(+), 12 deletions(-)

diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
index 7f3597d..5c171b1 100644
--- a/drivers/char/hw_random/omap-rng.c
+++ b/drivers/char/hw_random/omap-rng.c
@@ -422,9 +422,7 @@ static int omap_rng_remove(struct platform_device *pdev)
 	return 0;
 }
 
-#ifdef CONFIG_PM_SLEEP
-
-static int omap_rng_suspend(struct device *dev)
+static int __maybe_unused omap_rng_suspend(struct device *dev)
 {
 	struct omap_rng_dev *priv = dev_get_drvdata(dev);
 
@@ -434,7 +432,7 @@ static int omap_rng_suspend(struct device *dev)
 	return 0;
 }
 
-static int omap_rng_resume(struct device *dev)
+static int __maybe_unused omap_rng_resume(struct device *dev)
 {
 	struct omap_rng_dev *priv = dev_get_drvdata(dev);
 
@@ -445,18 +443,11 @@ static int omap_rng_resume(struct device *dev)
 }
 
 static SIMPLE_DEV_PM_OPS(omap_rng_pm, omap_rng_suspend, omap_rng_resume);
-#define	OMAP_RNG_PM	(&omap_rng_pm)
-
-#else
-
-#define	OMAP_RNG_PM	NULL
-
-#endif
 
 static struct platform_driver omap_rng_driver = {
 	.driver = {
 		.name		= "omap_rng",
-		.pm		= OMAP_RNG_PM,
+		.pm		= &omap_rng_pm,
 		.of_match_table = of_match_ptr(omap_rng_of_match),
 	},
 	.probe		= omap_rng_probe,
-- 
2.2.0.rc0.207.ga3a616c

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

* [PATCH 3/4] hwrng: octeon - remove incorrect __exit markups
  2015-03-09 17:36 [PATCH 1/4] hwrng: omap - remove incorrect __exit markups Dmitry Torokhov
  2015-03-09 17:36 ` [PATCH 2/4] hwrng: omap - remove #ifdefery around PM methods Dmitry Torokhov
@ 2015-03-09 17:36 ` Dmitry Torokhov
  2015-03-09 17:36 ` [PATCH 4/4] hwrng: pseries-rng - remove incorrect __init/__exit markups Dmitry Torokhov
  2015-03-11 14:13 ` [PATCH 1/4] hwrng: omap - remove incorrect __exit markups Herbert Xu
  3 siblings, 0 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2015-03-09 17:36 UTC (permalink / raw)
  To: linux-crypto; +Cc: linux-kernel, Herbert Xu

Even if bus is not hot-pluggable, the devices can be unbound from the
driver via sysfs, so we should not be using __exit annotations on
remove() methods. The only exception is drivers registered with
platform_driver_probe() which specifically disables sysfs bind/unbind
attributes

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/char/hw_random/octeon-rng.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/octeon-rng.c b/drivers/char/hw_random/octeon-rng.c
index be1c3f6..6234a4a 100644
--- a/drivers/char/hw_random/octeon-rng.c
+++ b/drivers/char/hw_random/octeon-rng.c
@@ -105,7 +105,7 @@ static int octeon_rng_probe(struct platform_device *pdev)
 	return 0;
 }
 
-static int __exit octeon_rng_remove(struct platform_device *pdev)
+static int octeon_rng_remove(struct platform_device *pdev)
 {
 	struct hwrng *rng = platform_get_drvdata(pdev);
 
@@ -119,7 +119,7 @@ static struct platform_driver octeon_rng_driver = {
 		.name		= "octeon_rng",
 	},
 	.probe		= octeon_rng_probe,
-	.remove		= __exit_p(octeon_rng_remove),
+	.remove		= octeon_rng_remove,
 };
 
 module_platform_driver(octeon_rng_driver);
-- 
2.2.0.rc0.207.ga3a616c

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

* [PATCH 4/4] hwrng: pseries-rng - remove incorrect __init/__exit markups
  2015-03-09 17:36 [PATCH 1/4] hwrng: omap - remove incorrect __exit markups Dmitry Torokhov
  2015-03-09 17:36 ` [PATCH 2/4] hwrng: omap - remove #ifdefery around PM methods Dmitry Torokhov
  2015-03-09 17:36 ` [PATCH 3/4] hwrng: octeon - remove incorrect __exit markups Dmitry Torokhov
@ 2015-03-09 17:36 ` Dmitry Torokhov
  2015-03-11 14:13 ` [PATCH 1/4] hwrng: omap - remove incorrect __exit markups Herbert Xu
  3 siblings, 0 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2015-03-09 17:36 UTC (permalink / raw)
  To: linux-crypto; +Cc: linux-kernel, Herbert Xu

Even if bus is not hot-pluggable, the devices can be unbound from the
driver via sysfs, so we should not be using __exit annotations on
remove() methods. The only exception is drivers registered with
platform_driver_probe() which specifically disables sysfs bind/unbind
attributes.

Similarly probe() methods should not be marked __init unless
platform_driver_probe() is used.

Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
---
 drivers/char/hw_random/pseries-rng.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/char/hw_random/pseries-rng.c b/drivers/char/hw_random/pseries-rng.c
index bcf86f9..63ce51d 100644
--- a/drivers/char/hw_random/pseries-rng.c
+++ b/drivers/char/hw_random/pseries-rng.c
@@ -61,13 +61,13 @@ static struct hwrng pseries_rng = {
 	.read		= pseries_rng_read,
 };
 
-static int __init pseries_rng_probe(struct vio_dev *dev,
+static int pseries_rng_probe(struct vio_dev *dev,
 		const struct vio_device_id *id)
 {
 	return hwrng_register(&pseries_rng);
 }
 
-static int __exit pseries_rng_remove(struct vio_dev *dev)
+static int pseries_rng_remove(struct vio_dev *dev)
 {
 	hwrng_unregister(&pseries_rng);
 	return 0;
-- 
2.2.0.rc0.207.ga3a616c

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

* Re: [PATCH 2/4] hwrng: omap - remove #ifdefery around PM methods
  2015-03-09 17:36 ` [PATCH 2/4] hwrng: omap - remove #ifdefery around PM methods Dmitry Torokhov
@ 2015-03-11 10:59   ` Herbert Xu
  2015-03-11 15:44     ` Dmitry Torokhov
  0 siblings, 1 reply; 9+ messages in thread
From: Herbert Xu @ 2015-03-11 10:59 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-crypto, Deepak Saxena, linux-kernel

On Mon, Mar 09, 2015 at 10:36:36AM -0700, Dmitry Torokhov wrote:
> Instead of using #ifdefs let's mark suspend and resume methods as
> __maybe_unused which will suppress compiler warnings about them being
> unused and provide better compile coverage. This will not increase image
> size.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> ---
>  drivers/char/hw_random/omap-rng.c | 15 +++------------
>  1 file changed, 3 insertions(+), 12 deletions(-)
> 
> diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
> index 7f3597d..5c171b1 100644
> --- a/drivers/char/hw_random/omap-rng.c
> +++ b/drivers/char/hw_random/omap-rng.c
> @@ -422,9 +422,7 @@ static int omap_rng_remove(struct platform_device *pdev)
>  	return 0;
>  }
>  
> -#ifdef CONFIG_PM_SLEEP
> -
> -static int omap_rng_suspend(struct device *dev)
> +static int __maybe_unused omap_rng_suspend(struct device *dev)
>  {
>  	struct omap_rng_dev *priv = dev_get_drvdata(dev);
>  
> @@ -434,7 +432,7 @@ static int omap_rng_suspend(struct device *dev)
>  	return 0;
>  }
>  
> -static int omap_rng_resume(struct device *dev)
> +static int __maybe_unused omap_rng_resume(struct device *dev)
>  {
>  	struct omap_rng_dev *priv = dev_get_drvdata(dev);
>  
> @@ -445,18 +443,11 @@ static int omap_rng_resume(struct device *dev)
>  }
>  
>  static SIMPLE_DEV_PM_OPS(omap_rng_pm, omap_rng_suspend, omap_rng_resume);
> -#define	OMAP_RNG_PM	(&omap_rng_pm)
> -
> -#else
> -
> -#define	OMAP_RNG_PM	NULL
> -
> -#endif
>  
>  static struct platform_driver omap_rng_driver = {
>  	.driver = {
>  		.name		= "omap_rng",
> -		.pm		= OMAP_RNG_PM,
> +		.pm		= &omap_rng_pm,

This will cause omap_rng_suspend/omap_rng_resume to be referenced
always, thus rendering the __maybe_unused moot, no?

Cheers,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [PATCH 1/4] hwrng: omap - remove incorrect __exit markups
  2015-03-09 17:36 [PATCH 1/4] hwrng: omap - remove incorrect __exit markups Dmitry Torokhov
                   ` (2 preceding siblings ...)
  2015-03-09 17:36 ` [PATCH 4/4] hwrng: pseries-rng - remove incorrect __init/__exit markups Dmitry Torokhov
@ 2015-03-11 14:13 ` Herbert Xu
  3 siblings, 0 replies; 9+ messages in thread
From: Herbert Xu @ 2015-03-11 14:13 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-crypto, Deepak Saxena, linux-kernel

On Mon, Mar 09, 2015 at 10:36:35AM -0700, Dmitry Torokhov wrote:
> Even if bus is not hot-pluggable, the devices can be unbound from the
> driver via sysfs, so we should not be using __exit annotations on
> remove() methods. The only exception is drivers registered with
> platform_driver_probe() which specifically disables sysfs bind/unbind
> attributes.
> 
> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

Patches 1/3/4 applied.
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [PATCH 2/4] hwrng: omap - remove #ifdefery around PM methods
  2015-03-11 10:59   ` Herbert Xu
@ 2015-03-11 15:44     ` Dmitry Torokhov
  2015-03-11 21:00       ` Herbert Xu
  0 siblings, 1 reply; 9+ messages in thread
From: Dmitry Torokhov @ 2015-03-11 15:44 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-crypto, Deepak Saxena, linux-kernel

Hi Herbert,

On Wed, Mar 11, 2015 at 09:59:57PM +1100, Herbert Xu wrote:
> On Mon, Mar 09, 2015 at 10:36:36AM -0700, Dmitry Torokhov wrote:
> > Instead of using #ifdefs let's mark suspend and resume methods as
> > __maybe_unused which will suppress compiler warnings about them being
> > unused and provide better compile coverage. This will not increase image
> > size.
> > 
> > Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
> > ---
> >  drivers/char/hw_random/omap-rng.c | 15 +++------------
> >  1 file changed, 3 insertions(+), 12 deletions(-)
> > 
> > diff --git a/drivers/char/hw_random/omap-rng.c b/drivers/char/hw_random/omap-rng.c
> > index 7f3597d..5c171b1 100644
> > --- a/drivers/char/hw_random/omap-rng.c
> > +++ b/drivers/char/hw_random/omap-rng.c
> > @@ -422,9 +422,7 @@ static int omap_rng_remove(struct platform_device *pdev)
> >  	return 0;
> >  }
> >  
> > -#ifdef CONFIG_PM_SLEEP
> > -
> > -static int omap_rng_suspend(struct device *dev)
> > +static int __maybe_unused omap_rng_suspend(struct device *dev)
> >  {
> >  	struct omap_rng_dev *priv = dev_get_drvdata(dev);
> >  
> > @@ -434,7 +432,7 @@ static int omap_rng_suspend(struct device *dev)
> >  	return 0;
> >  }
> >  
> > -static int omap_rng_resume(struct device *dev)
> > +static int __maybe_unused omap_rng_resume(struct device *dev)
> >  {
> >  	struct omap_rng_dev *priv = dev_get_drvdata(dev);
> >  
> > @@ -445,18 +443,11 @@ static int omap_rng_resume(struct device *dev)
> >  }
> >  
> >  static SIMPLE_DEV_PM_OPS(omap_rng_pm, omap_rng_suspend, omap_rng_resume);
> > -#define	OMAP_RNG_PM	(&omap_rng_pm)
> > -
> > -#else
> > -
> > -#define	OMAP_RNG_PM	NULL
> > -
> > -#endif
> >  
> >  static struct platform_driver omap_rng_driver = {
> >  	.driver = {
> >  		.name		= "omap_rng",
> > -		.pm		= OMAP_RNG_PM,
> > +		.pm		= &omap_rng_pm,
> 
> This will cause omap_rng_suspend/omap_rng_resume to be referenced
> always, thus rendering the __maybe_unused moot, no?

SIMPLE_DEV_PM_OPS() produces an empty omap_rng_pm structure in case of
!CONFIG_PM_SLEEP so neither omap_rng_suspend nor omap_rng_resume will
end up being referenced.

Thanks.

-- 
Dmitry

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

* Re: [PATCH 2/4] hwrng: omap - remove #ifdefery around PM methods
  2015-03-11 15:44     ` Dmitry Torokhov
@ 2015-03-11 21:00       ` Herbert Xu
  2015-03-11 21:08         ` Dmitry Torokhov
  0 siblings, 1 reply; 9+ messages in thread
From: Herbert Xu @ 2015-03-11 21:00 UTC (permalink / raw)
  To: Dmitry Torokhov; +Cc: linux-crypto, Deepak Saxena, linux-kernel

On Wed, Mar 11, 2015 at 08:44:07AM -0700, Dmitry Torokhov wrote:
> 
> SIMPLE_DEV_PM_OPS() produces an empty omap_rng_pm structure in case of
> !CONFIG_PM_SLEEP so neither omap_rng_suspend nor omap_rng_resume will
> end up being referenced.

OK, could you please resend this patch?

Thanks,
-- 
Email: Herbert Xu <herbert@gondor.apana.org.au>
Home Page: http://gondor.apana.org.au/~herbert/
PGP Key: http://gondor.apana.org.au/~herbert/pubkey.txt

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

* Re: [PATCH 2/4] hwrng: omap - remove #ifdefery around PM methods
  2015-03-11 21:00       ` Herbert Xu
@ 2015-03-11 21:08         ` Dmitry Torokhov
  0 siblings, 0 replies; 9+ messages in thread
From: Dmitry Torokhov @ 2015-03-11 21:08 UTC (permalink / raw)
  To: Herbert Xu; +Cc: linux-crypto, Deepak Saxena, linux-kernel

On Thu, Mar 12, 2015 at 08:00:35AM +1100, Herbert Xu wrote:
> On Wed, Mar 11, 2015 at 08:44:07AM -0700, Dmitry Torokhov wrote:
> > 
> > SIMPLE_DEV_PM_OPS() produces an empty omap_rng_pm structure in case of
> > !CONFIG_PM_SLEEP so neither omap_rng_suspend nor omap_rng_resume will
> > end up being referenced.
> 
> OK, could you please resend this patch?

Done.

Thanks!

-- 
Dmitry

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

end of thread, other threads:[~2015-03-11 21:08 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-09 17:36 [PATCH 1/4] hwrng: omap - remove incorrect __exit markups Dmitry Torokhov
2015-03-09 17:36 ` [PATCH 2/4] hwrng: omap - remove #ifdefery around PM methods Dmitry Torokhov
2015-03-11 10:59   ` Herbert Xu
2015-03-11 15:44     ` Dmitry Torokhov
2015-03-11 21:00       ` Herbert Xu
2015-03-11 21:08         ` Dmitry Torokhov
2015-03-09 17:36 ` [PATCH 3/4] hwrng: octeon - remove incorrect __exit markups Dmitry Torokhov
2015-03-09 17:36 ` [PATCH 4/4] hwrng: pseries-rng - remove incorrect __init/__exit markups Dmitry Torokhov
2015-03-11 14:13 ` [PATCH 1/4] hwrng: omap - remove incorrect __exit markups Herbert Xu

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.