Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

media: mtk_jpeg_core: avoid unused-variable warning

The mtk8195_jpegenc_drvdata object was added outside of an #ifdef causing
a harmless build warning.

drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c:1879:32: error: 'mtk8195_jpegenc_drvdata' defined but not used [-Werror=unused-variable]
1879 | static struct mtk_jpeg_variant mtk8195_jpegenc_drvdata = {
| ^~~~~~~~~~~~~~~~~~~~~~~

A follow-up patch moved it inside of an #ifdef, which caused more
warnings, and a third patch ended up adding even more #ifdefs. These
were all bogus, since the actual problem here is the incorrect use
of of_ptr(). Since the driver (like any other modern platform driver)
only works in combination with CONFIG_OF, there is no point in hiding
the reference, so just remove that along with all the pointless #ifdef
checks in the driver.

This improves build coverage and avoids running into the same problem
again when another part of the driver gets changed that relies on
the #ifdef blocks to be completely matched.

Fixes: 934e8bccac95 ("mtk-jpegenc: support jpegenc multi-hardware")
Fixes: 4ae47770d57b ("media: mtk-jpegenc: Fix a compilation issue")
Fixes: da4ede4b7fd6 ("media: mtk-jpeg: move data/code inside CONFIG_OF blocks")
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@kernel.org>

authored by

Arnd Bergmann and committed by
Mauro Carvalho Chehab
20de9fda 53ebeea5

+3 -11
+1 -5
drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c
··· 28 28 #include "mtk_jpeg_core.h" 29 29 #include "mtk_jpeg_dec_parse.h" 30 30 31 - #if defined(CONFIG_OF) 32 31 static struct mtk_jpeg_fmt mtk_jpeg_enc_formats[] = { 33 32 { 34 33 .fourcc = V4L2_PIX_FMT_JPEG, ··· 101 102 .flags = MTK_JPEG_FMT_FLAG_CAPTURE, 102 103 }, 103 104 }; 104 - #endif 105 105 106 106 #define MTK_JPEG_ENC_NUM_FORMATS ARRAY_SIZE(mtk_jpeg_enc_formats) 107 107 #define MTK_JPEG_DEC_NUM_FORMATS ARRAY_SIZE(mtk_jpeg_dec_formats) ··· 1453 1455 SET_RUNTIME_PM_OPS(mtk_jpeg_pm_suspend, mtk_jpeg_pm_resume, NULL) 1454 1456 }; 1455 1457 1456 - #if defined(CONFIG_OF) 1457 1458 static int mtk_jpegenc_get_hw(struct mtk_jpeg_ctx *ctx) 1458 1459 { 1459 1460 struct mtk_jpegenc_comp_dev *comp_jpeg; ··· 1948 1951 }; 1949 1952 1950 1953 MODULE_DEVICE_TABLE(of, mtk_jpeg_match); 1951 - #endif 1952 1954 1953 1955 static struct platform_driver mtk_jpeg_driver = { 1954 1956 .probe = mtk_jpeg_probe, 1955 1957 .remove_new = mtk_jpeg_remove, 1956 1958 .driver = { 1957 1959 .name = MTK_JPEG_NAME, 1958 - .of_match_table = of_match_ptr(mtk_jpeg_match), 1960 + .of_match_table = mtk_jpeg_match, 1959 1961 .pm = &mtk_jpeg_pm_ops, 1960 1962 }, 1961 1963 };
+1 -3
drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c
··· 39 39 MTK_JPEG_COLOR_400 = 0x00110000 40 40 }; 41 41 42 - #if defined(CONFIG_OF) 43 42 static const struct of_device_id mtk_jpegdec_hw_ids[] = { 44 43 { 45 44 .compatible = "mediatek,mt8195-jpgdec-hw", ··· 46 47 {}, 47 48 }; 48 49 MODULE_DEVICE_TABLE(of, mtk_jpegdec_hw_ids); 49 - #endif 50 50 51 51 static inline int mtk_jpeg_verify_align(u32 val, int align, u32 reg) 52 52 { ··· 651 653 .probe = mtk_jpegdec_hw_probe, 652 654 .driver = { 653 655 .name = "mtk-jpegdec-hw", 654 - .of_match_table = of_match_ptr(mtk_jpegdec_hw_ids), 656 + .of_match_table = mtk_jpegdec_hw_ids, 655 657 }, 656 658 }; 657 659
+1 -3
drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c
··· 46 46 {.quality_param = 97, .hardware_value = JPEG_ENC_QUALITY_Q97}, 47 47 }; 48 48 49 - #if defined(CONFIG_OF) 50 49 static const struct of_device_id mtk_jpegenc_drv_ids[] = { 51 50 { 52 51 .compatible = "mediatek,mt8195-jpgenc-hw", ··· 53 54 {}, 54 55 }; 55 56 MODULE_DEVICE_TABLE(of, mtk_jpegenc_drv_ids); 56 - #endif 57 57 58 58 void mtk_jpeg_enc_reset(void __iomem *base) 59 59 { ··· 375 377 .probe = mtk_jpegenc_hw_probe, 376 378 .driver = { 377 379 .name = "mtk-jpegenc-hw", 378 - .of_match_table = of_match_ptr(mtk_jpegenc_drv_ids), 380 + .of_match_table = mtk_jpegenc_drv_ids, 379 381 }, 380 382 }; 381 383