diff mbox series

[V5,1/5] rpmsg: glink: Use complete_all for open states

Message ID 1589346606-15046-2-git-send-email-aneela@codeaurora.org
State New
Headers show
Series [V5,1/5] rpmsg: glink: Use complete_all for open states | expand

Commit Message

Arun Kumar Neelakantam May 13, 2020, 5:10 a.m. UTC
From: Chris Lew <clew@codeaurora.org>

The open_req and open_ack completion variables are the state variables
to represet a remote channel as open. Use complete_all so there are no
races with waiters and using completion_done.

Signed-off-by: Chris Lew <clew@codeaurora.org>
Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
---
 drivers/rpmsg/qcom_glink_native.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Arun Kumar Neelakantam May 20, 2020, 9:28 a.m. UTC | #1
On 5/14/2020 2:29 AM, Mathieu Poirier wrote:
> Hi Arun,
>
> On Wed, May 13, 2020 at 10:40:02AM +0530, Arun Kumar Neelakantam wrote:
>> From: Chris Lew <clew@codeaurora.org>
>>
>> The open_req and open_ack completion variables are the state variables
>> to represet a remote channel as open. Use complete_all so there are no
> s/represet/represent
done added in patch set 6
>
>> races with waiters and using completion_done.
>>
>> Signed-off-by: Chris Lew <clew@codeaurora.org>
>> Signed-off-by: Arun Kumar Neelakantam <aneela@codeaurora.org>
>> ---
>>   drivers/rpmsg/qcom_glink_native.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
>> index 1995f5b..604f11f 100644
>> --- a/drivers/rpmsg/qcom_glink_native.c
>> +++ b/drivers/rpmsg/qcom_glink_native.c
>> @@ -970,7 +970,7 @@ static int qcom_glink_rx_open_ack(struct qcom_glink *glink, unsigned int lcid)
>>   		return -EINVAL;
>>   	}
>>   
>> -	complete(&channel->open_ack);
>> +	complete_all(&channel->open_ack);
> If you do this and as per the note in the comment section above
> completion_done(), there shouldn't be a need to call completion_done() in
> qcom_glink_announce_create().
>
> Thanks,
> Mathieu
the completion_done() check still required to avoid sending intent 
request on channel which only opened by remote.
>   
>
>>   
>>   	return 0;
>>   }
>> @@ -1413,7 +1413,7 @@ static int qcom_glink_rx_open(struct qcom_glink *glink, unsigned int rcid,
>>   	channel->rcid = ret;
>>   	spin_unlock_irqrestore(&glink->idr_lock, flags);
>>   
>> -	complete(&channel->open_req);
>> +	complete_all(&channel->open_req);
>>   
>>   	if (create_device) {
>>   		rpdev = kzalloc(sizeof(*rpdev), GFP_KERNEL);
>> -- 
>> 2.7.4
diff mbox series

Patch

diff --git a/drivers/rpmsg/qcom_glink_native.c b/drivers/rpmsg/qcom_glink_native.c
index 1995f5b..604f11f 100644
--- a/drivers/rpmsg/qcom_glink_native.c
+++ b/drivers/rpmsg/qcom_glink_native.c
@@ -970,7 +970,7 @@  static int qcom_glink_rx_open_ack(struct qcom_glink *glink, unsigned int lcid)
 		return -EINVAL;
 	}
 
-	complete(&channel->open_ack);
+	complete_all(&channel->open_ack);
 
 	return 0;
 }
@@ -1413,7 +1413,7 @@  static int qcom_glink_rx_open(struct qcom_glink *glink, unsigned int rcid,
 	channel->rcid = ret;
 	spin_unlock_irqrestore(&glink->idr_lock, flags);
 
-	complete(&channel->open_req);
+	complete_all(&channel->open_req);
 
 	if (create_device) {
 		rpdev = kzalloc(sizeof(*rpdev), GFP_KERNEL);