All of lore.kernel.org
 help / color / mirror / Atom feed
* [patch 2.6.25-rc3] smc91x section fix
@ 2008-02-25  3:34 David Brownell
  2008-02-25  6:02 ` Sam Ravnborg
  0 siblings, 1 reply; 7+ messages in thread
From: David Brownell @ 2008-02-25  3:34 UTC (permalink / raw)
  To: nico, netdev

Section fixup:

WARNING: drivers/net/built-in.o(.text+0x1a2c): Section mismatch
	in reference from the function smc_drv_probe()
	to the function .init.text:smc_probe()
The function smc_drv_probe() references
the function __init smc_probe().
This is often because smc_drv_probe lacks a __init
annotation or the annotation of smc_probe is wrong.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
 drivers/net/smc91x.c |    2 +-
 1 files changed, 1 insertion(+), 1 deletion(-)

--- a/drivers/net/smc91x.c	2008-02-24 18:50:32.000000000 -0800
+++ b/drivers/net/smc91x.c	2008-02-24 19:16:29.000000000 -0800
@@ -2121,7 +2121,7 @@ static void smc_release_datacs(struct pl
  *	0 --> there is a device
  *	anything else, error
  */
-static int smc_drv_probe(struct platform_device *pdev)
+static int __init smc_drv_probe(struct platform_device *pdev)
 {
 	struct net_device *ndev;
 	struct resource *res, *ires;

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

* Re: [patch 2.6.25-rc3] smc91x section fix
  2008-02-25  3:34 [patch 2.6.25-rc3] smc91x section fix David Brownell
@ 2008-02-25  6:02 ` Sam Ravnborg
  2008-02-25  6:33   ` David Brownell
  0 siblings, 1 reply; 7+ messages in thread
From: Sam Ravnborg @ 2008-02-25  6:02 UTC (permalink / raw)
  To: David Brownell; +Cc: nico, netdev

On Sun, Feb 24, 2008 at 07:34:11PM -0800, David Brownell wrote:
> Section fixup:
> 
> WARNING: drivers/net/built-in.o(.text+0x1a2c): Section mismatch
> 	in reference from the function smc_drv_probe()
> 	to the function .init.text:smc_probe()
> The function smc_drv_probe() references
> the function __init smc_probe().
> This is often because smc_drv_probe lacks a __init
> annotation or the annotation of smc_probe is wrong.
> 
> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> ---
>  drivers/net/smc91x.c |    2 +-
>  1 files changed, 1 insertion(+), 1 deletion(-)
> 
> --- a/drivers/net/smc91x.c	2008-02-24 18:50:32.000000000 -0800
> +++ b/drivers/net/smc91x.c	2008-02-24 19:16:29.000000000 -0800
> @@ -2121,7 +2121,7 @@ static void smc_release_datacs(struct pl
>   *	0 --> there is a device
>   *	anything else, error
>   */
> -static int smc_drv_probe(struct platform_device *pdev)
> +static int __init smc_drv_probe(struct platform_device *pdev)
>  {
>  	struct net_device *ndev;
>  	struct resource *res, *ires;

>From a quick look this is wrong.
smc_drv_probe is assined the .probe member so it is used during
hotplug and thus should be __devinit.
Likewise smc_probe is used by smc_drv_probe and thus smc_probe
should be __devinit too.

So something like the appended. On my way out of the door so
not even build tested!


	Sam

diff --git a/drivers/net/smc91x.c b/drivers/net/smc91x.c
index 4020e9e..640bca5 100644
--- a/drivers/net/smc91x.c
+++ b/drivers/net/smc91x.c
@@ -1775,7 +1775,7 @@ static int __init smc_findirq(void __iomem *ioaddr)
  * o  actually GRAB the irq.
  * o  GRAB the region
  */
-static int __init smc_probe(struct net_device *dev, void __iomem *ioaddr,
+static int __devinit smc_probe(struct net_device *dev, void __iomem *ioaddr,
 			    unsigned long irq_flags)
 {
 	struct smc_local *lp = netdev_priv(dev);
@@ -2121,7 +2121,7 @@ static void smc_release_datacs(struct platform_device *pdev, struct net_device *
  *	0 --> there is a device
  *	anything else, error
  */
-static int smc_drv_probe(struct platform_device *pdev)
+static int __devinit smc_drv_probe(struct platform_device *pdev)
 {
 	struct net_device *ndev;
 	struct resource *res, *ires;

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

* Re: [patch 2.6.25-rc3] smc91x section fix
  2008-02-25  6:02 ` Sam Ravnborg
