arch/arm/common/sa1111.c

Source file repositories/reference/linux-study-clean/arch/arm/common/sa1111.c

File Facts

System
Linux kernel
Corpus path
arch/arm/common/sa1111.c
Extension
.c
Size
35669 bytes
Lines
1414
Domain
Architecture Layer
Bucket
arch/arm
Inferred role
Architecture Layer: operation-table or driver-model contract
Status
pattern implementation candidate

Why This File Exists

CPU and platform-specific kernel glue: boot entry, traps, syscall entry, interrupts, page tables, context switch, and low-level barriers.

Dependency Surface

Detected Declarations

Annotated Snippet

static int sa1111_match(struct device *_dev, const struct device_driver *_drv)
{
	struct sa1111_dev *dev = to_sa1111_device(_dev);
	const struct sa1111_driver *drv = SA1111_DRV(_drv);

	return !!(dev->devid & drv->devid);
}

static int sa1111_bus_probe(struct device *dev)
{
	struct sa1111_dev *sadev = to_sa1111_device(dev);
	struct sa1111_driver *drv = SA1111_DRV(dev->driver);
	int ret = -ENODEV;

	if (drv->probe)
		ret = drv->probe(sadev);
	return ret;
}

static void sa1111_bus_remove(struct device *dev)
{
	struct sa1111_dev *sadev = to_sa1111_device(dev);
	struct sa1111_driver *drv = SA1111_DRV(dev->driver);

	if (drv->remove)
		drv->remove(sadev);
}

const struct bus_type sa1111_bus_type = {
	.name		= "sa1111-rab",
	.match		= sa1111_match,
	.probe		= sa1111_bus_probe,
	.remove		= sa1111_bus_remove,
};
EXPORT_SYMBOL(sa1111_bus_type);

int sa1111_driver_register(struct sa1111_driver *driver)
{
	driver->drv.bus = &sa1111_bus_type;
	return driver_register(&driver->drv);
}
EXPORT_SYMBOL(sa1111_driver_register);

void sa1111_driver_unregister(struct sa1111_driver *driver)
{
	driver_unregister(&driver->drv);
}
EXPORT_SYMBOL(sa1111_driver_unregister);

static int __init sa1111_init(void)
{
	int ret = bus_register(&sa1111_bus_type);
	if (ret == 0)
		platform_driver_register(&sa1111_device_driver);
	return ret;
}

static void __exit sa1111_exit(void)
{
	platform_driver_unregister(&sa1111_device_driver);
	bus_unregister(&sa1111_bus_type);
}

subsys_initcall(sa1111_init);
module_exit(sa1111_exit);

MODULE_DESCRIPTION("Intel Corporation SA1111 core driver");
MODULE_LICENSE("GPL");

Annotation

Implementation Notes