arch/sparc/kernel/apc.c

Source file repositories/reference/linux-study-clean/arch/sparc/kernel/apc.c

File Facts

System
Linux kernel
Corpus path
arch/sparc/kernel/apc.c
Extension
.c
Size
4192 bytes
Lines
196
Domain
Architecture Layer
Bucket
arch/sparc
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 const struct file_operations apc_fops = {
	.unlocked_ioctl =	apc_ioctl,
	.open =			apc_open,
	.release =		apc_release,
	.llseek =		noop_llseek,
};

static struct miscdevice apc_miscdev = { MISC_DYNAMIC_MINOR, APC_DEVNAME, &apc_fops };

static int apc_probe(struct platform_device *op)
{
	int err;

	regs = of_ioremap(&op->resource[0], 0,
			  resource_size(&op->resource[0]), APC_OBPNAME);
	if (!regs) {
		printk(KERN_ERR "%s: unable to map registers\n", APC_DEVNAME);
		return -ENODEV;
	}

	err = misc_register(&apc_miscdev);
	if (err) {
		printk(KERN_ERR "%s: unable to register device\n", APC_DEVNAME);
		apc_free(op);
		return -ENODEV;
	}

	/* Assign power management IDLE handler */
	if (!apc_no_idle)
		sparc_idle = apc_swift_idle;

	printk(KERN_INFO "%s: power management initialized%s\n", 
	       APC_DEVNAME, apc_no_idle ? " (CPU idle disabled)" : "");

	return 0;
}

static const struct of_device_id apc_match[] = {
	{
		.name = APC_OBPNAME,
	},
	{},
};
MODULE_DEVICE_TABLE(of, apc_match);

static struct platform_driver apc_driver = {
	.driver = {
		.name = "apc",
		.of_match_table = apc_match,
	},
	.probe		= apc_probe,
};

static int __init apc_init(void)
{
	return platform_driver_register(&apc_driver);
}

/* This driver is not critical to the boot process
 * and is easiest to ioremap when SBus is already
 * initialized, so we install ourselves thusly:
 */
__initcall(apc_init);

Annotation

Implementation Notes