From d1e44d9ce8589cc4ca0596989fe17130817ebec5 Mon Sep 17 00:00:00 2001 From: David Brownell Date: Tue, 16 Oct 2007 01:27:46 -0700 Subject: 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 Signed-off-by: Andrew Morton Signed-off-by: Linus Torvalds --- drivers/spi/spi_imx.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) (limited to 'drivers/spi/spi_imx.c') diff --git a/drivers/spi/spi_imx.c b/drivers/spi/spi_imx.c index bd9177f51de..0f0c5c11c79 100644 --- a/drivers/spi/spi_imx.c +++ b/drivers/spi/spi_imx.c @@ -1361,7 +1361,7 @@ static void cleanup(struct spi_device *spi) kfree(spi_get_ctldata(spi)); } -static int init_queue(struct driver_data *drv_data) +static int __init init_queue(struct driver_data *drv_data) { INIT_LIST_HEAD(&drv_data->queue); spin_lock_init(&drv_data->lock); @@ -1444,7 +1444,7 @@ static int destroy_queue(struct driver_data *drv_data) return 0; } -static int spi_imx_probe(struct platform_device *pdev) +static int __init spi_imx_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct spi_imx_master *platform_info; @@ -1622,7 +1622,7 @@ err_no_mem: return status; } -static int __devexit spi_imx_remove(struct platform_device *pdev) +static int __exit spi_imx_remove(struct platform_device *pdev) { struct driver_data *drv_data = platform_get_drvdata(pdev); int irq; @@ -1739,8 +1739,7 @@ static struct platform_driver driver = { .bus = &platform_bus_type, .owner = THIS_MODULE, }, - .probe = spi_imx_probe, - .remove = __devexit_p(spi_imx_remove), + .remove = __exit_p(spi_imx_remove), .shutdown = spi_imx_shutdown, .suspend = spi_imx_suspend, .resume = spi_imx_resume, @@ -1748,7 +1747,7 @@ static struct platform_driver driver = { static int __init spi_imx_init(void) { - return platform_driver_register(&driver); + return platform_driver_probe(&driver, spi_imx_probe); } module_init(spi_imx_init); -- cgit v1.2.3