Subject: Re: [PATCH v4 07/17] wifi: cc33xx: Add event.c, event.h

From: Simon Horman <[email-masked]>
Date: Sat, 2 Nov 2024 13:12:01 +0000

On Tue, Oct 29, 2024 at 07:23:44PM +0200, Michael Nemanov wrote:
> Unlike in wlcore, events are queued on linked list
> (cc->event_list) and are handled outside the IRQ
> context. This will be more clear when looking at main.c
> 
> Signed-off-by: Michael Nemanov <[email-masked]>
> ---
>  drivers/net/wireless/ti/cc33xx/event.c | 363 +++++++++++++++++++++++++
>  drivers/net/wireless/ti/cc33xx/event.h |  71 +++++
>  2 files changed, 434 insertions(+)
>  create mode 100644 drivers/net/wireless/ti/cc33xx/event.c
>  create mode 100644 drivers/net/wireless/ti/cc33xx/event.h
> 
> diff --git a/drivers/net/wireless/ti/cc33xx/event.c b/drivers/net/wireless/ti/cc33xx/event.c

...

> +struct event_node {
> +	struct llist_node node;
> +	struct cc33xx_event_mailbox event_data;
> +};
> +
> +void deffer_event(struct cc33xx *cc,
> +		  const void *event_payload, size_t event_length)
> +{
> +	struct event_node *event_node;
> +	bool ret;

Hi Michael,

A minor nit from my side: ret is set but otherwise unused in this function.
Probably it should be removed.

> +
> +	if (WARN_ON(event_length != sizeof(event_node->event_data)))
> +		return;
> +
> +	event_node = kzalloc(sizeof(*event_node), GFP_KERNEL);
> +	if (WARN_ON(!event_node))
> +		return;
> +
> +	memcpy(&event_node->event_data,
> +	       event_payload, sizeof(event_node->event_data));
> +
> +	llist_add(&event_node->node, &cc->event_list);
> +	ret = queue_work(cc->freezable_wq, &cc->irq_deferred_work);
> +}

...