net/nfc/core.c
Source file repositories/reference/linux-study-clean/net/nfc/core.c
File Facts
- System
- Linux kernel
- Corpus path
net/nfc/core.c- Extension
.c- Size
- 25561 bytes
- Lines
- 1274
- Domain
- Networking Core
- Bucket
- Sockets, Protocols, Packet Path, And Network Policy
- Inferred role
- Networking Core: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Networking stack implementation surface: socket APIs, protocol dispatch, packet flow, routing, filtering, and network namespaces.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/init.hlinux/kernel.hlinux/module.hlinux/slab.hlinux/rfkill.hlinux/nfc.hnet/genetlink.hnfc.h
Detected Declarations
function nfc_fw_downloadfunction nfc_fw_download_donefunction nfc_dev_upfunction nfc_dev_downfunction nfc_rfkill_set_blockfunction nfc_start_pollfunction nfc_stop_pollfunction nfc_dep_link_upfunction nfc_dep_link_downfunction nfc_dep_link_is_upfunction nfc_activate_targetfunction nfc_deactivate_targetfunction nfc_data_exchangefunction nfc_enable_sefunction nfc_disable_sefunction nfc_set_remote_general_bytesfunction nfc_tm_data_receivedfunction nfc_tm_activatedfunction nfc_tm_deactivatedfunction nfc_targets_foundfunction nfc_target_lostfunction nfc_driver_failurefunction nfc_add_sefunction nfc_remove_sefunction list_for_each_entry_safefunction nfc_se_transactionfunction nfc_se_connectivityfunction nfc_releasefunction list_for_each_entry_safefunction nfc_check_pres_workfunction nfc_check_pres_timeoutfunction match_idxfunction nfc_register_devicefunction nfc_unregister_rfkillfunction nfc_remove_devicefunction nfc_unregister_devicefunction nfc_initfunction nfc_exitmodule init nfc_initexport nfc_fw_download_doneexport nfc_dep_link_is_upexport nfc_find_seexport nfc_set_remote_general_bytesexport nfc_get_local_general_bytesexport nfc_tm_data_receivedexport nfc_tm_activatedexport nfc_tm_deactivatedexport nfc_alloc_recv_skb
Annotated Snippet
rc = device_add(&dev->dev);
mutex_unlock(&nfc_devlist_mutex);
if (rc < 0)
return rc;
rc = nfc_llcp_register_device(dev);
if (rc)
pr_err("Could not register llcp device\n");
device_lock(&dev->dev);
dev->rfkill = rfkill_alloc(dev_name(&dev->dev), &dev->dev,
RFKILL_TYPE_NFC, &nfc_rfkill_ops, dev);
if (dev->rfkill) {
if (rfkill_register(dev->rfkill) < 0) {
rfkill_destroy(dev->rfkill);
dev->rfkill = NULL;
}
}
dev->shutting_down = false;
device_unlock(&dev->dev);
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_rfkill - unregister a nfc device in the rfkill subsystem
*
* @dev: The nfc device to unregister
*/
void nfc_unregister_rfkill(struct nfc_dev *dev)
{
struct rfkill *rfk = NULL;
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));
device_lock(&dev->dev);
if (dev->rfkill) {
rfk = dev->rfkill;
dev->rfkill = NULL;
}
dev->shutting_down = true;
device_unlock(&dev->dev);
if (rfk) {
rfkill_unregister(rfk);
rfkill_destroy(rfk);
}
}
EXPORT_SYMBOL(nfc_unregister_rfkill);
/**
* nfc_remove_device - remove a nfc device in the nfc subsystem
*
* @dev: The nfc device to remove
*/
void nfc_remove_device(struct nfc_dev *dev)
{
if (dev->ops->check_presence) {
timer_delete_sync(&dev->check_pres_timer);
cancel_work_sync(&dev->check_pres_work);
}
nfc_llcp_unregister_device(dev);
mutex_lock(&nfc_devlist_mutex);
nfc_devlist_generation++;
device_del(&dev->dev);
mutex_unlock(&nfc_devlist_mutex);
}
EXPORT_SYMBOL(nfc_remove_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)
Annotation
- Immediate include surface: `linux/init.h`, `linux/kernel.h`, `linux/module.h`, `linux/slab.h`, `linux/rfkill.h`, `linux/nfc.h`, `net/genetlink.h`, `nfc.h`.
- Detected declarations: `function nfc_fw_download`, `function nfc_fw_download_done`, `function nfc_dev_up`, `function nfc_dev_down`, `function nfc_rfkill_set_block`, `function nfc_start_poll`, `function nfc_stop_poll`, `function nfc_dep_link_up`, `function nfc_dep_link_down`, `function nfc_dep_link_is_up`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.