Re: [PATCH] uHIDP: HIDP in userspace

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

 



Hi,

On Mon, Mar 17, 2014 at 5:43 AM, Johan Hedberg <johan.hedberg@xxxxxxxxx> wrote:
>>  static gboolean intr_watch_cb(GIOChannel *chan, GIOCondition cond, gpointer data)
>>  {
>>       struct input_device *idev = data;
>>       char address[18];
>>
>> +     if ((cond & G_IO_IN) && hidp_recv_intr_data(chan, idev) &&
>> +                                                     (cond == G_IO_IN)) {
>> +             return TRUE;
>> +     }
>
> This is cramming a bit too many things into the same if-statement.
> Please split it up, e.g. something like:
>
> if ((cond & G_IO_IN) && !hidp_recv_intr_data(chan, idev))
>         goto failed;
>
> /* No exceptions just incoming data  */
> if (cond == G_IO_IN)
>         return TRUE;

Actually, as the original expression was "if ((cond & G_IO_IN) && ...
&& (cond == G_IO_IN))", "cond & G_IO_IN" became no-op. checking
GIOCondition cond with "==" is rarely correct (IMHO), so better review
the logic here.

Best Regards,
-- 
Anderson Lizardo
http://www.indt.org/?lang=en
INdT - Manaus - Brazil
--
To unsubscribe from this list: send the line "unsubscribe linux-bluetooth" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [Bluez Devel]     [Linux Wireless Networking]     [Linux Wireless Personal Area Networking]     [Linux ATH6KL]     [Linux USB Devel]     [Linux Media Drivers]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux