All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <Jonathan.Cameron@Huawei.com>
To: Gavin Shan <gshan@redhat.com>
Cc: mark.rutland@arm.com, catalin.marinas@arm.com,
	james.morse@arm.com, shan.gavin@gmail.com, will@kernel.org,
	linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH v2 11/17] drivers/firmware/sdei: Introduce sdei_do_local_call()
Date: Thu, 23 Jul 2020 16:25:35 +0100	[thread overview]
Message-ID: <20200723162535.00006d91@Huawei.com> (raw)
In-Reply-To: <20200722095740.28560-12-gshan@redhat.com>

On Wed, 22 Jul 2020 19:57:34 +1000
Gavin Shan <gshan@redhat.com> wrote:

> During the CPU hotplug, the private events are registered, enabled
> or unregistered on the specific CPU. It repeats the same steps:
> initializing cross call argument, make function call on local CPU,
> check the returned error.
> 
> This introduces sdei_do_local_call() to cover the first steps. The
> other benefit is to make CROSSCALL_INIT and struct sdei_crosscall_args
> are only visible to sddi_do_{cross, local}_call().
> 
> Signed-off-by: Gavin Shan <gshan@redhat.com>
One comment inline.

Jonathan

> ---
>  drivers/firmware/arm_sdei.c | 43 ++++++++++++++++++++++---------------
>  1 file changed, 26 insertions(+), 17 deletions(-)
> 
> diff --git a/drivers/firmware/arm_sdei.c b/drivers/firmware/arm_sdei.c
> index 04dc144a8f31..da0e0d5591a8 100644
> --- a/drivers/firmware/arm_sdei.c
> +++ b/drivers/firmware/arm_sdei.c
> @@ -85,7 +85,18 @@ struct sdei_crosscall_args {
>  		atomic_set(&arg.errors, 0);	\
>  	} while (0)
>  
> -static inline int sdei_do_cross_call(void *fn, struct sdei_event * event)
> +static inline int sdei_do_local_call(void *fn, struct sdei_event *event)

Can we now give the function parameter it's full type and avoid the nasty
looking cast below?

> +{
> +	struct sdei_crosscall_args arg;
> +	void (*func)(void *) = fn;
> +
> +	CROSSCALL_INIT(arg, event);
> +	func(&arg);
> +
> +	return arg.first_error;
> +}
> +
> +static inline int sdei_do_cross_call(void *fn, struct sdei_event *event)
>  {
>  	struct sdei_crosscall_args arg;
>  
> @@ -675,7 +686,7 @@ static int sdei_reregister_shared(void)
>  static int sdei_cpuhp_down(unsigned int cpu)
>  {
>  	struct sdei_event *event;
> -	struct sdei_crosscall_args arg;
> +	int err;
>  
>  	/* un-register private events */
>  	spin_lock(&sdei_list_lock);
> @@ -683,12 +694,11 @@ static int sdei_cpuhp_down(unsigned int cpu)
>  		if (event->type == SDEI_EVENT_TYPE_SHARED)
>  			continue;
>  
> -		CROSSCALL_INIT(arg, event);
> -		/* call the cross-call function locally... */
> -		_local_event_unregister(&arg);
> -		if (arg.first_error)
> +		err = sdei_do_local_call(_local_event_unregister, event);
> +		if (err) {
>  			pr_err("Failed to unregister event %u: %d\n",
> -			       event->event_num, arg.first_error);
> +			       event->event_num, err);
> +		}
>  	}
>  	spin_unlock(&sdei_list_lock);
>  
> @@ -698,7 +708,7 @@ static int sdei_cpuhp_down(unsigned int cpu)
>  static int sdei_cpuhp_up(unsigned int cpu)
>  {
>  	struct sdei_event *event;
> -	struct sdei_crosscall_args arg;
> +	int err;
>  
>  	/* re-register/enable private events */
>  	spin_lock(&sdei_list_lock);
> @@ -707,20 +717,19 @@ static int sdei_cpuhp_up(unsigned int cpu)
>  			continue;
>  
>  		if (event->reregister) {
> -			CROSSCALL_INIT(arg, event);
> -			/* call the cross-call function locally... */
> -			_local_event_register(&arg);
> -			if (arg.first_error)
> +			err = sdei_do_local_call(_local_event_register, event);
> +			if (err) {
>  				pr_err("Failed to re-register event %u: %d\n",
> -				       event->event_num, arg.first_error);
> +				       event->event_num, err);
> +			}
>  		}
>  
>  		if (event->reenable) {
> -			CROSSCALL_INIT(arg, event);
> -			_local_event_enable(&arg);
> -			if (arg.first_error)
> +			err = sdei_do_local_call(_local_event_enable, event);
> +			if (err) {
>  				pr_err("Failed to re-enable event %u: %d\n",
> -				       event->event_num, arg.first_error);
> +				       event->event_num, err);
> +			}
>  		}
>  	}
>  	spin_unlock(&sdei_list_lock);



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

  reply	other threads:[~2020-07-23 15:29 UTC|newest]

