Re: [PATCH v1, 06/14] media: mtk-vcodec: Add irq interface for core hardware

From: mtk12024
Date: Mon Jul 12 2021 - 05:04:56 EST


Hi Tzung-Bi,

Thanks for your detail feedback.
I add the description according to your each comments.

On Fri, 2021-07-09 at 15:59 +0800, Tzung-Bi Shih wrote:
> On Wed, Jul 7, 2021 at 2:22 PM Yunfei Dong <yunfei.dong@xxxxxxxxxxxx> wrote:
> > +static int mtk_vcodec_get_hw_count(struct mtk_vcodec_dev *dev)
> > +{
> > + if (dev->vdec_pdata->hw_arch == MTK_VDEC_PURE_SINGLE_CORE)
> > + return 1;
> > + else if (dev->vdec_pdata->hw_arch == MTK_VDEC_LAT_SINGLE_CORE)
> > + return 2;
> > + else
> > + return 0;
> > +}
> Use a switch .. case .. would be easier to read.
Yes
> Would it be better to use some macro or enums for the magic numbers?
Yes, add enums for magic numbers.
enum mtk_vdec_hw_count {
MTK_VDEC_NO_HW = 0,
MTK_VDEC_ONE_CORE,
MTK_VDEC_ONE_LAT_ONE_CORE,
MTK_VDEC_MAX_HW_COUNT,
};
> > @@ -113,8 +114,7 @@ static int mtk_vdec_comp_init_irq(struct mtk_vdec_comp_dev *dev)
> > }
> >
> > ret = devm_request_irq(&pdev->dev, dev->dec_irq,
> > - mtk_vdec_comp_irq_handler,
> > - 0, pdev->name, dev);
> > + mtk_vdec_comp_irq_handler, 0, pdev->name, dev);
> The change is irrelevant to this patch.
Will fix.
> > @@ -154,8 +154,10 @@ static int mtk_vdec_comp_probe(struct platform_device *pdev)
> > dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(34));
> >
> > ret = mtk_vdec_comp_init_irq(dev);
> > - if (ret)
> > + if (ret) {
> > + dev_err(&pdev->dev, "Failed to register irq handler.\n");
> > goto err;
> > + }
> The change shouldn't be in this patch. Instead, another patch that
> adds the mtk_vdec_comp_init_irq() invocation.
>
> > +int mtk_vcodec_wait_for_comp_done_ctx(struct mtk_vcodec_ctx *ctx,
> Remove the extra space before "*ctx".
Wil fix.