@@ -1059,7 +1059,7 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,
DEBUG_TRACE(SERVICE_CALLBACK_LINE);
rcu_read_lock();
- service = handle_to_service(handle);
+ service = handle_to_service(instance, handle);
if (WARN_ON(!service)) {
rcu_read_unlock();
return VCHIQ_SUCCESS;
@@ -240,7 +240,7 @@ find_service_by_handle(struct vchiq_instance *instance, unsigned int handle)
struct vchiq_service *service;
rcu_read_lock();
- service = handle_to_service(handle);
+ service = handle_to_service(instance, handle);
if (service && service->srvstate != VCHIQ_SRVSTATE_FREE &&
service->handle == handle &&
kref_get_unless_zero(&service->ref_count)) {
@@ -281,7 +281,7 @@ find_service_for_instance(struct vchiq_instance *instance, unsigned int handle)
struct vchiq_service *service;
rcu_read_lock();
- service = handle_to_service(handle);
+ service = handle_to_service(instance, handle);
if (service && service->srvstate != VCHIQ_SRVSTATE_FREE &&
service->handle == handle &&
service->instance == instance &&
@@ -302,7 +302,7 @@ find_closed_service_for_instance(struct vchiq_instance *instance, unsigned int h
struct vchiq_service *service;
rcu_read_lock();
- service = handle_to_service(handle);
+ service = handle_to_service(instance, handle);
if (service &&
(service->srvstate == VCHIQ_SRVSTATE_FREE ||
service->srvstate == VCHIQ_SRVSTATE_CLOSED) &&
@@ -404,7 +404,7 @@ vchiq_get_client_id(struct vchiq_instance *instance, unsigned int handle)
int id;
rcu_read_lock();
- service = handle_to_service(handle);
+ service = handle_to_service(instance, handle);
id = service ? service->client_id : 0;
rcu_read_unlock();
return id;
@@ -417,7 +417,7 @@ vchiq_get_service_userdata(struct vchiq_instance *instance, unsigned int handle)
struct vchiq_service *service;
rcu_read_lock();
- service = handle_to_service(handle);
+ service = handle_to_service(instance, handle);
userdata = service ? service->base.userdata : NULL;
rcu_read_unlock();
return userdata;
@@ -510,7 +510,7 @@ request_poll(struct vchiq_state *state, struct vchiq_service *service,
int poll_type);
static inline struct vchiq_service *
-handle_to_service(unsigned int handle)
+handle_to_service(struct vchiq_instance *instance, unsigned int handle)
{
int idx = handle & (VCHIQ_MAX_SERVICES - 1);
struct vchiq_state *state = vchiq_states[(handle / VCHIQ_MAX_SERVICES) &
In order to remove the 'vchiq_states' global array, we need to pass the vchiq_instance reference to the 'handle_to_service' function. This will allow accessing the vchiq state through the vchiq instance instead of through the global array. Signed-off-by: Adrien Thierry <athierry@redhat.com> --- .../vc04_services/interface/vchiq_arm/vchiq_arm.c | 2 +- .../vc04_services/interface/vchiq_arm/vchiq_core.c | 10 +++++----- .../vc04_services/interface/vchiq_arm/vchiq_core.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-)