[PATCH 5/6] staging: vchiq_arm: Do not retry bulk transfers on -EINTR

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



-EINTR is returned by various vchiq bulk transfer code paths
on receiving a fatal signal to the process. Since the process is
deemed to be terminated anyway, do not retry the bulk transfer
on -EINTR.

Signed-off-by: Umang Jain <umang.jain@xxxxxxxxxxxxxxxx>
---
 .../interface/vchiq_arm/vchiq_arm.c           | 74 +++++++------------
 1 file changed, 25 insertions(+), 49 deletions(-)

diff --git a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
index d5b23f3fee87..c44b4dc79c03 100644
--- a/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
+++ b/drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c
@@ -853,31 +853,19 @@ vchiq_bulk_transmit(struct vchiq_instance *instance, unsigned int handle, const
 {
 	int ret;
 
-	while (1) {
-		switch (mode) {
-		case VCHIQ_BULK_MODE_NOCALLBACK:
-		case VCHIQ_BULK_MODE_CALLBACK:
-			ret = vchiq_bulk_xfer_callback(instance, handle, (void *)data,
-						       NULL, size, mode, userdata,
-						       VCHIQ_BULK_TRANSMIT);
-			break;
-		case VCHIQ_BULK_MODE_BLOCKING:
-			ret = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size,
-							   VCHIQ_BULK_TRANSMIT);
-			break;
-		default:
-			return -EINVAL;
-		}
-
-		/*
-		 * vchiq_*_bulk_transfer() may return -EINTR, so we need
-		 * to implement a retry mechanism since this function is
-		 * supposed to block until queued
-		 */
-		if (ret != -EINTR)
-			break;
-
-		msleep(1);
+	switch (mode) {
+	case VCHIQ_BULK_MODE_NOCALLBACK:
+	case VCHIQ_BULK_MODE_CALLBACK:
+		ret = vchiq_bulk_xfer_callback(instance, handle, (void *)data,
+					       NULL, size, mode, userdata,
+					       VCHIQ_BULK_TRANSMIT);
+		break;
+	case VCHIQ_BULK_MODE_BLOCKING:
+		ret = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size,
+						   VCHIQ_BULK_TRANSMIT);
+		break;
+	default:
+		return -EINVAL;
 	}
 
 	return ret;
@@ -890,30 +878,18 @@ int vchiq_bulk_receive(struct vchiq_instance *instance, unsigned int handle,
 {
 	int ret;
 
-	while (1) {
-		switch (mode) {
-		case VCHIQ_BULK_MODE_NOCALLBACK:
-		case VCHIQ_BULK_MODE_CALLBACK:
-			ret = vchiq_bulk_xfer_callback(instance, handle, (void *)data, NULL,
-						       size, mode, userdata, VCHIQ_BULK_RECEIVE);
-			break;
-		case VCHIQ_BULK_MODE_BLOCKING:
-			ret = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size,
-							   VCHIQ_BULK_RECEIVE);
-			break;
-		default:
-			return -EINVAL;
-		}
-
-		/*
-		 * vchiq_*_bulk_transfer() may return -EINTR, so we need
-		 * to implement a retry mechanism since this function is
-		 * supposed to block until queued
-		 */
-		if (ret != -EINTR)
-			break;
-
-		msleep(1);
+	switch (mode) {
+	case VCHIQ_BULK_MODE_NOCALLBACK:
+	case VCHIQ_BULK_MODE_CALLBACK:
+		ret = vchiq_bulk_xfer_callback(instance, handle, (void *)data, NULL,
+					       size, mode, userdata, VCHIQ_BULK_RECEIVE);
+		break;
+	case VCHIQ_BULK_MODE_BLOCKING:
+		ret = vchiq_blocking_bulk_transfer(instance, handle, (void *)data, size,
+						   VCHIQ_BULK_RECEIVE);
+		break;
+	default:
+		return -EINVAL;
 	}
 
 	return ret;
-- 
2.45.2





[Index of Archives]     [Linux Driver Development]     [Linux Driver Backports]     [DMA Engine]     [Linux GPIO]     [Linux SPI]     [Video for Linux]     [Linux USB Devel]     [Linux Coverity]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Yosemite Backpacking]
  Powered by Linux