@ 2008-02-25  6:33   ` David Brownell
  2008-02-25 20:11     ` Sam Ravnborg
  2008-04-19  3:01     ` [RESEND/UPDATED patch 2.6.25] " David Brownell
  0 siblings, 2 replies; 7+ messages in thread
From: David Brownell @ 2008-02-25  6:33 UTC (permalink / raw)
  To: Sam Ravnborg; +Cc: nico, netdev

On Sunday 24 February 2008, Sam Ravnborg wrote:

> From a quick look this is wrong.
> smc_drv_probe is assined the .probe member so it is used during
> hotplug and thus should be __devinit.
> Likewise smc_probe is used by smc_drv_probe and thus smc_probe
> should be __devinit too.

Thing is, with only rare exceptions, devices on the platform
bus are *NOT* hotpluggable.  So using __devinit/__devexit and
friends adds up to no more than a waste of I-space.

Nico may know if this driver is one of the rare exceptions.
Example, is it used in PCMCIA cards?

See also platform_driver_probe(), which is a much safer way
to handle such issues.  I've seen it save a full page in some
drivers, but usually it's less.

- Dave

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

* Re: [patch 2.6.25-rc3] smc91x section fix
  2008-02-25  6:33   ` David Brownell
@ 2008-02-25 20:11     ` Sam Ravnborg
  2008-04-19  3:01     ` [RESEND/UPDATED patch 2.6.25] " David Brownell
  1 sibling, 0 replies; 7+ messages in thread
From: Sam Ravnborg @ 2008-02-25 20:11 UTC (permalink / raw)
  To: David Brownell; +Cc: nico, netdev

On Sun, Feb 24, 2008 at 10:33:12PM -0800, David Brownell wrote:
> On Sunday 24 February 2008, Sam Ravnborg wrote:
> 
> > From a quick look this is wrong.
> > smc_drv_probe is assined the .probe member so it is used during
> > hotplug and thus should be __devinit.
> > Likewise smc_probe is used by smc_drv_probe and thus smc_probe
> > should be __devinit too.
> 
> Thing is, with only rare exceptions, devices on the platform
> bus are *NOT* hotpluggable.  So using __devinit/__devexit and
> friends adds up to no more than a waste of I-space.

It was a quick look - thanks for the explanation.

	Sam

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

* [RESEND/UPDATED patch 2.6.25] smc91x section fix
  2008-02-25  6:33   ` David Brownell
  2008-02-25 20:11     ` Sam Ravnborg
@ 2008-04-19  3:01     ` David Brownell
  2008-04-25  6:02       ` Jeff Garzik
  2008-07-25 20:11       ` David Brownell
  1 sibling, 2 replies; 7+ messages in thread
From: David Brownell @ 2008-04-19  3:01 UTC (permalink / raw)
  To: netdev; +Cc: nico

From: David Brownell <dbrownell@users.sourceforge.net>

Section fixup:

  WARNING: drivers/net/built-in.o(.text+0x1a2c): Section mismatch
	in reference from the function smc_drv_probe()
	to the function .init.text:smc_probe()
  The function smc_drv_probe() references
  the function __init smc_probe().
  This is often because smc_drv_probe lacks a __init
  annotation or the annotation of smc_probe is wrong.

Also switch to platform_driver_probe(), and mark exit code as such.
Total footprint shrinkage is about 2KB on ARMv5.

Note that few platform devices are actually hotpluggable, and these
smc devices are evidently not exceptions to that rule ... else there
would have been oopsing in this driver from the smc_probe() problem.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
Changes since earlier version:  use platform_driver_probe(), add
the __exit annotations, not how we can know this driver doesn't
need to use hotplug-supporting "__devinit" annotations.

 drivers/net/smc91x.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- g26.orig/drivers/net/smc91x.c	2008-04-18 19:13:57.000000000 -0700
+++ g26/drivers/net/smc91x.c	2008-04-18 19:15:57.000000000 -0700
@@ -2097,7 +2097,8 @@ static inline void smc_request_datacs(st
 	}
 }
 
-static void smc_release_datacs(struct platform_device *pdev, struct net_device *ndev)
+static void __exit smc_release_datacs(struct platform_device *pdev,
+		struct net_device *ndev)
 {
 	if (SMC_CAN_USE_DATACS) {
 		struct smc_local *lp = netdev_priv(ndev);
@@ -2124,7 +2125,7 @@ static void smc_release_datacs(struct pl
  *	0 --> there is a device
  *	anything else, error
  */
-static int smc_drv_probe(struct platform_device *pdev)
+static int __init smc_drv_probe(struct platform_device *pdev)
 {
 	struct net_device *ndev;
 	struct resource *res, *ires;
@@ -2214,7 +2215,7 @@ static int smc_drv_probe(struct platform
 	return ret;
 }
 
-static int smc_drv_remove(struct platform_device *pdev)
+static int __exit smc_drv_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct smc_local *lp = netdev_priv(ndev);
@@ -2278,8 +2279,7 @@ static int smc_drv_resume(struct platfor
 }
 
 static struct platform_driver smc_driver = {
-	.probe		= smc_drv_probe,
-	.remove		= smc_drv_remove,
+	.remove		= __exit_p(smc_drv_remove),
 	.suspend	= smc_drv_suspend,
 	.resume		= smc_drv_resume,
 	.driver		= {
@@ -2299,7 +2299,7 @@ static int __init smc_init(void)
 #endif
 #endif
 
-	return platform_driver_register(&smc_driver);
+	return platform_driver_probe(&smc_driver, smc_drv_probe);
 }
 
 static void __exit smc_cleanup(void)

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

* Re: [RESEND/UPDATED patch 2.6.25] smc91x section fix
  2008-04-19  3:01     ` [RESEND/UPDATED patch 2.6.25] " David Brownell
