diff mbox series

[v2,6/9] staging: vchiq_arm: pass vchiq instance to 'vchiq_get_service_userdata'

Message ID 20220518191126.60396-7-athierry@redhat.com (mailing list archive)
State New, archived
Headers show
Series staging: vchiq_arm: remove some unnecessary global variables | expand

Commit Message

Adrien Thierry May 18, 2022, 7:11 p.m. UTC
In order to remove the 'vchiq_states' global array, we need to pass the
vchiq_instance reference to the 'handle_to_service' function, as well as
to all functions that call 'handle_to_service'. This will allow
accessing the vchiq state through the vchiq instance instead of through
the global array.

'handle_to_service' is called by 'vchiq_get_service_userdata'.
Therefore, pass the vchiq instance reference to it.

Signed-off-by: Adrien Thierry <athierry@redhat.com>
---
 drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c    | 3 ++-
 .../staging/vc04_services/include/linux/raspberrypi/vchiq.h    | 2 +-
 drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c | 2 +-
 drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c          | 2 +-
 4 files changed, 5 insertions(+), 4 deletions(-)
diff mbox series

Patch

diff --git a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
index aa2ab0df7af5..f4c2c9506d86 100644
--- a/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
+++ b/drivers/staging/vc04_services/bcm2835-audio/bcm2835-vchiq.c
@@ -96,7 +96,8 @@  static enum vchiq_status audio_vchi_callback(struct vchiq_instance *vchiq_instan
 					     struct vchiq_header *header,
 					     unsigned int handle, void *userdata)
 {
-	struct bcm2835_audio_instance *instance = vchiq_get_service_userdata(handle);
+	struct bcm2835_audio_instance *instance = vchiq_get_service_userdata(vchiq_instance,
+									     handle);
 	struct vc_audio_msg *m;
 
 	if (reason != VCHIQ_MESSAGE_AVAILABLE)
diff --git a/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h b/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h
index 0d3833e9773c..db1441c0cc66 100644
--- a/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h
+++ b/drivers/staging/vc04_services/include/linux/raspberrypi/vchiq.h
@@ -109,7 +109,7 @@  extern enum vchiq_status vchiq_bulk_transmit(struct vchiq_instance *instance, un
 extern enum vchiq_status vchiq_bulk_receive(struct vchiq_instance *instance, unsigned int service,
 					    void *data, unsigned int size, void *userdata,
 					    enum vchiq_bulk_mode mode);
-extern void *vchiq_get_service_userdata(unsigned int service);
+extern void *vchiq_get_service_userdata(struct vchiq_instance *instance, unsigned int service);
 extern enum vchiq_status vchiq_get_peer_version(struct vchiq_instance *instance,
 						unsigned int handle,
 						short *peer_version);
diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
index d6853e23564c..d4fed18b1baa 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
@@ -411,7 +411,7 @@  vchiq_get_client_id(struct vchiq_instance *instance, unsigned int handle)
 }
 
 void *
-vchiq_get_service_userdata(unsigned int handle)
+vchiq_get_service_userdata(struct vchiq_instance *instance, unsigned int handle)
 {
 	void *userdata;
 	struct vchiq_service *service;
diff --git a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
index 4c29cb7794a1..cb921c94996a 100644
--- a/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
+++ b/drivers/staging/vc04_services/vchiq-mmal/mmal-vchiq.c
@@ -553,7 +553,7 @@  static enum vchiq_status service_callback(struct vchiq_instance *vchiq_instance,
 					  struct vchiq_header *header,
 					  unsigned int handle, void *bulk_ctx)
 {
-	struct vchiq_mmal_instance *instance = vchiq_get_service_userdata(handle);
+	struct vchiq_mmal_instance *instance = vchiq_get_service_userdata(vchiq_instance, handle);
 	u32 msg_len;
 	struct mmal_msg *msg;
 	struct mmal_msg_context *msg_context;