linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Adrien Thierry <athierry@redhat.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Florian Fainelli <f.fainelli@gmail.com>,
	Ray Jui <rjui@broadcom.com>,
	Scott Branden <sbranden@broadcom.com>,
	bcm-kernel-feedback-list@broadcom.com
Cc: Stefan Wahren <stefan.wahren@i2se.com>,
	Adrien Thierry <athierry@redhat.com>,
	linux-staging@lists.linux.dev,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org
Subject: [PATCH v2 6/9] staging: vchiq_arm: pass vchiq instance to 'vchiq_get_service_userdata'
Date: Wed, 18 May 2022 15:11:17 -0400	[thread overview]
Message-ID: <20220518191126.60396-7-athierry@redhat.com> (raw)
In-Reply-To: <20220518191126.60396-1-athierry@redhat.com>

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 --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;
-- 
2.35.3


  parent reply	other threads:[~2022-05-18 19:12 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-05-18 19:11 [PATCH v2 0/9] staging: vchiq_arm: remove some unnecessary global variables Adrien Thierry
2022-05-18 19:11 ` [PATCH v2 1/9] staging: vchiq_arm: add reference to vchiq device in vchiq_state Adrien Thierry
2022-05-18 19:11 ` [PATCH v2 2/9] staging: vchiq_arm: get rid of global device structure Adrien Thierry
2022-05-18 19:11 ` [PATCH v2 3/9] staging: vchiq_arm: pass vchiq instance to service callbacks Adrien Thierry
2022-05-30 19:26   ` Stefan Wahren
2022-05-18 19:11 ` [PATCH v2 4/9] staging: vchiq_arm: pass vchiq instance to 'find_service_by_handle' Adrien Thierry
2022-05-30 19:43   ` Stefan Wahren
2022-05-18 19:11 ` [PATCH v2 5/9] staging: vchiq_arm: pass vchiq instance to 'vchiq_get_client_id' Adrien Thierry
2022-05-18 19:11 ` Adrien Thierry [this message]
2022-05-18 19:11 ` [PATCH v2 7/9] staging: vchiq_arm: pass vchiq instance to 'handle_to_service' Adrien Thierry
2022-05-18 19:11 ` [PATCH v2 8/9] staging: vchiq_arm: use state from vchiq instance Adrien Thierry
2022-05-30 20:09   ` Stefan Wahren
2022-05-18 19:11 ` [PATCH v2 9/9] staging: vchiq_arm: remove global 'vchiq_states' array Adrien Thierry
2022-05-30 20:19 ` [PATCH v2 0/9] staging: vchiq_arm: remove some unnecessary global variables Stefan Wahren
2022-06-01 22:12   ` Gaston Gonzalez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220518191126.60396-7-athierry@redhat.com \
    --to=athierry@redhat.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=f.fainelli@gmail.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=nsaenz@kernel.org \
    --cc=rjui@broadcom.com \
    --cc=sbranden@broadcom.com \
    --cc=stefan.wahren@i2se.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).