On 01/22/2012 04:22 PM, Mark Brown wrote: > On Sun, Jan 22, 2012 at 01:59:25PM +0100, Sylwester Nawrocki wrote: >> How about the following patch (untested) ? It might be a better start for >> proper power management implementation and would still allow the driver >> to work on platforms that don't support runtime PM. > > It's not really a platform issue - the platform bus by default does the > right thing and the runtime PM core is pure software, the only platform > dependency is if users have bothered truning runtime PM on. It is a platform (SoC) issue in terms of enabling PM_RUNTIME, which is pure software, as you're pointing out. I think we agree here that the only issue is that some (ill) platforms refuse to enable PM_RUNTIME. And clock gating belongs to runtime PM, which this I2C controller driver chooses to implement without runtime PM awareness. >> +static inline int s3c24xx_pm_runtime_put(struct s3c24xx_i2c *i2c) >> +{ >> + if (!pm_runtime_enabled(i2c->dev)) { >> + clk_disable(i2c->clk); >> + return 0; >> + } >> + >> + return pm_runtime_put(i2c->dev); >> +} > > To be honest I don't think this is worth it. Either we just keep the > clock management outside of runtime PM or we push it in but trying to > support both simultaneously adds complication and doesn't actually do > all that much in practical terms. It's not pretty, I agree. However it is supposed to be more a temporary solution, rather than anything final. And it probably is better at avoiding any races and mismatch between real device state and the PM core knowledge of it. I'm not going to persuade my version too much, it's far from prefect, similarly as the original patch in this thread. The best solution would be to force platform to enable PM_RUNTIME if they want to use a driver which does runtime PM. But this has to wait, yet, probably infinitely.. :) -- To unsubscribe from this list: send the line "unsubscribe linux-i2c" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html