Created
August 19, 2017 01:35
-
-
Save bartcubbins/2da2d3327d5d67f5ac016eb04d481242 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| static int smb1360_regulator_init(struct smb1360_chip *chip) | |
| { | |
| int rc = 0; | |
| struct regulator_init_data *init_data; | |
| struct regulator_config cfg = {}; | |
| init_data = of_get_regulator_init_data(chip->dev, chip->dev->of_node); | |
| if (!init_data) { | |
| dev_err(chip->dev, "Unable to allocate memory\n"); | |
| return -ENOMEM; | |
| } | |
| if (init_data->constraints.name) { | |
| chip->otg_vreg.rdesc.owner = THIS_MODULE; | |
| chip->otg_vreg.rdesc.type = REGULATOR_VOLTAGE; | |
| chip->otg_vreg.rdesc.ops = &smb1360_otg_reg_ops; | |
| chip->otg_vreg.rdesc.name = init_data->constraints.name; | |
| cfg.dev = chip->dev; | |
| cfg.init_data = init_data; | |
| cfg.driver_data = chip; | |
| cfg.of_node = chip->dev->of_node; | |
| init_data->constraints.valid_ops_mask | |
| |= REGULATOR_CHANGE_STATUS; | |
| chip->otg_vreg.rdev = regulator_register( | |
| &chip->otg_vreg.rdesc, &cfg); | |
| if (IS_ERR(chip->otg_vreg.rdev)) { | |
| rc = PTR_ERR(chip->otg_vreg.rdev); | |
| chip->otg_vreg.rdev = NULL; | |
| if (rc != -EPROBE_DEFER) | |
| dev_err(chip->dev, | |
| "OTG reg failed, rc=%d\n", rc); | |
| } | |
| } | |
| return rc; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment