[PATCH 2/3] drivers: drop simple bus remove in favor of common implementation
Ahmad Fatoum
a.fatoum at pengutronix.de
Thu Feb 15 02:33:52 PST 2024
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 at 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
More information about the barebox
mailing list