drivers/s390/crypto/zcrypt_card.c
Source file repositories/reference/linux-study-clean/drivers/s390/crypto/zcrypt_card.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/crypto/zcrypt_card.c- Extension
.c- Size
- 5450 bytes
- Lines
- 226
- Domain
- Driver Families
- Bucket
- drivers/s390
- 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/export.hlinux/module.hlinux/init.hlinux/interrupt.hlinux/miscdevice.hlinux/fs.hlinux/proc_fs.hlinux/seq_file.hlinux/slab.hlinux/atomic.hlinux/uaccess.hlinux/hw_random.hlinux/debugfs.hasm/debug.hzcrypt_debug.hzcrypt_api.hzcrypt_msgtype6.hzcrypt_msgtype50.h
Detected Declarations
function Authorfunction online_showfunction online_storefunction load_showfunction zcrypt_card_freefunction zcrypt_card_releasefunction zcrypt_card_getfunction zcrypt_card_putfunction zcrypt_card_registerfunction zcrypt_card_unregisterexport zcrypt_card_allocexport zcrypt_card_freeexport zcrypt_card_getexport zcrypt_card_putexport zcrypt_card_registerexport zcrypt_card_unregister
Annotated Snippet
if (zq_uelist) {
zcrypt_queue_get(zq);
zq_uelist[i++] = zq;
}
spin_unlock(&zcrypt_list_lock);
if (zq_uelist) {
for (i = 0; zq_uelist[i]; i++) {
zq = zq_uelist[i];
ap_send_online_uevent(&zq->queue->ap_dev, online);
zcrypt_queue_put(zq);
}
kfree(zq_uelist);
}
return count;
}
static DEVICE_ATTR_RW(online);
static ssize_t load_show(struct device *dev,
struct device_attribute *attr,
char *buf)
{
struct zcrypt_card *zc = dev_get_drvdata(dev);
return sysfs_emit(buf, "%d\n", atomic_read(&zc->load));
}
static DEVICE_ATTR_RO(load);
static struct attribute *zcrypt_card_attrs[] = {
&dev_attr_type.attr,
&dev_attr_online.attr,
&dev_attr_load.attr,
NULL,
};
static const struct attribute_group zcrypt_card_attr_group = {
.attrs = zcrypt_card_attrs,
};
struct zcrypt_card *zcrypt_card_alloc(void)
{
struct zcrypt_card *zc;
zc = kzalloc_obj(*zc);
if (!zc)
return NULL;
INIT_LIST_HEAD(&zc->list);
INIT_LIST_HEAD(&zc->zqueues);
kref_init(&zc->refcount);
return zc;
}
EXPORT_SYMBOL(zcrypt_card_alloc);
void zcrypt_card_free(struct zcrypt_card *zc)
{
kfree(zc);
}
EXPORT_SYMBOL(zcrypt_card_free);
static void zcrypt_card_release(struct kref *kref)
{
struct zcrypt_card *zdev =
container_of(kref, struct zcrypt_card, refcount);
zcrypt_card_free(zdev);
}
void zcrypt_card_get(struct zcrypt_card *zc)
{
kref_get(&zc->refcount);
}
EXPORT_SYMBOL(zcrypt_card_get);
int zcrypt_card_put(struct zcrypt_card *zc)
{
return kref_put(&zc->refcount, zcrypt_card_release);
}
EXPORT_SYMBOL(zcrypt_card_put);
/**
* zcrypt_card_register() - Register a crypto card device.
* @zc: Pointer to a crypto card device
*
* Register a crypto card device. Returns 0 if successful.
*/
int zcrypt_card_register(struct zcrypt_card *zc)
{
int rc;
Annotation
- Immediate include surface: `linux/export.h`, `linux/module.h`, `linux/init.h`, `linux/interrupt.h`, `linux/miscdevice.h`, `linux/fs.h`, `linux/proc_fs.h`, `linux/seq_file.h`.
- Detected declarations: `function Author`, `function online_show`, `function online_store`, `function load_show`, `function zcrypt_card_free`, `function zcrypt_card_release`, `function zcrypt_card_get`, `function zcrypt_card_put`, `function zcrypt_card_register`, `function zcrypt_card_unregister`.
- Atlas domain: Driver Families / drivers/s390.
- 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.