~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/net/nfc/nci/lib.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  *  The NFC Controller Interface is the communication protocol between an
  4  *  NFC Controller (NFCC) and a Device Host (DH).
  5  *
  6  *  Copyright (C) 2011 Texas Instruments, Inc.
  7  *
  8  *  Written by Ilan Elias <ilane@ti.com>
  9  *
 10  *  Acknowledgements:
 11  *  This file is based on lib.c, which was written
 12  *  by Maxim Krasnyansky.
 13  */
 14 
 15 #include <linux/module.h>
 16 #include <linux/kernel.h>
 17 #include <linux/types.h>
 18 #include <linux/errno.h>
 19 
 20 #include <net/nfc/nci.h>
 21 #include <net/nfc/nci_core.h>
 22 
 23 /* NCI status codes to Unix errno mapping */
 24 int nci_to_errno(__u8 code)
 25 {
 26         switch (code) {
 27         case NCI_STATUS_OK:
 28                 return 0;
 29 
 30         case NCI_STATUS_REJECTED:
 31                 return -EBUSY;
 32 
 33         case NCI_STATUS_RF_FRAME_CORRUPTED:
 34                 return -EBADMSG;
 35 
 36         case NCI_STATUS_NOT_INITIALIZED:
 37                 return -EHOSTDOWN;
 38 
 39         case NCI_STATUS_SYNTAX_ERROR:
 40         case NCI_STATUS_SEMANTIC_ERROR:
 41         case NCI_STATUS_INVALID_PARAM:
 42         case NCI_STATUS_RF_PROTOCOL_ERROR:
 43         case NCI_STATUS_NFCEE_PROTOCOL_ERROR:
 44                 return -EPROTO;
 45 
 46         case NCI_STATUS_UNKNOWN_GID:
 47         case NCI_STATUS_UNKNOWN_OID:
 48                 return -EBADRQC;
 49 
 50         case NCI_STATUS_MESSAGE_SIZE_EXCEEDED:
 51                 return -EMSGSIZE;
 52 
 53         case NCI_STATUS_DISCOVERY_ALREADY_STARTED:
 54                 return -EALREADY;
 55 
 56         case NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED:
 57         case NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED:
 58                 return -ECONNREFUSED;
 59 
 60         case NCI_STATUS_RF_TRANSMISSION_ERROR:
 61         case NCI_STATUS_NFCEE_TRANSMISSION_ERROR:
 62                 return -ECOMM;
 63 
 64         case NCI_STATUS_RF_TIMEOUT_ERROR:
 65         case NCI_STATUS_NFCEE_TIMEOUT_ERROR:
 66                 return -ETIMEDOUT;
 67 
 68         case NCI_STATUS_FAILED:
 69         default:
 70                 return -ENOSYS;
 71         }
 72 }
 73 EXPORT_SYMBOL(nci_to_errno);
 74 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php