[jolsa-perf:bpf/batch 19/27] drivers/media/platform/mtk-mdp/mtk_mdp_core.c:207:52: warning: implicit conversion from 'unsigned long long' to 'unsigned int' changes value from 18446744073709551615 to 4294967295

From: kernel test robot
Date: Fri Aug 27 2021 - 04:00:49 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git bpf/batch
head: b81b17307e02f8e6d4abf87e7ec2d7e5aea1e0b5
commit: 847fb4eb93cf46ad827ba84404d2c9d6998ea67f [19/27] bpf: Attach multi trampoline with ftrace_ops
config: riscv-buildonly-randconfig-r006-20210826 (attached as .config)
compiler: clang version 14.0.0 (https://github.com/llvm/llvm-project 1076082a0d97bd5c16a25ee7cf3dbb6ee4b5a9fe)
reproduce (this is a W=1 build):
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# install riscv cross compiling tool for clang build
# apt-get install binutils-riscv64-linux-gnu
# https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git/commit/?id=847fb4eb93cf46ad827ba84404d2c9d6998ea67f
git remote add jolsa-perf https://git.kernel.org/pub/scm/linux/kernel/git/jolsa/perf.git
git fetch --no-tags jolsa-perf bpf/batch
git checkout 847fb4eb93cf46ad827ba84404d2c9d6998ea67f
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=clang make.cross ARCH=riscv

If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>

All warnings (new ones prefixed by >>):

In file included from drivers/media/platform/mtk-mdp/mtk_mdp_core.c:22:
In file included from drivers/media/platform/mtk-mdp/mtk_mdp_core.h:13:
In file included from include/media/v4l2-device.h:13:
In file included from include/media/v4l2-subdev.h:15:
In file included from include/media/v4l2-common.h:105:
In file included from include/linux/i2c.h:18:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
In file included from include/linux/bpf.h:26:
include/linux/ftrace.h:353:41: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:353:5: warning: no previous prototype for function 'register_ftrace_direct_multi' [-Wmissing-prototypes]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:353:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
include/linux/ftrace.h:357:43: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:357:5: warning: no previous prototype for function 'unregister_ftrace_direct_multi' [-Wmissing-prototypes]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:357:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
static
include/linux/ftrace.h:361:39: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:361:5: warning: no previous prototype for function 'modify_ftrace_direct_multi' [-Wmissing-prototypes]
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:361:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
In file included from drivers/media/platform/mtk-mdp/mtk_mdp_core.c:22:
In file included from drivers/media/platform/mtk-mdp/mtk_mdp_core.h:13:
In file included from include/media/v4l2-device.h:13:
In file included from include/media/v4l2-subdev.h:15:
In file included from include/media/v4l2-common.h:105:
In file included from include/linux/i2c.h:18:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
include/linux/bpf.h:707:20: error: field has incomplete type 'struct ftrace_ops'
struct ftrace_ops ops;
^
include/linux/bpf.h:707:9: note: forward declaration of 'struct ftrace_ops'
struct ftrace_ops ops;
^
drivers/media/platform/mtk-mdp/mtk_mdp_core.c:151:15: warning: cast to smaller integer type 'enum mtk_mdp_comp_type' from 'const void *' [-Wvoid-pointer-to-enum-cast]
comp_type = (enum mtk_mdp_comp_type)of_id->data;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>> drivers/media/platform/mtk-mdp/mtk_mdp_core.c:207:52: warning: implicit conversion from 'unsigned long long' to 'unsigned int' changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
ret = vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:40: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^~~~~
8 warnings and 1 error generated.
--
In file included from drivers/media/platform/s5p-mfc/s5p_mfc.c:24:
In file included from drivers/media/platform/s5p-mfc/s5p_mfc_common.h:18:
In file included from include/media/v4l2-device.h:13:
In file included from include/media/v4l2-subdev.h:15:
In file included from include/media/v4l2-common.h:105:
In file included from include/linux/i2c.h:18:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
In file included from include/linux/bpf.h:26:
include/linux/ftrace.h:353:41: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:353:5: warning: no previous prototype for function 'register_ftrace_direct_multi' [-Wmissing-prototypes]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:353:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
include/linux/ftrace.h:357:43: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:357:5: warning: no previous prototype for function 'unregister_ftrace_direct_multi' [-Wmissing-prototypes]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:357:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
static
include/linux/ftrace.h:361:39: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:361:5: warning: no previous prototype for function 'modify_ftrace_direct_multi' [-Wmissing-prototypes]
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:361:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
In file included from drivers/media/platform/s5p-mfc/s5p_mfc.c:24:
In file included from drivers/media/platform/s5p-mfc/s5p_mfc_common.h:18:
In file included from include/media/v4l2-device.h:13:
In file included from include/media/v4l2-subdev.h:15:
In file included from include/media/v4l2-common.h:105:
In file included from include/linux/i2c.h:18:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
include/linux/bpf.h:707:20: error: field has incomplete type 'struct ftrace_ops'
struct ftrace_ops ops;
^
include/linux/bpf.h:707:9: note: forward declaration of 'struct ftrace_ops'
struct ftrace_ops ops;
^
>> drivers/media/platform/s5p-mfc/s5p_mfc.c:1169:6: warning: implicit conversion from 'unsigned long long' to 'unsigned int' changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
DMA_BIT_MASK(32));
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:40: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^~~~~
drivers/media/platform/s5p-mfc/s5p_mfc.c:1171:6: warning: implicit conversion from 'unsigned long long' to 'unsigned int' changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
DMA_BIT_MASK(32));
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:40: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^~~~~
drivers/media/platform/s5p-mfc/s5p_mfc.c:1230:39: warning: implicit conversion from 'unsigned long long' to 'unsigned int' changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
vb2_dma_contig_set_max_seg_size(dev, DMA_BIT_MASK(32));
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:40: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^~~~~
9 warnings and 1 error generated.
--
In file included from drivers/gpu/drm/exynos/exynos_drm_dma.c:15:
In file included from drivers/gpu/drm/exynos/exynos_drm_drv.h:16:
In file included from include/drm/drm_crtc.h:28:
In file included from include/linux/i2c.h:18:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
In file included from include/linux/bpf.h:26:
include/linux/ftrace.h:353:41: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:353:5: warning: no previous prototype for function 'register_ftrace_direct_multi' [-Wmissing-prototypes]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:353:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
include/linux/ftrace.h:357:43: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:357:5: warning: no previous prototype for function 'unregister_ftrace_direct_multi' [-Wmissing-prototypes]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:357:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
static
include/linux/ftrace.h:361:39: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:361:5: warning: no previous prototype for function 'modify_ftrace_direct_multi' [-Wmissing-prototypes]
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:361:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
In file included from drivers/gpu/drm/exynos/exynos_drm_dma.c:15:
In file included from drivers/gpu/drm/exynos/exynos_drm_drv.h:16:
In file included from include/drm/drm_crtc.h:28:
In file included from include/linux/i2c.h:18:
In file included from include/linux/regulator/consumer.h:35:
In file included from include/linux/suspend.h:5:
In file included from include/linux/swap.h:9:
In file included from include/linux/memcontrol.h:13:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
include/linux/bpf.h:707:20: error: field has incomplete type 'struct ftrace_ops'
struct ftrace_ops ops;
^
include/linux/bpf.h:707:9: note: forward declaration of 'struct ftrace_ops'
struct ftrace_ops ops;
^
>> drivers/gpu/drm/exynos/exynos_drm_dma.c:55:35: warning: implicit conversion from 'unsigned long long' to 'unsigned int' changes value from 18446744073709551615 to 4294967295 [-Wconstant-conversion]
dma_set_max_seg_size(subdrv_dev, DMA_BIT_MASK(32));
~~~~~~~~~~~~~~~~~~~~ ^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:40: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^~~~~
7 warnings and 1 error generated.
--
In file included from drivers/net/ethernet/hisilicon/hns/hns_enet.c:8:
In file included from include/linux/etherdevice.h:21:
In file included from include/linux/netdevice.h:41:
In file included from include/net/netprio_cgroup.h:11:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
In file included from include/linux/bpf.h:26:
include/linux/ftrace.h:353:41: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:353:5: warning: no previous prototype for function 'register_ftrace_direct_multi' [-Wmissing-prototypes]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:353:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
include/linux/ftrace.h:357:43: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:357:5: warning: no previous prototype for function 'unregister_ftrace_direct_multi' [-Wmissing-prototypes]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:357:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
static
include/linux/ftrace.h:361:39: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:361:5: warning: no previous prototype for function 'modify_ftrace_direct_multi' [-Wmissing-prototypes]
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:361:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
In file included from drivers/net/ethernet/hisilicon/hns/hns_enet.c:8:
In file included from include/linux/etherdevice.h:21:
In file included from include/linux/netdevice.h:41:
In file included from include/net/netprio_cgroup.h:11:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
include/linux/bpf.h:707:20: error: field has incomplete type 'struct ftrace_ops'
struct ftrace_ops ops;
^
include/linux/bpf.h:707:9: note: forward declaration of 'struct ftrace_ops'
struct ftrace_ops ops;
^
>> drivers/net/ethernet/hisilicon/hns/hns_enet.c:2355:38: warning: shift count >= width of type [-Wshift-count-overflow]
if (!dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)))
^~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
7 warnings and 1 error generated.
--
In file included from drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c:12:
In file included from include/linux/netdevice.h:41:
In file included from include/net/netprio_cgroup.h:11:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
In file included from include/linux/bpf.h:26:
include/linux/ftrace.h:353:41: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:353:5: warning: no previous prototype for function 'register_ftrace_direct_multi' [-Wmissing-prototypes]
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:353:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int register_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
include/linux/ftrace.h:357:43: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:357:5: warning: no previous prototype for function 'unregister_ftrace_direct_multi' [-Wmissing-prototypes]
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
include/linux/ftrace.h:357:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int unregister_ftrace_direct_multi(struct ftrace_ops *ops)
^
static
include/linux/ftrace.h:361:39: warning: declaration of 'struct ftrace_ops' will not be visible outside of this function [-Wvisibility]
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:361:5: warning: no previous prototype for function 'modify_ftrace_direct_multi' [-Wmissing-prototypes]
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
include/linux/ftrace.h:361:1: note: declare 'static' if the function is not intended to be used outside of this translation unit
int modify_ftrace_direct_multi(struct ftrace_ops *ops, unsigned long addr)
^
static
In file included from drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c:12:
In file included from include/linux/netdevice.h:41:
In file included from include/net/netprio_cgroup.h:11:
In file included from include/linux/cgroup.h:28:
In file included from include/linux/cgroup-defs.h:22:
In file included from include/linux/bpf-cgroup.h:5:
include/linux/bpf.h:707:20: error: field has incomplete type 'struct ftrace_ops'
struct ftrace_ops ops;
^
include/linux/bpf.h:707:9: note: forward declaration of 'struct ftrace_ops'
struct ftrace_ops ops;
^
>> drivers/net/ethernet/hisilicon/hns/hns_dsaf_main.c:200:48: warning: shift count >= width of type [-Wshift-count-overflow]
if (!dma_set_mask_and_coherent(dsaf_dev->dev, DMA_BIT_MASK(64ULL)))
^~~~~~~~~~~~~~~~~~~
include/linux/dma-mapping.h:76:54: note: expanded from macro 'DMA_BIT_MASK'
#define DMA_BIT_MASK(n) (((n) == 64) ? ~0ULL : ((1ULL<<(n))-1))
^ ~~~
7 warnings and 1 error generated.
..


