summaryrefslogtreecommitdiffstats
path: root/drivers/staging/wfx/hif_rx.c
diff options
context:
space:
mode:
authorJérôme Pouiller <jerome.pouiller@silabs.com>2020-04-20 18:02:59 +0200
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2020-04-23 13:26:03 +0200
commit988cf07bb9a0f3c296e38124ab7e7f5d2f2d28a4 (patch)
tree2618ebb92324c86b01b263d98889f87a8f09d5e0 /drivers/staging/wfx/hif_rx.c
parent5c442b6a39e112539144abbfd5e75fe486c3dfab (diff)
downloadlinux-stable-988cf07bb9a0f3c296e38124ab7e7f5d2f2d28a4.tar.gz
linux-stable-988cf07bb9a0f3c296e38124ab7e7f5d2f2d28a4.tar.bz2
linux-stable-988cf07bb9a0f3c296e38124ab7e7f5d2f2d28a4.zip
staging: wfx: handle firmware events synchronously
Currently, events from firmware are handled in a work queue with a complex event queue mechanism. It is probably overkill since there is only two events to handle: bss_loss and CQM events. Handling these events synchronously is sufficient. Signed-off-by: Jérôme Pouiller <jerome.pouiller@silabs.com> Link: https://lore.kernel.org/r/20200420160311.57323-5-Jerome.Pouiller@silabs.com Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/wfx/hif_rx.c')
-rw-r--r--drivers/staging/wfx/hif_rx.c39
1 files changed, 22 insertions, 17 deletions
diff --git a/drivers/staging/wfx/hif_rx.c b/drivers/staging/wfx/hif_rx.c
index 33c22c5d629d..b8d570256498 100644
--- a/drivers/staging/wfx/hif_rx.c
+++ b/drivers/staging/wfx/hif_rx.c
@@ -158,26 +158,31 @@ static int hif_event_indication(struct wfx_dev *wdev,
{
struct wfx_vif *wvif = wdev_to_wvif(wdev, hif->interface);
const struct hif_ind_event *body = buf;
- struct wfx_hif_event *event;
- int first;
- WARN_ON(!wvif);
- if (!wvif)
+ if (!wvif) {
+ dev_warn(wdev->dev, "received event for non-existent vif\n");
return 0;
+ }
- event = kzalloc(sizeof(*event), GFP_KERNEL);
- if (!event)
- return -ENOMEM;
-
- memcpy(&event->evt, body, sizeof(struct hif_ind_event));
- spin_lock(&wvif->event_queue_lock);
- first = list_empty(&wvif->event_queue);
- list_add_tail(&event->link, &wvif->event_queue);
- spin_unlock(&wvif->event_queue_lock);
-
- if (first)
- schedule_work(&wvif->event_handler_work);
-
+ switch (body->event_id) {
+ case HIF_EVENT_IND_RCPI_RSSI:
+ wfx_event_report_rssi(wvif, body->event_data.rcpi_rssi);
+ break;
+ case HIF_EVENT_IND_BSSLOST:
+ schedule_delayed_work(&wvif->beacon_loss_work, 0);
+ break;
+ case HIF_EVENT_IND_BSSREGAINED:
+ cancel_delayed_work(&wvif->beacon_loss_work);
+ dev_dbg(wdev->dev, "ignore BSSREGAINED indication\n");
+ break;
+ case HIF_EVENT_IND_PS_MODE_ERROR:
+ dev_warn(wdev->dev, "error while processing power save request\n");
+ break;
+ default:
+ dev_warn(wdev->dev, "unhandled event indication: %.2x\n",
+ body->event_id);
+ break;
+ }
return 0;
}