From: Alexandre Courbot <acourbot@chromium.org> To: Tiffany Lin <tiffany.lin@mediatek.com>, Andrew-CT Chen <andrew-ct.chen@mediatek.com> Cc: linux-media@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Alexandre Courbot <acourbot@chromium.org>, Ezequiel Garcia <ezequiel@collabora.com> Subject: [PATCH] media: mtk-vcodec: make IRQs disabled upon request Date: Fri, 21 Aug 2020 20:19:23 +0900 [thread overview] Message-ID: <20200821111924.2328306-1-acourbot@chromium.org> (raw) The driver requests IRQs to disable them immediately. This is potentially racy, fix this by requesting the IRQs to come disabled instead using the IRQ_NOAUTOEN flag of irq_set_status_flags(). Reported-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Alexandre Courbot <acourbot@chromium.org> --- The "media: mtk-vcodec: venc: support for MT8183" happens to change this part of the code, this version applies on top of it (but adapting it to the media ToT is trivial). If preferred I can include this one on top of the series on its next respin, even though it also touches the decoder. drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 2 +- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c index 5b5765b98e57..a6ba342f7bc8 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c @@ -259,6 +259,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) } dev->dec_irq = platform_get_irq(pdev, 0); + irq_set_status_flags(dev->dec_irq, IRQ_NOAUTOEN); ret = devm_request_irq(&pdev->dev, dev->dec_irq, mtk_vcodec_dec_irq_handler, 0, pdev->name, dev); if (ret) { @@ -268,7 +269,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev) goto err_res; } - disable_irq(dev->dec_irq); mutex_init(&dev->dec_mutex); mutex_init(&dev->dev_mutex); spin_lock_init(&dev->irqlock); diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c index d6438cb4eead..2a4136e6e867 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -311,6 +311,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) } dev->enc_irq = platform_get_irq(pdev, 0); + irq_set_status_flags(dev->enc_irq, IRQ_NOAUTOEN); ret = devm_request_irq(&pdev->dev, dev->enc_irq, mtk_vcodec_enc_irq_handler, 0, pdev->name, dev); @@ -321,7 +322,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret = -EINVAL; goto err_res; } - disable_irq(dev->enc_irq); if (dev->venc_pdata->has_lt_irq) { res = platform_get_resource(pdev, IORESOURCE_MEM, 1); @@ -333,6 +333,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) mtk_v4l2_debug(2, "reg[%d] base=0x%p", i, dev->reg_base[VENC_LT_SYS]); dev->enc_lt_irq = platform_get_irq(pdev, 1); + irq_set_status_flags(dev->enc_lt_irq, IRQ_NOAUTOEN); ret = devm_request_irq(&pdev->dev, dev->enc_lt_irq, mtk_vcodec_enc_lt_irq_handler, @@ -344,7 +345,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret = -EINVAL; goto err_res; } - disable_irq(dev->enc_lt_irq); /* VENC_LT */ } mutex_init(&dev->enc_mutex); -- 2.28.0.297.g1956fa8f8d-goog
WARNING: multiple messages have this Message-ID (diff)
From: Alexandre Courbot <acourbot@chromium.org> To: Tiffany Lin <tiffany.lin@mediatek.com>, Andrew-CT Chen <andrew-ct.chen@mediatek.com> Cc: Ezequiel Garcia <ezequiel@collabora.com>, linux-mediatek@lists.infradead.org, linux-kernel@vger.kernel.org, Alexandre Courbot <acourbot@chromium.org>, linux-media@vger.kernel.org Subject: [PATCH] media: mtk-vcodec: make IRQs disabled upon request Date: Fri, 21 Aug 2020 20:19:23 +0900 [thread overview] Message-ID: <20200821111924.2328306-1-acourbot@chromium.org> (raw) The driver requests IRQs to disable them immediately. This is potentially racy, fix this by requesting the IRQs to come disabled instead using the IRQ_NOAUTOEN flag of irq_set_status_flags(). Reported-by: Ezequiel Garcia <ezequiel@collabora.com> Signed-off-by: Alexandre Courbot <acourbot@chromium.org> --- The "media: mtk-vcodec: venc: support for MT8183" happens to change this part of the code, this version applies on top of it (but adapting it to the media ToT is trivial). If preferred I can include this one on top of the series on its next respin, even though it also touches the decoder. drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c | 2 +- drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c index 5b5765b98e57..a6ba342f7bc8 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_dec_drv.c @@ -259,6 +259,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) } dev->dec_irq = platform_get_irq(pdev, 0); + irq_set_status_flags(dev->dec_irq, IRQ_NOAUTOEN); ret = devm_request_irq(&pdev->dev, dev->dec_irq, mtk_vcodec_dec_irq_handler, 0, pdev->name, dev); if (ret) { @@ -268,7 +269,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev) goto err_res; } - disable_irq(dev->dec_irq); mutex_init(&dev->dec_mutex); mutex_init(&dev->dev_mutex); spin_lock_init(&dev->irqlock); diff --git a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c index d6438cb4eead..2a4136e6e867 100644 --- a/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c +++ b/drivers/media/platform/mtk-vcodec/mtk_vcodec_enc_drv.c @@ -311,6 +311,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) } dev->enc_irq = platform_get_irq(pdev, 0); + irq_set_status_flags(dev->enc_irq, IRQ_NOAUTOEN); ret = devm_request_irq(&pdev->dev, dev->enc_irq, mtk_vcodec_enc_irq_handler, 0, pdev->name, dev); @@ -321,7 +322,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret = -EINVAL; goto err_res; } - disable_irq(dev->enc_irq); if (dev->venc_pdata->has_lt_irq) { res = platform_get_resource(pdev, IORESOURCE_MEM, 1); @@ -333,6 +333,7 @@ static int mtk_vcodec_probe(struct platform_device *pdev) mtk_v4l2_debug(2, "reg[%d] base=0x%p", i, dev->reg_base[VENC_LT_SYS]); dev->enc_lt_irq = platform_get_irq(pdev, 1); + irq_set_status_flags(dev->enc_lt_irq, IRQ_NOAUTOEN); ret = devm_request_irq(&pdev->dev, dev->enc_lt_irq, mtk_vcodec_enc_lt_irq_handler, @@ -344,7 +345,6 @@ static int mtk_vcodec_probe(struct platform_device *pdev) ret = -EINVAL; goto err_res; } - disable_irq(dev->enc_lt_irq); /* VENC_LT */ } mutex_init(&dev->enc_mutex); -- 2.28.0.297.g1956fa8f8d-goog _______________________________________________ Linux-mediatek mailing list Linux-mediatek@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-mediatek
next reply other threads:[~2020-08-21 11:20 UTC|newest] Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top 2020-08-21 11:19 Alexandre Courbot [this message] 2020-08-21 11:19 ` [PATCH] media: mtk-vcodec: make IRQs disabled upon request Alexandre Courbot
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=20200821111924.2328306-1-acourbot@chromium.org \ --to=acourbot@chromium.org \ --cc=andrew-ct.chen@mediatek.com \ --cc=ezequiel@collabora.com \ --cc=linux-kernel@vger.kernel.org \ --cc=linux-media@vger.kernel.org \ --cc=linux-mediatek@lists.infradead.org \ --cc=tiffany.lin@mediatek.com \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.