* [PATCH 0/2] host1x: Convert to bus methods
@ 2025-12-10 8:31 Uwe Kleine-König
2025-12-10 8:31 ` [PATCH 1/2] host1x: Make remove callback return void Uwe Kleine-König
2025-12-10 8:31 ` [PATCH 2/2] host1x: Convert to bus methods Uwe Kleine-König
0 siblings, 2 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2025-12-10 8:31 UTC (permalink / raw)
To: Akhil R, Herbert Xu, David S. Miller, Thierry Reding,
Jonathan Hunter, Mikko Perttunen, David Airlie, Simona Vetter,
Sowjanya Komatineni, Luca Ceresoli, Mauro Carvalho Chehab,
Greg Kroah-Hartman
Cc: linux-crypto, linux-tegra, linux-kernel, dri-devel, linux-media,
linux-staging
Hello,
with the eventual goal to get rid of the callbacks .probe(), .remove()
and .shutdown() in struct device_driver, migrate host1x to use bus
callbacks instead.
Best regards
Uwe
Uwe Kleine-König (2):
host1x: Make remove callback return void
host1x: Convert to bus methods
drivers/crypto/tegra/tegra-se-main.c | 4 +-
drivers/gpu/drm/tegra/drm.c | 4 +-
drivers/gpu/host1x/bus.c | 67 +++++++++++------------
drivers/staging/media/tegra-video/video.c | 4 +-
include/linux/host1x.h | 2 +-
5 files changed, 37 insertions(+), 44 deletions(-)
base-commit: 7d0a66e4bb9081d75c82ec4957c50034cb0ea449
--
2.47.3
^ permalink raw reply [flat|nested] 3+ messages in thread
* [PATCH 1/2] host1x: Make remove callback return void
2025-12-10 8:31 [PATCH 0/2] host1x: Convert to bus methods Uwe Kleine-König
@ 2025-12-10 8:31 ` Uwe Kleine-König
2025-12-10 8:31 ` [PATCH 2/2] host1x: Convert to bus methods Uwe Kleine-König
1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2025-12-10 8:31 UTC (permalink / raw)
To: Akhil R, Herbert Xu, David S. Miller, Thierry Reding,
Jonathan Hunter, Mikko Perttunen, David Airlie, Simona Vetter,
Sowjanya Komatineni, Luca Ceresoli, Mauro Carvalho Chehab,
Greg Kroah-Hartman
Cc: linux-crypto, linux-tegra, linux-kernel, dri-devel, linux-media,
linux-staging
The return value of struct device_driver::remove is ignored by the core
(see device_remove() in drivers/base/dd.c). So it doesn't make sense to
let the host1x remove callback return an int just to ignore it later.
So make the callback return void. All current implementors return 0, so
they are easily converted.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/crypto/tegra/tegra-se-main.c | 4 +---
drivers/gpu/drm/tegra/drm.c | 4 +---
drivers/gpu/host1x/bus.c | 2 +-
drivers/staging/media/tegra-video/video.c | 4 +---
include/linux/host1x.h | 2 +-
5 files changed, 5 insertions(+), 11 deletions(-)
diff --git a/drivers/crypto/tegra/tegra-se-main.c b/drivers/crypto/tegra/tegra-se-main.c
index 7237f14eaf5a..4e7115b247e7 100644
--- a/drivers/crypto/tegra/tegra-se-main.c
+++ b/drivers/crypto/tegra/tegra-se-main.c
@@ -401,11 +401,9 @@ static int tegra_se_host1x_probe(struct host1x_device *dev)
return host1x_device_init(dev);
}
-static int tegra_se_host1x_remove(struct host1x_device *dev)
+static void tegra_se_host1x_remove(struct host1x_device *dev)
{
host1x_device_exit(dev);
-
- return 0;
}
static struct host1x_driver tegra_se_host1x_driver = {
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 4596073fe28f..bd0646eae555 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -1300,7 +1300,7 @@ static int host1x_drm_probe(struct host1x_device *dev)
return err;
}
-static int host1x_drm_remove(struct host1x_device *dev)
+static void host1x_drm_remove(struct host1x_device *dev)
{
struct drm_device *drm = dev_get_drvdata(&dev->dev);
struct tegra_drm *tegra = drm->dev_private;
@@ -1329,8 +1329,6 @@ static int host1x_drm_remove(struct host1x_device *dev)
kfree(tegra);
drm_dev_put(drm);
-
- return 0;
}
static void host1x_drm_shutdown(struct host1x_device *dev)
diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index 344cc9e741c1..fd89512d4488 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -628,7 +628,7 @@ static int host1x_device_remove(struct device *dev)
struct host1x_device *device = to_host1x_device(dev);
if (driver->remove)
- return driver->remove(device);
+ driver->remove(device);
return 0;
}
diff --git a/drivers/staging/media/tegra-video/video.c b/drivers/staging/media/tegra-video/video.c
index 074ad0dc56ca..68783d5ffeb1 100644
--- a/drivers/staging/media/tegra-video/video.c
+++ b/drivers/staging/media/tegra-video/video.c
@@ -107,7 +107,7 @@ static int host1x_video_probe(struct host1x_device *dev)
return ret;
}
-static int host1x_video_remove(struct host1x_device *dev)
+static void host1x_video_remove(struct host1x_device *dev)
{
struct tegra_video_device *vid = dev_get_drvdata(&dev->dev);
@@ -118,8 +118,6 @@ static int host1x_video_remove(struct host1x_device *dev)
/* This calls v4l2_dev release callback on last reference */
v4l2_device_put(&vid->v4l2_dev);
-
- return 0;
}
static const struct of_device_id host1x_video_subdevs[] = {
diff --git a/include/linux/host1x.h b/include/linux/host1x.h
index 9fa9c30a34e6..5e7a63143a4a 100644
--- a/include/linux/host1x.h
+++ b/include/linux/host1x.h
@@ -380,7 +380,7 @@ struct host1x_driver {
struct list_head list;
int (*probe)(struct host1x_device *device);
- int (*remove)(struct host1x_device *device);
+ void (*remove)(struct host1x_device *device);
void (*shutdown)(struct host1x_device *device);
};
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH 2/2] host1x: Convert to bus methods
2025-12-10 8:31 [PATCH 0/2] host1x: Convert to bus methods Uwe Kleine-König
2025-12-10 8:31 ` [PATCH 1/2] host1x: Make remove callback return void Uwe Kleine-König
@ 2025-12-10 8:31 ` Uwe Kleine-König
1 sibling, 0 replies; 3+ messages in thread
From: Uwe Kleine-König @ 2025-12-10 8:31 UTC (permalink / raw)
To: Akhil R, Herbert Xu, David S. Miller, Thierry Reding,
Jonathan Hunter, Mikko Perttunen, David Airlie, Simona Vetter,
Sowjanya Komatineni, Luca Ceresoli, Mauro Carvalho Chehab,
Greg Kroah-Hartman
Cc: linux-crypto, linux-tegra, linux-kernel, dri-devel, linux-media,
linux-staging
The callbacks .probe(), .remove() and .shutdown() for device_drivers
should go away. So migrate to bus methods. There are two differences
that need addressing:
- The bus remove callback returns void while the driver remove callback
returns int (the actual value is ignored by the core).
- The bus shutdown callback is also called for unbound devices, so an
additional check for dev->driver != NULL is needed.
Signed-off-by: Uwe Kleine-König <u.kleine-koenig@baylibre.com>
---
drivers/gpu/host1x/bus.c | 67 ++++++++++++++++++++--------------------
1 file changed, 33 insertions(+), 34 deletions(-)
diff --git a/drivers/gpu/host1x/bus.c b/drivers/gpu/host1x/bus.c
index fd89512d4488..c0d7a9b5f07a 100644
--- a/drivers/gpu/host1x/bus.c
+++ b/drivers/gpu/host1x/bus.c
@@ -346,6 +346,36 @@ static int host1x_device_uevent(const struct device *dev,
return 0;
}
+static int host1x_device_probe(struct device *dev)
+{
+ struct host1x_driver *driver = to_host1x_driver(dev->driver);
+ struct host1x_device *device = to_host1x_device(dev);
+
+ if (driver->probe)
+ return driver->probe(device);
+
+ return 0;
+}
+
+static void host1x_device_remove(struct device *dev)
+{
+ struct host1x_driver *driver = to_host1x_driver(dev->driver);
+ struct host1x_device *device = to_host1x_device(dev);
+
+ if (driver->remove)
+ driver->remove(device);
+}
+
+static void host1x_device_shutdown(struct device *dev)
+{
+ struct host1x_driver *driver = to_host1x_driver(dev->driver);
+ struct host1x_device *device = to_host1x_device(dev);
+
+ if (dev->driver && driver->shutdown)
+ driver->shutdown(device);
+}
+
+
static const struct dev_pm_ops host1x_device_pm_ops = {
.suspend = pm_generic_suspend,
.resume = pm_generic_resume,
@@ -359,6 +389,9 @@ const struct bus_type host1x_bus_type = {
.name = "host1x",
.match = host1x_device_match,
.uevent = host1x_device_uevent,
+ .probe = host1x_device_probe,
+ .remove = host1x_device_remove,
+ .shutdown = host1x_device_shutdown,
.pm = &host1x_device_pm_ops,
};
@@ -611,37 +644,6 @@ int host1x_unregister(struct host1x *host1x)
return 0;
}
-static int host1x_device_probe(struct device *dev)
-{
- struct host1x_driver *driver = to_host1x_driver(dev->driver);
- struct host1x_device *device = to_host1x_device(dev);
-
- if (driver->probe)
- return driver->probe(device);
-
- return 0;
-}
-
-static int host1x_device_remove(struct device *dev)
-{
- struct host1x_driver *driver = to_host1x_driver(dev->driver);
- struct host1x_device *device = to_host1x_device(dev);
-
- if (driver->remove)
- driver->remove(device);
-
- return 0;
-}
-
-static void host1x_device_shutdown(struct device *dev)
-{
- struct host1x_driver *driver = to_host1x_driver(dev->driver);
- struct host1x_device *device = to_host1x_device(dev);
-
- if (driver->shutdown)
- driver->shutdown(device);
-}
-
/**
* host1x_driver_register_full() - register a host1x driver
* @driver: host1x driver
@@ -672,9 +674,6 @@ int host1x_driver_register_full(struct host1x_driver *driver,
driver->driver.bus = &host1x_bus_type;
driver->driver.owner = owner;
- driver->driver.probe = host1x_device_probe;
- driver->driver.remove = host1x_device_remove;
- driver->driver.shutdown = host1x_device_shutdown;
return driver_register(&driver->driver);
}
--
2.47.3
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2025-12-10 8:31 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-12-10 8:31 [PATCH 0/2] host1x: Convert to bus methods Uwe Kleine-König
2025-12-10 8:31 ` [PATCH 1/2] host1x: Make remove callback return void Uwe Kleine-König
2025-12-10 8:31 ` [PATCH 2/2] host1x: Convert to bus methods Uwe Kleine-König
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).