libertas: convert SNMP_MIB to a direct command
[pandora-kernel.git] / drivers / net / wireless / libertas / cmdresp.c
1 /**
2   * This file contains the handling of command
3   * responses as well as events generated by firmware.
4   */
5 #include <linux/delay.h>
6 #include <linux/if_arp.h>
7 #include <linux/netdevice.h>
8
9 #include <net/iw_handler.h>
10
11 #include "host.h"
12 #include "decl.h"
13 #include "defs.h"
14 #include "dev.h"
15 #include "assoc.h"
16 #include "wext.h"
17
18 /**
19  *  @brief This function handles disconnect event. it
20  *  reports disconnect to upper layer, clean tx/rx packets,
21  *  reset link state etc.
22  *
23  *  @param priv    A pointer to struct lbs_private structure
24  *  @return        n/a
25  */
26 void lbs_mac_event_disconnected(struct lbs_private *priv)
27 {
28         union iwreq_data wrqu;
29
30         if (priv->connect_status != LBS_CONNECTED)
31                 return;
32
33         lbs_deb_enter(LBS_DEB_ASSOC);
34
35         memset(wrqu.ap_addr.sa_data, 0x00, ETH_ALEN);
36         wrqu.ap_addr.sa_family = ARPHRD_ETHER;
37
38         /*
39          * Cisco AP sends EAP failure and de-auth in less than 0.5 ms.
40          * It causes problem in the Supplicant
41          */
42
43         msleep_interruptible(1000);
44         wireless_send_event(priv->dev, SIOCGIWAP, &wrqu, NULL);
45
46         /* report disconnect to upper layer */
47         netif_stop_queue(priv->dev);
48         netif_carrier_off(priv->dev);
49
50         /* Free Tx and Rx packets */
51         kfree_skb(priv->currenttxskb);
52         priv->currenttxskb = NULL;
53         priv->tx_pending_len = 0;
54
55         /* reset SNR/NF/RSSI values */
56         memset(priv->SNR, 0x00, sizeof(priv->SNR));
57         memset(priv->NF, 0x00, sizeof(priv->NF));
58         memset(priv->RSSI, 0x00, sizeof(priv->RSSI));
59         memset(priv->rawSNR, 0x00, sizeof(priv->rawSNR));
60         memset(priv->rawNF, 0x00, sizeof(priv->rawNF));
61         priv->nextSNRNF = 0;
62         priv->numSNRNF = 0;
63         priv->connect_status = LBS_DISCONNECTED;
64
65         /* Clear out associated SSID and BSSID since connection is
66          * no longer valid.
67          */
68         memset(&priv->curbssparams.bssid, 0, ETH_ALEN);
69         memset(&priv->curbssparams.ssid, 0, IW_ESSID_MAX_SIZE);
70         priv->curbssparams.ssid_len = 0;
71
72         if (priv->psstate != PS_STATE_FULL_POWER) {
73                 /* make firmware to exit PS mode */
74                 lbs_deb_cmd("disconnected, so exit PS mode\n");
75                 lbs_ps_wakeup(priv, 0);
76         }
77         lbs_deb_leave(LBS_DEB_ASSOC);
78 }
79
80 /**
81  *  @brief This function handles MIC failure event.
82  *
83  *  @param priv    A pointer to struct lbs_private structure
84  *  @para  event   the event id
85  *  @return        n/a
86  */
87 static void handle_mic_failureevent(struct lbs_private *priv, u32 event)
88 {
89         char buf[50];
90
91         lbs_deb_enter(LBS_DEB_CMD);
92         memset(buf, 0, sizeof(buf));
93
94         sprintf(buf, "%s", "MLME-MICHAELMICFAILURE.indication ");
95
96         if (event == MACREG_INT_CODE_MIC_ERR_UNICAST) {
97                 strcat(buf, "unicast ");
98         } else {
99                 strcat(buf, "multicast ");
100         }
101
102         lbs_send_iwevcustom_event(priv, buf);
103         lbs_deb_leave(LBS_DEB_CMD);
104 }
105
106 static int lbs_ret_reg_access(struct lbs_private *priv,
107                                u16 type, struct cmd_ds_command *resp)
108 {
109         int ret = 0;
110
111         lbs_deb_enter(LBS_DEB_CMD);
112
113         switch (type) {
114         case CMD_RET(CMD_MAC_REG_ACCESS):
115                 {
116                         struct cmd_ds_mac_reg_access *reg = &resp->params.macreg;
117
118                         priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
119                         priv->offsetvalue.value = le32_to_cpu(reg->value);
120                         break;
121                 }
122
123         case CMD_RET(CMD_BBP_REG_ACCESS):
124                 {
125                         struct cmd_ds_bbp_reg_access *reg = &resp->params.bbpreg;
126
127                         priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
128                         priv->offsetvalue.value = reg->value;
129                         break;
130                 }
131
132         case CMD_RET(CMD_RF_REG_ACCESS):
133                 {
134                         struct cmd_ds_rf_reg_access *reg = &resp->params.rfreg;
135
136                         priv->offsetvalue.offset = (u32)le16_to_cpu(reg->offset);
137                         priv->offsetvalue.value = reg->value;
138                         break;
139                 }
140
141         default:
142                 ret = -1;
143         }
144
145         lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
146         return ret;
147 }
148
149 static int lbs_ret_802_11_rssi(struct lbs_private *priv,
150                                 struct cmd_ds_command *resp)
151 {
152         struct cmd_ds_802_11_rssi_rsp *rssirsp = &resp->params.rssirsp;
153
154         lbs_deb_enter(LBS_DEB_CMD);
155
156         /* store the non average value */
157         priv->SNR[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->SNR);
158         priv->NF[TYPE_BEACON][TYPE_NOAVG] = le16_to_cpu(rssirsp->noisefloor);
159
160         priv->SNR[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgSNR);
161         priv->NF[TYPE_BEACON][TYPE_AVG] = le16_to_cpu(rssirsp->avgnoisefloor);
162
163         priv->RSSI[TYPE_BEACON][TYPE_NOAVG] =
164             CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_NOAVG],
165                      priv->NF[TYPE_BEACON][TYPE_NOAVG]);
166
167         priv->RSSI[TYPE_BEACON][TYPE_AVG] =
168             CAL_RSSI(priv->SNR[TYPE_BEACON][TYPE_AVG] / AVG_SCALE,
169                      priv->NF[TYPE_BEACON][TYPE_AVG] / AVG_SCALE);
170
171         lbs_deb_cmd("RSSI: beacon %d, avg %d\n",
172                priv->RSSI[TYPE_BEACON][TYPE_NOAVG],
173                priv->RSSI[TYPE_BEACON][TYPE_AVG]);
174
175         lbs_deb_leave(LBS_DEB_CMD);
176         return 0;
177 }
178
179 static int lbs_ret_802_11_bcn_ctrl(struct lbs_private * priv,
180                                         struct cmd_ds_command *resp)
181 {
182         struct cmd_ds_802_11_beacon_control *bcn_ctrl =
183             &resp->params.bcn_ctrl;
184
185         lbs_deb_enter(LBS_DEB_CMD);
186
187         if (bcn_ctrl->action == CMD_ACT_GET) {
188                 priv->beacon_enable = (u8) le16_to_cpu(bcn_ctrl->beacon_enable);
189                 priv->beacon_period = le16_to_cpu(bcn_ctrl->beacon_period);
190         }
191
192         lbs_deb_enter(LBS_DEB_CMD);
193         return 0;
194 }
195
196 static inline int handle_cmd_response(struct lbs_private *priv,
197                                       struct cmd_header *cmd_response)
198 {
199         struct cmd_ds_command *resp = (struct cmd_ds_command *) cmd_response;
200         int ret = 0;
201         unsigned long flags;
202         uint16_t respcmd = le16_to_cpu(resp->command);
203
204         lbs_deb_enter(LBS_DEB_HOST);
205
206         switch (respcmd) {
207         case CMD_RET(CMD_MAC_REG_ACCESS):
208         case CMD_RET(CMD_BBP_REG_ACCESS):
209         case CMD_RET(CMD_RF_REG_ACCESS):
210                 ret = lbs_ret_reg_access(priv, respcmd, resp);
211                 break;
212
213         case CMD_RET_802_11_ASSOCIATE:
214         case CMD_RET(CMD_802_11_ASSOCIATE):
215         case CMD_RET(CMD_802_11_REASSOCIATE):
216                 ret = lbs_ret_80211_associate(priv, resp);
217                 break;
218
219         case CMD_RET(CMD_802_11_SET_AFC):
220         case CMD_RET(CMD_802_11_GET_AFC):
221                 spin_lock_irqsave(&priv->driver_lock, flags);
222                 memmove((void *)priv->cur_cmd->callback_arg, &resp->params.afc,
223                         sizeof(struct cmd_ds_802_11_afc));
224                 spin_unlock_irqrestore(&priv->driver_lock, flags);
225
226                 break;
227
228         case CMD_RET(CMD_802_11_AUTHENTICATE):
229         case CMD_RET(CMD_802_11_BEACON_STOP):
230                 break;
231
232         case CMD_RET(CMD_802_11_RSSI):
233                 ret = lbs_ret_802_11_rssi(priv, resp);
234                 break;
235
236         case CMD_RET(CMD_802_11D_DOMAIN_INFO):
237                 ret = lbs_ret_802_11d_domain_info(resp);
238                 break;
239
240         case CMD_RET(CMD_802_11_TPC_CFG):
241                 spin_lock_irqsave(&priv->driver_lock, flags);
242                 memmove((void *)priv->cur_cmd->callback_arg, &resp->params.tpccfg,
243                         sizeof(struct cmd_ds_802_11_tpc_cfg));
244                 spin_unlock_irqrestore(&priv->driver_lock, flags);
245                 break;
246         case CMD_RET(CMD_802_11_LED_GPIO_CTRL):
247                 spin_lock_irqsave(&priv->driver_lock, flags);
248                 memmove((void *)priv->cur_cmd->callback_arg, &resp->params.ledgpio,
249                         sizeof(struct cmd_ds_802_11_led_ctrl));
250                 spin_unlock_irqrestore(&priv->driver_lock, flags);
251                 break;
252
253         case CMD_RET(CMD_GET_TSF):
254                 spin_lock_irqsave(&priv->driver_lock, flags);
255                 memcpy((void *)priv->cur_cmd->callback_arg,
256                        &resp->params.gettsf.tsfvalue, sizeof(u64));
257                 spin_unlock_irqrestore(&priv->driver_lock, flags);
258                 break;
259         case CMD_RET(CMD_BT_ACCESS):
260                 spin_lock_irqsave(&priv->driver_lock, flags);
261                 if (priv->cur_cmd->callback_arg)
262                         memcpy((void *)priv->cur_cmd->callback_arg,
263                                &resp->params.bt.addr1, 2 * ETH_ALEN);
264                 spin_unlock_irqrestore(&priv->driver_lock, flags);
265                 break;
266         case CMD_RET(CMD_FWT_ACCESS):
267                 spin_lock_irqsave(&priv->driver_lock, flags);
268                 if (priv->cur_cmd->callback_arg)
269                         memcpy((void *)priv->cur_cmd->callback_arg, &resp->params.fwt,
270                                sizeof(resp->params.fwt));
271                 spin_unlock_irqrestore(&priv->driver_lock, flags);
272                 break;
273         case CMD_RET(CMD_802_11_BEACON_CTRL):
274                 ret = lbs_ret_802_11_bcn_ctrl(priv, resp);
275                 break;
276
277         default:
278                 lbs_pr_err("CMD_RESP: unknown cmd response 0x%04x\n",
279                            le16_to_cpu(resp->command));
280                 break;
281         }
282         lbs_deb_leave(LBS_DEB_HOST);
283         return ret;
284 }
285
286 int lbs_process_command_response(struct lbs_private *priv, u8 *data, u32 len)
287 {
288         uint16_t respcmd, curcmd;
289         struct cmd_header *resp;
290         int ret = 0;
291         unsigned long flags;
292         uint16_t result;
293
294         lbs_deb_enter(LBS_DEB_HOST);
295
296         mutex_lock(&priv->lock);
297         spin_lock_irqsave(&priv->driver_lock, flags);
298
299         if (!priv->cur_cmd) {
300                 lbs_deb_host("CMD_RESP: cur_cmd is NULL\n");
301                 ret = -1;
302                 spin_unlock_irqrestore(&priv->driver_lock, flags);
303                 goto done;
304         }
305
306         resp = (void *)data;
307         curcmd = le16_to_cpu(priv->cur_cmd->cmdbuf->command);
308         respcmd = le16_to_cpu(resp->command);
309         result = le16_to_cpu(resp->result);
310
311         lbs_deb_cmd("CMD_RESP: response 0x%04x, seq %d, size %d\n",
312                      respcmd, le16_to_cpu(resp->seqnum), len);
313         lbs_deb_hex(LBS_DEB_CMD, "CMD_RESP", (void *) resp, len);
314
315         if (resp->seqnum != priv->cur_cmd->cmdbuf->seqnum) {
316                 lbs_pr_info("Received CMD_RESP with invalid sequence %d (expected %d)\n",
317                             le16_to_cpu(resp->seqnum), le16_to_cpu(priv->cur_cmd->cmdbuf->seqnum));
318                 spin_unlock_irqrestore(&priv->driver_lock, flags);
319                 ret = -1;
320                 goto done;
321         }
322         if (respcmd != CMD_RET(curcmd) &&
323             respcmd != CMD_RET_802_11_ASSOCIATE && curcmd != CMD_802_11_ASSOCIATE) {
324                 lbs_pr_info("Invalid CMD_RESP %x to command %x!\n", respcmd, curcmd);
325                 spin_unlock_irqrestore(&priv->driver_lock, flags);
326                 ret = -1;
327                 goto done;
328         }
329
330         if (resp->result == cpu_to_le16(0x0004)) {
331                 /* 0x0004 means -EAGAIN. Drop the response, let it time out
332                    and be resubmitted */
333                 lbs_pr_info("Firmware returns DEFER to command %x. Will let it time out...\n",
334                             le16_to_cpu(resp->command));
335                 spin_unlock_irqrestore(&priv->driver_lock, flags);
336                 ret = -1;
337                 goto done;
338         }
339
340         /* Now we got response from FW, cancel the command timer */
341         del_timer(&priv->command_timer);
342         priv->cmd_timed_out = 0;
343         if (priv->nr_retries) {
344                 lbs_pr_info("Received result %x to command %x after %d retries\n",
345                             result, curcmd, priv->nr_retries);
346                 priv->nr_retries = 0;
347         }
348
349         /* Store the response code to cur_cmd_retcode. */
350         priv->cur_cmd_retcode = result;
351
352         if (respcmd == CMD_RET(CMD_802_11_PS_MODE)) {
353                 struct cmd_ds_802_11_ps_mode *psmode = (void *) &resp[1];
354                 u16 action = le16_to_cpu(psmode->action);
355
356                 lbs_deb_host(
357                        "CMD_RESP: PS_MODE cmd reply result 0x%x, action 0x%x\n",
358                        result, action);
359
360                 if (result) {
361                         lbs_deb_host("CMD_RESP: PS command failed with 0x%x\n",
362                                     result);
363                         /*
364                          * We should not re-try enter-ps command in
365                          * ad-hoc mode. It takes place in
366                          * lbs_execute_next_command().
367                          */
368                         if (priv->mode == IW_MODE_ADHOC &&
369                             action == CMD_SUBCMD_ENTER_PS)
370                                 priv->psmode = LBS802_11POWERMODECAM;
371                 } else if (action == CMD_SUBCMD_ENTER_PS) {
372                         priv->needtowakeup = 0;
373                         priv->psstate = PS_STATE_AWAKE;
374
375                         lbs_deb_host("CMD_RESP: ENTER_PS command response\n");
376                         if (priv->connect_status != LBS_CONNECTED) {
377                                 /*
378                                  * When Deauth Event received before Enter_PS command
379                                  * response, We need to wake up the firmware.
380                                  */
381                                 lbs_deb_host(
382                                        "disconnected, invoking lbs_ps_wakeup\n");
383
384                                 spin_unlock_irqrestore(&priv->driver_lock, flags);
385                                 mutex_unlock(&priv->lock);
386                                 lbs_ps_wakeup(priv, 0);
387                                 mutex_lock(&priv->lock);
388                                 spin_lock_irqsave(&priv->driver_lock, flags);
389                         }
390                 } else if (action == CMD_SUBCMD_EXIT_PS) {
391                         priv->needtowakeup = 0;
392                         priv->psstate = PS_STATE_FULL_POWER;
393                         lbs_deb_host("CMD_RESP: EXIT_PS command response\n");
394                 } else {
395                         lbs_deb_host("CMD_RESP: PS action 0x%X\n", action);
396                 }
397
398                 lbs_complete_command(priv, priv->cur_cmd, result);
399                 spin_unlock_irqrestore(&priv->driver_lock, flags);
400
401                 ret = 0;
402                 goto done;
403         }
404
405         /* If the command is not successful, cleanup and return failure */
406         if ((result != 0 || !(respcmd & 0x8000))) {
407                 lbs_deb_host("CMD_RESP: error 0x%04x in command reply 0x%04x\n",
408                        result, respcmd);
409                 /*
410                  * Handling errors here
411                  */
412                 switch (respcmd) {
413                 case CMD_RET(CMD_GET_HW_SPEC):
414                 case CMD_RET(CMD_802_11_RESET):
415                         lbs_deb_host("CMD_RESP: reset failed\n");
416                         break;
417
418                 }
419                 lbs_complete_command(priv, priv->cur_cmd, result);
420                 spin_unlock_irqrestore(&priv->driver_lock, flags);
421
422                 ret = -1;
423                 goto done;
424         }
425
426         spin_unlock_irqrestore(&priv->driver_lock, flags);
427
428         if (priv->cur_cmd && priv->cur_cmd->callback) {
429                 ret = priv->cur_cmd->callback(priv, priv->cur_cmd->callback_arg,
430                                 resp);
431         } else
432                 ret = handle_cmd_response(priv, resp);
433
434         spin_lock_irqsave(&priv->driver_lock, flags);
435
436         if (priv->cur_cmd) {
437                 /* Clean up and Put current command back to cmdfreeq */
438                 lbs_complete_command(priv, priv->cur_cmd, result);
439         }
440         spin_unlock_irqrestore(&priv->driver_lock, flags);
441
442 done:
443         mutex_unlock(&priv->lock);
444         lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
445         return ret;
446 }
447
448 static int lbs_send_confirmwake(struct lbs_private *priv)
449 {
450         struct cmd_header cmd;
451         int ret = 0;
452
453         lbs_deb_enter(LBS_DEB_HOST);
454
455         cmd.command = cpu_to_le16(CMD_802_11_WAKEUP_CONFIRM);
456         cmd.size = cpu_to_le16(sizeof(cmd));
457         cmd.seqnum = cpu_to_le16(++priv->seqnum);
458         cmd.result = 0;
459
460         lbs_deb_hex(LBS_DEB_HOST, "wake confirm", (u8 *) &cmd,
461                 sizeof(cmd));
462
463         ret = priv->hw_host_to_card(priv, MVMS_CMD, (u8 *) &cmd, sizeof(cmd));
464         if (ret)
465                 lbs_pr_alert("SEND_WAKEC_CMD: Host to Card failed for Confirm Wake\n");
466
467         lbs_deb_leave_args(LBS_DEB_HOST, "ret %d", ret);
468         return ret;
469 }
470
471 int lbs_process_event(struct lbs_private *priv, u32 event)
472 {
473         int ret = 0;
474
475         lbs_deb_enter(LBS_DEB_CMD);
476
477         switch (event) {
478         case MACREG_INT_CODE_LINK_SENSED:
479                 lbs_deb_cmd("EVENT: link sensed\n");
480                 break;
481
482         case MACREG_INT_CODE_DEAUTHENTICATED:
483                 lbs_deb_cmd("EVENT: deauthenticated\n");
484                 lbs_mac_event_disconnected(priv);
485                 break;
486
487         case MACREG_INT_CODE_DISASSOCIATED:
488                 lbs_deb_cmd("EVENT: disassociated\n");
489                 lbs_mac_event_disconnected(priv);
490                 break;
491
492         case MACREG_INT_CODE_LINK_LOST_NO_SCAN:
493                 lbs_deb_cmd("EVENT: link lost\n");
494                 lbs_mac_event_disconnected(priv);
495                 break;
496
497         case MACREG_INT_CODE_PS_SLEEP:
498                 lbs_deb_cmd("EVENT: ps sleep\n");
499
500                 /* handle unexpected PS SLEEP event */
501                 if (priv->psstate == PS_STATE_FULL_POWER) {
502                         lbs_deb_cmd(
503                                "EVENT: in FULL POWER mode, ignoreing PS_SLEEP\n");
504                         break;
505                 }
506                 priv->psstate = PS_STATE_PRE_SLEEP;
507
508                 lbs_ps_confirm_sleep(priv);
509
510                 break;
511
512         case MACREG_INT_CODE_HOST_AWAKE:
513                 lbs_deb_cmd("EVENT: host awake\n");
514                 lbs_send_confirmwake(priv);
515                 break;
516
517         case MACREG_INT_CODE_PS_AWAKE:
518                 lbs_deb_cmd("EVENT: ps awake\n");
519                 /* handle unexpected PS AWAKE event */
520                 if (priv->psstate == PS_STATE_FULL_POWER) {
521                         lbs_deb_cmd(
522                                "EVENT: In FULL POWER mode - ignore PS AWAKE\n");
523                         break;
524                 }
525
526                 priv->psstate = PS_STATE_AWAKE;
527
528                 if (priv->needtowakeup) {
529                         /*
530                          * wait for the command processing to finish
531                          * before resuming sending
532                          * priv->needtowakeup will be set to FALSE
533                          * in lbs_ps_wakeup()
534                          */
535                         lbs_deb_cmd("waking up ...\n");
536                         lbs_ps_wakeup(priv, 0);
537                 }
538                 break;
539
540         case MACREG_INT_CODE_MIC_ERR_UNICAST:
541                 lbs_deb_cmd("EVENT: UNICAST MIC ERROR\n");
542                 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_UNICAST);
543                 break;
544
545         case MACREG_INT_CODE_MIC_ERR_MULTICAST:
546                 lbs_deb_cmd("EVENT: MULTICAST MIC ERROR\n");
547                 handle_mic_failureevent(priv, MACREG_INT_CODE_MIC_ERR_MULTICAST);
548                 break;
549
550         case MACREG_INT_CODE_MIB_CHANGED:
551                 lbs_deb_cmd("EVENT: MIB CHANGED\n");
552                 break;
553         case MACREG_INT_CODE_INIT_DONE:
554                 lbs_deb_cmd("EVENT: INIT DONE\n");
555                 break;
556         case MACREG_INT_CODE_ADHOC_BCN_LOST:
557                 lbs_deb_cmd("EVENT: ADHOC beacon lost\n");
558                 break;
559         case MACREG_INT_CODE_RSSI_LOW:
560                 lbs_pr_alert("EVENT: rssi low\n");
561                 break;
562         case MACREG_INT_CODE_SNR_LOW:
563                 lbs_pr_alert("EVENT: snr low\n");
564                 break;
565         case MACREG_INT_CODE_MAX_FAIL:
566                 lbs_pr_alert("EVENT: max fail\n");
567                 break;
568         case MACREG_INT_CODE_RSSI_HIGH:
569                 lbs_pr_alert("EVENT: rssi high\n");
570                 break;
571         case MACREG_INT_CODE_SNR_HIGH:
572                 lbs_pr_alert("EVENT: snr high\n");
573                 break;
574
575         case MACREG_INT_CODE_MESH_AUTO_STARTED:
576                 /* Ignore spurious autostart events if autostart is disabled */
577                 if (!priv->mesh_autostart_enabled) {
578                         lbs_pr_info("EVENT: MESH_AUTO_STARTED (ignoring)\n");
579                         break;
580                 }
581                 lbs_pr_info("EVENT: MESH_AUTO_STARTED\n");
582                 priv->mesh_connect_status = LBS_CONNECTED;
583                 if (priv->mesh_open) {
584                         netif_carrier_on(priv->mesh_dev);
585                         if (!priv->tx_pending_len)
586                                 netif_wake_queue(priv->mesh_dev);
587                 }
588                 priv->mode = IW_MODE_ADHOC;
589                 schedule_work(&priv->sync_channel);
590                 break;
591
592         default:
593                 lbs_pr_alert("EVENT: unknown event id %d\n", event);
594                 break;
595         }
596
597         lbs_deb_leave_args(LBS_DEB_CMD, "ret %d", ret);
598         return ret;
599 }