Skip to contentSkip to conversation

regulator-core has_full_constraints set too late for dt using boards ?

DISCUSSION Hans de Goede 2 participants 8 messages Dec 11, 2013 – Dec 12, 2013

lore
Share & tools
lore
#0 lore raw

Hi All,

While looking into making regulator_get_optional not print an error when no regulator is found, I've noticed that for dt enabled boards, has_full_constraints is not set until regulator_init_complete() runs, which is a late_initcall.

This means that it gets set after it has already been checked from calls like regulator_get which are likely done by init functions running earlier.

This seems wrong ...

Regards,

Hans

#1 lore raw
Quoted 11 lines · Hans de Goede

While looking into making regulator_get_optional not print an error when no regulator is found, I've noticed that for dt enabled boards, has_full_constraints is not set until regulator_init_complete() runs, which is a late_initcall.

This means that it gets set after it has already been checked from calls like regulator_get which are likely done by init functions running earlier.

This seems wrong ...

Please look at the current code, that's not how this works any more.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131211/55f674c2/attachment.sig>

#2 lore raw

Hi,

Quoted 8 lines · Mark Brown
Quoted 5 lines · Hans de Goede

While looking into making regulator_get_optional not print an error when no regulator is found, I've noticed that for dt enabled boards, has_full_constraints is not set until regulator_init_complete() runs, which is a late_initcall.

Quoted 7 lines
Quoted 5 lines

This means that it gets set after it has already been checked from calls like regulator_get which are likely done by init functions running earlier.

This seems wrong ...

Please look at the current code, that's not how this works any more.

More current then 3.13-rc3 ? Because that is what I've been looking at.

I could be completely wrong of course. Either way could you give a few hints as to how my interpretation of how this works is wrong ?

Thanks & Regards,

Hans

#3 lore raw
Quoted 5 lines · Hans de Goede
Quoted 1 line · Mark Brown

Please look at the current code, that's not how this works any more.

More current then 3.13-rc3 ? Because that is what I've been looking at.

Yes, -next. It'll be going to Linus probably this week.

Quoted 2 lines

I could be completely wrong of course. Either way could you give a few hints as to how my interpretation of how this works is wrong ?

It's correct for the code you've been looking at but has since been
changed. Please look at the changes in -next, you should generally
check -next for the current state of things.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131212/b8104725/attachment-0001.sig>

#4 lore raw

Hi,

Quoted 7 lines · Mark Brown
Quoted 5 lines · Hans de Goede
Quoted 1 line · Mark Brown

Please look at the current code, that's not how this works any more.

More current then 3.13-rc3 ? Because that is what I've been looking at.

Quoted 8 lines

Yes, -next. It'll be going to Linus probably this week.

Quoted 2 lines

I could be completely wrong of course. Either way could you give a few hints as to how my interpretation of how this works is wrong ?

It's correct for the code you've been looking at but has since been changed. Please look at the changes in -next, you should generally check -next for the current state of things.

Ah yes, I see, thanks for clarifying this.

Note my patch to not do a dev_err when no regulator is found for regulator_get_optional still is needed in -next.

Thanks & Regards,

Hans

#5 lore raw
Quoted 2 lines · Hans de Goede

Note my patch to not do a dev_err when no regulator is found for regulator_get_optional still is needed in -next.

It's sitting in my review queue, it's not very well described so it's
not clear that you've selected the correct criteria and I need to find
time to actually look at it properly.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131212/c792fad9/attachment.sig>

#6 lore raw

Hi,

Quoted 8 lines · Mark Brown
Quoted 2 lines · Hans de Goede

Note my patch to not do a dev_err when no regulator is found for regulator_get_optional still is needed in -next.

It's sitting in my review queue, it's not very well described so it's not clear that you've selected the correct criteria and I need to find time to actually look at it properly.

I did not want to add a third boolean parameter to indicate _regulator_get() was being called from regulator_get_optional.

Since regulator_get_optional is the only one calling _regulator_get() with both allow_dummy and exclusive set to false I've added the following condition to printing the error:

	if (!(!allow_dummy && !exclusive))

Simplified to:

	if (allow_dummy || exclusive)

Which means that it will get printed in all cases it would get printed previously, except when called from regulator_get_optional.

Alternatively a third "optional" boolean parameter could get added to _regulator_get() and the test for printing the error could become:

if (!optional)

Let me know if you would prefer doing things that way and I'll respin the patch.

Thanks & Regards,

Hans

#7 lore raw
Quoted 10 lines · Hans de Goede
Quoted 3 lines · Mark Brown

It's sitting in my review queue, it's not very well described so it's not clear that you've selected the correct criteria and I need to find time to actually look at it properly.

Since regulator_get_optional is the only one calling _regulator_get() with both allow_dummy and exclusive set to false I've added the following condition to printing the error:

Put some of this analysis in the commit message and perhaps a comment in
the code please...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20131212/a3e93479/attachment.sig>