lkml.org 
[lkml]   [2012]   [Dec]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH 4/4 v4] rtc: add rtc-driver for HID sensors of type time
Am 14.12.2012 14:08, schrieb Alexander Holler:
> Am 14.12.2012 10:42, schrieb Lars-Peter Clausen:

>> And another thing I've overlooked before:
>> wait_for_completion_interruptible_timeout can either return a positive
>> number when the completion was completed, 0 in case of an timeout, or a
>> negative error code in case it was interrupted. You need to handle all
>> three. E.g. something like this.
>>
>> ret = wait_for_completion_interruptible_timeout(...)
>> if (ret == 0)
>> return -EIO;
>> if (ret < 0)
>> return ret
>>
>
> Hmpf, the only working approach to use some in kernel functions really
> is to the read source yourself and don't trust anything else. :/

Anyway, my approach doesn't work as it introduces a race condition:


/* get a report with all values through requesting one value */
sensor_hub_input_attr_get_raw_value(...)

/* race if this task goes to slepp and the values were
received before it could call the below wait...

/* wait for all values (event) */
if (!wait_for_completion_interruptible_timeout(...))


I'll have to look for a mechanism how to avoid that. So v5 might need
some time.


Regards,

Alexander



\
 
 \ /
  Last update: 2012-12-14 16:01    [W:0.413 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site