Skip to content

Commit c00c513

Browse files
slongerbeamgregkh
authored andcommitted
gpu: ipu-v3: image-convert: Combine rotate/no-rotate irq handlers
[ Upstream commit 0f6245f ] Combine the rotate_irq() and norotate_irq() handlers into a single eof_irq() handler. Signed-off-by: Steve Longerbeam <slongerbeam@gmail.com> Signed-off-by: Philipp Zabel <p.zabel@pengutronix.de> Signed-off-by: Sasha Levin <sashal@kernel.org>
1 parent 388a802 commit c00c513

1 file changed

Lines changed: 20 additions & 38 deletions

File tree

drivers/gpu/ipu-v3/ipu-image-convert.c

Lines changed: 20 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -998,9 +998,10 @@ static irqreturn_t do_irq(struct ipu_image_convert_run *run)
998998
return IRQ_WAKE_THREAD;
999999
}
10001000

1001-
static irqreturn_t norotate_irq(int irq, void *data)
1001+
static irqreturn_t eof_irq(int irq, void *data)
10021002
{
10031003
struct ipu_image_convert_chan *chan = data;
1004+
struct ipu_image_convert_priv *priv = chan->priv;
10041005
struct ipu_image_convert_ctx *ctx;
10051006
struct ipu_image_convert_run *run;
10061007
unsigned long flags;
@@ -1017,45 +1018,26 @@ static irqreturn_t norotate_irq(int irq, void *data)
10171018

10181019
ctx = run->ctx;
10191020

1020-
if (ipu_rot_mode_is_irt(ctx->rot_mode)) {
1021-
/* this is a rotation operation, just ignore */
1022-
spin_unlock_irqrestore(&chan->irqlock, flags);
1023-
return IRQ_HANDLED;
1024-
}
1025-
1026-
ret = do_irq(run);
1027-
out:
1028-
spin_unlock_irqrestore(&chan->irqlock, flags);
1029-
return ret;
1030-
}
1031-
1032-
static irqreturn_t rotate_irq(int irq, void *data)
1033-
{
1034-
struct ipu_image_convert_chan *chan = data;
1035-
struct ipu_image_convert_priv *priv = chan->priv;
1036-
struct ipu_image_convert_ctx *ctx;
1037-
struct ipu_image_convert_run *run;
1038-
unsigned long flags;
1039-
irqreturn_t ret;
1040-
1041-
spin_lock_irqsave(&chan->irqlock, flags);
1042-
1043-
/* get current run and its context */
1044-
run = chan->current_run;
1045-
if (!run) {
1021+
if (irq == chan->out_eof_irq) {
1022+
if (ipu_rot_mode_is_irt(ctx->rot_mode)) {
1023+
/* this is a rotation op, just ignore */
1024+
ret = IRQ_HANDLED;
1025+
goto out;
1026+
}
1027+
} else if (irq == chan->rot_out_eof_irq) {
1028+
if (!ipu_rot_mode_is_irt(ctx->rot_mode)) {
1029+
/* this was NOT a rotation op, shouldn't happen */
1030+
dev_err(priv->ipu->dev,
1031+
"Unexpected rotation interrupt\n");
1032+
ret = IRQ_HANDLED;
1033+
goto out;
1034+
}
1035+
} else {
1036+
dev_err(priv->ipu->dev, "Received unknown irq %d\n", irq);
10461037
ret = IRQ_NONE;
10471038
goto out;
10481039
}
10491040

1050-
ctx = run->ctx;
1051-
1052-
if (!ipu_rot_mode_is_irt(ctx->rot_mode)) {
1053-
/* this was NOT a rotation operation, shouldn't happen */
1054-
dev_err(priv->ipu->dev, "Unexpected rotation interrupt\n");
1055-
spin_unlock_irqrestore(&chan->irqlock, flags);
1056-
return IRQ_HANDLED;
1057-
}
1058-
10591041
ret = do_irq(run);
10601042
out:
10611043
spin_unlock_irqrestore(&chan->irqlock, flags);
@@ -1148,7 +1130,7 @@ static int get_ipu_resources(struct ipu_image_convert_chan *chan)
11481130
chan->out_chan,
11491131
IPU_IRQ_EOF);
11501132

1151-
ret = request_threaded_irq(chan->out_eof_irq, norotate_irq, do_bh,
1133+
ret = request_threaded_irq(chan->out_eof_irq, eof_irq, do_bh,
11521134
0, "ipu-ic", chan);
11531135
if (ret < 0) {
11541136
dev_err(priv->ipu->dev, "could not acquire irq %d\n",
@@ -1161,7 +1143,7 @@ static int get_ipu_resources(struct ipu_image_convert_chan *chan)
11611143
chan->rotation_out_chan,
11621144
IPU_IRQ_EOF);
11631145

1164-
ret = request_threaded_irq(chan->rot_out_eof_irq, rotate_irq, do_bh,
1146+
ret = request_threaded_irq(chan->rot_out_eof_irq, eof_irq, do_bh,
11651147
0, "ipu-ic", chan);
11661148
if (ret < 0) {
11671149
dev_err(priv->ipu->dev, "could not acquire irq %d\n",

0 commit comments

Comments
 (0)