drivers/nubus/bus.c
Source file repositories/reference/linux-study-clean/drivers/nubus/bus.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/nubus/bus.c- Extension
.c- Size
- 2421 bytes
- Lines
- 98
- Domain
- Driver Families
- Bucket
- drivers/nubus
- 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.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/device.hlinux/dma-mapping.hlinux/list.hlinux/nubus.hlinux/seq_file.hlinux/slab.h
Detected Declarations
function nubus_device_probefunction nubus_device_removefunction nubus_driver_registerfunction nubus_driver_unregisterfunction nubus_bus_registerfunction nubus_device_releasefunction list_for_each_entry_safefunction nubus_device_registerfunction nubus_print_device_name_fnfunction nubus_proc_showexport nubus_driver_registerexport nubus_driver_unregister
Annotated Snippet
static const struct bus_type nubus_bus_type = {
.name = "nubus",
.probe = nubus_device_probe,
.remove = nubus_device_remove,
};
int nubus_driver_register(struct nubus_driver *ndrv)
{
ndrv->driver.bus = &nubus_bus_type;
return driver_register(&ndrv->driver);
}
EXPORT_SYMBOL(nubus_driver_register);
void nubus_driver_unregister(struct nubus_driver *ndrv)
{
driver_unregister(&ndrv->driver);
}
EXPORT_SYMBOL(nubus_driver_unregister);
static int __init nubus_bus_register(void)
{
return bus_register(&nubus_bus_type);
}
postcore_initcall(nubus_bus_register);
static void nubus_device_release(struct device *dev)
{
struct nubus_board *board = to_nubus_board(dev);
struct nubus_rsrc *fres, *tmp;
list_for_each_entry_safe(fres, tmp, &nubus_func_rsrcs, list)
if (fres->board == board) {
list_del(&fres->list);
kfree(fres);
}
kfree(board);
}
int nubus_device_register(struct device *parent, struct nubus_board *board)
{
board->dev.parent = parent;
board->dev.release = nubus_device_release;
board->dev.bus = &nubus_bus_type;
dev_set_name(&board->dev, "slot.%X", board->slot);
board->dev.dma_mask = &board->dev.coherent_dma_mask;
dma_set_mask(&board->dev, DMA_BIT_MASK(32));
return device_register(&board->dev);
}
static int nubus_print_device_name_fn(struct device *dev, void *data)
{
struct nubus_board *board = to_nubus_board(dev);
struct seq_file *m = data;
seq_printf(m, "Slot %X: %s\n", board->slot, board->name);
return 0;
}
int nubus_proc_show(struct seq_file *m, void *data)
{
return bus_for_each_dev(&nubus_bus_type, NULL, m,
nubus_print_device_name_fn);
}
Annotation
- Immediate include surface: `linux/device.h`, `linux/dma-mapping.h`, `linux/list.h`, `linux/nubus.h`, `linux/seq_file.h`, `linux/slab.h`.
- Detected declarations: `function nubus_device_probe`, `function nubus_device_remove`, `function nubus_driver_register`, `function nubus_driver_unregister`, `function nubus_bus_register`, `function nubus_device_release`, `function list_for_each_entry_safe`, `function nubus_device_register`, `function nubus_print_device_name_fn`, `function nubus_proc_show`.
- Atlas domain: Driver Families / drivers/nubus.
- 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.