aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi/pxa2xx_spi.c
diff options
context:
space:
mode:
authorDavid Brownell <david-b@pacbell.net>2007-10-16 04:27:46 -0400
committerLinus Torvalds <torvalds@woody.linux-foundation.org>2007-10-16 12:43:09 -0400
commitd1e44d9ce8589cc4ca0596989fe17130817ebec5 (patch)
treed1b3bcfe1804ea1871d5e965a2e3f3fa2efa07fc /drivers/spi/pxa2xx_spi.c
parent86eeb6fe71c79bd0484e17d267034249a6943bd5 (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/pxa2xx_spi.c')
-rw-r--r--drivers/spi/pxa2xx_spi.c11
1 files changed, 4 insertions, 7 deletions
diff --git a/drivers/spi/pxa2xx_spi.c b/drivers/spi/pxa2xx_spi.c
index 16bf66b7c94e..e05918e79eae 100644
--- a/drivers/spi/pxa2xx_spi.c
+++ b/drivers/spi/pxa2xx_spi.c
@@ -1229,7 +1229,7 @@ static void cleanup(struct spi_device *spi)
1229 kfree(chip); 1229 kfree(chip);
1230} 1230}
1231 1231
1232static int init_queue(struct driver_data *drv_data) 1232static int __init init_queue(struct driver_data *drv_data)
1233{ 1233{
1234 INIT_LIST_HEAD(&drv_data->queue); 1234 INIT_LIST_HEAD(&drv_data->queue);
1235 spin_lock_init(&drv_data->lock); 1235 spin_lock_init(&drv_data->lock);
@@ -1317,7 +1317,7 @@ static int destroy_queue(struct driver_data *drv_data)
1317 return 0; 1317 return 0;
1318} 1318}
1319 1319
1320static int pxa2xx_spi_probe(struct platform_device *pdev) 1320static int __init pxa2xx_spi_probe(struct platform_device *pdev)
1321{ 1321{
1322 struct device *dev = &pdev->dev; 1322 struct device *dev = &pdev->dev;
1323 struct pxa2xx_spi_master *platform_info; 1323 struct pxa2xx_spi_master *platform_info;
@@ -1621,8 +1621,7 @@ static struct platform_driver driver = {
1621 .bus = &platform_bus_type, 1621 .bus = &platform_bus_type,
1622 .owner = THIS_MODULE, 1622 .owner = THIS_MODULE,
1623 }, 1623 },
1624 .probe = pxa2xx_spi_probe, 1624 .remove = pxa2xx_spi_remove,
1625 .remove = __devexit_p(pxa2xx_spi_remove),
1626 .shutdown = pxa2xx_spi_shutdown, 1625 .shutdown = pxa2xx_spi_shutdown,
1627 .suspend = pxa2xx_spi_suspend, 1626 .suspend = pxa2xx_spi_suspend,
1628 .resume = pxa2xx_spi_resume, 1627 .resume = pxa2xx_spi_resume,
@@ -1630,9 +1629,7 @@ static struct platform_driver driver = {
1630 1629
1631static int __init pxa2xx_spi_init(void) 1630static int __init pxa2xx_spi_init(void)
1632{ 1631{
1633 platform_driver_register(&driver); 1632 return platform_driver_probe(&driver, pxa2xx_spi_probe);
1634
1635 return 0;
1636} 1633}
1637module_init(pxa2xx_spi_init); 1634module_init(pxa2xx_spi_init);
1638 1635