/*
 *  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.
 *
 *  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/>.
 *
 */

#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);
ight' method='get' action='/cgit.cgi/linux/net-next.git/log/tools/power/cpupower/Makefile'>
<input type='hidden' name='id' value='fff4b87e594ad3d2e4f51e8d3d86a6f9d3d8b654'/><select name='qt'>
<option value='grep'>log msg</option>
<option value='author'>author</option>
<option value='committer'>committer</option>
<option value='range'>range</option>
</select>
<input class='txt' type='search' size='10' name='q' value=''/>
<input type='submit' value='search'/>
</form>
</td></tr></table>
<div class='path'>path: <a href='/cgit.cgi/linux/net-next.git/log/?id=fff4b87e594ad3d2e4f51e8d3d86a6f9d3d8b654'>root</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools?id=fff4b87e594ad3d2e4f51e8d3d86a6f9d3d8b654'>tools</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/power?id=fff4b87e594ad3d2e4f51e8d3d86a6f9d3d8b654'>power</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/power/cpupower?id=fff4b87e594ad3d2e4f51e8d3d86a6f9d3d8b654'>cpupower</a>/<a href='/cgit.cgi/linux/net-next.git/log/tools/power/cpupower/Makefile?id=fff4b87e594ad3d2e4f51e8d3d86a6f9d3d8b654'>Makefile</a></div><div class='content'><table class='list nowrap'><tr class='nohover'><th class='left'>Age</th><th class='left'>Commit message (<a href='/cgit.cgi/linux/net-next.git/log/tools/power/cpupower/Makefile?id=fff4b87e594ad3d2e4f51e8d3d86a6f9d3d8b654&amp;showmsg=1'>Expand</a>)</th><th class='left'>Author</th><th class='left'>Files</th><th class='left'>Lines</th></tr>
ion><option value='6'>6</option><option value='7'>7</option><option value='8'>8</option><option value='9'>9</option><option value='10'>10</option><option value='15'>15</option><option value='20'>20</option><option value='25'>25</option><option value='30'>30</option><option value='35'>35</option><option value='40'>40</option></select></td></tr><tr><td class='label'>space:</td><td class='ctrl'><select name='ignorews' onchange='this.form.submit();'><option value='0' selected='selected'>include</option><option value='1'>ignore</option></select></td></tr><tr><td class='label'>mode:</td><td class='ctrl'><select name='dt' onchange='this.form.submit();'><option value='0' selected='selected'>unified</option><option value='1'>ssdiff</option><option value='2'>stat only</option></select></td></tr><tr><td/><td class='ctrl'><noscript><input type='submit' value='reload'/></noscript></td></tr></table></form></div><table summary='commit info' class='commit-info'>
<tr><th>author</th><td>Johannes Berg &lt;johannes.berg@intel.com&gt;</td><td class='right'>2017-01-26 17:15:44 +0100</td></tr>
<tr><th>committer</th><td>Johannes Berg &lt;johannes.berg@intel.com&gt;</td><td class='right'>2017-01-26 18:03:09 +0100</td></tr>
<tr><th>commit</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/include/net/transp_v6.h?id=228c8c6b1f4376788e9d5ab00d50b10228eb40d3'>228c8c6b1f4376788e9d5ab00d50b10228eb40d3</a> (<a href='/cgit.cgi/linux/net-next.git/patch/include/net/transp_v6.h?id=228c8c6b1f4376788e9d5ab00d50b10228eb40d3'>patch</a>)</td></tr>
<tr><th>tree</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/tree/?id=228c8c6b1f4376788e9d5ab00d50b10228eb40d3'>dfd7010fa9480284fe72bb2c4ab50a5225792a10</a> /<a href='/cgit.cgi/linux/net-next.git/tree/include/net/transp_v6.h?id=228c8c6b1f4376788e9d5ab00d50b10228eb40d3'>include/net/transp_v6.h</a></td></tr>
<tr><th>parent</th><td colspan='2' class='oid'><a href='/cgit.cgi/linux/net-next.git/commit/include/net/transp_v6.h?id=731977e97b3697454a862fec656c2561eabc0b87'>731977e97b3697454a862fec656c2561eabc0b87</a> (<a href='/cgit.cgi/linux/net-next.git/diff/include/net/transp_v6.h?id=228c8c6b1f4376788e9d5ab00d50b10228eb40d3&amp;id2=731977e97b3697454a862fec656c2561eabc0b87'>diff</a>)</td></tr></table>
<div class='commit-subject'>wireless: define cipher/AKM suites using a macro</div><div class='commit-msg'>The spec writes cipher/AKM suites as something like 00-0F-AC:9,
but the part after the colon isn't hex, it's decimal, so that
we've already had a few mistakes (in other code, or unmerged
patches) to e.g. write 0x000FAC10 instead of 0x000FAC0A.

Use a macro to avoid that problem.

Reviewed-by: Luca Coelho &lt;luciano.coelho@intel.com&gt;
Signed-off-by: Johannes Berg &lt;johannes.berg@intel.com&gt;
</div><div class='diffstat-header'><a href='/cgit.cgi/linux/net-next.git/diff/?id=228c8c6b1f4376788e9d5ab00d50b10228eb40d3'>Diffstat</a> (limited to 'include/net/transp_v6.h')</div><table summary='diffstat' class='diffstat'>