netdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] macb: Fix section mismatch and shrink runtime footprint
@ 2008-01-31 12:10 Haavard Skinnemoen
  2008-02-01 18:40 ` Jeff Garzik
  0 siblings, 1 reply; 2+ messages in thread
From: Haavard Skinnemoen @ 2008-01-31 12:10 UTC (permalink / raw)
  To: Jeff Garzik; +Cc: netdev, David Brownell, Haavard Skinnemoen

macb devices are only found integrated on SoCs, so they can't be
hotplugged. Thus, the probe() and exit() functions can be __init and
__exit, respectively. By using platform_driver_probe() instead of
platform_driver_register(), there won't be any references to the
discarded probe() function after the driver has loaded.

This also fixes a section mismatch due to macb_probe(), defined as
__devinit, calling macb_get_hwaddr, defined as __init.

Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
---
 drivers/net/macb.c |    9 ++++-----
 1 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/drivers/net/macb.c b/drivers/net/macb.c
index e10528e..81bf005 100644
--- a/drivers/net/macb.c
+++ b/drivers/net/macb.c
@@ -1084,7 +1084,7 @@ static int macb_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
 	return phy_mii_ioctl(phydev, if_mii(rq), cmd);
 }
 
-static int __devinit macb_probe(struct platform_device *pdev)
+static int __init macb_probe(struct platform_device *pdev)
 {
 	struct eth_platform_data *pdata;
 	struct resource *regs;
@@ -1248,7 +1248,7 @@ err_out:
 	return err;
 }
 
-static int __devexit macb_remove(struct platform_device *pdev)
+static int __exit macb_remove(struct platform_device *pdev)
 {
 	struct net_device *dev;
 	struct macb *bp;
@@ -1276,8 +1276,7 @@ static int __devexit macb_remove(struct platform_device *pdev)
 }
 
 static struct platform_driver macb_driver = {
-	.probe		= macb_probe,
-	.remove		= __devexit_p(macb_remove),
+	.remove		= __exit_p(macb_remove),
 	.driver		= {
 		.name		= "macb",
 	},
@@ -1285,7 +1284,7 @@ static struct platform_driver macb_driver = {
 
 static int __init macb_init(void)
 {
-	return platform_driver_register(&macb_driver);
+	return platform_driver_probe(&macb_driver, macb_probe);
 }
 
 static void __exit macb_exit(void)
-- 
1.5.3.8


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

* Re: [PATCH] macb: Fix section mismatch and shrink runtime footprint
  2008-01-31 12:10 [PATCH] macb: Fix section mismatch and shrink runtime footprint Haavard Skinnemoen
@ 2008-02-01 18:40 ` Jeff Garzik
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Garzik @ 2008-02-01 18:40 UTC (permalink / raw)
  To: Haavard Skinnemoen; +Cc: netdev, David Brownell

Haavard Skinnemoen wrote:
> macb devices are only found integrated on SoCs, so they can't be
> hotplugged. Thus, the probe() and exit() functions can be __init and
> __exit, respectively. By using platform_driver_probe() instead of
> platform_driver_register(), there won't be any references to the
> discarded probe() function after the driver has loaded.
> 
> This also fixes a section mismatch due to macb_probe(), defined as
> __devinit, calling macb_get_hwaddr, defined as __init.
> 
> Signed-off-by: Haavard Skinnemoen <hskinnemoen@atmel.com>
> ---
>  drivers/net/macb.c |    9 ++++-----
>  1 files changed, 4 insertions(+), 5 deletions(-)

applied



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

end of thread, other threads:[~2008-02-01 18:40 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2008-01-31 12:10 [PATCH] macb: Fix section mismatch and shrink runtime footprint Haavard Skinnemoen
2008-02-01 18:40 ` Jeff Garzik

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).