Commit 0b2771dd authored by Uwe Kleine-König's avatar Uwe Kleine-König Committed by Damien Le Moal

ata: pata_gayle: Stop using module_platform_driver_probe()

On today's platforms the benefit of platform_driver_probe() isn't that
relevant any more. It allows to drop some code after booting (or module
loading) for .probe() and discard the .remove() function completely if
the driver is built-in. This typically saves a few 100k.

The downside of platform_driver_probe() is that the driver cannot be
bound and unbound at runtime which is ancient and so slightly
complicates testing. There are also thoughts to deprecate
platform_driver_probe() because it adds some complexity in the driver
core for little gain. Also many drivers don't use it correctly. This
driver for example misses to mark the driver struct with __ref which is
needed to suppress a (W=1) modpost warning.
Signed-off-by: default avatarUwe Kleine-König <u.kleine-koenig@pengutronix.de>
Reviewed-by: default avatarSergey Shtylyov <s.shtylyov@omp.ru>
Reviewed-by: default avatarNiklas Cassel <niklas.cassel@wdc.com>
Signed-off-by: default avatarDamien Le Moal <dlemoal@kernel.org>
parent 36f10a91
...@@ -124,7 +124,7 @@ static struct ata_port_operations pata_gayle_a4000_ops = { ...@@ -124,7 +124,7 @@ static struct ata_port_operations pata_gayle_a4000_ops = {
.set_mode = pata_gayle_set_mode, .set_mode = pata_gayle_set_mode,
}; };
static int __init pata_gayle_init_one(struct platform_device *pdev) static int pata_gayle_init_one(struct platform_device *pdev)
{ {
struct resource *res; struct resource *res;
struct gayle_ide_platform_data *pdata; struct gayle_ide_platform_data *pdata;
...@@ -193,7 +193,7 @@ static int __init pata_gayle_init_one(struct platform_device *pdev) ...@@ -193,7 +193,7 @@ static int __init pata_gayle_init_one(struct platform_device *pdev)
return 0; return 0;
} }
static int __exit pata_gayle_remove_one(struct platform_device *pdev) static int pata_gayle_remove_one(struct platform_device *pdev)
{ {
struct ata_host *host = platform_get_drvdata(pdev); struct ata_host *host = platform_get_drvdata(pdev);
...@@ -203,13 +203,14 @@ static int __exit pata_gayle_remove_one(struct platform_device *pdev) ...@@ -203,13 +203,14 @@ static int __exit pata_gayle_remove_one(struct platform_device *pdev)
} }
static struct platform_driver pata_gayle_driver = { static struct platform_driver pata_gayle_driver = {
.remove = __exit_p(pata_gayle_remove_one), .probe = pata_gayle_init_one,
.remove = pata_gayle_remove_one,
.driver = { .driver = {
.name = "amiga-gayle-ide", .name = "amiga-gayle-ide",
}, },
}; };
module_platform_driver_probe(pata_gayle_driver, pata_gayle_init_one); module_platform_driver(pata_gayle_driver);
MODULE_AUTHOR("Bartlomiej Zolnierkiewicz"); MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
MODULE_DESCRIPTION("low-level driver for Amiga Gayle PATA"); MODULE_DESCRIPTION("low-level driver for Amiga Gayle PATA");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment