mhi_bus: core: Return EBUSY if MHI ring is full
Subsystems (2)
PATCH 1/1 mhi_bus: core: Return EBUSY if MHI ring is full
From: Fan Wu <[email protected]>
Currently ENOMEM is returned when MHI ring is full. This error code is very misleading. Change to EBUSY instead.
--- drivers/bus/mhi/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/bus/mhi/core/main.c +1 -1
@@ -996,7 +996,7 @@ static int mhi_queue(struct mhi_device *mhi_dev, struct mhi_buf_info *buf_info, ret =mhi_is_ring_full (mhi_cntrl, tre_ring);if (unlikely (ret)) { - ret = -ENOMEM ; + ret = -EBUSY ; goto exit_unlock; }
Signature · 2 lines
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Quoted 16 lines · Jeffrey Hugo
From: Fan Wu <[email protected]>
Currently ENOMEM is returned when MHI ring is full. This error code is very misleading. Change to EBUSY instead.
Signed-off-by Fan Wu <[email protected]>Signed-off-by Jeffrey Hugo <[email protected]>--- drivers/bus/mhi/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/bus/mhi/core/main.c +0
-0
drivers/bus/mhi/core/main.c static int mhi_queue(struct mhi_device *mhi_dev, · line 1002
Quoted 8 lines
drivers/bus/mhi/core/main.c +1
-1@@ -996,7 +996,7 @@ static int mhi_queue(struct mhi_device *mhi_dev,struct mhi_buf_info *buf_info, ret =mhi_is_ring_full (mhi_cntrl, tre_ring);if (unlikely (ret)) { - ret = -ENOMEM ; + ret = -EBUSY ; goto exit_unlock; }
ENOMEM is descriptive of the state of the ring since you basically cannot queue any more packets as no memory is currently available.
But I agree, it can be misleading for this API. How about EAGAIN in place of EBUSY, which tells the user to try the queue attempt again implying memory should become available as more elements are consumed by the device/client?
Thanks,
Bhaumik
---
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
Quoted 29 lines · Bhaumik Bhatt
Quoted 16 lines · Jeffrey Hugo
From: Fan Wu <[email protected]>
Currently ENOMEM is returned when MHI ring is full. This error code is very misleading. Change to EBUSY instead.
Signed-off-by Fan Wu <[email protected]>Signed-off-by Jeffrey Hugo <[email protected]>---
drivers/bus/mhi/core/main.c | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)drivers/bus/mhi/core/main.c +0
-0drivers/bus/mhi/core/main.c static int mhi_queue(struct mhi_device *mhi_dev, · line 1002
Quoted 8 lines
drivers/bus/mhi/core/main.c +1
-1@@ -996,7 +996,7 @@ static int mhi_queue(struct mhi_device *mhi_dev,struct mhi_buf_info *buf_info, ret = mhi_is_ring_full(mhi_cntrl, tre_ring); if (unlikely(ret)) { - ret = -ENOMEM; + ret = -EBUSY; goto exit_unlock; }ENOMEM is descriptive of the state of the ring since you basically cannot queue any more packets as no memory is currently available.
Quoted 3 lines
But I agree, it can be misleading for this API. How about EAGAIN in place of EBUSY, which tells the user to try the queue attempt again implying memory should become available as more elements are consumed by the device/client?
Fan and I think EAGAIN is fine. Will send a v2.
Signature · 3 lines
Jeffrey Hugo Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Quoted 5 lines · Jeffrey Hugo
From: Fan Wu <[email protected]>
Currently ENOMEM is returned when MHI ring is full. This error code is very misleading. Change to EBUSY instead.
Please use the subject prefix:
"bus: mhi: ..."
Thanks,
Mani
Quoted 23 lines
Signed-off-by Fan Wu <[email protected]>Signed-off-by Jeffrey Hugo <[email protected]>--- drivers/bus/mhi/core/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/bus/mhi/core/main.c +1
-1@@ -996,7 +996,7 @@ static int mhi_queue(struct mhi_device *mhi_dev, struct mhi_buf_info *buf_info, ret =mhi_is_ring_full (mhi_cntrl, tre_ring);if (unlikely (ret)) { - ret = -ENOMEM ; + ret = -EBUSY ; goto exit_unlock; }Signature · 2 lines
Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Quoted 5 lines · Jeffrey Hugo
From: Fan Wu <[email protected]>
Currently ENOMEM is returned when MHI ring is full. This error code is very misleading. Change to EBUSY instead.
Well, there is no space left in the ring, so it's no so misleading.
Regards,
Loic
Quoted 8 lines · Loic Poulain
Quoted 5 lines · Jeffrey Hugo
From: Fan Wu <[email protected]>
Currently ENOMEM is returned when MHI ring is full. This error code is very misleading. Change to EBUSY instead.
Well, there is no space left in the ring, so it's no so misleading.
ENOMEM is typically a memory allocation failure which is not what a client is going to think of regarding the ring, and it's not a unique failure code in this case. gen_tre can also return ENOMEM, which makes it difficult for the client to know if there is some significant failure, or they might just need to wait (assuming that is something the client can do).
Signature · 3 lines
Jeffrey Hugo Qualcomm Technologies, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project.
Quoted 9 lines · Jeffrey Hugo
Quoted 7 lines · Loic Poulain
Quoted 5 lines · Jeffrey Hugo
From: Fan Wu <[email protected]>
Currently ENOMEM is returned when MHI ring is full. This error code is very misleading. Change to EBUSY instead.
Quoted 8 lines
Quoted 1 line
Well, there is no space left in the ring, so it's no so misleading.
ENOMEM is typically a memory allocation failure which is not what a client is going to think of regarding the ring, and it's not a unique failure code in this case.
gen_trecan also return ENOMEM, which makes it difficult for the client to know if there is some significant failure, or they might just need to wait (assuming that is something the client can do).
Yes, fair enough, I overlooked the other thread, -EAGAIN would indeed make sense.
Regards,
Loic