Skip to content

Commit 20de9fd

Browse files
arndbmchehab
authored andcommitted
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: 934e8bc ("mtk-jpegenc: support jpegenc multi-hardware") Fixes: 4ae4777 ("media: mtk-jpegenc: Fix a compilation issue") Fixes: da4ede4 ("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>
1 parent 53ebeea commit 20de9fd

File tree

3 files changed

+3
-11
lines changed

3 files changed

+3
-11
lines changed

drivers/media/platform/mediatek/jpeg/mtk_jpeg_core.c

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@
2828
#include "mtk_jpeg_core.h"
2929
#include "mtk_jpeg_dec_parse.h"
3030

31-
#if defined(CONFIG_OF)
3231
static struct mtk_jpeg_fmt mtk_jpeg_enc_formats[] = {
3332
{
3433
.fourcc = V4L2_PIX_FMT_JPEG,
@@ -102,7 +101,6 @@ static struct mtk_jpeg_fmt mtk_jpeg_dec_formats[] = {
102101
.flags = MTK_JPEG_FMT_FLAG_CAPTURE,
103102
},
104103
};
105-
#endif
106104

107105
#define MTK_JPEG_ENC_NUM_FORMATS ARRAY_SIZE(mtk_jpeg_enc_formats)
108106
#define MTK_JPEG_DEC_NUM_FORMATS ARRAY_SIZE(mtk_jpeg_dec_formats)
@@ -1455,7 +1453,6 @@ static const struct dev_pm_ops mtk_jpeg_pm_ops = {
14551453
SET_RUNTIME_PM_OPS(mtk_jpeg_pm_suspend, mtk_jpeg_pm_resume, NULL)
14561454
};
14571455

1458-
#if defined(CONFIG_OF)
14591456
static int mtk_jpegenc_get_hw(struct mtk_jpeg_ctx *ctx)
14601457
{
14611458
struct mtk_jpegenc_comp_dev *comp_jpeg;
@@ -1951,14 +1948,13 @@ static const struct of_device_id mtk_jpeg_match[] = {
19511948
};
19521949

19531950
MODULE_DEVICE_TABLE(of, mtk_jpeg_match);
1954-
#endif
19551951

19561952
static struct platform_driver mtk_jpeg_driver = {
19571953
.probe = mtk_jpeg_probe,
19581954
.remove_new = mtk_jpeg_remove,
19591955
.driver = {
19601956
.name = MTK_JPEG_NAME,
1961-
.of_match_table = of_match_ptr(mtk_jpeg_match),
1957+
.of_match_table = mtk_jpeg_match,
19621958
.pm = &mtk_jpeg_pm_ops,
19631959
},
19641960
};

drivers/media/platform/mediatek/jpeg/mtk_jpeg_dec_hw.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,13 @@ enum mtk_jpeg_color {
3939
MTK_JPEG_COLOR_400 = 0x00110000
4040
};
4141

42-
#if defined(CONFIG_OF)
4342
static const struct of_device_id mtk_jpegdec_hw_ids[] = {
4443
{
4544
.compatible = "mediatek,mt8195-jpgdec-hw",
4645
},
4746
{},
4847
};
4948
MODULE_DEVICE_TABLE(of, mtk_jpegdec_hw_ids);
50-
#endif
5149

5250
static inline int mtk_jpeg_verify_align(u32 val, int align, u32 reg)
5351
{
@@ -653,7 +651,7 @@ static struct platform_driver mtk_jpegdec_hw_driver = {
653651
.probe = mtk_jpegdec_hw_probe,
654652
.driver = {
655653
.name = "mtk-jpegdec-hw",
656-
.of_match_table = of_match_ptr(mtk_jpegdec_hw_ids),
654+
.of_match_table = mtk_jpegdec_hw_ids,
657655
},
658656
};
659657

drivers/media/platform/mediatek/jpeg/mtk_jpeg_enc_hw.c

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,13 @@ static const struct mtk_jpeg_enc_qlt mtk_jpeg_enc_quality[] = {
4646
{.quality_param = 97, .hardware_value = JPEG_ENC_QUALITY_Q97},
4747
};
4848

49-
#if defined(CONFIG_OF)
5049
static const struct of_device_id mtk_jpegenc_drv_ids[] = {
5150
{
5251
.compatible = "mediatek,mt8195-jpgenc-hw",
5352
},
5453
{},
5554
};
5655
MODULE_DEVICE_TABLE(of, mtk_jpegenc_drv_ids);
57-
#endif
5856

5957
void mtk_jpeg_enc_reset(void __iomem *base)
6058
{
@@ -377,7 +375,7 @@ static struct platform_driver mtk_jpegenc_hw_driver = {
377375
.probe = mtk_jpegenc_hw_probe,
378376
.driver = {
379377
.name = "mtk-jpegenc-hw",
380-
.of_match_table = of_match_ptr(mtk_jpegenc_drv_ids),
378+
.of_match_table = mtk_jpegenc_drv_ids,
381379
},
382380
};
383381

0 commit comments

Comments
 (0)