diff options
author | David Brownell <david-b@pacbell.net> | 2007-10-16 04:27:46 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@woody.linux-foundation.org> | 2007-10-16 12:43:09 -0400 |
commit | d1e44d9ce8589cc4ca0596989fe17130817ebec5 (patch) | |
tree | d1b3bcfe1804ea1871d5e965a2e3f3fa2efa07fc /drivers/spi/spi_imx.c | |
parent | 86eeb6fe71c79bd0484e17d267034249a6943bd5 (diff) |
SPI driver runtime footprint shrinkage
Shrink the runtime footprint of various SPI drivers:
- Move the probe() routine into the init section where practical,
using platform_driver_probe() to make that safe. This often saves
around 1KB. Using platform_driver_probe() can also be a correctness
fix, if the probe routine is already marked __init but the driver
struct keeps a dangling pointer to it after init section removal.
- Likewise move remove() routines into the exit sections.
These changes would be inappropriate iff the platform devices were
actually hotpluggable (e.g. they're found on optional addon cards,
or in an FPGA that's dynamically reprogrammed). In these cases,
that's not the situation; it's an SOC controller and the only device
is initialized before these drivers.
Signed-off-by: David Brownell <dbrownell@users.sourceforge.net>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/spi/spi_imx.c')
-rw-r--r-- | drivers/spi/spi_imx.c | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index bd9177f51de9..0f0c5c11c79f 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c | |||
@@ -1361,7 +1361,7 @@ static void cleanup(struct spi_device *spi) | |||
1361 | kfree(spi_get_ctldata(spi)); | 1361 | kfree(spi_get_ctldata(spi)); |
1362 | } | 1362 | } |
1363 | 1363 | ||
1364 | static int init_queue(struct driver_data *drv_data) | 1364 | static int __init init_queue(struct driver_data *drv_data) |
1365 | { | 1365 | { |
1366 | INIT_LIST_HEAD(&drv_data->queue); | 1366 | INIT_LIST_HEAD(&drv_data->queue); |
1367 | spin_lock_init(&drv_data->lock); | 1367 | spin_lock_init(&drv_data->lock); |
@@ -1444,7 +1444,7 @@ static int destroy_queue(struct driver_data *drv_data) | |||
1444 | return 0; | 1444 | return 0; |
1445 | } | 1445 | } |
1446 | 1446 | ||
1447 | static int spi_imx_probe(struct platform_device *pdev) | 1447 | static int __init spi_imx_probe(struct platform_device *pdev) |
1448 | { | 1448 | { |
1449 | struct device *dev = &pdev->dev; | 1449 | struct device *dev = &pdev->dev; |
1450 | struct spi_imx_master *platform_info; | 1450 | struct spi_imx_master *platform_info; |
@@ -1622,7 +1622,7 @@ err_no_mem: | |||
1622 | return status; | 1622 | return status; |
1623 | } | 1623 | } |
1624 | 1624 | ||
1625 | static int __devexit spi_imx_remove(struct platform_device *pdev) | 1625 | static int __exit spi_imx_remove(struct platform_device *pdev) |
1626 | { | 1626 | { |
1627 | struct driver_data *drv_data = platform_get_drvdata(pdev); | 1627 | struct driver_data *drv_data = platform_get_drvdata(pdev); |
1628 | int irq; | 1628 | int irq; |
@@ -1739,8 +1739,7 @@ static struct platform_driver driver = { | |||
1739 | .bus = &platform_bus_type, | 1739 | .bus = &platform_bus_type, |
1740 | .owner = THIS_MODULE, | 1740 | .owner = THIS_MODULE, |
1741 | }, | 1741 | }, |
1742 | .probe = spi_imx_probe, | 1742 | .remove = __exit_p(spi_imx_remove), |
1743 | .remove = __devexit_p(spi_imx_remove), | ||
1744 | .shutdown = spi_imx_shutdown, | 1743 | .shutdown = spi_imx_shutdown, |
1745 | .suspend = spi_imx_suspend, | 1744 | .suspend = spi_imx_suspend, |
1746 | .resume = spi_imx_resume, | 1745 | .resume = spi_imx_resume, |
@@ -1748,7 +1747,7 @@ static struct platform_driver driver = { | |||
1748 | 1747 | ||
1749 | static int __init spi_imx_init(void) | 1748 | static int __init spi_imx_init(void) |
1750 | { | 1749 | { |
1751 | return platform_driver_register(&driver); | 1750 | return platform_driver_probe(&driver, spi_imx_probe); |
1752 | } | 1751 | } |
1753 | module_init(spi_imx_init); | 1752 | module_init(spi_imx_init); |
1754 | 1753 | ||