diff mbox series

[RFC,v1,05/10] s390/cio: Use common channel program processor for TIC

Message ID 20181109023937.96105-6-farman@linux.ibm.com (mailing list archive)
State New, archived
Headers show
Series vfio-ccw channel program rework | expand

Commit Message

Eric Farman Nov. 9, 2018, 2:39 a.m. UTC
Now that a channel program is examined by a separate routine,
we can replace much of the TIC code with a call to that function.

Signed-off-by: Eric Farman <farman@linux.ibm.com>
---
 drivers/s390/cio/vfio_ccw_cp.c | 39 ++++-----------------------------------
 1 file changed, 4 insertions(+), 35 deletions(-)

Comments

Farhan Ali Nov. 19, 2018, 2:34 p.m. UTC | #1
On 11/08/2018 09:39 PM, Eric Farman wrote:
> Now that a channel program is examined by a separate routine,
> we can replace much of the TIC code with a call to that function.
> 
> Signed-off-by: Eric Farman<farman@linux.ibm.com>
> ---
>   drivers/s390/cio/vfio_ccw_cp.c | 39 ++++-----------------------------------
>   1 file changed, 4 insertions(+), 35 deletions(-)

Reviewed-by: Farhan Ali <alifm@linux.ibm.com>
Farhan Ali Nov. 19, 2018, 2:45 p.m. UTC | #2
On 11/08/2018 09:39 PM, Eric Farman wrote:
> Now that a channel program is examined by a separate routine,
> we can replace much of the TIC code with a call to that function.
> 
> Signed-off-by: Eric Farman<farman@linux.ibm.com>
> ---
>   drivers/s390/cio/vfio_ccw_cp.c | 39 ++++-----------------------------------
>   1 file changed, 4 insertions(+), 35 deletions(-)

Reviewed-by: Farhan Ali<alifm@linux.ibm.com>
diff mbox series

Patch

diff --git a/drivers/s390/cio/vfio_ccw_cp.c b/drivers/s390/cio/vfio_ccw_cp.c
index 383f810ef389..3957c46bdaea 100644
--- a/drivers/s390/cio/vfio_ccw_cp.c
+++ b/drivers/s390/cio/vfio_ccw_cp.c
@@ -405,40 +405,6 @@  static int tic_target_chain_exists(struct ccw1 *tic, struct channel_program *cp)
 	return 0;
 }
 
-static int ccwchain_loop_tic(struct ccwchain *chain,
-			     struct channel_program *cp);
-
-static int ccwchain_handle_tic(struct ccw1 *tic, struct channel_program *cp)
-{
-	struct ccwchain *chain;
-	int len, ret;
-
-	/* May transfer to an existing chain. */
-	if (tic_target_chain_exists(tic, cp))
-		return 0;
-
-	/* Get chain length. */
-	len = ccwchain_calc_length(tic->cda, cp);
-	if (len < 0)
-		return len;
-
-	/* Need alloc a new chain for this one. */
-	chain = ccwchain_alloc(cp, len);
-	if (!chain)
-		return -ENOMEM;
-	chain->ch_iova = tic->cda;
-
-	/* Copy the new chain from user. */
-	ret = copy_ccw_from_iova(cp, chain->ch_ccw, tic->cda, len);
-	if (ret) {
-		ccwchain_free(chain);
-		return ret;
-	}
-
-	/* Loop for tics on this new chain. */
-	return ccwchain_loop_tic(chain, cp);
-}
-
 /* Loop for TICs. */
 static int ccwchain_loop_tic(struct ccwchain *chain, struct channel_program *cp)
 {
@@ -451,7 +417,10 @@  static int ccwchain_loop_tic(struct ccwchain *chain, struct channel_program *cp)
 		if (!ccw_is_tic(tic))
 			continue;
 
-		ret = ccwchain_handle_tic(tic, cp);
+		if (tic_target_chain_exists(tic, cp))
+			continue;
+
+		ret = process_channel_program(cp, tic->cda);
 		if (ret)
 			return ret;
 	}