Linux Kernel  3.7.1
 All Data Structures Namespaces Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
lib.c
Go to the documentation of this file.
1 /*
2  * The NFC Controller Interface is the communication protocol between an
3  * NFC Controller (NFCC) and a Device Host (DH).
4  *
5  * Copyright (C) 2011 Texas Instruments, Inc.
6  *
7  * Written by Ilan Elias <[email protected]>
8  *
9  * Acknowledgements:
10  * This file is based on lib.c, which was written
11  * by Maxim Krasnyansky.
12  *
13  * This program is free software; you can redistribute it and/or modify
14  * it under the terms of the GNU General Public License version 2
15  * as published by the Free Software Foundation
16  *
17  * This program is distributed in the hope that it will be useful,
18  * but WITHOUT ANY WARRANTY; without even the implied warranty of
19  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
20  * GNU General Public License for more details.
21  *
22  * You should have received a copy of the GNU General Public License
23  * along with this program; if not, write to the Free Software
24  * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25  *
26  */
27 
28 #include <linux/module.h>
29 #include <linux/kernel.h>
30 #include <linux/types.h>
31 #include <linux/errno.h>
32 
33 #include <net/nfc/nci.h>
34 #include <net/nfc/nci_core.h>
35 
36 /* NCI status codes to Unix errno mapping */
38 {
39  switch (code) {
40  case NCI_STATUS_OK:
41  return 0;
42 
44  return -EBUSY;
45 
47  return -EBADMSG;
48 
50  return -EHOSTDOWN;
51 
57  return -EPROTO;
58 
61  return -EBADRQC;
62 
64  return -EMSGSIZE;
65 
67  return -EALREADY;
68 
71  return -ECONNREFUSED;
72 
75  return -ECOMM;
76 
79  return -ETIMEDOUT;
80 
81  case NCI_STATUS_FAILED:
82  default:
83  return -ENOSYS;
84  }
85 }