linux-staging.lists.linux.dev archive mirror
 help / color / mirror / Atom feed
From: Stefan Wahren <stefan.wahren@i2se.com>
To: Adrien Thierry <athierry@redhat.com>,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: bcm-kernel-feedback-list@broadcom.com,
	linux-rpi-kernel@lists.infradead.org,
	linux-arm-kernel@lists.infradead.org,
	linux-staging@lists.linux.dev
Subject: Re: [PATCH v2 8/9] staging: vchiq_arm: use state from vchiq instance
Date: Mon, 30 May 2022 22:09:05 +0200	[thread overview]
Message-ID: <5b5bdc2a-90a4-25c5-6741-a20e142011b9@i2se.com> (raw)
In-Reply-To: <20220518191126.60396-9-athierry@redhat.com>

Hi Adrien,

Am 18.05.22 um 21:11 schrieb Adrien Thierry:
> In 'handle_to_service', access the vchiq state from the vchiq instance
> instead of the global 'vchiq_states' array. This will allow getting rid
> of the global 'vchiq_states' array.
>
> Signed-off-by: Adrien Thierry <athierry@redhat.com>
> ---
>   .../vc04_services/interface/vchiq_arm/vchiq_core.c   |  7 +++++++
>   .../vc04_services/interface/vchiq_arm/vchiq_core.h   | 12 +-----------
>   2 files changed, 8 insertions(+), 11 deletions(-)
>
> 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 be2ee84686b7..cd23d18f8b3c 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c
> @@ -13,6 +13,7 @@
>   #include <linux/rcupdate.h>
>   #include <linux/sched/signal.h>
>   
> +#include "vchiq_arm.h"
>   #include "vchiq_core.h"
>   
>   #define VCHIQ_SLOT_HANDLER_STACK 8192
> @@ -234,6 +235,12 @@ set_service_state(struct vchiq_service *service, int newstate)
>   	service->srvstate = newstate;
>   }
>   
> +struct vchiq_service *handle_to_service(struct vchiq_instance *instance, unsigned int handle)
> +{
> +	int idx = handle & (VCHIQ_MAX_SERVICES - 1);
> +
> +	return rcu_dereference(instance->state->services[idx]);
looking at vchiq_initialise() and vchiq_get_state() let me think that we 
cannot assume that instance->state is always different from NULL.
> +}
>   struct vchiq_service *
>   find_service_by_handle(struct vchiq_instance *instance, unsigned int handle)
>   {
> 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 07c3a82e6084..f87b4b9b3596 100644
> --- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> +++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h
> @@ -509,17 +509,7 @@ extern void
>   request_poll(struct vchiq_state *state, struct vchiq_service *service,
>   	     int poll_type);
>   
> -static inline struct vchiq_service *
> -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) &
> -		(VCHIQ_MAX_STATES - 1)];
> -
> -	if (!state)
> -		return NULL;
> -	return rcu_dereference(state->services[idx]);
> -}
> +struct vchiq_service *handle_to_service(struct vchiq_instance *instance, unsigned int handle);
>   
>   extern struct vchiq_service *
>   find_service_by_handle(struct vchiq_instance *instance, unsigned int handle);

  reply	other threads:[~2022-05-30 20:09 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 ` [PATCH v2 6/9] staging: vchiq_arm: pass vchiq instance to 'vchiq_get_service_userdata' Adrien Thierry
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 [this message]
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=5b5bdc2a-90a4-25c5-6741-a20e142011b9@i2se.com \
    --to=stefan.wahren@i2se.com \
    --cc=athierry@redhat.com \
    --cc=bcm-kernel-feedback-list@broadcom.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 \
    /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).