static int __devexit footswitch_remove(struct platform_device *pdev) { struct footswitch *fs = &footswitches[pdev->id]; regulator_unregister(fs->rdev); set_rail_mode(fs->pcom_id, PCOM_RAIL_MODE_AUTO); put_clocks(fs); return 0; }
static int footswitch_probe(struct platform_device *pdev) { struct footswitch *fs; struct regulator_init_data *init_data; int rc; if (pdev == NULL) return -EINVAL; if (pdev->id >= MAX_FS) return -ENODEV; init_data = pdev->dev.platform_data; fs = &footswitches[pdev->id]; rc = set_rail_state(fs->pcom_id, PCOM_CLKCTL_RPC_RAIL_ENABLE); if (rc) return rc; rc = set_rail_mode(fs->pcom_id, PCOM_RAIL_MODE_MANUAL); if (rc) return rc; rc = get_clocks(&pdev->dev, fs); if (rc) return rc; fs->rdev = regulator_register(&fs->desc, &pdev->dev, init_data, fs, NULL); if (IS_ERR(fs->rdev)) { pr_err("regulator_register(%s) failed\n", fs->desc.name); rc = PTR_ERR(fs->rdev); goto err_register; } return 0; err_register: put_clocks(fs); return rc; }
static int footswitch_probe(struct platform_device *pdev) { struct footswitch *fs; struct regulator_init_data *init_data; int rc; if (pdev == NULL) return -EINVAL; if (pdev->id >= MAX_FS) return -ENODEV; fs = &footswitches[pdev->id]; if (!fs->is_manual) { pr_err("%s is not in manual mode\n", fs->desc.name); return -EINVAL; } init_data = pdev->dev.platform_data; rc = get_clocks(&pdev->dev, fs); if (rc) return rc; fs->rdev = regulator_register(&fs->desc, &pdev->dev, init_data, fs); if (IS_ERR(fs->rdev)) { pr_err("regulator_register(%s) failed\n", fs->desc.name); rc = PTR_ERR(fs->rdev); goto err_register; } return 0; err_register: put_clocks(fs); return rc; }