From: Rasmus Villemoes <linux@rasmusvillemoes.dk>
To: Joe Perches <joe@perches.com>
Cc: Jiri Kosina <jikos@kernel.org>,
linux-input@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] HID: debug: improve hid_debug_event()
Date: Thu, 26 Nov 2015 22:03:35 +0100 [thread overview]
Message-ID: <87a8q0eamw.fsf@rasmusvillemoes.dk> (raw)
In-Reply-To: <1448483516.20113.61.camel@perches.com> (Joe Perches's message of "Wed, 25 Nov 2015 12:31:56 -0800")
On Wed, Nov 25 2015, Joe Perches <joe@perches.com> wrote:
>> spin_lock_irqsave(&hdev->debug_list_lock, flags);
>> list_for_each_entry(list, &hdev->debug_list, node) {
>> - for (i = 0; i < strlen(buf); i++)
>> + for (i = 0; buf[i]; i++)
>> list->hid_debug_buf[(list->tail + i) % HID_DEBUG_BUFSIZE] =
>> buf[i];
>> list->tail = (list->tail + i) % HID_DEBUG_BUFSIZE;
>
> trivia:
>
> The code might look nicer if (list->tail + i) % HID_DEBUG_BUFSIZE
> was stored into a temporary.
Maybe.
> Maybe use an if >= BUFSIZE to avoid a %
Nah, that would likely be worse; both a cmov and a conditional jump are
probably more expensive than a simple '& 0x1ff' which the % should compile to
(provided the expression is unsigned).
Rasmus
next prev parent reply other threads:[~2015-11-26 21:03 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-11-24 12:33 [PATCH] HID: debug: improve hid_debug_event() Rasmus Villemoes
2015-11-25 20:31 ` Joe Perches
2015-11-26 21:03 ` Rasmus Villemoes [this message]
2015-11-26 23:05 ` Jiri Kosina
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=87a8q0eamw.fsf@rasmusvillemoes.dk \
--to=linux@rasmusvillemoes.dk \
--cc=jikos@kernel.org \
--cc=joe@perches.com \
--cc=linux-input@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
/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