@ 2008-04-25  6:02       ` Jeff Garzik
  2008-07-25 20:11       ` David Brownell
  1 sibling, 0 replies; 7+ messages in thread
From: Jeff Garzik @ 2008-04-25  6:02 UTC (permalink / raw)
  To: David Brownell; +Cc: netdev, nico

David Brownell wrote:
> From: David Brownell <dbrownell@users.sourceforge.net>
> 
> Section fixup:
> 
>   WARNING: drivers/net/built-in.o(.text+0x1a2c): Section mismatch
> 	in reference from the function smc_drv_probe()
> 	to the function .init.text:smc_probe()
>   The function smc_drv_probe() references
>   the function __init smc_probe().
>   This is often because smc_drv_probe lacks a __init
>   annotation or the annotation of smc_probe is wrong.
> 
> Also switch to platform_driver_probe(), and mark exit code as such.
> Total footprint shrinkage is about 2KB on ARMv5.
> 
> Note that few platform devices are actually hotpluggable, and these
> smc devices are evidently not exceptions to that rule ... else there
> would have been oopsing in this driver from the smc_probe() problem.
> 
> Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
> ---
> Changes since earlier version:  use platform_driver_probe(), add
> the __exit annotations, not how we can know this driver doesn't
> need to use hotplug-supporting "__devinit" annotations.
> 
>  drivers/net/smc91x.c |   12 ++++++------
>  1 file changed, 6 insertions(+), 6 deletions(-)
> 
> --- g26.orig/drivers/net/smc91x.c	2008-04-18 19:13:57.000000000 -0700
> +++ g26/drivers/net/smc91x.c	2008-04-18 19:15:57.000000000 -0700
> @@ -2097,7 +2097,8 @@ static inline void smc_request_datacs(st
>  	}
>  }
>  
> -static void smc_release_datacs(struct platform_device *pdev, struct net_device *ndev)
> +static void __exit smc_release_datacs(struct platform_device *pdev,
> +		struct net_device *ndev)
>  {
>  	if (SMC_CAN_USE_DATACS) {
>  		struct smc_local *lp = netdev_priv(ndev);
> @@ -2124,7 +2125,7 @@ static void smc_release_datacs(struct pl
>   *	0 --> there is a device
>   *	anything else, error
>   */
> -static int smc_drv_probe(struct platform_device *pdev)
> +static int __init smc_drv_probe(struct platform_device *pdev)
>  {
>  	struct net_device *ndev;
>  	struct resource *res, *ires;
> @@ -2214,7 +2215,7 @@ static int smc_drv_probe(struct platform
>  	return ret;
>  }
>  
> -static int smc_drv_remove(struct platform_device *pdev)
> +static int __exit smc_drv_remove(struct platform_device *pdev)
>  {
>  	struct net_device *ndev = platform_get_drvdata(pdev);
>  	struct smc_local *lp = netdev_priv(ndev);
> @@ -2278,8 +2279,7 @@ static int smc_drv_resume(struct platfor
>  }
>  
>  static struct platform_driver smc_driver = {
> -	.probe		= smc_drv_probe,
> -	.remove		= smc_drv_remove,
> +	.remove		= __exit_p(smc_drv_remove),
>  	.suspend	= smc_drv_suspend,
>  	.resume		= smc_drv_resume,
>  	.driver		= {
> @@ -2299,7 +2299,7 @@ static int __init smc_init(void)
>  #endif
>  #endif
>  
> -	return platform_driver_register(&smc_driver);
> +	return platform_driver_probe(&smc_driver, smc_drv_probe);
>  }
>  
>  static void __exit smc_cleanup(void)
> --

applied



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

* Re: [RESEND/UPDATED patch 2.6.25] smc91x section fix
  2008-04-19  3:01     ` [RESEND/UPDATED patch 2.6.25] " David Brownell
  2008-04-25  6:02       ` Jeff Garzik
@ 2008-07-25 20:11       ` David Brownell
  1 sibling, 0 replies; 7+ messages in thread
From: David Brownell @ 2008-07-25 20:11 UTC (permalink / raw)
  To: netdev; +Cc: Jeff Garzik

From: David Brownell <dbrownell@users.sourceforge.net>

Section fixup:

  WARNING: drivers/net/built-in.o(.text+0x1a2c): Section mismatch
	in reference from the function smc_drv_probe()
	to the function .init.text:smc_probe()
  The function smc_drv_probe() references
  the function __init smc_probe().
  This is often because smc_drv_probe lacks a __init
  annotation or the annotation of smc_probe is wrong.

Also switch to platform_driver_probe(), and mark the exit code as such.
Total footprint shrinkage is about 2KB on ARMv5.

Note that few platform devices are actually hotpluggable, and these
smc devices are evidently not exceptions to that rule ... else there
would have been oopsing in this driver from the smc_probe() problem.

Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
---
I thought this was queued for 2.6.26, or (later) 2.6.27 ...

 drivers/net/smc91x.c |   12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

--- a/drivers/net/smc91x.c	2008-07-24 21:27:38.000000000 -0700
+++ b/drivers/net/smc91x.c	2008-07-24 21:42:15.000000000 -0700
@@ -2096,7 +2096,8 @@ static inline void smc_request_datacs(st
 	}
 }
 
-static void smc_release_datacs(struct platform_device *pdev, struct net_device *ndev)
+static void __exit smc_release_datacs(struct platform_device *pdev,
+		struct net_device *ndev)
 {
 	if (SMC_CAN_USE_DATACS) {
 		struct smc_local *lp = netdev_priv(ndev);
@@ -2123,7 +2124,7 @@ static void smc_release_datacs(struct pl
  *	0 --> there is a device
  *	anything else, error
  */
-static int smc_drv_probe(struct platform_device *pdev)
+static int __init smc_drv_probe(struct platform_device *pdev)
 {
 	struct smc91x_platdata *pd = pdev->dev.platform_data;
 	struct smc_local *lp;
@@ -2232,7 +2233,7 @@ static int smc_drv_probe(struct platform
 	return ret;
 }
 
-static int smc_drv_remove(struct platform_device *pdev)
+static int __exit smc_drv_remove(struct platform_device *pdev)
 {
 	struct net_device *ndev = platform_get_drvdata(pdev);
 	struct smc_local *lp = netdev_priv(ndev);
@@ -2296,8 +2297,7 @@ static int smc_drv_resume(struct platfor
 }
 
 static struct platform_driver smc_driver = {
-	.probe		= smc_drv_probe,
-	.remove		= smc_drv_remove,
+	.remove		= __exit_p(smc_drv_remove),
 	.suspend	= smc_drv_suspend,
 	.resume		= smc_drv_resume,
 	.driver		= {
@@ -2317,7 +2317,7 @@ static int __init smc_init(void)
 #endif
 #endif
 
-	return platform_driver_register(&smc_driver);
+	return platform_driver_probe(&smc_driver, smc_drv_probe);
 }
 
 static void __exit smc_cleanup(void)

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

end of thread, other threads:[~2008-07-25 20:12 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2008-02-25  3:34 [patch 2.6.25-rc3] smc91x section fix David Brownell
2008-02-25  6:02 ` Sam Ravnborg
2008-02-25  6:33   ` David Brownell
2008-02-25 20:11     ` Sam Ravnborg
2008-04-19  3:01     ` [RESEND/UPDATED patch 2.6.25] " David Brownell
2008-04-25  6:02       ` Jeff Garzik
2008-07-25 20:11       ` David Brownell

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.