OSDN Git Service

media: v4l2-subdev: Guard whole fops and ioctl hdlr
authorJacopo Mondi <jacopo@jmondi.org>
Thu, 7 May 2020 15:12:51 +0000 (17:12 +0200)
committerMauro Carvalho Chehab <mchehab+huawei@kernel.org>
Tue, 12 May 2020 15:05:02 +0000 (17:05 +0200)
commitfb15db8c0060e73317a7872986b909343504eb84
tree97685291d3103dff0ec81de51d1b13e13ac6c85c
parentf75c431e54e2e43c91fe267097b974ff2e5dc668
media: v4l2-subdev: Guard whole fops and ioctl hdlr

A sub-device device node can be registered in user space only if the
CONFIG_VIDEO_V4L2_SUBDEV_API Kconfig option is selected. Currently the
open/close file operations and the ioctl handler have some parts of
their implementations guarded by #if
defined(CONFIG_VIDEO_V4L2_SUBDEV_API), while they are actually not
accessible without a video device node registered to user space.

Guard the whole open, close and ioctl handler and provide stubs if the
VIDEO_V4L2_SUBDEV_API Kconfig option is not selected.

This slightly reduces the kernel size when the option is not selected
and simplifies the file ops and ioctl implementations.

Signed-off-by: Jacopo Mondi <jacopo@jmondi.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab+huawei@kernel.org>
drivers/media/v4l2-core/v4l2-subdev.c