[PATCH 2/3] staging: v04_services: Add connection structure to driver data

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Introduce a new struct vchiq_connected, responsible to track
the connections to the vchiq platform driver. The struct is added
as part of vchiq platform driver data.

Adding struct vchiq_connected will help us to move away from global
variables members being used to track the connections in
vchiq_connected.[ch]. This will be done in a subsequent patch.

Signed-off-by: Umang Jain <umang.jain@xxxxxxxxxxxxxxxx>
---
 .../vc04_services/interface/vchiq_arm/vchiq_arm.c      | 10 ++++++++++
 .../interface/vchiq_arm/vchiq_connected.h              | 10 ++++++++++
 .../vc04_services/interface/vchiq_arm/vchiq_core.h     |  2 ++
 3 files changed, 22 insertions(+)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index 52569517ba4e..b8b51267bcde 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -72,10 +72,20 @@ static struct vchiq_device *bcm2835_camera;
 
 static struct vchiq_drvdata bcm2835_drvdata = {
 	.cache_line_size = 32,
+	.drv_connected = {
+		.connected = 0,
+		.num_deferred_callbacks = 0,
+		.once_init = 0,
+	},
 };
 
 static struct vchiq_drvdata bcm2836_drvdata = {
 	.cache_line_size = 64,
+	.drv_connected = {
+		.connected = 0,
+		.num_deferred_callbacks = 0,
+		.once_init = 0,
+	},
 };
 
 struct vchiq_arm_state {
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.h
index e4ed56446f8a..cb5cba94dd54 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.h
@@ -6,6 +6,16 @@
 #ifndef VCHIQ_CONNECTED_H
 #define VCHIQ_CONNECTED_H
 
+#define  VCHIQ_DRV_MAX_CALLBACKS  10
+
+struct vchiq_connected {
+	int connected;
+	int num_deferred_callbacks;
+	int once_init;
+
+	void (*deferred_callback[VCHIQ_DRV_MAX_CALLBACKS])(void);
+};
+
 void vchiq_add_connected_callback(struct vchiq_device *device, void (*callback)(void));
 void vchiq_call_connected_callbacks(void);
 
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
index 331959a91102..e36a8cd8533a 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
@@ -17,6 +17,7 @@
 
 #include "../../include/linux/raspberrypi/vchiq.h"
 #include "vchiq_cfg.h"
+#include "vchiq_connected.h"
 
 /* Do this so that we can test-build the code on non-rpi systems */
 #if IS_ENABLED(CONFIG_RASPBERRYPI_FIRMWARE)
@@ -429,6 +430,7 @@ struct vchiq_config {
 struct vchiq_drvdata {
 	const unsigned int cache_line_size;
 	struct rpi_firmware *fw;
+	struct vchiq_connected drv_connected;
 };
 
 extern spinlock_t bulk_waiter_spinlock;
-- 
2.43.0





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux