Well, the regulator_get_optional() is still needed to improve. For instance, if dts is not used for one platform and the external VDDD supply is absent. The regulator_get_optional() will return -EPROBE_DEFER, so the SGTL5000's probe, and then the SGTL5000 will do the deferral probe, and this time the same -EPROBE_DEFER error will
return again.
Yea, it seems in non-DT that regulator core can not figure out the -ENODEV case like it does in DT, so it simply returns -EPROBE_DEFER no matter whether the regulator is absent or it's present but just not registered yet. IOW, it can not distinguish between these two cases in non-DT case.
Neither am I aware of any non-DT SGTL5000 users in the tree, nor I care. I'm not concerned by this issue.
Where should this special handling be dealt with ? Is here or regulator_get_optional() will be better ?
Anyway, this is another issue which should be addressed in regulator core, IMO.
Yes, agree.