aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/spi
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
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')
-rw-r--r--drivers/spi/omap_uwire.c9
-rw-r--r--drivers/spi/pxa2xx_spi.c11
-rw-r--r--drivers/spi/spi_imx.c11
-rw-r--r--drivers/spi/spi_mpc83xx.c7
-rw-r--r--drivers/spi/spi_s3c24xx.c9
5 files changed, 20 insertions, 27 deletions
diff --git a/drivers/spi/omap_uwire.c b/drivers/spi/omap_uwire.c
index d275c615a73e..8245b5153f30 100644
--- a/drivers/spi/omap_uwire.c
+++ b/drivers/spi/omap_uwire.c
@@ -481,7 +481,7 @@ static void uwire_off(struct uwire_spi *uwire)
481 spi_master_put(uwire->bitbang.master); 481 spi_master_put(uwire->bitbang.master);
482} 482}
483 483
484static int uwire_probe(struct platform_device *pdev) 484static int __init uwire_probe(struct platform_device *pdev)
485{ 485{
486 struct spi_master *master; 486 struct spi_master *master;
487 struct uwire_spi *uwire; 487 struct uwire_spi *uwire;
@@ -525,7 +525,7 @@ static int uwire_probe(struct platform_device *pdev)
525 return status; 525 return status;
526} 526}
527 527
528static int uwire_remove(struct platform_device *pdev) 528static int __exit uwire_remove(struct platform_device *pdev)
529{ 529{
530 struct uwire_spi *uwire = dev_get_drvdata(&pdev->dev); 530 struct uwire_spi *uwire = dev_get_drvdata(&pdev->dev);
531 int status; 531 int status;
@@ -543,8 +543,7 @@ static struct platform_driver uwire_driver = {
543 .bus = &platform_bus_type, 543 .bus = &platform_bus_type,
544 .owner = THIS_MODULE, 544 .owner = THIS_MODULE,
545 }, 545 },
546 .probe = uwire_probe, 546 .remove = __exit_p(uwire_remove),
547 .remove = uwire_remove,
548 // suspend ... unuse ck 547 // suspend ... unuse ck
549 // resume ... use ck 548 // resume ... use ck
550}; 549};
@@ -566,7 +565,7 @@ static int __init omap_uwire_init(void)
566 omap_writel(val | 0x00AAA000, OMAP730_IO_CONF_9); 565 omap_writel(val | 0x00AAA000, OMAP730_IO_CONF_9);
567 } 566 }
568 567
569 return platform_driver_register(&uwire_driver); 568 return platform_driver_probe(&uwire_driver, uwire_probe);
570} 569}
571 570
572static void __exit omap_uwire_exit(void) 571static void __exit omap_uwire_exit(void)
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
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
1364static int init_queue(struct driver_data *drv_data) 1364static 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
1447static int spi_imx_probe(struct platform_device *pdev) 1447static 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
1625static int __devexit spi_imx_remove(struct platform_device *pdev) 1625static 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
1749static int __init spi_imx_init(void) 1748static 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}
1753module_init(spi_imx_init); 1752module_init(spi_imx_init);
1754 1753
diff --git a/drivers/spi/spi_mpc83xx.c b/drivers/spi/spi_mpc83xx.c
index 32cda77b31cd..4580b9cf625d 100644
--- a/drivers/spi/spi_mpc83xx.c
+++ b/drivers/spi/spi_mpc83xx.c
@@ -511,7 +511,7 @@ err:
511 return ret; 511 return ret;
512} 512}
513 513
514static int __devexit mpc83xx_spi_remove(struct platform_device *dev) 514static int __exit mpc83xx_spi_remove(struct platform_device *dev)
515{ 515{
516 struct mpc83xx_spi *mpc83xx_spi; 516 struct mpc83xx_spi *mpc83xx_spi;
517 struct spi_master *master; 517 struct spi_master *master;
@@ -529,8 +529,7 @@ static int __devexit mpc83xx_spi_remove(struct platform_device *dev)
529 529
530MODULE_ALIAS("mpc83xx_spi"); /* for platform bus hotplug */ 530MODULE_ALIAS("mpc83xx_spi"); /* for platform bus hotplug */
531static struct platform_driver mpc83xx_spi_driver = { 531static struct platform_driver mpc83xx_spi_driver = {
532 .probe = mpc83xx_spi_probe, 532 .remove = __exit_p(mpc83xx_spi_remove),
533 .remove = __devexit_p(mpc83xx_spi_remove),
534 .driver = { 533 .driver = {
535 .name = "mpc83xx_spi", 534 .name = "mpc83xx_spi",
536 }, 535 },
@@ -538,7 +537,7 @@ static struct platform_driver mpc83xx_spi_driver = {
538 537
539static int __init mpc83xx_spi_init(void) 538static int __init mpc83xx_spi_init(void)
540{ 539{
541 return platform_driver_register(&mpc83xx_spi_driver); 540 return platform_driver_probe(&mpc83xx_spi_driver, mpc83xx_spi_probe);
542} 541}
543 542
544static void __exit mpc83xx_spi_exit(void) 543static void __exit mpc83xx_spi_exit(void)
diff --git a/drivers/spi/spi_s3c24xx.c b/drivers/spi/spi_s3c24xx.c
index e9b683f7d7b3..89d6685a5ca4 100644
--- a/drivers/spi/spi_s3c24xx.c
+++ b/drivers/spi/spi_s3c24xx.c
@@ -233,7 +233,7 @@ static irqreturn_t s3c24xx_spi_irq(int irq, void *dev)
233 return IRQ_HANDLED; 233 return IRQ_HANDLED;
234} 234}
235 235
236static int s3c24xx_spi_probe(struct platform_device *pdev) 236static int __init s3c24xx_spi_probe(struct platform_device *pdev)
237{ 237{
238 struct s3c24xx_spi *hw; 238 struct s3c24xx_spi *hw;
239 struct spi_master *master; 239 struct spi_master *master;
@@ -382,7 +382,7 @@ static int s3c24xx_spi_probe(struct platform_device *pdev)
382 return err; 382 return err;
383} 383}
384 384
385static int s3c24xx_spi_remove(struct platform_device *dev) 385static int __exit s3c24xx_spi_remove(struct platform_device *dev)
386{ 386{
387 struct s3c24xx_spi *hw = platform_get_drvdata(dev); 387 struct s3c24xx_spi *hw = platform_get_drvdata(dev);
388 388
@@ -429,8 +429,7 @@ static int s3c24xx_spi_resume(struct platform_device *pdev)
429 429
430MODULE_ALIAS("s3c2410_spi"); /* for platform bus hotplug */ 430MODULE_ALIAS("s3c2410_spi"); /* for platform bus hotplug */
431static struct platform_driver s3c24xx_spidrv = { 431static struct platform_driver s3c24xx_spidrv = {
432 .probe = s3c24xx_spi_probe, 432 .remove = __exit_p(s3c24xx_spi_remove),
433 .remove = s3c24xx_spi_remove,
434 .suspend = s3c24xx_spi_suspend, 433 .suspend = s3c24xx_spi_suspend,
435 .resume = s3c24xx_spi_resume, 434 .resume = s3c24xx_spi_resume,
436 .driver = { 435 .driver = {
@@ -441,7 +440,7 @@ static struct platform_driver s3c24xx_spidrv = {
441 440
442static int __init s3c24xx_spi_init(void) 441static int __init s3c24xx_spi_init(void)
443{ 442{
444 return platform_driver_register(&s3c24xx_spidrv); 443 return platform_driver_probe(&s3c24xx_spidrv, s3c24xx_spi_probe);
445} 444}
446 445
447static void __exit s3c24xx_spi_exit(void) 446static void __exit s3c24xx_spi_exit(void)