linux/net/nfc/nci/lib.c
Thomas Gleixner caab277b1d treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 234
Based on 1 normalized pattern(s):

  this program is free software you can redistribute it and or modify
  it under the terms of the gnu general public license version 2 as
  published by the free software foundation this program is
  distributed in the hope that it will be useful but without any
  warranty without even the implied warranty of merchantability or
  fitness for a particular purpose see the gnu general public license
  for more details you should have received a copy of the gnu general
  public license along with this program if not see http www gnu org
  licenses

extracted by the scancode license scanner the SPDX license identifier

  GPL-2.0-only

has been chosen to replace the boilerplate/reference in 503 file(s).

Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Reviewed-by: Alexios Zavras <alexios.zavras@intel.com>
Reviewed-by: Allison Randal <allison@lohutok.net>
Reviewed-by: Enrico Weigelt <info@metux.net>
Cc: linux-spdx@vger.kernel.org
Link: https://lkml.kernel.org/r/20190602204653.811534538@linutronix.de
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2019-06-19 17:09:07 +02:00

74 lines
1.6 KiB
C

// SPDX-License-Identifier: GPL-2.0-only
/*
* The NFC Controller Interface is the communication protocol between an
* NFC Controller (NFCC) and a Device Host (DH).
*
* Copyright (C) 2011 Texas Instruments, Inc.
*
* Written by Ilan Elias <ilane@ti.com>
*
* Acknowledgements:
* This file is based on lib.c, which was written
* by Maxim Krasnyansky.
*/
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/types.h>
#include <linux/errno.h>
#include <net/nfc/nci.h>
#include <net/nfc/nci_core.h>
/* NCI status codes to Unix errno mapping */
int nci_to_errno(__u8 code)
{
switch (code) {
case NCI_STATUS_OK:
return 0;
case NCI_STATUS_REJECTED:
return -EBUSY;
case NCI_STATUS_RF_FRAME_CORRUPTED:
return -EBADMSG;
case NCI_STATUS_NOT_INITIALIZED:
return -EHOSTDOWN;
case NCI_STATUS_SYNTAX_ERROR:
case NCI_STATUS_SEMANTIC_ERROR:
case NCI_STATUS_INVALID_PARAM:
case NCI_STATUS_RF_PROTOCOL_ERROR:
case NCI_STATUS_NFCEE_PROTOCOL_ERROR:
return -EPROTO;
case NCI_STATUS_UNKNOWN_GID:
case NCI_STATUS_UNKNOWN_OID:
return -EBADRQC;
case NCI_STATUS_MESSAGE_SIZE_EXCEEDED:
return -EMSGSIZE;
case NCI_STATUS_DISCOVERY_ALREADY_STARTED:
return -EALREADY;
case NCI_STATUS_DISCOVERY_TARGET_ACTIVATION_FAILED:
case NCI_STATUS_NFCEE_INTERFACE_ACTIVATION_FAILED:
return -ECONNREFUSED;
case NCI_STATUS_RF_TRANSMISSION_ERROR:
case NCI_STATUS_NFCEE_TRANSMISSION_ERROR:
return -ECOMM;
case NCI_STATUS_RF_TIMEOUT_ERROR:
case NCI_STATUS_NFCEE_TIMEOUT_ERROR:
return -ETIMEDOUT;
case NCI_STATUS_FAILED:
default:
return -ENOSYS;
}
}
EXPORT_SYMBOL(nci_to_errno);