include/linux/w1.h
Source file repositories/reference/linux-study-clean/include/linux/w1.h
File Facts
- System
- Linux kernel
- Corpus path
include/linux/w1.h- Extension
.h- Size
- 9141 bytes
- Lines
- 326
- Domain
- Core OS
- Bucket
- Core Kernel Interface
- Inferred role
- Core OS: operation-table or driver-model contract
- Status
- pattern implementation candidate
Why This File Exists
Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- Core operating-system implementation surface: boot, tasks, memory, VFS, syscall-facing interfaces, synchronization, credentials, and isolation.
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.h
Detected Declarations
struct w1_reg_numstruct w1_slavestruct w1_bus_masterstruct w1_masterstruct w1_family_opsstruct w1_familyenum w1_master_flagsfunction dev_to_w1_slavefunction kobj_to_w1_slavefunction dev_to_w1_master
Annotated Snippet
struct device_driver *driver;
struct device dev;
struct w1_bus_master *bus_master;
u32 seq;
};
int w1_add_master_device(struct w1_bus_master *master);
void w1_remove_master_device(struct w1_bus_master *master);
/**
* struct w1_family_ops - operations for a family type
* @add_slave: add_slave
* @remove_slave: remove_slave
* @groups: sysfs group
* @chip_info: pointer to struct hwmon_chip_info
*/
struct w1_family_ops {
int (*add_slave)(struct w1_slave *sl);
void (*remove_slave)(struct w1_slave *sl);
const struct attribute_group **groups;
const struct hwmon_chip_info *chip_info;
};
/**
* struct w1_family - reference counted family structure.
* @family_entry: family linked list
* @fid: 8 bit family identifier
* @fops: operations for this family
* @of_match_table: open firmware match table
* @refcnt: reference counter
*/
struct w1_family {
struct list_head family_entry;
u8 fid;
const struct w1_family_ops *fops;
const struct of_device_id *of_match_table;
atomic_t refcnt;
};
int w1_register_family(struct w1_family *family);
void w1_unregister_family(struct w1_family *family);
/**
* module_w1_family() - Helper macro for registering a 1-Wire families
* @__w1_family: w1_family struct
*
* Helper macro for 1-Wire families which do not do anything special in module
* init/exit. This eliminates a lot of boilerplate. Each module may only
* use this macro once, and calling it replaces module_init() and module_exit()
*/
#define module_w1_family(__w1_family) \
module_driver(__w1_family, w1_register_family, \
w1_unregister_family)
u8 w1_triplet(struct w1_master *dev, int bdir);
u8 w1_touch_bit(struct w1_master *dev, int bit);
void w1_write_8(struct w1_master *, u8);
u8 w1_read_8(struct w1_master *);
int w1_reset_bus(struct w1_master *);
u8 w1_calc_crc8(u8 *, int);
void w1_write_block(struct w1_master *, const u8 *, int);
void w1_touch_block(struct w1_master *, u8 *, int);
u8 w1_read_block(struct w1_master *, u8 *, int);
int w1_reset_select_slave(struct w1_slave *sl);
int w1_reset_resume_command(struct w1_master *);
void w1_next_pullup(struct w1_master *, int);
static inline struct w1_slave* dev_to_w1_slave(struct device *dev)
{
return container_of(dev, struct w1_slave, dev);
}
static inline struct w1_slave* kobj_to_w1_slave(struct kobject *kobj)
{
return dev_to_w1_slave(container_of(kobj, struct device, kobj));
}
static inline struct w1_master* dev_to_w1_master(struct device *dev)
{
return container_of(dev, struct w1_master, dev);
}
#endif /* __KERNEL__ */
#endif /* __LINUX_W1_H */
Annotation
- Immediate include surface: `linux/device.h`.
- Detected declarations: `struct w1_reg_num`, `struct w1_slave`, `struct w1_bus_master`, `struct w1_master`, `struct w1_family_ops`, `struct w1_family`, `enum w1_master_flags`, `function dev_to_w1_slave`, `function kobj_to_w1_slave`, `function dev_to_w1_master`.
- Atlas domain: Core OS / Core Kernel Interface.
- 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.