Re: [PATCH] HID: debug: improve hid_debug_event()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Nov 25 2015, Joe Perches <joe@xxxxxxxxxxx> 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
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Index of Archives]     [Linux Media Devel]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [Linux Wireless Networking]     [Linux Omap]

  Powered by Linux