mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: barebox@lists.infradead.org
Cc: ske@pengutronix.de, Ahmad Fatoum <a.fatoum@pengutronix.de>
Subject: [PATCH 2/3] drivers: drop simple bus remove in favor of common implementation
Date: Thu, 15 Feb 2024 11:33:52 +0100	[thread overview]
Message-ID: <20240215103353.2799723-2-a.fatoum@pengutronix.de> (raw)
In-Reply-To: <20240215103353.2799723-1-a.fatoum@pengutronix.de>

Now that driver core will call dev->driver->remove if dev->bus->remove
is NULL, we cann remove all bus_type::remove functions that do the same.

This has the welcome side effect that devices that device_remove will
return false when called on a device the neither has a bus remove or
driver remove function and thus we can skip tracing these calls when
CONFIG_DEBUG_PROBES is enabled.

Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
---
 drivers/base/platform.c | 7 -------
 drivers/bus/acpi.c      | 7 -------
 drivers/i2c/i2c.c       | 7 -------
 drivers/spi/spi.c       | 7 -------
 drivers/tee/tee_core.c  | 7 -------
 5 files changed, 35 deletions(-)

diff --git a/drivers/base/platform.c b/drivers/base/platform.c
index f9954785608b..ac7c473c8c7b 100644
--- a/drivers/base/platform.c
+++ b/drivers/base/platform.c
@@ -22,12 +22,6 @@ static int platform_probe(struct device *dev)
 	return dev->driver->probe(dev);
 }
 
-static void platform_remove(struct device *dev)
-{
-	if (dev->driver->remove)
-		dev->driver->remove(dev);
-}
-
 int platform_driver_register(struct driver *drv)
 {
 	drv->bus = &platform_bus;
@@ -46,7 +40,6 @@ struct bus_type platform_bus = {
 	.name = "platform",
 	.match = device_match,
 	.probe = platform_probe,
-	.remove = platform_remove,
 };
 
 static int platform_init(void)
diff --git a/drivers/bus/acpi.c b/drivers/bus/acpi.c
index ac034cce4569..cf85e886d0a2 100644
--- a/drivers/bus/acpi.c
+++ b/drivers/bus/acpi.c
@@ -210,17 +210,10 @@ static int acpi_bus_probe(struct device *dev)
 	return dev->driver->probe(dev);
 }
 
-static void acpi_bus_remove(struct device *dev)
-{
-	if (dev->driver->remove)
-		dev->driver->remove(dev);
-}
-
 struct bus_type acpi_bus = {
 	.name = "acpi",
 	.match = acpi_bus_match,
 	.probe = acpi_bus_probe,
-	.remove = acpi_bus_remove,
 };
 
 static int efi_acpi_probe(void)
diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
index 70d1b810c1c3..d518bf2c9dcf 100644
--- a/drivers/i2c/i2c.c
+++ b/drivers/i2c/i2c.c
@@ -748,17 +748,10 @@ static int i2c_probe(struct device *dev)
 	return dev->driver->probe(dev);
 }
 
-static void i2c_remove(struct device *dev)
-{
-	if (dev->driver->remove)
-		dev->driver->remove(dev);
-}
-
 struct bus_type i2c_bus = {
 	.name = "i2c",
 	.match = device_match_of_modalias,
 	.probe = i2c_probe,
-	.remove = i2c_remove,
 };
 
 static int i2c_bus_init(void)
diff --git a/drivers/spi/spi.c b/drivers/spi/spi.c
index 83f2b0ee1b2e..fd9c8da17100 100644
--- a/drivers/spi/spi.c
+++ b/drivers/spi/spi.c
@@ -417,17 +417,10 @@ static int spi_probe(struct device *dev)
 	return dev->driver->probe(dev);
 }
 
-static void spi_remove(struct device *dev)
-{
-	if (dev->driver->remove)
-		dev->driver->remove(dev);
-}
-
 struct bus_type spi_bus = {
 	.name = "spi",
 	.match = device_match_of_modalias,
 	.probe = spi_probe,
-	.remove = spi_remove,
 };
 
 static int spi_bus_init(void)
diff --git a/drivers/tee/tee_core.c b/drivers/tee/tee_core.c
index 0bf645a310eb..36c6210b8b1d 100644
--- a/drivers/tee/tee_core.c
+++ b/drivers/tee/tee_core.c
@@ -775,17 +775,10 @@ static int tee_bus_probe(struct device *dev)
 	return dev->driver->probe(dev);
 }
 
-static void tee_bus_remove(struct device *dev)
-{
-	if (dev->driver->remove)
-		dev->driver->remove(dev);
-}
-
 struct bus_type tee_bus_type = {
 	.name		= "tee",
 	.match		= tee_client_device_match,
 	.probe		= tee_bus_probe,
-	.remove		= tee_bus_remove,
 };
 EXPORT_SYMBOL_GPL(tee_bus_type);
 
-- 
2.39.2




  reply	other threads:[~2024-02-15 10:36 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-02-15 10:33 [PATCH 1/3] driver: make CONFIG_DEBUG_PROBES more useful for removal Ahmad Fatoum
2024-02-15 10:33 ` Ahmad Fatoum [this message]
2024-02-15 10:33 ` [PATCH 3/3] firmware: arm_scmi: call device driver remove if defined Ahmad Fatoum
2024-02-16 11:59 ` [PATCH 1/3] driver: make CONFIG_DEBUG_PROBES more useful for removal Sascha Hauer

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=20240215103353.2799723-2-a.fatoum@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=ske@pengutronix.de \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox