static int __devexit bbc_i2c_remove(struct of_device *op) { struct bbc_i2c_bus *bp = dev_get_drvdata(&op->dev); bbc_envctrl_cleanup(bp); free_irq(op->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); return 0; }
static void __exit bbc_i2c_cleanup(void) { struct bbc_i2c_bus *bp = all_bbc_i2c; bbc_envctrl_cleanup(); while (bp != NULL) { struct bbc_i2c_bus *next = bp->next; free_irq(bp->bus_edev->irqs[0], bp); if (bp->i2c_bussel_reg) iounmap(bp->i2c_bussel_reg); if (bp->i2c_control_regs) iounmap(bp->i2c_control_regs); kfree(bp); bp = next; } all_bbc_i2c = NULL; }