On 31/10/2024 16:58, Krzysztof Kozlowski wrote: >> + regmap_write(rtc->regmap, RG_RTC_32K_CK_PDN_CLR, RG_RTC_32K_CK_PDN_MASK); >> + regmap_write(rtc->regmap, RG_RTC_MCLK_PDN_CLR, RG_RTC_MCLK_PDN_MASK); >> + counter++; >> + mdelay(1); >> + mutex_unlock(&rtc->clk_lock); >> +} >> + >> +static void power_down_mclk(struct mt6685_rtc *rtc) >> +{ >> + mutex_lock(&rtc->clk_lock); >> + counter--; >> + if (counter < 0) { >> + //dump_stack(); >> + pr_info("mclk_counter[%d]\n", counter); > > Oh man... So many wrong things. This applies to entire code: > 1. Drop dead code. All dead code. > > 2. Do not use pr_xxx but dev_xxx > > 3. Drop all such useless printks because your driver is supposed to be > silent. > > 4. Implement proper clock handling instead of reimplementing it yourself > with some counters. ... clock handling or runtime PM, depending what this thing here really is. Best regards, Krzysztof