From: kyrie wu Date: Fri, 10 Mar 2023 06:23:53 +0000 (+0000) Subject: media: mtk-jpeg: Remove some unnecessary variables X-Git-Tag: v6.6.17~5047^2~334 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=6a7a883f020fb2c25b33a6144fc3481a6b9bf560;p=platform%2Fkernel%2Flinux-rpi.git media: mtk-jpeg: Remove some unnecessary variables remove is_jpgenc_multihw, is_jpgdec_multihw, and unnecessary initialization. Signed-off-by: kyrie wu Signed-off-by: irui wang Signed-off-by: Hans Verkuil Signed-off-by: Mauro Carvalho Chehab --- diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h index e118a01..83cf35a 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.h @@ -204,12 +204,10 @@ struct mtk_jpegdec_comp_dev { * @variant: driver variant to be used * @reg_encbase: jpg encode register base addr * @enc_hw_dev: jpg encode hardware device - * @is_jpgenc_multihw: the flag of multi-hw core * @enc_hw_wq: jpg encode wait queue * @enchw_rdy: jpg encode hw ready flag * @reg_decbase: jpg decode register base addr * @dec_hw_dev: jpg decode hardware device - * @is_jpgdec_multihw: the flag of dec multi-hw core * @dec_hw_wq: jpg decode wait queue * @dec_workqueue: jpg decode work queue * @dechw_rdy: jpg decode hw ready flag @@ -229,13 +227,11 @@ struct mtk_jpeg_dev { void __iomem *reg_encbase[MTK_JPEGENC_HW_MAX]; struct mtk_jpegenc_comp_dev *enc_hw_dev[MTK_JPEGENC_HW_MAX]; - bool is_jpgenc_multihw; wait_queue_head_t enc_hw_wq; atomic_t enchw_rdy; void __iomem *reg_decbase[MTK_JPEGDEC_HW_MAX]; struct mtk_jpegdec_comp_dev *dec_hw_dev[MTK_JPEGDEC_HW_MAX]; - bool is_jpgdec_multihw; wait_queue_head_t dec_hw_wq; struct workqueue_struct *dec_workqueue; atomic_t dechw_rdy; diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c index 8c07fa0..5b47bd8 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c @@ -608,23 +608,18 @@ static int mtk_jpegdec_hw_probe(struct platform_device *pdev) dev->plat_dev = pdev; dev->dev = &pdev->dev; - if (!master_dev->is_jpgdec_multihw) { - master_dev->is_jpgdec_multihw = true; - for (i = 0; i < MTK_JPEGDEC_HW_MAX; i++) - master_dev->dec_hw_dev[i] = NULL; - - init_waitqueue_head(&master_dev->dec_hw_wq); - master_dev->workqueue = alloc_ordered_workqueue(MTK_JPEG_NAME, - WQ_MEM_RECLAIM - | WQ_FREEZABLE); - if (!master_dev->workqueue) - return -EINVAL; - - ret = devm_add_action_or_reset(&pdev->dev, mtk_jpegdec_destroy_workqueue, - master_dev->workqueue); - if (ret) - return ret; - } + init_waitqueue_head(&master_dev->dec_hw_wq); + master_dev->workqueue = alloc_ordered_workqueue(MTK_JPEG_NAME, + WQ_MEM_RECLAIM + | WQ_FREEZABLE); + if (!master_dev->workqueue) + return -EINVAL; + + ret = devm_add_action_or_reset(&pdev->dev, + mtk_jpegdec_destroy_workqueue, + master_dev->workqueue); + if (ret) + return ret; atomic_set(&master_dev->dechw_rdy, MTK_JPEGDEC_HW_MAX); spin_lock_init(&dev->hw_lock); diff --git a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c index 867f4c1..c2bc0b5 100644 --- a/drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c +++ b/drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c @@ -340,18 +340,12 @@ static int mtk_jpegenc_hw_probe(struct platform_device *pdev) dev->plat_dev = pdev; dev->dev = &pdev->dev; - if (!master_dev->is_jpgenc_multihw) { - master_dev->is_jpgenc_multihw = true; - for (i = 0; i < MTK_JPEGENC_HW_MAX; i++) - master_dev->enc_hw_dev[i] = NULL; - - init_waitqueue_head(&master_dev->enc_hw_wq); - master_dev->workqueue = alloc_ordered_workqueue(MTK_JPEG_NAME, - WQ_MEM_RECLAIM - | WQ_FREEZABLE); - if (!master_dev->workqueue) - return -EINVAL; - } + init_waitqueue_head(&master_dev->enc_hw_wq); + master_dev->workqueue = alloc_ordered_workqueue(MTK_JPEG_NAME, + WQ_MEM_RECLAIM + | WQ_FREEZABLE); + if (!master_dev->workqueue) + return -EINVAL; atomic_set(&master_dev->enchw_rdy, MTK_JPEGENC_HW_MAX); spin_lock_init(&dev->hw_lock);