smc91x section fix
Subsystems (2)
PATCH 1/1 smc91x section fix
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.
--- drivers/net/smc91x.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/net/smc91x.c +1 -1
@@ -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;
Quoted 27 lines · David Brownell
Section fixup:
WARNING: drivers/net/built-in.o(.text+0x1a2c): Section mismatch
in reference from the functionsmc_drv_probe()to the function .init.text:smc_probe()
The functionsmc_drv_probe()references
the function__initsmc_probe().
This is often becausesmc_drv_probelacks a__initannotation or the annotation ofsmc_probeis wrong.Signed-off-by David Brownell <[email protected]>--- drivers/net/smc91x.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)drivers/net/smc91x.c +1
-1@@ -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;
Quoted 1 line
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
drivers/net/smc91x.c +2 -2
@@ -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;
Quoted 5 lines · Sam Ravnborg
From a quick look this is wrong.
smc_drv_probeis assined the .probe member so it is used during hotplug and thus should be__devinit.
Likewisesmc_probeis used bysmc_drv_probeand thussmc_probeshould be__devinittoo.
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
Quoted 11 lines · David Brownell
Quoted 5 lines · Sam Ravnborg
From a quick look this is wrong.
smc_drv_probeis assined the .probe member so it is used during hotplug and thus should be__devinit.
Likewisesmc_probeis used bysmc_drv_probeand thussmc_probeshould be__devinittoo.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
PATCH 1/1 smc91x section fix
In reply to David BrownellFrom: David Brownell <[email protected]>
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.
---
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(-)
drivers/net/smc91x.c +6 -6
@@ -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 platformreturn 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)
Jeff Garzik
AppliedQuoted 69 lines · David Brownell
From: David Brownell <[email protected]>
Section fixup:
WARNING: drivers/net/built-in.o(.text+0x1a2c): Section mismatch
in reference from the functionsmc_drv_probe()to the function .init.text:smc_probe()
The functionsmc_drv_probe()references
the function__initsmc_probe().
This is often becausesmc_drv_probelacks a__initannotation or the annotation ofsmc_probeis 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 <[email protected]>---
Changes since earlier version: useplatform_driver_probe(), add the__exitannotations, 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(-)drivers/net/smc91x.c +5
-5@@ -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 platformreturn 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 = {
drivers/net/smc91x.c static int __init smc_init(void)
Quoted 9 lines
drivers/net/smc91x.c +1
-2@@ -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
From: David Brownell <[email protected]>
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.
---
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(-)
drivers/net/smc91x.c +6 -6
@@ -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 platformreturn 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)