On Thu, Nov 16, 2023 at 4:34 PM Joy Chakraborty <joychakr@xxxxxxxxxx> wrote: > I tried to place the calls to set the pinctrl states after driver/user > callback based on my understanding of runtime code so that existing > users do get a chance to set the state with any special sequence that > needs to be performed post which doing another call to set the state > would be ignored in the pinctrl framework. This makes sense. (And also is in the original commit.) I think you should actually over-document this by also mentioning this in the kerneldoc above each of the *_try_* callbacks so users simply can't miss this point. > But this only would be possible with the assumption that even in any > special sequences executed by users they set nothing but "default" > state in runtime_resume, "idle" state in runtime_idle and "'sleep" > state in their runtime suspend callbacks. > And like Andy mentions about "->prepare callback", if there are > drivers that are setting pinctrl state "default", "sleep" or "idle" > from any callback but > ... > int (*runtime_suspend)(struct device *dev); > int (*runtime_resume)(struct device *dev); > int (*runtime_idle)(struct device *dev); > ... > it could indeed be a problem. > I'll dig into users of pinctrl_select_sleep/default/idle and see if > there are such cases or if it could be done in some other way. It's worth a check but I doubt much will turn up. The "idle" and "sleep" states are simply not used much in the kernel. Your users will likely be the first. So which hardware target will use this? It's immensely useful to have a good example to point at: that device use "defaul", "sleep", "idle" the idiomatic way. Yours, Linus Walleij