[PATCH v2 2/6] platform/raspberrypi: vchiq: Store audio device in driver management struct
Jai Luthra
jai.luthra at ideasonboard.com
Mon Jan 5 00:56:48 PST 2026
The VCHIQ firmware devices are not discoverable, so they must be tracked
manually by the driver. Previously, the bcm2835 audio device was stored
in a static global pointer.
Move the audio device pointer into struct vchiq_drv_mgmt instead, so it
is properly associated with the driver instance and lifecycle. This
avoids global state and makes device registration and removal follow the
platform device more cleanly.
No functional change intended.
Signed-off-by: Jai Luthra <jai.luthra at ideasonboard.com>
---
drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c | 11 ++---------
include/linux/raspberrypi/vchiq_arm.h | 8 ++++++++
2 files changed, 10 insertions(+), 9 deletions(-)
diff --git a/drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c b/drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c
index 6a7b96d3dae6275a483ef15dc619c5510454765e..2cc7574a6132d9a26278439eb5f89c7bad94d764 100644
--- a/drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c
+++ b/drivers/platform/raspberrypi/vchiq-interface/vchiq_arm.c
@@ -57,13 +57,6 @@
#define KEEPALIVE_VER 1
#define KEEPALIVE_VER_MIN KEEPALIVE_VER
-/*
- * The devices implemented in the VCHIQ firmware are not discoverable,
- * so we need to maintain a list of them in order to register them with
- * the interface.
- */
-static struct vchiq_device *bcm2835_audio;
-
static const struct vchiq_platform_info bcm2835_info = {
.cache_line_size = 32,
};
@@ -1421,7 +1414,7 @@ static int vchiq_probe(struct platform_device *pdev)
vchiq_debugfs_init(&mgmt->state);
- bcm2835_audio = vchiq_device_register(&pdev->dev, "bcm2835-audio");
+ mgmt->audio_dev = vchiq_device_register(&pdev->dev, "bcm2835-audio");
return 0;
}
@@ -1430,7 +1423,7 @@ static void vchiq_remove(struct platform_device *pdev)
{
struct vchiq_drv_mgmt *mgmt = dev_get_drvdata(&pdev->dev);
- vchiq_device_unregister(bcm2835_audio);
+ vchiq_device_unregister(mgmt->audio_dev);
vchiq_debugfs_deinit();
vchiq_deregister_chrdev();
vchiq_platform_uninit(mgmt);
diff --git a/include/linux/raspberrypi/vchiq_arm.h b/include/linux/raspberrypi/vchiq_arm.h
index e32b02f990244b46ab97c463dab6a973fdd97033..541b4efd64d9a8229c7e4b5bc21137a9899af9c6 100644
--- a/include/linux/raspberrypi/vchiq_arm.h
+++ b/include/linux/raspberrypi/vchiq_arm.h
@@ -11,6 +11,7 @@
#include <linux/platform_device.h>
#include <linux/semaphore.h>
#include <linux/atomic.h>
+#include "vchiq_bus.h"
#include "vchiq_core.h"
#include "vchiq_debugfs.h"
@@ -54,6 +55,13 @@ struct vchiq_drv_mgmt {
void __iomem *regs;
struct vchiq_state state;
+
+ /*
+ * The devices implemented in the VCHIQ firmware are not discoverable,
+ * so we need to maintain a list of them in order to register them with
+ * the interface.
+ */
+ struct vchiq_device *audio_dev;
};
struct user_service {
--
2.52.0
More information about the linux-arm-kernel
mailing list