include/sound/core.h
Source file repositories/reference/linux-study-clean/include/sound/core.h
File Facts
- System
- Linux kernel
- Corpus path
include/sound/core.h- Extension
.h- Size
- 15055 bytes
- Lines
- 477
- Domain
- Driver Families
- Bucket
- include/sound
- 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.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/sched.hlinux/mutex.hlinux/rwsem.hlinux/pm.hlinux/stringify.hlinux/printk.hlinux/xarray.h
Detected Declarations
struct pci_devstruct modulestruct completionstruct snd_devicestruct snd_device_opsstruct snd_devicestruct snd_refcountstruct snd_cardstruct snd_minorstruct resourcestruct snd_pci_quirkstruct snd_fasyncenum snd_device_typeenum snd_device_statefunction snd_refcount_getfunction snd_power_get_statefunction snd_power_change_statefunction snd_power_sync_reffunction snd_power_unreffunction snd_power_sync_reffunction snd_power_waitfunction snd_power_reffunction snd_power_sync_reffunction snd_minor_info_oss_initfunction snd_card_reffunction snd_pci_quirk_lookupfunction snd_pci_quirk_lookup_id
Annotated Snippet
const struct file_operations *f_ops; /* file operations */
void *private_data; /* private data for f_ops->open */
struct device *dev; /* device for sysfs */
struct snd_card *card_ptr; /* assigned card instance */
};
/* return a device pointer linked to each sound device as a parent */
static inline struct device *snd_card_get_device_link(struct snd_card *card)
{
return card ? &card->card_dev : NULL;
}
/* sound.c */
extern int snd_major;
extern int snd_ecards_limit;
extern const struct class sound_class;
#ifdef CONFIG_SND_DEBUG
extern struct dentry *sound_debugfs_root;
#endif
void snd_request_card(int card);
int snd_device_alloc(struct device **dev_p, struct snd_card *card);
int snd_register_device(int type, struct snd_card *card, int dev,
const struct file_operations *f_ops,
void *private_data, struct device *device);
int snd_unregister_device(struct device *dev);
void *snd_lookup_minor_data(unsigned int minor, int type);
#ifdef CONFIG_SND_OSSEMUL
int snd_register_oss_device(int type, struct snd_card *card, int dev,
const struct file_operations *f_ops, void *private_data);
int snd_unregister_oss_device(int type, struct snd_card *card, int dev);
void *snd_lookup_oss_minor_data(unsigned int minor, int type);
#endif
int snd_minor_info_init(void);
/* sound_oss.c */
#ifdef CONFIG_SND_OSSEMUL
int snd_minor_info_oss_init(void);
#else
static inline int snd_minor_info_oss_init(void) { return 0; }
#endif
/* memory.c */
int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count);
int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count);
/* init.c */
int snd_card_locked(int card);
#if IS_ENABLED(CONFIG_SND_MIXER_OSS)
#define SND_MIXER_OSS_NOTIFY_REGISTER 0
#define SND_MIXER_OSS_NOTIFY_DISCONNECT 1
#define SND_MIXER_OSS_NOTIFY_FREE 2
extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
#endif
int snd_card_new(struct device *parent, int idx, const char *xid,
struct module *module, int extra_size,
struct snd_card **card_ret);
int snd_devm_card_new(struct device *parent, int idx, const char *xid,
struct module *module, size_t extra_size,
struct snd_card **card_ret);
void snd_card_disconnect(struct snd_card *card);
void snd_card_disconnect_sync(struct snd_card *card);
void snd_card_free(struct snd_card *card);
void snd_card_free_when_closed(struct snd_card *card);
int snd_card_free_on_error(struct device *dev, int ret);
void snd_card_set_id(struct snd_card *card, const char *id);
int snd_card_register(struct snd_card *card);
int snd_card_info_init(void);
int snd_card_add_dev_attr(struct snd_card *card,
const struct attribute_group *group);
int snd_component_add(struct snd_card *card, const char *component);
int snd_card_file_add(struct snd_card *card, struct file *file);
int snd_card_file_remove(struct snd_card *card, struct file *file);
struct snd_card *snd_card_ref(int card);
/**
* snd_card_unref - Unreference the card object
* @card: the card object to unreference
*
Annotation
- Immediate include surface: `linux/device.h`, `linux/sched.h`, `linux/mutex.h`, `linux/rwsem.h`, `linux/pm.h`, `linux/stringify.h`, `linux/printk.h`, `linux/xarray.h`.
- Detected declarations: `struct pci_dev`, `struct module`, `struct completion`, `struct snd_device`, `struct snd_device_ops`, `struct snd_device`, `struct snd_refcount`, `struct snd_card`, `struct snd_minor`, `struct resource`.
- Atlas domain: Driver Families / include/sound.
- Implementation status: pattern implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.