drivers/leds/led-class-flash.c
Source file repositories/reference/linux-study-clean/drivers/leds/led-class-flash.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/leds/led-class-flash.c- Extension
.c- Size
- 11321 bytes
- Lines
- 461
- Domain
- Driver Families
- Bucket
- drivers/leds
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/init.hlinux/led-class-flash.hlinux/leds.hlinux/module.hlinux/slab.h
Detected Declarations
function flash_brightness_storefunction flash_brightness_showfunction max_flash_brightness_showfunction flash_strobe_storefunction flash_strobe_showfunction flash_timeout_storefunction flash_timeout_showfunction max_flash_timeout_showfunction flash_fault_showfunction led_flash_resumefunction led_flash_init_sysfs_groupsfunction led_classdev_flash_register_extfunction led_classdev_flash_unregisterfunction devm_led_classdev_flash_releasefunction devm_led_classdev_flash_register_extfunction devm_led_classdev_flash_matchfunction devm_led_classdev_flash_unregisterfunction led_clamp_alignfunction led_set_flash_timeoutfunction led_get_flash_faultfunction led_set_flash_brightnessfunction led_update_flash_brightnessfunction led_set_flash_durationexport led_classdev_flash_register_extexport led_classdev_flash_unregisterexport devm_led_classdev_flash_register_extexport devm_led_classdev_flash_unregisterexport led_set_flash_timeoutexport led_get_flash_faultexport led_set_flash_brightnessexport led_update_flash_brightnessexport led_set_flash_duration
Annotated Snippet
if (fault & mask) {
buf_len = sprintf(pbuf, "%s ",
led_flash_fault_names[i]);
pbuf += buf_len;
}
mask <<= 1;
}
return strlen(strcat(buf, "\n"));
}
static DEVICE_ATTR_RO(flash_fault);
static struct attribute *led_flash_strobe_attrs[] = {
&dev_attr_flash_strobe.attr,
NULL,
};
static struct attribute *led_flash_timeout_attrs[] = {
&dev_attr_flash_timeout.attr,
&dev_attr_max_flash_timeout.attr,
NULL,
};
static struct attribute *led_flash_brightness_attrs[] = {
&dev_attr_flash_brightness.attr,
&dev_attr_max_flash_brightness.attr,
NULL,
};
static struct attribute *led_flash_fault_attrs[] = {
&dev_attr_flash_fault.attr,
NULL,
};
static const struct attribute_group led_flash_strobe_group = {
.attrs = led_flash_strobe_attrs,
};
static const struct attribute_group led_flash_timeout_group = {
.attrs = led_flash_timeout_attrs,
};
static const struct attribute_group led_flash_brightness_group = {
.attrs = led_flash_brightness_attrs,
};
static const struct attribute_group led_flash_fault_group = {
.attrs = led_flash_fault_attrs,
};
static void led_flash_resume(struct led_classdev *led_cdev)
{
struct led_classdev_flash *fled_cdev = lcdev_to_flcdev(led_cdev);
call_flash_op(fled_cdev, flash_brightness_set,
fled_cdev->brightness.val);
call_flash_op(fled_cdev, timeout_set, fled_cdev->timeout.val);
}
static void led_flash_init_sysfs_groups(struct led_classdev_flash *fled_cdev)
{
struct led_classdev *led_cdev = &fled_cdev->led_cdev;
const struct led_flash_ops *ops = fled_cdev->ops;
const struct attribute_group **flash_groups = fled_cdev->sysfs_groups;
int num_sysfs_groups = 0;
flash_groups[num_sysfs_groups++] = &led_flash_strobe_group;
if (ops->flash_brightness_set)
flash_groups[num_sysfs_groups++] = &led_flash_brightness_group;
if (ops->timeout_set)
flash_groups[num_sysfs_groups++] = &led_flash_timeout_group;
if (ops->fault_get)
flash_groups[num_sysfs_groups++] = &led_flash_fault_group;
led_cdev->groups = flash_groups;
}
int led_classdev_flash_register_ext(struct device *parent,
struct led_classdev_flash *fled_cdev,
struct led_init_data *init_data)
{
struct led_classdev *led_cdev;
const struct led_flash_ops *ops;
int ret;
if (!fled_cdev)
Annotation
- Immediate include surface: `linux/device.h`, `linux/init.h`, `linux/led-class-flash.h`, `linux/leds.h`, `linux/module.h`, `linux/slab.h`.
- Detected declarations: `function flash_brightness_store`, `function flash_brightness_show`, `function max_flash_brightness_show`, `function flash_strobe_store`, `function flash_strobe_show`, `function flash_timeout_store`, `function flash_timeout_show`, `function max_flash_timeout_show`, `function flash_fault_show`, `function led_flash_resume`.
- Atlas domain: Driver Families / drivers/leds.
- 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.