public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Mukesh Ojha <mojha@codeaurora.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: john.stultz@linaro.org, linux-kernel@vger.kernel.org,
	gkohli@codeaurora.org, cpandya@codeaurora.org,
	neeraju@codeaurora.org
Subject: Re: [PATCH v4] time: Fix extra sleeptime injection when suspend fails
Date: Tue, 17 Jul 2018 11:49:46 +0530	[thread overview]
Message-ID: <6d6dbd5e-0fad-736e-197d-2c4546dda232@codeaurora.org> (raw)
In-Reply-To: <alpine.DEB.2.21.1807162241470.1693@nanos.tec.linutronix.de>



On 7/17/2018 2:20 AM, Thomas Gleixner wrote:
> On Tue, 17 Jul 2018, Mukesh Ojha wrote:
>> @@ -102,7 +102,7 @@ static int rtc_resume(struct device *dev)
>>   	struct timespec64	sleep_time;
>>   	int err;
>>   
>> -	if (timekeeping_rtc_skipresume())
>> +	if (!timekeeping_rtc_skipresume())
>>   		return 0;
> That does not make any sense at all, really.
>
>>   /* Flag for if there is a persistent clock on this platform */
>>   static bool persistent_clock_exists;
>> @@ -1610,7 +1622,7 @@ static void __timekeeping_inject_sleeptime(struct timekeeper *tk,
>>    */
>>   bool timekeeping_rtc_skipresume(void)
>>   {
>> -	return sleeptime_injected;
>> +	return suspend_timing_needed;
> Just make this !suspend_timing_needed and the function name and its return
> value still makes sense.
>
>> @@ -1701,13 +1714,13 @@ void timekeeping_resume(void)
>>   					      tk->tkr_mono.mask);
>>   		nsec = mul_u64_u32_shr(cyc_delta, clock->mult, clock->shift);
>>   		ts_delta = ns_to_timespec64(nsec);
>> -		sleeptime_injected = true;
>> +		suspend_timing_needed = false;
>>   	} else if (timespec64_compare(&ts_new, &timekeeping_suspend_time) > 0) {
>>   		ts_delta = timespec64_sub(ts_new, timekeeping_suspend_time);
>> -		sleeptime_injected = true;
>> +		suspend_timing_needed = false;
>>   	}
>>   
>> -	if (sleeptime_injected)
>> +	if (!suspend_timing_needed)
>>   		__timekeeping_inject_sleeptime(tk, &ts_delta);
> This reads odd as well. I'd rather keep a local variable inject_sleeptime
> or such and set that in the code pathes above.
>
>     	if (...) {
> 	   	...
> 		inject_sleeptime = true;
>     	} else if (...) {
> 	   	...
> 		inject_sleeptime = true;
> 	}
>
> 	if (inject_sleeptime) {
> 		suspend_timing_needed = false;
> 		__timekeeping_inject_sleeptime();
> 	}

Will do suggested change and send in v5.

Thanks.
>
> Hmm? Just blindly converting everything results in functional, but
> nonsensical code. Think about what happens when you look at that stuff 6
> month from now...
>
> Thanks,
>
> 	tglx
>


  reply	other threads:[~2018-07-17  6:19 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-07-16 20:40 [PATCH v4] time: Fix extra sleeptime injection when suspend fails Mukesh Ojha
2018-07-16 20:50 ` Thomas Gleixner
2018-07-17  6:19   ` Mukesh Ojha [this message]
2018-07-16 21:01 ` John Stultz
2018-07-17  6:29   ` Mukesh Ojha

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=6d6dbd5e-0fad-736e-197d-2c4546dda232@codeaurora.org \
    --to=mojha@codeaurora.org \
    --cc=cpandya@codeaurora.org \
    --cc=gkohli@codeaurora.org \
    --cc=john.stultz@linaro.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=neeraju@codeaurora.org \
    --cc=tglx@linutronix.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox