diff options
Diffstat (limited to 'drivers/regulator/core.c')
-rw-r--r-- | drivers/regulator/core.c | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 1e976b6320a2..75aa49085763 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -3553,12 +3553,17 @@ regulator_register(const struct regulator_desc *regulator_desc, | |||
3553 | return ERR_PTR(-EINVAL); | 3553 | return ERR_PTR(-EINVAL); |
3554 | } | 3554 | } |
3555 | 3555 | ||
3556 | init_data = config->init_data; | ||
3557 | |||
3558 | rdev = kzalloc(sizeof(struct regulator_dev), GFP_KERNEL); | 3556 | rdev = kzalloc(sizeof(struct regulator_dev), GFP_KERNEL); |
3559 | if (rdev == NULL) | 3557 | if (rdev == NULL) |
3560 | return ERR_PTR(-ENOMEM); | 3558 | return ERR_PTR(-ENOMEM); |
3561 | 3559 | ||
3560 | init_data = regulator_of_get_init_data(dev, regulator_desc, | ||
3561 | &rdev->dev.of_node); | ||
3562 | if (!init_data) { | ||
3563 | init_data = config->init_data; | ||
3564 | rdev->dev.of_node = of_node_get(config->of_node); | ||
3565 | } | ||
3566 | |||
3562 | mutex_lock(®ulator_list_mutex); | 3567 | mutex_lock(®ulator_list_mutex); |
3563 | 3568 | ||
3564 | mutex_init(&rdev->mutex); | 3569 | mutex_init(&rdev->mutex); |
@@ -3585,7 +3590,6 @@ regulator_register(const struct regulator_desc *regulator_desc, | |||
3585 | 3590 | ||
3586 | /* register with sysfs */ | 3591 | /* register with sysfs */ |
3587 | rdev->dev.class = ®ulator_class; | 3592 | rdev->dev.class = ®ulator_class; |
3588 | rdev->dev.of_node = of_node_get(config->of_node); | ||
3589 | rdev->dev.parent = dev; | 3593 | rdev->dev.parent = dev; |
3590 | dev_set_name(&rdev->dev, "regulator.%d", | 3594 | dev_set_name(&rdev->dev, "regulator.%d", |
3591 | atomic_inc_return(®ulator_no) - 1); | 3595 | atomic_inc_return(®ulator_no) - 1); |