treewide: remove redundant IS_ERR() before error code check
[linux/fpc-iii.git] / drivers / net / wireless / ti / wl12xx / event.c
blobf539f5e0604f80ecd8a1667b98097b556e5c17a2
1 // SPDX-License-Identifier: GPL-2.0-only
2 /*
3 * This file is part of wl12xx
5 * Copyright (C) 2012 Texas Instruments. All rights reserved.
6 */
8 #include "event.h"
9 #include "scan.h"
10 #include "../wlcore/cmd.h"
11 #include "../wlcore/debug.h"
13 int wl12xx_wait_for_event(struct wl1271 *wl, enum wlcore_wait_event event,
14 bool *timeout)
16 u32 local_event;
18 switch (event) {
19 case WLCORE_EVENT_ROLE_STOP_COMPLETE:
20 local_event = ROLE_STOP_COMPLETE_EVENT_ID;
21 break;
23 case WLCORE_EVENT_PEER_REMOVE_COMPLETE:
24 local_event = PEER_REMOVE_COMPLETE_EVENT_ID;
25 break;
27 default:
28 /* event not implemented */
29 return 0;
31 return wlcore_cmd_wait_for_event_or_timeout(wl, local_event, timeout);
34 int wl12xx_process_mailbox_events(struct wl1271 *wl)
36 struct wl12xx_event_mailbox *mbox = wl->mbox;
37 u32 vector;
40 vector = le32_to_cpu(mbox->events_vector);
41 vector &= ~(le32_to_cpu(mbox->events_mask));
43 wl1271_debug(DEBUG_EVENT, "MBOX vector: 0x%x", vector);
45 if (vector & SCAN_COMPLETE_EVENT_ID) {
46 wl1271_debug(DEBUG_EVENT, "status: 0x%x",
47 mbox->scheduled_scan_status);
49 if (wl->scan_wlvif)
50 wl12xx_scan_completed(wl, wl->scan_wlvif);
53 if (vector & PERIODIC_SCAN_REPORT_EVENT_ID) {
54 wl1271_debug(DEBUG_EVENT,
55 "PERIODIC_SCAN_REPORT_EVENT (status 0x%0x)",
56 mbox->scheduled_scan_status);
58 wlcore_scan_sched_scan_results(wl);
61 if (vector & PERIODIC_SCAN_COMPLETE_EVENT_ID)
62 wlcore_event_sched_scan_completed(wl,
63 mbox->scheduled_scan_status);
64 if (vector & SOFT_GEMINI_SENSE_EVENT_ID)
65 wlcore_event_soft_gemini_sense(wl,
66 mbox->soft_gemini_sense_info);
68 if (vector & BSS_LOSE_EVENT_ID)
69 wlcore_event_beacon_loss(wl, 0xff);
71 if (vector & RSSI_SNR_TRIGGER_0_EVENT_ID)
72 wlcore_event_rssi_trigger(wl, mbox->rssi_snr_trigger_metric);
74 if (vector & BA_SESSION_RX_CONSTRAINT_EVENT_ID)
75 wlcore_event_ba_rx_constraint(wl,
76 BIT(mbox->role_id),
77 mbox->rx_ba_allowed);
79 if (vector & CHANNEL_SWITCH_COMPLETE_EVENT_ID)
80 wlcore_event_channel_switch(wl, 0xff,
81 mbox->channel_switch_status);
83 if (vector & DUMMY_PACKET_EVENT_ID)
84 wlcore_event_dummy_packet(wl);
87 * "TX retries exceeded" has a different meaning according to mode.
88 * In AP mode the offending station is disconnected.
90 if (vector & MAX_TX_RETRY_EVENT_ID)
91 wlcore_event_max_tx_failure(wl,
92 le16_to_cpu(mbox->sta_tx_retry_exceeded));
94 if (vector & INACTIVE_STA_EVENT_ID)
95 wlcore_event_inactive_sta(wl,
96 le16_to_cpu(mbox->sta_aging_status));
98 if (vector & REMAIN_ON_CHANNEL_COMPLETE_EVENT_ID)
99 wlcore_event_roc_complete(wl);
101 return 0;