linux/net/nfc/core.c

// SPDX-License-Identifier: GPL-2.0-or-later
/*
 * Copyright (C) 2011 Instituto Nokia de Tecnologia
 *
 * Authors:
 *    Lauro Ramos Venancio <[email protected]>
 *    Aloisio Almeida Jr <[email protected]>
 */

#define pr_fmt(fmt)

#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/module.h>
#include <linux/slab.h>
#include <linux/rfkill.h>
#include <linux/nfc.h>

#include <net/genetlink.h>

#include "nfc.h"

#define VERSION

#define NFC_CHECK_PRES_FREQ_MS

int nfc_devlist_generation;
DEFINE_MUTEX();

/* NFC device ID bitmap */
static DEFINE_IDA(nfc_index_ida);

int nfc_fw_download(struct nfc_dev *dev, const char *firmware_name)
{}

/**
 * nfc_fw_download_done - inform that a firmware download was completed
 *
 * @dev: The nfc device to which firmware was downloaded
 * @firmware_name: The firmware filename
 * @result: The positive value of a standard errno value
 */
int nfc_fw_download_done(struct nfc_dev *dev, const char *firmware_name,
			 u32 result)
{}
EXPORT_SYMBOL();

/**
 * nfc_dev_up - turn on the NFC device
 *
 * @dev: The nfc device to be turned on
 *
 * The device remains up until the nfc_dev_down function is called.
 */
int nfc_dev_up(struct nfc_dev *dev)
{}

/**
 * nfc_dev_down - turn off the NFC device
 *
 * @dev: The nfc device to be turned off
 */
int nfc_dev_down(struct nfc_dev *dev)
{}

static int nfc_rfkill_set_block(void *data, bool blocked)
{}

static const struct rfkill_ops nfc_rfkill_ops =;

/**
 * nfc_start_poll - start polling for nfc targets
 *
 * @dev: The nfc device that must start polling
 * @im_protocols: bitset of nfc initiator protocols to be used for polling
 * @tm_protocols: bitset of nfc transport protocols to be used for polling
 *
 * The device remains polling for targets until a target is found or
 * the nfc_stop_poll function is called.
 */
int nfc_start_poll(struct nfc_dev *dev, u32 im_protocols, u32 tm_protocols)
{}

/**
 * nfc_stop_poll - stop polling for nfc targets
 *
 * @dev: The nfc device that must stop polling
 */
int nfc_stop_poll(struct nfc_dev *dev)
{}

static struct nfc_target *nfc_find_target(struct nfc_dev *dev, u32 target_idx)
{}

int nfc_dep_link_up(struct nfc_dev *dev, int target_index, u8 comm_mode)
{}

int nfc_dep_link_down(struct nfc_dev *dev)
{}

int nfc_dep_link_is_up(struct nfc_dev *dev, u32 target_idx,
		       u8 comm_mode, u8 rf_mode)
{}
EXPORT_SYMBOL();

/**
 * nfc_activate_target - prepare the target for data exchange
 *
 * @dev: The nfc device that found the target
 * @target_idx: index of the target that must be activated
 * @protocol: nfc protocol that will be used for data exchange
 */
int nfc_activate_target(struct nfc_dev *dev, u32 target_idx, u32 protocol)
{}

/**
 * nfc_deactivate_target - deactivate a nfc target
 *
 * @dev: The nfc device that found the target
 * @target_idx: index of the target that must be deactivated
 * @mode: idle or sleep?
 */
int nfc_deactivate_target(struct nfc_dev *dev, u32 target_idx, u8 mode)
{}

/**
 * nfc_data_exchange - transceive data
 *
 * @dev: The nfc device that found the target
 * @target_idx: index of the target
 * @skb: data to be sent
 * @cb: callback called when the response is received
 * @cb_context: parameter for the callback function
 *
 * The user must wait for the callback before calling this function again.
 */
int nfc_data_exchange(struct nfc_dev *dev, u32 target_idx, struct sk_buff *skb,
		      data_exchange_cb_t cb, void *cb_context)
{}

struct nfc_se *nfc_find_se(struct nfc_dev *dev, u32 se_idx)
{}
EXPORT_SYMBOL();

int nfc_enable_se(struct nfc_dev *dev, u32 se_idx)
{}

int nfc_disable_se(struct nfc_dev *dev, u32 se_idx)
{}

int nfc_set_remote_general_bytes(struct nfc_dev *dev, const u8 *gb, u8 gb_len)
{}
EXPORT_SYMBOL();

u8 *nfc_get_local_general_bytes(struct nfc_dev *dev, size_t *gb_len)
{}
EXPORT_SYMBOL();

int nfc_tm_data_received(struct nfc_dev *dev, struct sk_buff *skb)
{}
EXPORT_SYMBOL();

