On 25 October 2016 at 18:13, Jack Wang <xjtu...@gmail.com> wrote:
> Hi Binoy,
>
> snip
>>
>>         port->ib_dev   = device;
>>         port->port_num = port_num;
>> -       sema_init(&port->sm_sem, 1);
>> +       init_completion(&port->sm_comp);
>> +       complete(&port->sm_comp);
>
> Why complete here?
>
>>         mutex_init(&port->file_mutex);
>>         INIT_LIST_HEAD(&port->file_list);
>>
>> --
> KR,
> Jinpu


Hi Jack,

ib_umad_sm_open() calls wait_for_completion_interruptible() which comes before
ib_umad_sm_close() that calls complete(). In the initial open() there
will not be
anybody to signal the completion, so the complete is called to mark
the initial state.
I am not sure if this is the right way to do it, though.

-Binoy

Reply via email to