vim +207 drivers/media/platform/mtk-mdp/mtk_mdp_core.c

86698b9505bbc9 Eizan Miyamoto 2020-05-07 105
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 106 static int mtk_mdp_probe(struct platform_device *pdev)
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 107 {
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 108 struct mtk_mdp_dev *mdp;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 109 struct device *dev = &pdev->dev;
ba1f1f70c2c08f Daniel Kurtz 2017-05-23 110 struct device_node *node, *parent;
86698b9505bbc9 Eizan Miyamoto 2020-05-07 111 struct mtk_mdp_comp *comp, *comp_temp;
86698b9505bbc9 Eizan Miyamoto 2020-05-07 112 int ret = 0;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 113
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 114 mdp = devm_kzalloc(dev, sizeof(*mdp), GFP_KERNEL);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 115 if (!mdp)
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 116 return -ENOMEM;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 117
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 118 mdp->id = pdev->id;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 119 mdp->pdev = pdev;
86698b9505bbc9 Eizan Miyamoto 2020-05-07 120 INIT_LIST_HEAD(&mdp->comp_list);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 121 INIT_LIST_HEAD(&mdp->ctx_list);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 122
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 123 mutex_init(&mdp->lock);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 124 mutex_init(&mdp->vpulock);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 125
ba1f1f70c2c08f Daniel Kurtz 2017-05-23 126 /* Old dts had the components as child nodes */
864919ea0380e6 Matthias Brugger 2019-06-21 127 node = of_get_next_child(dev->of_node, NULL);
864919ea0380e6 Matthias Brugger 2019-06-21 128 if (node) {
864919ea0380e6 Matthias Brugger 2019-06-21 129 of_node_put(node);
ba1f1f70c2c08f Daniel Kurtz 2017-05-23 130 parent = dev->of_node;
ba1f1f70c2c08f Daniel Kurtz 2017-05-23 131 dev_warn(dev, "device tree is out of date\n");
ba1f1f70c2c08f Daniel Kurtz 2017-05-23 132 } else {
ba1f1f70c2c08f Daniel Kurtz 2017-05-23 133 parent = dev->of_node->parent;
ba1f1f70c2c08f Daniel Kurtz 2017-05-23 134 }
ba1f1f70c2c08f Daniel Kurtz 2017-05-23 135
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 136 /* Iterate over sibling MDP function blocks */
ba1f1f70c2c08f Daniel Kurtz 2017-05-23 137 for_each_child_of_node(parent, node) {
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 138 const struct of_device_id *of_id;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 139 enum mtk_mdp_comp_type comp_type;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 140
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 141 of_id = of_match_node(mtk_mdp_comp_dt_ids, node);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 142 if (!of_id)
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 143 continue;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 144
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 145 if (!of_device_is_available(node)) {
68d9c47b1679ec Rob Herring 2017-07-21 146 dev_err(dev, "Skipping disabled component %pOF\n",
68d9c47b1679ec Rob Herring 2017-07-21 147 node);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 148 continue;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 149 }
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 150
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 151 comp_type = (enum mtk_mdp_comp_type)of_id->data;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 152
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 153 comp = devm_kzalloc(dev, sizeof(*comp), GFP_KERNEL);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 154 if (!comp) {
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 155 ret = -ENOMEM;
22ff7d4ca3f748 Nishka Dasgupta 2019-07-09 156 of_node_put(node);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 157 goto err_comp;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 158 }
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 159
37e278c801078d Eizan Miyamoto 2020-05-07 160 ret = mtk_mdp_comp_init(dev, node, comp, comp_type);
22ff7d4ca3f748 Nishka Dasgupta 2019-07-09 161 if (ret) {
22ff7d4ca3f748 Nishka Dasgupta 2019-07-09 162 of_node_put(node);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 163 goto err_comp;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 164 }
86698b9505bbc9 Eizan Miyamoto 2020-05-07 165
86698b9505bbc9 Eizan Miyamoto 2020-05-07 166 mtk_mdp_register_component(mdp, comp);
22ff7d4ca3f748 Nishka Dasgupta 2019-07-09 167 }
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 168
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 169 mdp->job_wq = create_singlethread_workqueue(MTK_MDP_MODULE_NAME);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 170 if (!mdp->job_wq) {
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 171 dev_err(&pdev->dev, "unable to alloc job workqueue\n");
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 172 ret = -ENOMEM;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 173 goto err_alloc_job_wq;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 174 }
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 175
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 176 mdp->wdt_wq = create_singlethread_workqueue("mdp_wdt_wq");
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 177 if (!mdp->wdt_wq) {
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 178 dev_err(&pdev->dev, "unable to alloc wdt workqueue\n");
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 179 ret = -ENOMEM;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 180 goto err_alloc_wdt_wq;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 181 }
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 182 INIT_WORK(&mdp->wdt_work, mtk_mdp_wdt_worker);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 183
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 184 ret = v4l2_device_register(dev, &mdp->v4l2_dev);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 185 if (ret) {
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 186 dev_err(&pdev->dev, "Failed to register v4l2 device\n");
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 187 ret = -EINVAL;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 188 goto err_dev_register;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 189 }
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 190
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 191 ret = mtk_mdp_register_m2m_device(mdp);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 192 if (ret) {
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 193 v4l2_err(&mdp->v4l2_dev, "Failed to init mem2mem device\n");
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 194 goto err_m2m_register;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 195 }
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 196
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 197 mdp->vpu_dev = vpu_get_plat_device(pdev);
ee18fc7b0b9517 Eizan Miyamoto 2020-05-07 198 ret = vpu_wdt_reg_handler(mdp->vpu_dev, mtk_mdp_reset_handler, mdp,
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 199 VPU_RST_MDP);
ee18fc7b0b9517 Eizan Miyamoto 2020-05-07 200 if (ret) {
ee18fc7b0b9517 Eizan Miyamoto 2020-05-07 201 dev_err(&pdev->dev, "Failed to register reset handler\n");
ee18fc7b0b9517 Eizan Miyamoto 2020-05-07 202 goto err_m2m_register;
ee18fc7b0b9517 Eizan Miyamoto 2020-05-07 203 }
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 204
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 205 platform_set_drvdata(pdev, mdp);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 206
256a12e1a343e1 Eizan Miyamoto 2020-05-07 @207 ret = vb2_dma_contig_set_max_seg_size(&pdev->dev, DMA_BIT_MASK(32));
256a12e1a343e1 Eizan Miyamoto 2020-05-07 208 if (ret) {
256a12e1a343e1 Eizan Miyamoto 2020-05-07 209 dev_err(&pdev->dev, "Failed to set vb2 dma mag seg size\n");
256a12e1a343e1 Eizan Miyamoto 2020-05-07 210 goto err_m2m_register;
256a12e1a343e1 Eizan Miyamoto 2020-05-07 211 }
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 212
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 213 pm_runtime_enable(dev);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 214 dev_dbg(dev, "mdp-%d registered successfully\n", mdp->id);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 215
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 216 return 0;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 217
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 218 err_m2m_register:
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 219 v4l2_device_unregister(&mdp->v4l2_dev);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 220
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 221 err_dev_register:
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 222 destroy_workqueue(mdp->wdt_wq);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 223
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 224 err_alloc_wdt_wq:
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 225 destroy_workqueue(mdp->job_wq);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 226
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 227 err_alloc_job_wq:
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 228
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 229 err_comp:
86698b9505bbc9 Eizan Miyamoto 2020-05-07 230 list_for_each_entry_safe(comp, comp_temp, &mdp->comp_list, node) {
86698b9505bbc9 Eizan Miyamoto 2020-05-07 231 mtk_mdp_unregister_component(mdp, comp);
86698b9505bbc9 Eizan Miyamoto 2020-05-07 232 mtk_mdp_comp_deinit(dev, comp);
86698b9505bbc9 Eizan Miyamoto 2020-05-07 233 }
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 234
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 235 dev_dbg(dev, "err %d\n", ret);
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 236 return ret;
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 237 }
c8eb2d7e8202fd Minghsiu Tsai 2016-09-08 238

:::::: The code at line 207 was first introduced by commit
:::::: 256a12e1a343e1efff00a9065063f0846d219336 media: mtk-mdp: handle vb2_dma_contig_set_max_seg_size errors during probe

:::::: TO: Eizan Miyamoto <eizan@xxxxxxxxxxxx>
:::::: CC: Mauro Carvalho Chehab <mchehab+huawei@xxxxxxxxxx>

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip