All of lore.kernel.org
 help / color / mirror / Atom feed
From: "Uwe Kleine-König" <u.kleine-koenig@pengutronix.de>
To: Damien Le Moal <dlemoal@kernel.org>
Cc: Sergey Shtylyov <s.shtylyov@omp.ru>,
	linux-ide@vger.kernel.org, kernel@pengutronix.de,
	linux-kbuild@vger.kernel.org
Subject: [PATCH 2/4] ata: pata_gayle: Stop using module_platform_driver_probe()
Date: Sun,  5 Nov 2023 16:00:37 +0100	[thread overview]
Message-ID: <20231105150037.3724669-8-u.kleine-koenig@pengutronix.de> (raw)
In-Reply-To: <20231105150037.3724669-6-u.kleine-koenig@pengutronix.de>

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>
---
 drivers/ata/pata_gayle.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/ata/pata_gayle.c b/drivers/ata/pata_gayle.c
index 3bdbe2b65a2b..e10411b02047 100644
--- a/drivers/ata/pata_gayle.c
+++ b/drivers/ata/pata_gayle.c
@@ -124,7 +124,7 @@ static struct ata_port_operations pata_gayle_a4000_ops = {
 	.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 gayle_ide_platform_data *pdata;
@@ -193,7 +193,7 @@ static int __init pata_gayle_init_one(struct platform_device *pdev)
 	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);
 
@@ -203,13 +203,14 @@ static int __exit pata_gayle_remove_one(struct platform_device *pdev)
 }
 
 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   = {
 		.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_DESCRIPTION("low-level driver for Amiga Gayle PATA");
-- 
2.42.0


  parent reply	other threads:[~2023-11-05 15:01 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-05 15:00 [PATCH 0/4] ata: Drop platform_driver_probe() and convert to platform remove callback returning void (part II) Uwe Kleine-König
2023-11-05 15:00 ` [PATCH 1/4] ata: pata_falcon: Stop using module_platform_driver_probe() Uwe Kleine-König
2023-11-06  9:55   ` Sergey Shtylyov
2023-11-05 15:00 ` Uwe Kleine-König [this message]
2023-11-06  9:55   ` [PATCH 2/4] ata: pata_gayle: " Sergey Shtylyov
2023-11-05 15:00 ` [PATCH 3/4] ata: pata_falcon: Convert to platform remove callback returning void Uwe Kleine-König
2023-11-06  9:56   ` Sergey Shtylyov
2023-11-05 15:00 ` [PATCH 4/4] ata: pata_gayle: " Uwe Kleine-König
2023-11-06  9:57   ` Sergey Shtylyov
2023-11-07 10:32 ` [PATCH 0/4] ata: Drop platform_driver_probe() and convert to platform remove callback returning void (part II) Niklas Cassel
2023-11-08  1:10 ` Damien Le Moal

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20231105150037.3724669-8-u.kleine-koenig@pengutronix.de \
    --to=u.kleine-koenig@pengutronix.de \
    --cc=dlemoal@kernel.org \
    --cc=kernel@pengutronix.de \
    --cc=linux-ide@vger.kernel.org \
    --cc=linux-kbuild@vger.kernel.org \
    --cc=s.shtylyov@omp.ru \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.