diff mbox series

[2/3] gpu: ipu-v3: image-convert: Combine rotate/no-rotate irq handlers

Message ID 20200617224038.17889-2-slongerbeam@gmail.com (mailing list archive)
State New, archived
Headers show
Series [1/3] gpu: ipu-v3: Restore RGB32, BGR32 | expand

Commit Message

Steve Longerbeam June 17, 2020, 10:40 p.m. UTC
Combine the rotate_irq() and norotate_irq() handlers into a single
eof_irq() handler.

Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>
---
 drivers/gpu/ipu-v3/ipu-image-convert.c | 58 +++++++++-----------------
 1 file changed, 20 insertions(+), 38 deletions(-)

Comments

Philipp Zabel June 26, 2020, 9:36 a.m. UTC | #1
On Wed, 2020-06-17 at 15:40 -0700, Steve Longerbeam wrote:
> Combine the rotate_irq() and norotate_irq() handlers into a single
> eof_irq() handler.
> 
> Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com>

Reviewed-by: Philipp Zabel <p.zabel@pengutronix.de>

regards
Philipp

> ---
>  drivers/gpu/ipu-v3/ipu-image-convert.c | 58 +++++++++-----------------
>  1 file changed, 20 insertions(+), 38 deletions(-)
> 
> diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c
> index eeca50d9a1ee..f8b031ded3cf 100644
> --- a/drivers/gpu/ipu-v3/ipu-image-convert.c
> +++ b/drivers/gpu/ipu-v3/ipu-image-convert.c
> @@ -1709,9 +1709,10 @@ static irqreturn_t do_irq(struct ipu_image_convert_run *run)
>  	return IRQ_WAKE_THREAD;
>  }
>  
> -static irqreturn_t norotate_irq(int irq, void *data)
> +static irqreturn_t eof_irq(int irq, void *data)
>  {
>  	struct ipu_image_convert_chan *chan = data;
> +	struct ipu_image_convert_priv *priv = chan->priv;
>  	struct ipu_image_convert_ctx *ctx;
>  	struct ipu_image_convert_run *run;
>  	unsigned long flags;
> @@ -1728,45 +1729,26 @@ static irqreturn_t norotate_irq(int irq, void *data)
>  
>  	ctx = run->ctx;
>  
> -	if (ipu_rot_mode_is_irt(ctx->rot_mode)) {
> -		/* this is a rotation operation, just ignore */
> -		spin_unlock_irqrestore(&chan->irqlock, flags);
> -		return IRQ_HANDLED;
> -	}
> -
> -	ret = do_irq(run);
> -out:
> -	spin_unlock_irqrestore(&chan->irqlock, flags);
> -	return ret;
> -}
> -
> -static irqreturn_t rotate_irq(int irq, void *data)
> -{
> -	struct ipu_image_convert_chan *chan = data;
> -	struct ipu_image_convert_priv *priv = chan->priv;
> -	struct ipu_image_convert_ctx *ctx;
> -	struct ipu_image_convert_run *run;
> -	unsigned long flags;
> -	irqreturn_t ret;
> -
> -	spin_lock_irqsave(&chan->irqlock, flags);
> -
> -	/* get current run and its context */
> -	run = chan->current_run;
> -	if (!run) {
> +	if (irq == chan->out_eof_irq) {
> +		if (ipu_rot_mode_is_irt(ctx->rot_mode)) {
> +			/* this is a rotation op, just ignore */
> +			ret = IRQ_HANDLED;
> +			goto out;
> +		}
> +	} else if (irq == chan->rot_out_eof_irq) {
> +		if (!ipu_rot_mode_is_irt(ctx->rot_mode)) {
> +			/* this was NOT a rotation op, shouldn't happen */
> +			dev_err(priv->ipu->dev,
> +				"Unexpected rotation interrupt\n");
> +			ret = IRQ_HANDLED;
> +			goto out;
> +		}
> +	} else {
> +		dev_err(priv->ipu->dev, "Received unknown irq %d\n", irq);
>  		ret = IRQ_NONE;
>  		goto out;
>  	}
>  
> -	ctx = run->ctx;
> -
> -	if (!ipu_rot_mode_is_irt(ctx->rot_mode)) {
> -		/* this was NOT a rotation operation, shouldn't happen */
> -		dev_err(priv->ipu->dev, "Unexpected rotation interrupt\n");
> -		spin_unlock_irqrestore(&chan->irqlock, flags);
> -		return IRQ_HANDLED;
> -	}
> -
>  	ret = do_irq(run);
>  out:
>  	spin_unlock_irqrestore(&chan->irqlock, flags);
> @@ -1859,7 +1841,7 @@ static int get_ipu_resources(struct ipu_image_convert_chan *chan)
>  						  chan->out_chan,
>  						  IPU_IRQ_EOF);
>  
> -	ret = request_threaded_irq(chan->out_eof_irq, norotate_irq, do_bh,
> +	ret = request_threaded_irq(chan->out_eof_irq, eof_irq, do_bh,
>  				   0, "ipu-ic", chan);
>  	if (ret < 0) {
>  		dev_err(priv->ipu->dev, "could not acquire irq %d\n",
> @@ -1872,7 +1854,7 @@ static int get_ipu_resources(struct ipu_image_convert_chan *chan)
>  						     chan->rotation_out_chan,
>  						     IPU_IRQ_EOF);
>  
> -	ret = request_threaded_irq(chan->rot_out_eof_irq, rotate_irq, do_bh,
> +	ret = request_threaded_irq(chan->rot_out_eof_irq, eof_irq, do_bh,
>  				   0, "ipu-ic", chan);
>  	if (ret < 0) {
>  		dev_err(priv->ipu->dev, "could not acquire irq %d\n",
diff mbox series

Patch

diff --git a/drivers/gpu/ipu-v3/ipu-image-convert.c b/drivers/gpu/ipu-v3/ipu-image-convert.c
index eeca50d9a1ee..f8b031ded3cf 100644
--- a/drivers/gpu/ipu-v3/ipu-image-convert.c
+++ b/drivers/gpu/ipu-v3/ipu-image-convert.c
@@ -1709,9 +1709,10 @@  static irqreturn_t do_irq(struct ipu_image_convert_run *run)
 	return IRQ_WAKE_THREAD;
 }
 
-static irqreturn_t norotate_irq(int irq, void *data)
+static irqreturn_t eof_irq(int irq, void *data)
 {
 	struct ipu_image_convert_chan *chan = data;
+	struct ipu_image_convert_priv *priv = chan->priv;
 	struct ipu_image_convert_ctx *ctx;
 	struct ipu_image_convert_run *run;
 	unsigned long flags;
@@ -1728,45 +1729,26 @@  static irqreturn_t norotate_irq(int irq, void *data)
 
 	ctx = run->ctx;
 
-	if (ipu_rot_mode_is_irt(ctx->rot_mode)) {
-		/* this is a rotation operation, just ignore */
-		spin_unlock_irqrestore(&chan->irqlock, flags);
-		return IRQ_HANDLED;
-	}
-
-	ret = do_irq(run);
-out:
-	spin_unlock_irqrestore(&chan->irqlock, flags);
-	return ret;
-}
-
-static irqreturn_t rotate_irq(int irq, void *data)
-{
-	struct ipu_image_convert_chan *chan = data;
-	struct ipu_image_convert_priv *priv = chan->priv;
-	struct ipu_image_convert_ctx *ctx;
-	struct ipu_image_convert_run *run;
-	unsigned long flags;
-	irqreturn_t ret;
-
-	spin_lock_irqsave(&chan->irqlock, flags);
-
-	/* get current run and its context */
-	run = chan->current_run;
-	if (!run) {
+	if (irq == chan->out_eof_irq) {
+		if (ipu_rot_mode_is_irt(ctx->rot_mode)) {
+			/* this is a rotation op, just ignore */
+			ret = IRQ_HANDLED;
+			goto out;
+		}
+	} else if (irq == chan->rot_out_eof_irq) {
+		if (!ipu_rot_mode_is_irt(ctx->rot_mode)) {
+			/* this was NOT a rotation op, shouldn't happen */
+			dev_err(priv->ipu->dev,
+				"Unexpected rotation interrupt\n");
+			ret = IRQ_HANDLED;
+			goto out;
+		}
+	} else {
+		dev_err(priv->ipu->dev, "Received unknown irq %d\n", irq);
 		ret = IRQ_NONE;
 		goto out;
 	}
 
-	ctx = run->ctx;
-
-	if (!ipu_rot_mode_is_irt(ctx->rot_mode)) {
-		/* this was NOT a rotation operation, shouldn't happen */
-		dev_err(priv->ipu->dev, "Unexpected rotation interrupt\n");
-		spin_unlock_irqrestore(&chan->irqlock, flags);
-		return IRQ_HANDLED;
-	}
-
 	ret = do_irq(run);
 out:
 	spin_unlock_irqrestore(&chan->irqlock, flags);
@@ -1859,7 +1841,7 @@  static int get_ipu_resources(struct ipu_image_convert_chan *chan)
 						  chan->out_chan,
 						  IPU_IRQ_EOF);
 
-	ret = request_threaded_irq(chan->out_eof_irq, norotate_irq, do_bh,
+	ret = request_threaded_irq(chan->out_eof_irq, eof_irq, do_bh,
 				   0, "ipu-ic", chan);
 	if (ret < 0) {
 		dev_err(priv->ipu->dev, "could not acquire irq %d\n",
@@ -1872,7 +1854,7 @@  static int get_ipu_resources(struct ipu_image_convert_chan *chan)
 						     chan->rotation_out_chan,
 						     IPU_IRQ_EOF);
 
-	ret = request_threaded_irq(chan->rot_out_eof_irq, rotate_irq, do_bh,
+	ret = request_threaded_irq(chan->rot_out_eof_irq, eof_irq, do_bh,
 				   0, "ipu-ic", chan);
 	if (ret < 0) {
 		dev_err(priv->ipu->dev, "could not acquire irq %d\n",