Thread overview: 40+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-07-22  9:57 [PATCH v2 00/17] Refactor SDEI client driver Gavin Shan
2020-07-22  9:57 ` [PATCH v2 01/17] drivers/firmware/sdei: Remove sdei_is_err() Gavin Shan
2020-07-22  9:57 ` [PATCH v2 02/17] drivers/firmware/sdei: Common block for failing path in sdei_event_create() Gavin Shan
2020-07-22  9:57 ` [PATCH v2 03/17] drivers/firmware/sdei: Retrieve event number from event instance Gavin Shan
2020-07-22  9:57 ` [PATCH v2 04/17] drivers/firmware/sdei: Avoid nested statements in sdei_init() Gavin Shan
2020-07-22  9:57 ` [PATCH v2 05/17] drivers/firmware/sdei: Unregister driver on error " Gavin Shan
2020-07-22  9:57 ` [PATCH v2 06/17] drivers/firmware/sdei: Remove duplicate check in sdei_get_conduit() Gavin Shan
2020-07-22  9:57 ` [PATCH v2 07/17] drivers/firmware/sdei: Remove Drop redundant error message in sdei_probe() Gavin Shan
2020-07-22  9:57 ` [PATCH v2 08/17] drivers/firmware/sdei: Remove while loop in sdei_event_register() Gavin Shan
2020-07-22  9:57 ` [PATCH v2 09/17] drivers/firmware/sdei: Remove while loop in sdei_event_unregister() Gavin Shan
2020-07-23 15:51   ` Jonathan Cameron
2020-07-27  0:22     ` Gavin Shan
2020-07-22  9:57 ` [PATCH v2 10/17] drivers/firmware/sdei: Cleanup on cross call function Gavin Shan
2020-07-23 15:52   ` Jonathan Cameron
2020-07-27  0:33     ` Gavin Shan
2020-07-27  8:58       ` Jonathan Cameron
2020-07-27  9:45         ` Gavin Shan
2020-07-22  9:57 ` [PATCH v2 11/17] drivers/firmware/sdei: Introduce sdei_do_local_call() Gavin Shan
2020-07-23 15:25   ` Jonathan Cameron [this message]
2020-07-27  0:41     ` Gavin Shan
2020-07-22  9:57 ` [PATCH v2 12/17] drivers/firmware/sdei: Remove _sdei_event_register() Gavin Shan
2020-07-23 15:25   ` Jonathan Cameron
2020-07-27  0:42     ` Gavin Shan
2020-07-22  9:57 ` [PATCH v2 13/17] drivers/firmware/sdei: Remove _sdei_event_unregister() Gavin Shan
2020-07-22  9:57 ` [PATCH v2 14/17] drivers/firmware/sdei: Move struct sdei_event to header file Gavin Shan
2020-07-23 15:19   ` Jonathan Cameron
2020-07-27  0:46     ` Gavin Shan
2020-07-27  9:02       ` Jonathan Cameron
2020-07-27  9:59         ` Gavin Shan
2020-07-27 13:50           ` Jonathan Cameron
2020-07-28  2:52             ` Gavin Shan
2020-07-22  9:57 ` [PATCH v2 15/17] drivers/firmware/sdei: Identify event by struct sdei_event Gavin Shan
2020-07-22  9:57 ` [PATCH v2 16/17] drivers/firmware/sdei: Retrieve event signaled property on registration Gavin Shan
2020-07-23 15:24   ` Jonathan Cameron
2020-07-27  0:53     ` Gavin Shan
2020-07-27  9:04       ` Jonathan Cameron
2020-07-27 10:03         ` Gavin Shan
2020-07-27 13:56           ` Jonathan Cameron
2020-07-28  2:56             ` Gavin Shan
2020-07-22  9:57 ` [PATCH v2 17/17] drivers/firmware/sdei: Add sdei_event_get_info() Gavin Shan

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=20200723162535.00006d91@Huawei.com \
    --to=jonathan.cameron@huawei.com \
    --cc=catalin.marinas@arm.com \
    --cc=gshan@redhat.com \
    --cc=james.morse@arm.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=mark.rutland@arm.com \
    --cc=shan.gavin@gmail.com \
    --cc=will@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.