static int __init bbc_i2c_init(void) { struct linux_ebus *ebus = NULL; struct linux_ebus_device *edev = NULL; int err, index = 0; if ((tlb_type != cheetah && tlb_type != cheetah_plus) || !bbc_present()) return -ENODEV; for_each_ebus(ebus) { for_each_ebusdev(edev, ebus) { if (!strcmp(edev->prom_node->name, "i2c")) { if (!attach_one_i2c(edev, index)) index++; } } } if (!index) return -ENODEV; err = bbc_envctrl_init(); if (err) bbc_i2c_cleanup(); return err; }
static int __devinit bbc_i2c_probe(struct platform_device *op) { struct bbc_i2c_bus *bp; int err, index = 0; bp = attach_one_i2c(op, index); if (!bp) return -EINVAL; err = bbc_envctrl_init(bp); if (err) { free_irq(op->archdata.irqs[0], bp); if (bp->i2c_bussel_reg) of_iounmap(&op->resource[0], bp->i2c_bussel_reg, 1); if (bp->i2c_control_regs) of_iounmap(&op->resource[1], bp->i2c_control_regs, 2); kfree(bp); } else { dev_set_drvdata(&op->dev, bp); } return err; }
static int __init bbc_i2c_init(void) { struct linux_ebus *ebus = NULL; struct linux_ebus_device *edev = NULL; int index = 0; if (tlb_type != cheetah || !bbc_present()) return -ENODEV; for_each_ebus(ebus) { for_each_ebusdev(edev, ebus) { if (!strcmp(edev->prom_name, "i2c")) { if (!attach_one_i2c(edev, index)) index++; } } } if (!index) return -ENODEV; bbc_envctrl_init(); return 0; }