drivers/s390/cio/ccwgroup.c
Source file repositories/reference/linux-study-clean/drivers/s390/cio/ccwgroup.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/s390/cio/ccwgroup.c- Extension
.c- Size
- 13507 bytes
- Lines
- 557
- Domain
- Driver Families
- Bucket
- drivers/s390
- Inferred role
- Driver Families: operation-table or driver-model contract
- Status
- pattern 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.
- Defines an operation table; this is where Linux turns generic core objects into subsystem-specific behavior.
- 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/errno.hlinux/slab.hlinux/list.hlinux/device.hlinux/init.hlinux/ctype.hlinux/dcache.hasm/cio.hasm/ccwdev.hasm/ccwgroup.hdevice.h
Detected Declarations
function __ccwgroup_remove_symlinksfunction ccwgroup_set_onlinefunction ccwgroup_set_offlinefunction ccwgroup_online_storefunction ccwgroup_online_showfunction ccwgroup_ungroupfunction ccwgroup_ungroup_storefunction ccwgroup_ungroup_workfnfunction ccwgroup_releasefunction __ccwgroup_create_symlinksfunction __get_next_idfunction ccwgroup_create_devfunction ccwgroup_notifierfunction init_ccwgroupfunction cleanup_ccwgroupfunction ccwgroup_removefunction ccwgroup_shutdownfunction dev_is_ccwgroupfunction ccwgroup_driver_registerfunction ccwgroup_driver_unregisterfunction ccwgroup_probe_ccwdevfunction ccwgroup_remove_ccwdevmodule init init_ccwgroupexport ccwgroup_set_onlineexport ccwgroup_set_offlineexport ccwgroup_create_devexport dev_is_ccwgroupexport ccwgroup_driver_registerexport ccwgroup_driver_unregisterexport ccwgroup_probe_ccwdevexport ccwgroup_remove_ccwdev
Annotated Snippet
static const struct bus_type ccwgroup_bus_type;
static void __ccwgroup_remove_symlinks(struct ccwgroup_device *gdev)
{
int i;
char str[16];
for (i = 0; i < gdev->count; i++) {
scnprintf(str, sizeof(str), "cdev%d", i);
sysfs_remove_link(&gdev->dev.kobj, str);
sysfs_remove_link(&gdev->cdev[i]->dev.kobj, "group_device");
}
}
/**
* ccwgroup_set_online() - enable a ccwgroup device
* @gdev: target ccwgroup device
*
* This function attempts to put the ccwgroup device into the online state.
* Returns:
* %0 on success and a negative error value on failure.
*/
int ccwgroup_set_online(struct ccwgroup_device *gdev)
{
struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
int ret = -EINVAL;
if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0)
return -EAGAIN;
if (gdev->state == CCWGROUP_ONLINE)
goto out;
if (gdrv->set_online)
ret = gdrv->set_online(gdev);
if (ret)
goto out;
gdev->state = CCWGROUP_ONLINE;
out:
atomic_set(&gdev->onoff, 0);
return ret;
}
EXPORT_SYMBOL(ccwgroup_set_online);
/**
* ccwgroup_set_offline() - disable a ccwgroup device
* @gdev: target ccwgroup device
* @call_gdrv: Call the registered gdrv set_offline function
*
* This function attempts to put the ccwgroup device into the offline state.
* Returns:
* %0 on success and a negative error value on failure.
*/
int ccwgroup_set_offline(struct ccwgroup_device *gdev, bool call_gdrv)
{
struct ccwgroup_driver *gdrv = to_ccwgroupdrv(gdev->dev.driver);
int ret = -EINVAL;
if (atomic_cmpxchg(&gdev->onoff, 0, 1) != 0)
return -EAGAIN;
if (gdev->state == CCWGROUP_OFFLINE)
goto out;
if (!call_gdrv) {
ret = 0;
goto offline;
}
if (gdrv->set_offline)
ret = gdrv->set_offline(gdev);
if (ret)
goto out;
offline:
gdev->state = CCWGROUP_OFFLINE;
out:
atomic_set(&gdev->onoff, 0);
return ret;
}
EXPORT_SYMBOL(ccwgroup_set_offline);
static ssize_t ccwgroup_online_store(struct device *dev,
struct device_attribute *attr,
const char *buf, size_t count)
{
struct ccwgroup_device *gdev = to_ccwgroupdev(dev);
unsigned long value;
int ret;
device_lock(dev);
if (!dev->driver) {
ret = -EINVAL;
goto out;
Annotation
- Immediate include surface: `linux/export.h`, `linux/module.h`, `linux/errno.h`, `linux/slab.h`, `linux/list.h`, `linux/device.h`, `linux/init.h`, `linux/ctype.h`.
- Detected declarations: `function __ccwgroup_remove_symlinks`, `function ccwgroup_set_online`, `function ccwgroup_set_offline`, `function ccwgroup_online_store`, `function ccwgroup_online_show`, `function ccwgroup_ungroup`, `function ccwgroup_ungroup_store`, `function ccwgroup_ungroup_workfn`, `function ccwgroup_release`, `function __ccwgroup_create_symlinks`.
- Atlas domain: Driver Families / drivers/s390.
- Implementation status: pattern 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.