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 int __init apc_probe(void) { struct sbus_bus *sbus = NULL; struct sbus_dev *sdev = NULL; int iTmp = 0; for_each_sbus(sbus) { for_each_sbusdev(sdev, sbus) { if (!strcmp(sdev->prom_name, APC_OBPNAME)) { goto sbus_done; } } } sbus_done: if (!sdev) { return -ENODEV; } apc_regsize = sdev->reg_addrs[0].reg_size; regs = sbus_ioremap(&sdev->resource[0], 0, apc_regsize, APC_OBPNAME); if(!regs) { printk(KERN_ERR "%s: unable to map registers\n", APC_DEVNAME); return -ENODEV; } iTmp = misc_register(&apc_miscdev); if (iTmp != 0) { printk(KERN_ERR "%s: unable to register device\n", APC_DEVNAME); apc_free(); return -ENODEV; } /* Assign power management IDLE handler */ if(!apc_no_idle) pm_idle = apc_swift_idle; printk(KERN_INFO "%s: power management initialized%s\n", APC_DEVNAME, apc_no_idle ? " (CPU idle disabled)" : ""); return 0; }