drivers/pps/sysfs.c
Source file repositories/reference/linux-study-clean/drivers/pps/sysfs.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/pps/sysfs.c- Extension
.c- Size
- 2208 bytes
- Lines
- 100
- Domain
- Driver Families
- Bucket
- drivers/pps
- Inferred role
- Driver Families: implementation source
- Status
- source 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 or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/module.hlinux/string.hlinux/pps_kernel.h
Detected Declarations
function Copyrightfunction clear_showfunction mode_showfunction echo_showfunction name_showfunction path_show
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-or-later
/*
* PPS sysfs support
*
* Copyright (C) 2007-2009 Rodolfo Giometti <giometti@linux.it>
*/
#include <linux/device.h>
#include <linux/module.h>
#include <linux/string.h>
#include <linux/pps_kernel.h>
/*
* Attribute functions
*/
static ssize_t assert_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct pps_device *pps = dev_get_drvdata(dev);
if (!(pps->info.mode & PPS_CAPTUREASSERT))
return 0;
return sprintf(buf, "%lld.%09d#%d\n",
(long long) pps->assert_tu.sec, pps->assert_tu.nsec,
pps->assert_sequence);
}
static DEVICE_ATTR_RO(assert);
static ssize_t clear_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct pps_device *pps = dev_get_drvdata(dev);
if (!(pps->info.mode & PPS_CAPTURECLEAR))
return 0;
return sprintf(buf, "%lld.%09d#%d\n",
(long long) pps->clear_tu.sec, pps->clear_tu.nsec,
pps->clear_sequence);
}
static DEVICE_ATTR_RO(clear);
static ssize_t mode_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct pps_device *pps = dev_get_drvdata(dev);
return sprintf(buf, "%4x\n", pps->info.mode);
}
static DEVICE_ATTR_RO(mode);
static ssize_t echo_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct pps_device *pps = dev_get_drvdata(dev);
return sprintf(buf, "%d\n", !!pps->info.echo);
}
static DEVICE_ATTR_RO(echo);
static ssize_t name_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct pps_device *pps = dev_get_drvdata(dev);
return sprintf(buf, "%s\n", pps->info.name);
}
static DEVICE_ATTR_RO(name);
static ssize_t path_show(struct device *dev, struct device_attribute *attr,
char *buf)
{
struct pps_device *pps = dev_get_drvdata(dev);
return sprintf(buf, "%s\n", pps->info.path);
}
static DEVICE_ATTR_RO(path);
static struct attribute *pps_attrs[] = {
&dev_attr_assert.attr,
&dev_attr_clear.attr,
&dev_attr_mode.attr,
&dev_attr_echo.attr,
&dev_attr_name.attr,
&dev_attr_path.attr,
NULL,
};
Annotation
- Immediate include surface: `linux/device.h`, `linux/module.h`, `linux/string.h`, `linux/pps_kernel.h`.
- Detected declarations: `function Copyright`, `function clear_show`, `function mode_show`, `function echo_show`, `function name_show`, `function path_show`.
- Atlas domain: Driver Families / drivers/pps.
- Implementation status: source 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.