net/nfc/hci/llc.c
Source file repositories/reference/linux-study-clean/net/nfc/hci/llc.c
File Facts
- System
- Linux kernel
- Corpus path
net/nfc/hci/llc.c- Extension
.c- Size
- 2712 bytes
- Lines
- 142
- 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.
- 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
net/nfc/llc.hllc.h
Detected Declarations
function nfc_llc_initfunction nfc_llc_del_enginefunction nfc_llc_exitfunction nfc_llc_registerfunction list_for_each_entryfunction nfc_llc_freefunction nfc_llc_startfunction nfc_llc_stopfunction nfc_llc_rcv_from_drvfunction nfc_llc_xmit_from_hciexport nfc_llc_startexport nfc_llc_stop
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Link Layer Control manager
*
* Copyright (C) 2012 Intel Corporation. All rights reserved.
*/
#include <net/nfc/llc.h>
#include "llc.h"
static LIST_HEAD(llc_engines);
int __init nfc_llc_init(void)
{
int r;
r = nfc_llc_nop_register();
if (r)
goto exit;
r = nfc_llc_shdlc_register();
if (r)
goto exit;
return 0;
exit:
nfc_llc_exit();
return r;
}
static void nfc_llc_del_engine(struct nfc_llc_engine *llc_engine)
{
list_del(&llc_engine->entry);
kfree_const(llc_engine->name);
kfree(llc_engine);
}
void nfc_llc_exit(void)
{
struct nfc_llc_engine *llc_engine, *n;
list_for_each_entry_safe(llc_engine, n, &llc_engines, entry)
nfc_llc_del_engine(llc_engine);
}
int nfc_llc_register(const char *name, const struct nfc_llc_ops *ops)
{
struct nfc_llc_engine *llc_engine;
llc_engine = kzalloc_obj(struct nfc_llc_engine);
if (llc_engine == NULL)
return -ENOMEM;
llc_engine->name = kstrdup_const(name, GFP_KERNEL);
if (llc_engine->name == NULL) {
kfree(llc_engine);
return -ENOMEM;
}
llc_engine->ops = ops;
INIT_LIST_HEAD(&llc_engine->entry);
list_add_tail(&llc_engine->entry, &llc_engines);
return 0;
}
static struct nfc_llc_engine *nfc_llc_name_to_engine(const char *name)
{
struct nfc_llc_engine *llc_engine;
list_for_each_entry(llc_engine, &llc_engines, entry) {
if (strcmp(llc_engine->name, name) == 0)
return llc_engine;
}
return NULL;
}
struct nfc_llc *nfc_llc_allocate(const char *name, struct nfc_hci_dev *hdev,
xmit_to_drv_t xmit_to_drv,
rcv_to_hci_t rcv_to_hci, int tx_headroom,
int tx_tailroom, llc_failure_t llc_failure)
{
struct nfc_llc_engine *llc_engine;
struct nfc_llc *llc;
llc_engine = nfc_llc_name_to_engine(name);
if (llc_engine == NULL)
Annotation
- Immediate include surface: `net/nfc/llc.h`, `llc.h`.
- Detected declarations: `function nfc_llc_init`, `function nfc_llc_del_engine`, `function nfc_llc_exit`, `function nfc_llc_register`, `function list_for_each_entry`, `function nfc_llc_free`, `function nfc_llc_start`, `function nfc_llc_stop`, `function nfc_llc_rcv_from_drv`, `function nfc_llc_xmit_from_hci`.
- Atlas domain: Networking Core / Sockets, Protocols, Packet Path, And Network Policy.
- Implementation status: integration implementation candidate.
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.