/** * 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, constchar *firmware_name,
u32 result)
{
dev->fw_download_in_progress = false;
/** * 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)
{ int rc = 0;
pr_debug("dev_name=%s\n", dev_name(&dev->dev));
device_lock(&dev->dev);
if (dev->shutting_down) {
rc = -ENODEV; goto error;
}
/** * 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)
{ int rc;
/** * nfc_stop_poll - stop polling for nfc targets * * @dev: The nfc device that must stop polling
*/ int nfc_stop_poll(struct nfc_dev *dev)
{ int rc = 0;
pr_debug("dev_name=%s\n", dev_name(&dev->dev));
device_lock(&dev->dev);
if (dev->shutting_down) {
rc = -ENODEV; goto error;
}
/** * 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)
{ int rc; struct nfc_target *target;
if (dev->ops->check_presence && !dev->shutting_down)
mod_timer(&dev->check_pres_timer, jiffies +
msecs_to_jiffies(NFC_CHECK_PRES_FREQ_MS));
}
error:
device_unlock(&dev->dev); return rc;
}
/** * 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)
{ int rc = 0;
/** * 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)
{ int rc;
int nfc_tm_data_received(struct nfc_dev *dev, struct sk_buff *skb)
{ /* Only LLCP target mode for now */ if (dev->dep_link_up == false) {
kfree_skb(skb); return -ENOLINK;
}
/** * 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)
{ int i;
/** * 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)
{ conststruct nfc_target *tg; int i;
d = class_find_device(&nfc_class, NULL, &idx, match_idx); if (!d) return NULL;
return to_nfc_dev(d);
}
/** * 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(conststruct nfc_ops *ops,
u32 supported_protocols, int tx_headroom, int tx_tailroom)
{ struct nfc_dev *dev; int rc;
/** * 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)
{ int rc;
rc = nfc_genl_device_added(dev); if (rc)
pr_debug("The userspace won't be notified that the device %s was added\n",
dev_name(&dev->dev));
return 0;
}
EXPORT_SYMBOL(nfc_register_device);
/** * 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)
{ int rc;
pr_debug("dev_name=%s\n", dev_name(&dev->dev));
rc = nfc_genl_device_removed(dev); if (rc)
pr_debug("The userspace won't be notified that the device %s " "was removed\n", dev_name(&dev->dev));
¤ Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.0.18Bemerkung:
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.