From: Alexey Dobriyan <adobriyan@gmail.com>
To: Michael Rodriguez <dkingston02@gmail.com>
Cc: tglx@linutronix.de, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] kernel/itimer.c use ternary operators where appropriate and fix all style issues.
Date: Thu, 24 Mar 2011 19:41:03 +0200 [thread overview]
Message-ID: <20110324174103.GA5187@p183.telecom.by> (raw)
In-Reply-To: <1300987563-27697-1-git-send-email-dkingston02@gmail.com>
On Thu, Mar 24, 2011 at 01:26:03PM -0400, Michael Rodriguez wrote:
> @@ -33,12 +32,8 @@ static struct timeval itimer_get_remtime(struct hrtimer *timer)
> * hrtimer_get_remtime() call but before this condition
> * then we return 0 - which is correct.
> */
> - if (hrtimer_active(timer)) {
> - if (rem.tv64 <= 0)
> - rem.tv64 = NSEC_PER_USEC;
> - } else
> - rem.tv64 = 0;
> -
> + rem.tv64 = ((hrtimer_active(timer) && rem.tv64 <= 0) ?
> + NSEC_PER_USEC : 0);
NAK, not equivalent code.
> return ktime_to_timeval(rem);
> }
>
> @@ -57,17 +52,12 @@ static void get_cpu_itimer(struct task_struct *tsk, unsigned int clock_id,
> cputime_t t;
>
> thread_group_cputimer(tsk, &cputime);
> - if (clock_id == CPUCLOCK_PROF)
> - t = cputime_add(cputime.utime, cputime.stime);
> - else
> - /* CPUCLOCK_VIRT */
> - t = cputime.utime;
> -
> - if (cputime_le(cval, t))
> - /* about to fire */
> - cval = cputime_one_jiffy;
> - else
> - cval = cputime_sub(cval, t);
> +
> + t = (clock_id == CPUCLOCK_PROF) ? cputime_add(cputime.utime,
> + cputime.stime) : cputime.utime;
> +
> + cval = (cputime_le(cval, t) ? cputime_one_jiffy :
> + cputime_sub(cval, t));
This code is not more readable than original one.
prev parent reply other threads:[~2011-03-24 17:41 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2011-03-24 17:26 Michael Rodriguez
2011-03-24 17:41 ` Alexey Dobriyan [this message]
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=20110324174103.GA5187@p183.telecom.by \
--to=adobriyan@gmail.com \
--cc=dkingston02@gmail.com \
--cc=linux-kernel@vger.kernel.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
all inboxes | Powered by JetHome®