static int __devexit axp_mfd_remove(struct i2c_client *client) { struct axp_mfd_chip *chip = i2c_get_clientdata(client); pm_power_off = NULL; axp = NULL; axp_mfd_remove_subdevs(chip); kfree(chip); return 0; }
static int __devinit axp_mfd_add_subdevs(struct axp_mfd_chip *chip, struct axp_platform_data *pdata) { struct axp_funcdev_info *regl_dev; struct axp_funcdev_info *sply_dev; struct axp_funcdev_info *gpio_dev; struct platform_device *pdev; int i, ret = 0; /* register for regultors */ for (i = 0; i < pdata->num_regl_devs; i++) { regl_dev = &pdata->regl_devs[i]; pdev = platform_device_alloc(regl_dev->name, regl_dev->id); pdev->dev.parent = chip->dev; pdev->dev.platform_data = regl_dev->platform_data; ret = platform_device_add(pdev); if (ret) goto failed; } /* register for power supply */ for (i = 0; i < pdata->num_sply_devs; i++) { sply_dev = &pdata->sply_devs[i]; pdev = platform_device_alloc(sply_dev->name, sply_dev->id); pdev->dev.parent = chip->dev; pdev->dev.platform_data = sply_dev->platform_data; ret = platform_device_add(pdev); if (ret) goto failed; } /* register for gpio */ for (i = 0; i < pdata->num_gpio_devs; i++) { gpio_dev = &pdata->gpio_devs[i]; pdev = platform_device_alloc(gpio_dev->name, gpio_dev->id); pdev->dev.parent = chip->dev; pdev->dev.platform_data = gpio_dev->platform_data; ret = platform_device_add(pdev); if (ret) goto failed; } return 0; failed: axp_mfd_remove_subdevs(chip); return ret; }
static int __devexit axp_mfd_remove(struct i2c_client *client) { struct axp_mfd_chip *chip = i2c_get_clientdata(client); pm_power_off = NULL; axp = NULL; #ifdef CONFIG_AXP_HWMON if (chip->itm_enabled == 1) { hwmon_device_unregister(chip->hwmon_dev); sysfs_remove_group(&client->dev.kobj, &axp20_group); } #endif axp_mfd_remove_subdevs(chip); kfree(chip); return 0; }