Skip to content

Commit 0b2771d

Browse files
Uwe Kleine-Königdamien-lemoal
authored andcommitted
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: Uwe Kleine-König <u.kleine-koenig@pengutronix.de> Reviewed-by: Sergey Shtylyov <s.shtylyov@omp.ru> Reviewed-by: Niklas Cassel <niklas.cassel@wdc.com> Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
1 parent 36f10a9 commit 0b2771d

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

drivers/ata/pata_gayle.c

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static struct ata_port_operations pata_gayle_a4000_ops = {
124124
.set_mode = pata_gayle_set_mode,
125125
};
126126

127-
static int __init pata_gayle_init_one(struct platform_device *pdev)
127+
static int pata_gayle_init_one(struct platform_device *pdev)
128128
{
129129
struct resource *res;
130130
struct gayle_ide_platform_data *pdata;
@@ -193,7 +193,7 @@ static int __init pata_gayle_init_one(struct platform_device *pdev)
193193
return 0;
194194
}
195195

196-
static int __exit pata_gayle_remove_one(struct platform_device *pdev)
196+
static int pata_gayle_remove_one(struct platform_device *pdev)
197197
{
198198
struct ata_host *host = platform_get_drvdata(pdev);
199199

@@ -203,13 +203,14 @@ static int __exit pata_gayle_remove_one(struct platform_device *pdev)
203203
}
204204

205205
static struct platform_driver pata_gayle_driver = {
206-
.remove = __exit_p(pata_gayle_remove_one),
206+
.probe = pata_gayle_init_one,
207+
.remove = pata_gayle_remove_one,
207208
.driver = {
208209
.name = "amiga-gayle-ide",
209210
},
210211
};
211212

212-
module_platform_driver_probe(pata_gayle_driver, pata_gayle_init_one);
213+
module_platform_driver(pata_gayle_driver);
213214

214215
MODULE_AUTHOR("Bartlomiej Zolnierkiewicz");
215216
MODULE_DESCRIPTION("low-level driver for Amiga Gayle PATA");

0 commit comments

Comments
 (0)