Re: [PATCH v2 2/8] IB/core: Replace semaphore sm_sem with completion

2016-10-25 Thread Arnd Bergmann
On Tuesday, October 25, 2016 9:48:22 AM CEST Jason Gunthorpe wrote: > > Using a completion to model exclusive ownership seems convoluted to > me - is that a thing now? What about an atomic? I also totally missed how this is used. I initially mentioned to Binoy that almost all semaphores can

Re: [PATCH v2 2/8] IB/core: Replace semaphore sm_sem with completion

2016-10-25 Thread Arnd Bergmann
On Tuesday, October 25, 2016 9:48:22 AM CEST Jason Gunthorpe wrote: > > Using a completion to model exclusive ownership seems convoluted to > me - is that a thing now? What about an atomic? I also totally missed how this is used. I initially mentioned to Binoy that almost all semaphores can

Re: [PATCH v2 2/8] IB/core: Replace semaphore sm_sem with completion

2016-10-25 Thread Jason Gunthorpe
On Tue, Oct 25, 2016 at 08:38:21PM +0530, Binoy Jayan wrote: > On 25 October 2016 at 18:13, Jack Wang wrote: > > Hi Binoy, > > > > snip > >> > >> port->ib_dev = device; > >> port->port_num = port_num; > >> - sema_init(>sm_sem, 1); > >> +

Re: [PATCH v2 2/8] IB/core: Replace semaphore sm_sem with completion

2016-10-25 Thread Jason Gunthorpe
On Tue, Oct 25, 2016 at 08:38:21PM +0530, Binoy Jayan wrote: > On 25 October 2016 at 18:13, Jack Wang wrote: > > Hi Binoy, > > > > snip > >> > >> port->ib_dev = device; > >> port->port_num = port_num; > >> - sema_init(>sm_sem, 1); > >> + init_completion(>sm_comp); >

Re: [PATCH v2 2/8] IB/core: Replace semaphore sm_sem with completion

2016-10-25 Thread Jack Wang
Hi Binoy, 2016-10-25 17:08 GMT+02:00 Binoy Jayan : > On 25 October 2016 at 18:13, Jack Wang wrote: >> Hi Binoy, >> >> snip >>> >>> port->ib_dev = device; >>> port->port_num = port_num; >>> - sema_init(>sm_sem, 1); >>> +

Re: [PATCH v2 2/8] IB/core: Replace semaphore sm_sem with completion

2016-10-25 Thread Jack Wang
Hi Binoy, 2016-10-25 17:08 GMT+02:00 Binoy Jayan : > On 25 October 2016 at 18:13, Jack Wang wrote: >> Hi Binoy, >> >> snip >>> >>> port->ib_dev = device; >>> port->port_num = port_num; >>> - sema_init(>sm_sem, 1); >>> + init_completion(>sm_comp); >>> +

Re: [PATCH v2 2/8] IB/core: Replace semaphore sm_sem with completion

2016-10-25 Thread Binoy Jayan
On 25 October 2016 at 18:13, Jack Wang wrote: > Hi Binoy, > > snip >> >> port->ib_dev = device; >> port->port_num = port_num; >> - sema_init(>sm_sem, 1); >> + init_completion(>sm_comp); >> + complete(>sm_comp); > > Why complete here? > >>

Re: [PATCH v2 2/8] IB/core: Replace semaphore sm_sem with completion

2016-10-25 Thread Binoy Jayan
On 25 October 2016 at 18:13, Jack Wang wrote: > Hi Binoy, > > snip >> >> port->ib_dev = device; >> port->port_num = port_num; >> - sema_init(>sm_sem, 1); >> + init_completion(>sm_comp); >> + complete(>sm_comp); > > Why complete here? > >>

Re: [PATCH v2 2/8] IB/core: Replace semaphore sm_sem with completion

2016-10-25 Thread Jack Wang
Hi Binoy, snip > > port->ib_dev = device; > port->port_num = port_num; > - sema_init(>sm_sem, 1); > + init_completion(>sm_comp); > + complete(>sm_comp); Why complete here? > mutex_init(>file_mutex); > INIT_LIST_HEAD(>file_list); > > -- KR,

Re: [PATCH v2 2/8] IB/core: Replace semaphore sm_sem with completion

2016-10-25 Thread Jack Wang
Hi Binoy, snip > > port->ib_dev = device; > port->port_num = port_num; > - sema_init(>sm_sem, 1); > + init_completion(>sm_comp); > + complete(>sm_comp); Why complete here? > mutex_init(>file_mutex); > INIT_LIST_HEAD(>file_list); > > -- KR,

[PATCH v2 2/8] IB/core: Replace semaphore sm_sem with completion

2016-10-25 Thread Binoy Jayan
The semaphore 'sm_sem' is used as completion, so convert it to struct completion. Semaphores are going away in the future. The initial status of the completion variable is marked as completed by a call to the function 'complete' immediately following the initialization. Signed-off-by: Binoy Jayan

[PATCH v2 2/8] IB/core: Replace semaphore sm_sem with completion

2016-10-25 Thread Binoy Jayan
The semaphore 'sm_sem' is used as completion, so convert it to struct completion. Semaphores are going away in the future. The initial status of the completion variable is marked as completed by a call to the function 'complete' immediately following the initialization. Signed-off-by: Binoy Jayan