This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
Re: [PATCH v2 1/2] posix-timers: Prevents overrun counter overflow
- From: Richard Cochran <richardcochran at gmail dot com>
- To: Daniel Church <dchurch at andplus dot com>
- Cc: Thomas Gleixner <tglx at linutronix dot de>, linux-kernel at vger dot kernel dot org, libc-alpha at sourceware dot org
- Date: Sat, 24 Jan 2015 19:17:24 +0100
- Subject: Re: [PATCH v2 1/2] posix-timers: Prevents overrun counter overflow
- Authentication-results: sourceware.org; auth=none
- References: <1422121737-3686-1-git-send-email-dchurch at andplus dot com> <1422121737-3686-2-git-send-email-dchurch at andplus dot com>
On Sat, Jan 24, 2015 at 12:48:56PM -0500, Daniel Church wrote:
> +/*
> + * Updates a timer's overrun count while capping it to delaytimer_max
> + */
> +static void posix_timer_update_overrun_count(struct k_itimer *timer,
> + unsigned int overruns)
> +{
> + const bool newOverrunsAboveMax = overruns >= delaytimer_max;
> + const bool totalOverrunsAboveMax =
> + timer->it_overrun >= 0 &&
> + timer->it_overrun >= delaytimer_max - overruns;
Lower camel case is not a part of the kernel coding style.
Also, the 'const' keyword is useless in this context.
> +
> + if (newOverrunsAboveMax || totalOverrunsAboveMax) {
> + timer->it_overrun = delaytimer_max;
> + } else {
> + timer->it_overrun += overruns;
> + }
> +}
> +
> /* Get clock_realtime */
> static int posix_clock_realtime_get(clockid_t which_clock, struct timespec *tp)
> {
> @@ -1122,3 +1150,4 @@ long clock_nanosleep_restart(struct restart_block *restart_block)
>
> return kc->nsleep_restart(restart_block);
> }
> +
This stray newline and the camel case are the kinds of things that
checkpatch.pl will catch.
Thanks,
Richard