Skip to contentSkip to conversation

regulator: fixed: Move drivers to subsys_initcall_sync()

PATCH In review Laxman Dewangan 3 participants 5 messages Jan 4, 2012 – Jan 6, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 regulator: fixed: Move drivers to subsys_initcall_sync()

From: Laxman Dewangan <[email protected]>

The fixed regulator is used to enable/disable rails which are mainly controlled by the switch. The switches are toggled by gpio apis.
The switches are connected through on-chip gpios or through external devices' gpios like mfd, i2c based gpio expander etc. The registration of the fixed regulator get success only if the required gpios are already available in the system at this time. The on-chip gpios are available till this time as on-chip gpios are initialized in arch_init(). But external peripheral's gpios may not be available at this time as they get initialized as part of subsys_initcall() and due to this registration of the fixed regulator may fails.
Moving the driver to subsys_initcall_sync() will make sure that all gpios i.e. on-chip gpios as well as external peripheral's gpios are available before fixed regulator registration.

---
 drivers/regulator/fixed.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)
drivers/regulator/fixed.c +1 -1
index a44a017..baec76e 100644
@@ -307,7 +307,7 @@ static int __init regulator_fixed_voltage_init(void)
 {
 	return platform_driver_register(&regulator_fixed_voltage_driver);
 }
-subsys_initcall(regulator_fixed_voltage_init);
+subsys_initcall_sync(regulator_fixed_voltage_init);
 
 static void __exit regulator_fixed_voltage_exit(void)
 {
Signature · 1 line
1.7.1.1
#1 lore raw
Quoted 17 lines · Laxman Dewangan

From: Laxman Dewangan <[email protected]>

The fixed regulator is used to enable/disable rails which are mainly controlled by the switch. The switches are toggled by gpio apis.
The switches are connected through on-chip gpios or through external devices' gpios like mfd, i2c based gpio expander etc. The registration of the fixed regulator get success only if the required gpios are already available in the system at this time. The on-chip gpios are available till this time as on-chip gpios are initialized in arch_init(). But external peripheral's gpios may not be available at this time as they get initialized as part of subsys_initcall() and due to this registration of the fixed regulator may fails.
Moving the driver to subsys_initcall_sync() will make sure that all gpios i.e. on-chip gpios as well as external peripheral's gpios are available before fixed regulator registration.

I don't really think this is worth faffing about with, it seems at least as likely to create more problems with things that depend on the regulator as it is to make the regulator work. Really we need Grant's probe retry stuff or something else to solve the init ordering issues properly.

#2 lore raw
Quoted 21 lines

From: [email protected] [mailto:[email protected]] On Behalf Of Mark Brown
Sent: Thursday, January 05, 2012 11:29 AM

Quoted 7 lines

The fixed regulator is used to enable/disable rails which are mainly controlled by the switch. The switches are toggled by gpio apis.
The switches are connected through on-chip gpios or through external devices' gpios like mfd, i2c based gpio expander etc. The registration of the fixed regulator get success only if the required gpios are already available in the system at this time.

Quoted 8 lines

The on-chip gpios are available till this time as on-chip gpios are initialized in arch_init(). But external peripheral's gpios may not be available at this time as they get initialized as part of subsys_initcall() and due to this registration of the fixed regulator may fails.
Moving the driver to subsys_initcall_sync() will make sure that all gpios i.e. on-chip gpios as well as external peripheral's gpios are available before fixed regulator registration.

Quoted 5 lines

I don't really think this is worth faffing about with, it seems at least as likely to create more problems with things that depend on the regulator as it is to make the regulator work. Really we need Grant's probe retry stuff or something else to solve the init ordering issues properly.

Yes, I agree, the init ordering need to be done properly but this is how we have as of now to make ordering.
I have the switchA which is connected on regulatorA (from PMIC) and the switchB which is in the gpio of the pmic. The fixed regulator registration for switchA and switchB are failing because it did not found the valid supply/gpio. The one way to resolve the call probe of the fixed regulator only when pmic initialization is done and it is in subsys_init().
The other way is to do the platform device registration of the fixed regulator is in subsys_initcall_sync() in place of arch_init, although driver is in subsys_initcall() to postponed the probe calling.

What do you suggest on this case?

#3 lore raw
Quoted 15 lines · Laxman Dewangan
Quoted 3 lines

I don't really think this is worth faffing about with, it seems at least as likely to create more problems with things that depend on the regulator as it is to make the regulator work. Really we need Grant's

Yes, I agree, the init ordering need to be done properly but this is how we have as of now to make ordering.
I have the switchA which is connected on regulatorA (from PMIC) and the switchB which is in the gpio of the pmic. The fixed regulator registration for switchA and switchB are failing because it did not found the valid supply/gpio. The one way to resolve the call probe of the fixed regulator only when pmic initialization is done and it is in subsys_init().
The other way is to do the platform device registration of the fixed regulator is in subsys_initcall_sync() in place of arch_init, although driver is in subsys_initcall() to postponed the probe calling.

Quoted 1 line

What do you suggest on this case?

Honestly I'd suggest that you contribute to the effort to get the probe ordering handling code implemented in mainline. This just seems like a big can of worms to open up for something that's hopefully just going to be a short term thing. It's a real problem but this seems fairly niche and like if we start doing more than we're already doing we're going to end up running around chasing our own tails on this stuff. I'm really not sure what the status is on that work, though - it may be that you actually need to pick the patches up and push them forwards yourself.

#4 lore raw
Quoted 9 lines

From: [email protected] [mailto:[email protected]] On Behalf Of Mark Brown
Sent: Friday, January 06, 2012 12:24 PM

Quoted 4 lines

is in subsys_initcall_sync() in place of arch_init, although driver is in subsys_initcall() to postponed the probe calling.

What do you suggest on this case?

Quoted 8 lines

Honestly I'd suggest that you contribute to the effort to get the probe ordering handling code implemented in mainline. This just seems like a big can of worms to open up for something that's hopefully just going to be a short term thing. It's a real problem but this seems fairly niche and like if we start doing more than we're already doing we're going to end up running around chasing our own tails on this stuff. I'm really not sure what the status is on that work, though - it may be that you actually need to pick the patches up and push them forwards yourself.

Completely agree with you. I went through the Grant's change " drivercore: Add driver probe deferral mechanism" and it is discussed in more details here. I will start different thread communication on this issue.

Quoted 4 lines

--
To unsubscribe from this list: send the line "unsubscribe linux-pm" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html