On Mon, Nov 27, 2023 at 11:58 AM Uwe Kleine-König <u.kleine-koenig@xxxxxxxxxxxxxx> wrote: > > Hello Bartosz, > > On Fri, Nov 24, 2023 at 10:16:40PM +0100, Bartosz Golaszewski wrote: > > I admit I've been quite busy but I do plan on going through Uwe's > > series next week and maybe running tests similar to what I have for > > GPIO on it. > > That's great. If you want to do that on my tree that already saw a few > improvements compared to what I sent out, get it at > > https://git.pengutronix.de/git/ukl/linux pwm-lifetime-tracking > > . The improvements are only on the driver level, so unless you're using > one of the improved drivers, the difference wouldn't be that big I > guess. For (maybe) quicker feedback loops, you can find me on irc (e.g. > on libera's #linux-pwm) if that's a communication channel you like. > > I look forward to your findings, > Uwe I don't see anything obviously wrong with the approach. I see the chip->operational field that is set to false on release. In my version, we just use a NULL-pointer to carry the same information. Interestingly you DO have a pwm_device and pwm_chip structures. I'd say it would be more logical to have the pwm_device embed struct device. My approach is more about maintaining the logical scope and not changing the ownership of objects allocated in the driver. I also don't see a reason to expose the internals of the subsystem (struct device) to the provider drivers other than in callbacks where it is relevant. Subsystems should handle as much as possible and any data structures not relevant to what the driver does should be hidden from it. Bart