int nfc_tm_activated(struct nfc_dev *dev, u32 protocol, u8 comm_mode,
		     const u8 *gb, size_t gb_len)
{}
EXPORT_SYMBOL();

int nfc_tm_deactivated(struct nfc_dev *dev)
{}
EXPORT_SYMBOL();

/**
 * nfc_alloc_send_skb - allocate a skb for data exchange responses
 *
 * @dev: device sending the response
 * @sk: socket sending the response
 * @flags: MSG_DONTWAIT flag
 * @size: size to allocate
 * @err: pointer to memory to store the error code
 */
struct sk_buff *nfc_alloc_send_skb(struct nfc_dev *dev, struct sock *sk,
				   unsigned int flags, unsigned int size,
				   unsigned int *err)
{}

/**
 * nfc_alloc_recv_skb - allocate a skb for data exchange responses
 *
 * @size: size to allocate
 * @gfp: gfp flags
 */
struct sk_buff *nfc_alloc_recv_skb(unsigned int size, gfp_t gfp)
{}
EXPORT_SYMBOL();

/**
 * nfc_targets_found - inform that targets were found
 *
 * @dev: The nfc device that found the targets
 * @targets: array of nfc targets found
 * @n_targets: targets array size
 *
 * The device driver must call this function when one or many nfc targets
 * are found. After calling this function, the device driver must stop
 * polling for targets.
 * NOTE: This function can be called with targets=NULL and n_targets=0 to
 * notify a driver error, meaning that the polling operation cannot complete.
 * IMPORTANT: this function must not be called from an atomic context.
 * In addition, it must also not be called from a context that would prevent
 * the NFC Core to call other nfc ops entry point concurrently.
 */
int nfc_targets_found(struct nfc_dev *dev,
		      struct nfc_target *targets, int n_targets)
{}
EXPORT_SYMBOL();

/**
 * nfc_target_lost - inform that an activated target went out of field
 *
 * @dev: The nfc device that had the activated target in field
 * @target_idx: the nfc index of the target
 *
 * The device driver must call this function when the activated target
 * goes out of the field.
 * IMPORTANT: this function must not be called from an atomic context.
 * In addition, it must also not be called from a context that would prevent
 * the NFC Core to call other nfc ops entry point concurrently.
 */
int nfc_target_lost(struct nfc_dev *dev, u32 target_idx)
{}
EXPORT_SYMBOL();

inline void nfc_driver_failure(struct nfc_dev *dev, int err)
{}
EXPORT_SYMBOL();

int nfc_add_se(struct nfc_dev *dev, u32 se_idx, u16 type)
{}
EXPORT_SYMBOL();

int nfc_remove_se(struct nfc_dev *dev, u32 se_idx)
{}
EXPORT_SYMBOL();

int nfc_se_transaction(struct nfc_dev *dev, u8 se_idx,
		       struct nfc_evt_transaction *evt_transaction)
{}
EXPORT_SYMBOL();

int nfc_se_connectivity(struct nfc_dev *dev, u8 se_idx)
{}
EXPORT_SYMBOL();

static void nfc_release(struct device *d)
{}

static void nfc_check_pres_work(struct work_struct *work)
{}

static void nfc_check_pres_timeout(struct timer_list *t)
{}

const struct class nfc_class =;
EXPORT_SYMBOL();

static int match_idx(struct device *d, const void *data)
{}

struct nfc_dev *nfc_get_device(unsigned int idx)
{}

/**
 * nfc_allocate_device - allocate a new nfc device
 *
 * @ops: device operations
 * @supported_protocols: NFC protocols supported by the device
 * @tx_headroom: reserved space at beginning of skb
 * @tx_tailroom: reserved space at end of skb
 */
struct nfc_dev *nfc_allocate_device(const struct nfc_ops *ops,
				    u32 supported_protocols,
				    int tx_headroom, int tx_tailroom)
{}
EXPORT_SYMBOL();

/**
 * nfc_register_device - register a nfc device in the nfc subsystem
 *
 * @dev: The nfc device to register
 */
int nfc_register_device(struct nfc_dev *dev)
{}
EXPORT_SYMBOL();

/**
 * nfc_unregister_device - unregister a nfc device in the nfc subsystem
 *
 * @dev: The nfc device to unregister
 */
void nfc_unregister_device(struct nfc_dev *dev)
{}
EXPORT_SYMBOL();

static int __init nfc_init(void)
{}

static void __exit nfc_exit(void)
{}

subsys_initcall(nfc_init);
module_exit(nfc_exit);

MODULE_AUTHOR();
MODULE_DESCRIPTION();
MODULE_VERSION();
MODULE_LICENSE();
MODULE_ALIAS_NETPROTO();
MODULE_ALIAS_GENL_FAMILY();