diff options
author | Mark Brown <broonie@opensource.wolfsonmicro.com> | 2011-06-07 18:36:18 -0400 |
---|---|---|
committer | Liam Girdwood <lrg@slimlogic.co.uk> | 2011-06-08 15:15:34 -0400 |
commit | c08957a2cf3c4a14e68d72c845d3c52cf3d826e1 (patch) | |
tree | ba1741763e858ef4be44c5e9d7877238dc31a47c /drivers/regulator/dummy.c | |
parent | 7736f11dbadce33d3f12bf0e8114d0f1da5e8622 (diff) |
regulator: Properly register dummy regulator driver
Recent changes in the driver core appear to mean that the data structures
for the driver core are not fully initialised unless the driver is bound.
Make sure the driver core knows the dummy driver is in use by binding it
to a driver.
Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
Diffstat (limited to 'drivers/regulator/dummy.c')
-rw-r--r-- | drivers/regulator/dummy.c | 32 |
1 files changed, 26 insertions, 6 deletions
diff --git a/drivers/regulator/dummy.c b/drivers/regulator/dummy.c index c7410bde7b5d..f6ef6694ab98 100644 --- a/drivers/regulator/dummy.c +++ b/drivers/regulator/dummy.c | |||
@@ -36,6 +36,29 @@ static struct regulator_desc dummy_desc = { | |||
36 | .ops = &dummy_ops, | 36 | .ops = &dummy_ops, |
37 | }; | 37 | }; |
38 | 38 | ||
39 | static int __devinit dummy_regulator_probe(struct platform_device *pdev) | ||
40 | { | ||
41 | int ret; | ||
42 | |||
43 | dummy_regulator_rdev = regulator_register(&dummy_desc, NULL, | ||
44 | &dummy_initdata, NULL); | ||
45 | if (IS_ERR(dummy_regulator_rdev)) { | ||
46 | ret = PTR_ERR(dummy_regulator_rdev); | ||
47 | pr_err("Failed to register regulator: %d\n", ret); | ||
48 | return ret; | ||
49 | } | ||
50 | |||
51 | return 0; | ||
52 | } | ||
53 | |||
54 | static struct platform_driver dummy_regulator_driver = { | ||
55 | .probe = dummy_regulator_probe, | ||
56 | .driver = { | ||
57 | .name = "reg-dummy", | ||
58 | .owner = THIS_MODULE, | ||
59 | }, | ||
60 | }; | ||
61 | |||
39 | static struct platform_device *dummy_pdev; | 62 | static struct platform_device *dummy_pdev; |
40 | 63 | ||
41 | void __init regulator_dummy_init(void) | 64 | void __init regulator_dummy_init(void) |
@@ -55,12 +78,9 @@ void __init regulator_dummy_init(void) | |||
55 | return; | 78 | return; |
56 | } | 79 | } |
57 | 80 | ||
58 | dummy_regulator_rdev = regulator_register(&dummy_desc, NULL, | 81 | ret = platform_driver_register(&dummy_regulator_driver); |
59 | &dummy_initdata, NULL); | 82 | if (ret != 0) { |
60 | if (IS_ERR(dummy_regulator_rdev)) { | 83 | pr_err("Failed to register dummy regulator driver: %d\n", ret); |
61 | ret = PTR_ERR(dummy_regulator_rdev); | ||
62 | pr_err("Failed to register regulator: %d\n", ret); | ||
63 | platform_device_unregister(dummy_pdev); | 84 | platform_device_unregister(dummy_pdev); |
64 | return; | ||
65 | } | 85 | } |
66 | } | 86 | } |