drivers/eisa/eisa-bus.c
Source file repositories/reference/linux-study-clean/drivers/eisa/eisa-bus.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/eisa/eisa-bus.c- Extension
.c- Size
- 10637 bytes
- Lines
- 455
- Domain
- Driver Families
- Bucket
- drivers/eisa
- 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.
- 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/kernel.hlinux/device.hlinux/eisa.hlinux/module.hlinux/moduleparam.hlinux/init.hlinux/slab.hlinux/ioport.hasm/io.hdevlist.h
Detected Declarations
struct eisa_device_infofunction is_forced_devfunction eisa_name_devicefunction eisa_bus_matchfunction eisa_bus_ueventfunction eisa_driver_registerfunction eisa_driver_unregisterfunction signature_showfunction enabled_showfunction modalias_showfunction eisa_init_devicefunction eisa_register_devicefunction eisa_request_resourcesfunction eisa_release_resourcesfunction eisa_probefunction eisa_root_registerfunction eisa_initexport eisa_bus_typeexport eisa_driver_registerexport eisa_driver_unregisterexport EISA_bus
Annotated Snippet
static int eisa_bus_match(struct device *dev, const struct device_driver *drv)
{
struct eisa_device *edev = to_eisa_device(dev);
const struct eisa_driver *edrv = to_eisa_driver(drv);
const struct eisa_device_id *eids = edrv->id_table;
if (!eids)
return 0;
while (strlen(eids->sig)) {
if (!strcmp(eids->sig, edev->id.sig) &&
edev->state & EISA_CONFIG_ENABLED) {
edev->id.driver_data = eids->driver_data;
return 1;
}
eids++;
}
return 0;
}
static int eisa_bus_uevent(const struct device *dev, struct kobj_uevent_env *env)
{
const struct eisa_device *edev = to_eisa_device(dev);
add_uevent_var(env, "MODALIAS=" EISA_DEVICE_MODALIAS_FMT, edev->id.sig);
return 0;
}
const struct bus_type eisa_bus_type = {
.name = "eisa",
.match = eisa_bus_match,
.uevent = eisa_bus_uevent,
};
EXPORT_SYMBOL(eisa_bus_type);
int eisa_driver_register(struct eisa_driver *edrv)
{
edrv->driver.bus = &eisa_bus_type;
return driver_register(&edrv->driver);
}
EXPORT_SYMBOL(eisa_driver_register);
void eisa_driver_unregister(struct eisa_driver *edrv)
{
driver_unregister(&edrv->driver);
}
EXPORT_SYMBOL(eisa_driver_unregister);
static ssize_t signature_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct eisa_device *edev = to_eisa_device(dev);
return sprintf(buf, "%s\n", edev->id.sig);
}
static DEVICE_ATTR_RO(signature);
static ssize_t enabled_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct eisa_device *edev = to_eisa_device(dev);
return sprintf(buf, "%d\n", edev->state & EISA_CONFIG_ENABLED);
}
static DEVICE_ATTR_RO(enabled);
static ssize_t modalias_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
struct eisa_device *edev = to_eisa_device(dev);
return sprintf(buf, EISA_DEVICE_MODALIAS_FMT "\n", edev->id.sig);
}
static DEVICE_ATTR_RO(modalias);
static int __init eisa_init_device(struct eisa_root_device *root,
struct eisa_device *edev,
int slot)
{
char *sig;
unsigned long sig_addr;
int i;
sig_addr = SLOT_ADDRESS(root, slot) + EISA_VENDOR_ID_OFFSET;
sig = decode_eisa_sig(sig_addr);
if (!sig)
return -1; /* No EISA device here */
memcpy(edev->id.sig, sig, EISA_SIG_LEN);
edev->slot = slot;
Annotation
- Immediate include surface: `linux/kernel.h`, `linux/device.h`, `linux/eisa.h`, `linux/module.h`, `linux/moduleparam.h`, `linux/init.h`, `linux/slab.h`, `linux/ioport.h`.
- Detected declarations: `struct eisa_device_info`, `function is_forced_dev`, `function eisa_name_device`, `function eisa_bus_match`, `function eisa_bus_uevent`, `function eisa_driver_register`, `function eisa_driver_unregister`, `function signature_show`, `function enabled_show`, `function modalias_show`.
- Atlas domain: Driver Families / drivers/eisa.
- Implementation status: pattern 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.