Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs
[linux/fpc-iii.git] / net / nfc / digital_core.c
blobc129d1571ca6c55281807781aeb803d6f9f9415b
1 /*
2 * NFC Digital Protocol stack
3 * Copyright (c) 2013, Intel Corporation.
5 * This program is free software; you can redistribute it and/or modify it
6 * under the terms and conditions of the GNU General Public License,
7 * version 2, as published by the Free Software Foundation.
9 * This program is distributed in the hope it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
16 #define pr_fmt(fmt) "digital: %s: " fmt, __func__
18 #include <linux/module.h>
20 #include "digital.h"
22 #define DIGITAL_PROTO_NFCA_RF_TECH \
23 (NFC_PROTO_JEWEL_MASK | NFC_PROTO_MIFARE_MASK | NFC_PROTO_NFC_DEP_MASK)
25 #define DIGITAL_PROTO_NFCF_RF_TECH \
26 (NFC_PROTO_FELICA_MASK | NFC_PROTO_NFC_DEP_MASK)
28 struct digital_cmd {
29 struct list_head queue;
31 u8 type;
32 u8 pending;
34 u16 timeout;
35 struct sk_buff *req;
36 struct sk_buff *resp;
37 struct digital_tg_mdaa_params *mdaa_params;
39 nfc_digital_cmd_complete_t cmd_cb;
40 void *cb_context;
43 struct sk_buff *digital_skb_alloc(struct nfc_digital_dev *ddev,
44 unsigned int len)
46 struct sk_buff *skb;
48 skb = alloc_skb(len + ddev->tx_headroom + ddev->tx_tailroom,
49 GFP_KERNEL);
50 if (skb)
51 skb_reserve(skb, ddev->tx_headroom);
53 return skb;
56 void digital_skb_add_crc(struct sk_buff *skb, crc_func_t crc_func, u16 init,
57 u8 bitwise_inv, u8 msb_first)
59 u16 crc;
61 crc = crc_func(init, skb->data, skb->len);
63 if (bitwise_inv)
64 crc = ~crc;
66 if (msb_first)
67 crc = __fswab16(crc);
69 *skb_put(skb, 1) = crc & 0xFF;
70 *skb_put(skb, 1) = (crc >> 8) & 0xFF;
73 int digital_skb_check_crc(struct sk_buff *skb, crc_func_t crc_func,
74 u16 crc_init, u8 bitwise_inv, u8 msb_first)
76 int rc;
77 u16 crc;
79 if (skb->len <= 2)
80 return -EIO;
82 crc = crc_func(crc_init, skb->data, skb->len - 2);
84 if (bitwise_inv)
85 crc = ~crc;
87 if (msb_first)
88 crc = __swab16(crc);
90 rc = (skb->data[skb->len - 2] - (crc & 0xFF)) +
91 (skb->data[skb->len - 1] - ((crc >> 8) & 0xFF));
93 if (rc)
94 return -EIO;
96 skb_trim(skb, skb->len - 2);
98 return 0;
101 static inline void digital_switch_rf(struct nfc_digital_dev *ddev, bool on)
103 ddev->ops->switch_rf(ddev, on);
106 static inline void digital_abort_cmd(struct nfc_digital_dev *ddev)
108 ddev->ops->abort_cmd(ddev);
111 static void digital_wq_cmd_complete(struct work_struct *work)
113 struct digital_cmd *cmd;
114 struct nfc_digital_dev *ddev = container_of(work,
115 struct nfc_digital_dev,
116 cmd_complete_work);
118 mutex_lock(&ddev->cmd_lock);
120 cmd = list_first_entry_or_null(&ddev->cmd_queue, struct digital_cmd,
121 queue);
122 if (!cmd) {
123 mutex_unlock(&ddev->cmd_lock);
124 return;
127 list_del(&cmd->queue);
129 mutex_unlock(&ddev->cmd_lock);
131 if (!IS_ERR(cmd->resp))
132 print_hex_dump_debug("DIGITAL RX: ", DUMP_PREFIX_NONE, 16, 1,
133 cmd->resp->data, cmd->resp->len, false);
135 cmd->cmd_cb(ddev, cmd->cb_context, cmd->resp);
137 kfree(cmd->mdaa_params);
138 kfree(cmd);
140 schedule_work(&ddev->cmd_work);
143 static void digital_send_cmd_complete(struct nfc_digital_dev *ddev,
144 void *arg, struct sk_buff *resp)
146 struct digital_cmd *cmd = arg;
148 cmd->resp = resp;
150 schedule_work(&ddev->cmd_complete_work);
153 static void digital_wq_cmd(struct work_struct *work)
155 int rc;
156 struct digital_cmd *cmd;
157 struct digital_tg_mdaa_params *params;
158 struct nfc_digital_dev *ddev = container_of(work,
159 struct nfc_digital_dev,
160 cmd_work);
162 mutex_lock(&ddev->cmd_lock);
164 cmd = list_first_entry_or_null(&ddev->cmd_queue, struct digital_cmd,
165 queue);
166 if (!cmd || cmd->pending) {
167 mutex_unlock(&ddev->cmd_lock);
168 return;
171 mutex_unlock(&ddev->cmd_lock);
173 if (cmd->req)
174 print_hex_dump_debug("DIGITAL TX: ", DUMP_PREFIX_NONE, 16, 1,
175 cmd->req->data, cmd->req->len, false);
177 switch (cmd->type) {
178 case DIGITAL_CMD_IN_SEND:
179 rc = ddev->ops->in_send_cmd(ddev, cmd->req, cmd->timeout,
180 digital_send_cmd_complete, cmd);
181 break;
183 case DIGITAL_CMD_TG_SEND:
184 rc = ddev->ops->tg_send_cmd(ddev, cmd->req, cmd->timeout,
185 digital_send_cmd_complete, cmd);
186 break;
188 case DIGITAL_CMD_TG_LISTEN:
189 rc = ddev->ops->tg_listen(ddev, cmd->timeout,
190 digital_send_cmd_complete, cmd);
191 break;
193 case DIGITAL_CMD_TG_LISTEN_MDAA:
194 params = cmd->mdaa_params;
196 rc = ddev->ops->tg_listen_mdaa(ddev, params, cmd->timeout,
197 digital_send_cmd_complete, cmd);
198 break;
200 default:
201 pr_err("Unknown cmd type %d\n", cmd->type);
202 return;
205 if (!rc)
206 return;
208 pr_err("in_send_command returned err %d\n", rc);
210 mutex_lock(&ddev->cmd_lock);
211 list_del(&cmd->queue);
212 mutex_unlock(&ddev->cmd_lock);
214 kfree_skb(cmd->req);
215 kfree(cmd->mdaa_params);
216 kfree(cmd);
218 schedule_work(&ddev->cmd_work);
221 int digital_send_cmd(struct nfc_digital_dev *ddev, u8 cmd_type,
222 struct sk_buff *skb, struct digital_tg_mdaa_params *params,
223 u16 timeout, nfc_digital_cmd_complete_t cmd_cb,
224 void *cb_context)
226 struct digital_cmd *cmd;
228 cmd = kzalloc(sizeof(struct digital_cmd), GFP_KERNEL);
229 if (!cmd)
230 return -ENOMEM;
232 cmd->type = cmd_type;
233 cmd->timeout = timeout;
234 cmd->req = skb;
235 cmd->mdaa_params = params;
236 cmd->cmd_cb = cmd_cb;
237 cmd->cb_context = cb_context;
238 INIT_LIST_HEAD(&cmd->queue);
240 mutex_lock(&ddev->cmd_lock);
241 list_add_tail(&cmd->queue, &ddev->cmd_queue);
242 mutex_unlock(&ddev->cmd_lock);
244 schedule_work(&ddev->cmd_work);
246 return 0;
249 int digital_in_configure_hw(struct nfc_digital_dev *ddev, int type, int param)
251 int rc;
253 rc = ddev->ops->in_configure_hw(ddev, type, param);
254 if (rc)
255 pr_err("in_configure_hw failed: %d\n", rc);
257 return rc;
260 int digital_tg_configure_hw(struct nfc_digital_dev *ddev, int type, int param)
262 int rc;
264 rc = ddev->ops->tg_configure_hw(ddev, type, param);
265 if (rc)
266 pr_err("tg_configure_hw failed: %d\n", rc);
268 return rc;
271 static int digital_tg_listen_mdaa(struct nfc_digital_dev *ddev, u8 rf_tech)
273 struct digital_tg_mdaa_params *params;
275 params = kzalloc(sizeof(struct digital_tg_mdaa_params), GFP_KERNEL);
276 if (!params)
277 return -ENOMEM;
279 params->sens_res = DIGITAL_SENS_RES_NFC_DEP;
280 get_random_bytes(params->nfcid1, sizeof(params->nfcid1));
281 params->sel_res = DIGITAL_SEL_RES_NFC_DEP;
283 params->nfcid2[0] = DIGITAL_SENSF_NFCID2_NFC_DEP_B1;
284 params->nfcid2[1] = DIGITAL_SENSF_NFCID2_NFC_DEP_B2;
285 get_random_bytes(params->nfcid2 + 2, NFC_NFCID2_MAXSIZE - 2);
286 params->sc = DIGITAL_SENSF_FELICA_SC;
288 return digital_send_cmd(ddev, DIGITAL_CMD_TG_LISTEN_MDAA, NULL, params,
289 500, digital_tg_recv_atr_req, NULL);
292 int digital_target_found(struct nfc_digital_dev *ddev,
293 struct nfc_target *target, u8 protocol)
295 int rc;
296 u8 framing;
297 u8 rf_tech;
298 int (*check_crc)(struct sk_buff *skb);
299 void (*add_crc)(struct sk_buff *skb);
301 rf_tech = ddev->poll_techs[ddev->poll_tech_index].rf_tech;
303 switch (protocol) {
304 case NFC_PROTO_JEWEL:
305 framing = NFC_DIGITAL_FRAMING_NFCA_T1T;
306 check_crc = digital_skb_check_crc_b;
307 add_crc = digital_skb_add_crc_b;
308 break;
310 case NFC_PROTO_MIFARE:
311 framing = NFC_DIGITAL_FRAMING_NFCA_T2T;
312 check_crc = digital_skb_check_crc_a;
313 add_crc = digital_skb_add_crc_a;
314 break;
316 case NFC_PROTO_FELICA:
317 framing = NFC_DIGITAL_FRAMING_NFCF_T3T;
318 check_crc = digital_skb_check_crc_f;
319 add_crc = digital_skb_add_crc_f;
320 break;
322 case NFC_PROTO_NFC_DEP:
323 if (rf_tech == NFC_DIGITAL_RF_TECH_106A) {
324 framing = NFC_DIGITAL_FRAMING_NFCA_NFC_DEP;
325 check_crc = digital_skb_check_crc_a;
326 add_crc = digital_skb_add_crc_a;
327 } else {
328 framing = NFC_DIGITAL_FRAMING_NFCF_NFC_DEP;
329 check_crc = digital_skb_check_crc_f;
330 add_crc = digital_skb_add_crc_f;
332 break;
334 default:
335 pr_err("Invalid protocol %d\n", protocol);
336 return -EINVAL;
339 pr_debug("rf_tech=%d, protocol=%d\n", rf_tech, protocol);
341 ddev->curr_rf_tech = rf_tech;
343 if (DIGITAL_DRV_CAPS_IN_CRC(ddev)) {
344 ddev->skb_add_crc = digital_skb_add_crc_none;
345 ddev->skb_check_crc = digital_skb_check_crc_none;
346 } else {
347 ddev->skb_add_crc = add_crc;
348 ddev->skb_check_crc = check_crc;
351 rc = digital_in_configure_hw(ddev, NFC_DIGITAL_CONFIG_FRAMING, framing);
352 if (rc)
353 return rc;
355 target->supported_protocols = (1 << protocol);
356 rc = nfc_targets_found(ddev->nfc_dev, target, 1);
357 if (rc)
358 return rc;
360 ddev->poll_tech_count = 0;
362 return 0;
365 void digital_poll_next_tech(struct nfc_digital_dev *ddev)
367 digital_switch_rf(ddev, 0);
369 mutex_lock(&ddev->poll_lock);
371 if (!ddev->poll_tech_count) {
372 mutex_unlock(&ddev->poll_lock);
373 return;
376 ddev->poll_tech_index = (ddev->poll_tech_index + 1) %
377 ddev->poll_tech_count;
379 mutex_unlock(&ddev->poll_lock);
381 schedule_work(&ddev->poll_work);
384 static void digital_wq_poll(struct work_struct *work)
386 int rc;
387 struct digital_poll_tech *poll_tech;
388 struct nfc_digital_dev *ddev = container_of(work,
389 struct nfc_digital_dev,
390 poll_work);
391 mutex_lock(&ddev->poll_lock);
393 if (!ddev->poll_tech_count) {
394 mutex_unlock(&ddev->poll_lock);
395 return;
398 poll_tech = &ddev->poll_techs[ddev->poll_tech_index];
400 mutex_unlock(&ddev->poll_lock);
402 rc = poll_tech->poll_func(ddev, poll_tech->rf_tech);
403 if (rc)
404 digital_poll_next_tech(ddev);
407 static void digital_add_poll_tech(struct nfc_digital_dev *ddev, u8 rf_tech,
408 digital_poll_t poll_func)
410 struct digital_poll_tech *poll_tech;
412 if (ddev->poll_tech_count >= NFC_DIGITAL_POLL_MODE_COUNT_MAX)
413 return;
415 poll_tech = &ddev->poll_techs[ddev->poll_tech_count++];
417 poll_tech->rf_tech = rf_tech;
418 poll_tech->poll_func = poll_func;
422 * start_poll operation
424 * For every supported protocol, the corresponding polling function is added
425 * to the table of polling technologies (ddev->poll_techs[]) using
426 * digital_add_poll_tech().
427 * When a polling function fails (by timeout or protocol error) the next one is
428 * schedule by digital_poll_next_tech() on the poll workqueue (ddev->poll_work).
430 static int digital_start_poll(struct nfc_dev *nfc_dev, __u32 im_protocols,
431 __u32 tm_protocols)
433 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
434 u32 matching_im_protocols, matching_tm_protocols;
436 pr_debug("protocols: im 0x%x, tm 0x%x, supported 0x%x\n", im_protocols,
437 tm_protocols, ddev->protocols);
439 matching_im_protocols = ddev->protocols & im_protocols;
440 matching_tm_protocols = ddev->protocols & tm_protocols;
442 if (!matching_im_protocols && !matching_tm_protocols) {
443 pr_err("Unknown protocol\n");
444 return -EINVAL;
447 if (ddev->poll_tech_count) {
448 pr_err("Already polling\n");
449 return -EBUSY;
452 if (ddev->curr_protocol) {
453 pr_err("A target is already active\n");
454 return -EBUSY;
457 ddev->poll_tech_count = 0;
458 ddev->poll_tech_index = 0;
460 if (matching_im_protocols & DIGITAL_PROTO_NFCA_RF_TECH)
461 digital_add_poll_tech(ddev, NFC_DIGITAL_RF_TECH_106A,
462 digital_in_send_sens_req);
464 if (im_protocols & DIGITAL_PROTO_NFCF_RF_TECH) {
465 digital_add_poll_tech(ddev, NFC_DIGITAL_RF_TECH_212F,
466 digital_in_send_sensf_req);
468 digital_add_poll_tech(ddev, NFC_DIGITAL_RF_TECH_424F,
469 digital_in_send_sensf_req);
472 if (tm_protocols & NFC_PROTO_NFC_DEP_MASK) {
473 if (ddev->ops->tg_listen_mdaa) {
474 digital_add_poll_tech(ddev, 0,
475 digital_tg_listen_mdaa);
476 } else {
477 digital_add_poll_tech(ddev, NFC_DIGITAL_RF_TECH_106A,
478 digital_tg_listen_nfca);
480 digital_add_poll_tech(ddev, NFC_DIGITAL_RF_TECH_212F,
481 digital_tg_listen_nfcf);
483 digital_add_poll_tech(ddev, NFC_DIGITAL_RF_TECH_424F,
484 digital_tg_listen_nfcf);
488 if (!ddev->poll_tech_count) {
489 pr_err("Unsupported protocols: im=0x%x, tm=0x%x\n",
490 matching_im_protocols, matching_tm_protocols);
491 return -EINVAL;
494 schedule_work(&ddev->poll_work);
496 return 0;
499 static void digital_stop_poll(struct nfc_dev *nfc_dev)
501 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
503 mutex_lock(&ddev->poll_lock);
505 if (!ddev->poll_tech_count) {
506 pr_err("Polling operation was not running\n");
507 mutex_unlock(&ddev->poll_lock);
508 return;
511 ddev->poll_tech_count = 0;
513 mutex_unlock(&ddev->poll_lock);
515 cancel_work_sync(&ddev->poll_work);
517 digital_abort_cmd(ddev);
520 static int digital_dev_up(struct nfc_dev *nfc_dev)
522 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
524 digital_switch_rf(ddev, 1);
526 return 0;
529 static int digital_dev_down(struct nfc_dev *nfc_dev)
531 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
533 digital_switch_rf(ddev, 0);
535 return 0;
538 static int digital_dep_link_up(struct nfc_dev *nfc_dev,
539 struct nfc_target *target,
540 __u8 comm_mode, __u8 *gb, size_t gb_len)
542 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
543 int rc;
545 rc = digital_in_send_atr_req(ddev, target, comm_mode, gb, gb_len);
547 if (!rc)
548 ddev->curr_protocol = NFC_PROTO_NFC_DEP;
550 return rc;
553 static int digital_dep_link_down(struct nfc_dev *nfc_dev)
555 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
557 ddev->curr_protocol = 0;
559 return 0;
562 static int digital_activate_target(struct nfc_dev *nfc_dev,
563 struct nfc_target *target, __u32 protocol)
565 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
567 if (ddev->poll_tech_count) {
568 pr_err("Can't activate a target while polling\n");
569 return -EBUSY;
572 if (ddev->curr_protocol) {
573 pr_err("A target is already active\n");
574 return -EBUSY;
577 ddev->curr_protocol = protocol;
579 return 0;
582 static void digital_deactivate_target(struct nfc_dev *nfc_dev,
583 struct nfc_target *target)
585 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
587 if (!ddev->curr_protocol) {
588 pr_err("No active target\n");
589 return;
592 ddev->curr_protocol = 0;
595 static int digital_tg_send(struct nfc_dev *dev, struct sk_buff *skb)
597 struct nfc_digital_dev *ddev = nfc_get_drvdata(dev);
599 return digital_tg_send_dep_res(ddev, skb);
602 static void digital_in_send_complete(struct nfc_digital_dev *ddev, void *arg,
603 struct sk_buff *resp)
605 struct digital_data_exch *data_exch = arg;
606 int rc;
608 if (IS_ERR(resp)) {
609 rc = PTR_ERR(resp);
610 goto done;
613 if (ddev->curr_protocol == NFC_PROTO_MIFARE)
614 rc = digital_in_recv_mifare_res(resp);
615 else
616 rc = ddev->skb_check_crc(resp);
618 if (rc) {
619 kfree_skb(resp);
620 resp = NULL;
623 done:
624 data_exch->cb(data_exch->cb_context, resp, rc);
626 kfree(data_exch);
629 static int digital_in_send(struct nfc_dev *nfc_dev, struct nfc_target *target,
630 struct sk_buff *skb, data_exchange_cb_t cb,
631 void *cb_context)
633 struct nfc_digital_dev *ddev = nfc_get_drvdata(nfc_dev);
634 struct digital_data_exch *data_exch;
636 data_exch = kzalloc(sizeof(struct digital_data_exch), GFP_KERNEL);
637 if (!data_exch) {
638 pr_err("Failed to allocate data_exch struct\n");
639 return -ENOMEM;
642 data_exch->cb = cb;
643 data_exch->cb_context = cb_context;
645 if (ddev->curr_protocol == NFC_PROTO_NFC_DEP)
646 return digital_in_send_dep_req(ddev, target, skb, data_exch);
648 ddev->skb_add_crc(skb);
650 return digital_in_send_cmd(ddev, skb, 500, digital_in_send_complete,
651 data_exch);
654 static struct nfc_ops digital_nfc_ops = {
655 .dev_up = digital_dev_up,
656 .dev_down = digital_dev_down,
657 .start_poll = digital_start_poll,
658 .stop_poll = digital_stop_poll,
659 .dep_link_up = digital_dep_link_up,
660 .dep_link_down = digital_dep_link_down,
661 .activate_target = digital_activate_target,
662 .deactivate_target = digital_deactivate_target,
663 .tm_send = digital_tg_send,
664 .im_transceive = digital_in_send,
667 struct nfc_digital_dev *nfc_digital_allocate_device(struct nfc_digital_ops *ops,
668 __u32 supported_protocols,
669 __u32 driver_capabilities,
670 int tx_headroom, int tx_tailroom)
672 struct nfc_digital_dev *ddev;
674 if (!ops->in_configure_hw || !ops->in_send_cmd || !ops->tg_listen ||
675 !ops->tg_configure_hw || !ops->tg_send_cmd || !ops->abort_cmd ||
676 !ops->switch_rf)
677 return NULL;
679 ddev = kzalloc(sizeof(struct nfc_digital_dev), GFP_KERNEL);
680 if (!ddev)
681 return NULL;
683 ddev->driver_capabilities = driver_capabilities;
684 ddev->ops = ops;
686 mutex_init(&ddev->cmd_lock);
687 INIT_LIST_HEAD(&ddev->cmd_queue);
689 INIT_WORK(&ddev->cmd_work, digital_wq_cmd);
690 INIT_WORK(&ddev->cmd_complete_work, digital_wq_cmd_complete);
692 mutex_init(&ddev->poll_lock);
693 INIT_WORK(&ddev->poll_work, digital_wq_poll);
695 if (supported_protocols & NFC_PROTO_JEWEL_MASK)
696 ddev->protocols |= NFC_PROTO_JEWEL_MASK;
697 if (supported_protocols & NFC_PROTO_MIFARE_MASK)
698 ddev->protocols |= NFC_PROTO_MIFARE_MASK;
699 if (supported_protocols & NFC_PROTO_FELICA_MASK)
700 ddev->protocols |= NFC_PROTO_FELICA_MASK;
701 if (supported_protocols & NFC_PROTO_NFC_DEP_MASK)
702 ddev->protocols |= NFC_PROTO_NFC_DEP_MASK;
704 ddev->tx_headroom = tx_headroom + DIGITAL_MAX_HEADER_LEN;
705 ddev->tx_tailroom = tx_tailroom + DIGITAL_CRC_LEN;
707 ddev->nfc_dev = nfc_allocate_device(&digital_nfc_ops, ddev->protocols,
708 ddev->tx_headroom,
709 ddev->tx_tailroom);
710 if (!ddev->nfc_dev) {
711 pr_err("nfc_allocate_device failed\n");
712 goto free_dev;
715 nfc_set_drvdata(ddev->nfc_dev, ddev);
717 return ddev;
719 free_dev:
720 kfree(ddev);
722 return NULL;
724 EXPORT_SYMBOL(nfc_digital_allocate_device);
726 void nfc_digital_free_device(struct nfc_digital_dev *ddev)
728 nfc_free_device(ddev->nfc_dev);
729 kfree(ddev);
731 EXPORT_SYMBOL(nfc_digital_free_device);
733 int nfc_digital_register_device(struct nfc_digital_dev *ddev)
735 return nfc_register_device(ddev->nfc_dev);
737 EXPORT_SYMBOL(nfc_digital_register_device);
739 void nfc_digital_unregister_device(struct nfc_digital_dev *ddev)
741 struct digital_cmd *cmd, *n;
743 nfc_unregister_device(ddev->nfc_dev);
745 mutex_lock(&ddev->poll_lock);
746 ddev->poll_tech_count = 0;
747 mutex_unlock(&ddev->poll_lock);
749 cancel_work_sync(&ddev->poll_work);
750 cancel_work_sync(&ddev->cmd_work);
751 cancel_work_sync(&ddev->cmd_complete_work);
753 list_for_each_entry_safe(cmd, n, &ddev->cmd_queue, queue) {
754 list_del(&cmd->queue);
755 kfree(cmd->mdaa_params);
756 kfree(cmd);
759 EXPORT_SYMBOL(nfc_digital_unregister_device);
761 MODULE_LICENSE("GPL");