Commit 983ba99a authored by Jonathan Neuschäfer's avatar Jonathan Neuschäfer Committed by Mark Brown

regulator: Update code examples in documentation

This involves using the REGULATOR_SUPPLY initializer macro and
reindenting some of the code.
Signed-off-by: default avatarJonathan Neuschäfer <j.neuschaefer@gmx.net>
Signed-off-by: default avatarMark Brown <broonie@kernel.org>
parent 2befc01b
...@@ -23,16 +23,12 @@ struct regulator_consumer_supply { ...@@ -23,16 +23,12 @@ struct regulator_consumer_supply {
e.g. for the machine above e.g. for the machine above
static struct regulator_consumer_supply regulator1_consumers[] = { static struct regulator_consumer_supply regulator1_consumers[] = {
{ REGULATOR_SUPPLY("Vcc", "consumer B"),
.dev_name = "dev_name(consumer B)", };
.supply = "Vcc",
},};
static struct regulator_consumer_supply regulator2_consumers[] = { static struct regulator_consumer_supply regulator2_consumers[] = {
{ REGULATOR_SUPPLY("Vcc", "consumer A"),
.dev = "dev_name(consumer A"), };
.supply = "Vcc",
},};
This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-2 This maps Regulator-1 to the 'Vcc' supply for Consumer B and maps Regulator-2
to the 'Vcc' supply for Consumer A. to the 'Vcc' supply for Consumer A.
...@@ -78,20 +74,20 @@ static struct regulator_init_data regulator2_data = { ...@@ -78,20 +74,20 @@ static struct regulator_init_data regulator2_data = {
Finally the regulator devices must be registered in the usual manner. Finally the regulator devices must be registered in the usual manner.
static struct platform_device regulator_devices[] = { static struct platform_device regulator_devices[] = {
{ {
.name = "regulator", .name = "regulator",
.id = DCDC_1, .id = DCDC_1,
.dev = { .dev = {
.platform_data = &regulator1_data, .platform_data = &regulator1_data,
},
}, },
}, {
{ .name = "regulator",
.name = "regulator", .id = DCDC_2,
.id = DCDC_2, .dev = {
.dev = { .platform_data = &regulator2_data,
.platform_data = &regulator2_data, },
}, },
},
}; };
/* register regulator 1 device */ /* register regulator 1 device */
platform_device_register(&regulator_devices[0]); platform_device_register(&regulator_devices[0]);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment