drivers/net/wireless/intel/ipw2x00/libipw_crypto.c
Source file repositories/reference/linux-study-clean/drivers/net/wireless/intel/ipw2x00/libipw_crypto.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/net/wireless/intel/ipw2x00/libipw_crypto.c- Extension
.c- Size
- 6297 bytes
- Lines
- 247
- Domain
- Driver Families
- Bucket
- drivers/net
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- 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/module.hlinux/ctype.hlinux/ieee80211.hlinux/errno.hlinux/init.hlinux/slab.hlinux/string.hlibipw.h
Detected Declarations
struct libipw_crypto_algfunction libipw_crypt_info_initfunction libipw_crypt_info_freefunction libipw_crypt_deinit_entriesfunction libipw_crypt_quiescingfunction libipw_crypt_deinit_handlerfunction libipw_crypt_delayed_deinitfunction libipw_register_crypto_opsfunction libipw_unregister_crypto_opsfunction libipw_crypt_null_deinitfunction libipw_crypto_initfunction libipw_crypto_exitexport libipw_crypt_info_initexport libipw_crypt_info_freeexport libipw_crypt_delayed_deinitexport libipw_register_crypto_opsexport libipw_unregister_crypto_opsexport libipw_get_crypto_ops
Annotated Snippet
struct libipw_crypto_alg {
struct list_head list;
const struct libipw_crypto_ops *ops;
};
static LIST_HEAD(libipw_crypto_algs);
static DEFINE_SPINLOCK(libipw_crypto_lock);
static void libipw_crypt_deinit_entries(struct libipw_crypt_info *info,
int force);
static void libipw_crypt_quiescing(struct libipw_crypt_info *info);
static void libipw_crypt_deinit_handler(struct timer_list *t);
int libipw_crypt_info_init(struct libipw_crypt_info *info, char *name,
spinlock_t *lock)
{
memset(info, 0, sizeof(*info));
info->name = name;
info->lock = lock;
INIT_LIST_HEAD(&info->crypt_deinit_list);
timer_setup(&info->crypt_deinit_timer, libipw_crypt_deinit_handler,
0);
return 0;
}
EXPORT_SYMBOL(libipw_crypt_info_init);
void libipw_crypt_info_free(struct libipw_crypt_info *info)
{
int i;
libipw_crypt_quiescing(info);
timer_delete_sync(&info->crypt_deinit_timer);
libipw_crypt_deinit_entries(info, 1);
for (i = 0; i < NUM_WEP_KEYS; i++) {
struct libipw_crypt_data *crypt = info->crypt[i];
if (crypt) {
if (crypt->ops) {
crypt->ops->deinit(crypt->priv);
module_put(crypt->ops->owner);
}
kfree(crypt);
info->crypt[i] = NULL;
}
}
}
EXPORT_SYMBOL(libipw_crypt_info_free);
static void libipw_crypt_deinit_entries(struct libipw_crypt_info *info,
int force)
{
struct libipw_crypt_data *entry, *next;
unsigned long flags;
spin_lock_irqsave(info->lock, flags);
list_for_each_entry_safe(entry, next, &info->crypt_deinit_list, list) {
if (atomic_read(&entry->refcnt) != 0 && !force)
continue;
list_del(&entry->list);
if (entry->ops) {
entry->ops->deinit(entry->priv);
module_put(entry->ops->owner);
}
kfree(entry);
}
spin_unlock_irqrestore(info->lock, flags);
}
/* After this, crypt_deinit_list won't accept new members */
static void libipw_crypt_quiescing(struct libipw_crypt_info *info)
{
unsigned long flags;
spin_lock_irqsave(info->lock, flags);
info->crypt_quiesced = 1;
spin_unlock_irqrestore(info->lock, flags);
}
static void libipw_crypt_deinit_handler(struct timer_list *t)
{
struct libipw_crypt_info *info = timer_container_of(info, t,
crypt_deinit_timer);
unsigned long flags;
libipw_crypt_deinit_entries(info, 0);
Annotation
- Immediate include surface: `linux/module.h`, `linux/ctype.h`, `linux/ieee80211.h`, `linux/errno.h`, `linux/init.h`, `linux/slab.h`, `linux/string.h`, `libipw.h`.
- Detected declarations: `struct libipw_crypto_alg`, `function libipw_crypt_info_init`, `function libipw_crypt_info_free`, `function libipw_crypt_deinit_entries`, `function libipw_crypt_quiescing`, `function libipw_crypt_deinit_handler`, `function libipw_crypt_delayed_deinit`, `function libipw_register_crypto_ops`, `function libipw_unregister_crypto_ops`, `function libipw_crypt_null_deinit`.
- Atlas domain: Driver Families / drivers/net.
- 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.