drm: Add DRM_GEM_FOPS
The DEFINE_DRM_GEM_FOPS() helper is a bit limiting if a driver wants to provide additional file ops, like show_fdinfo(). v2: Split out DRM_GEM_FOPS instead of making DEFINE_DRM_GEM_FOPS varardic v3: nits Signed-off-by: Rob Clark <robdclark@chromium.org> Acked-by: Thomas Zimmermann <tzimmermann@suse.de> Patchwork: https://patchwork.freedesktop.org/patch/488904/ Link: https://lore.kernel.org/r/20220609174213.2265938-1-robdclark@gmail.com Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
This commit is contained in:
Родитель
6867c9aff8
Коммит
1981c35bf7
|
@ -314,6 +314,23 @@ struct drm_gem_object {
|
|||
const struct drm_gem_object_funcs *funcs;
|
||||
};
|
||||
|
||||
/**
|
||||
* DRM_GEM_FOPS - Default drm GEM file operations
|
||||
*
|
||||
* This macro provides a shorthand for setting the GEM file ops in the
|
||||
* &file_operations structure. If all you need are the default ops, use
|
||||
* DEFINE_DRM_GEM_FOPS instead.
|
||||
*/
|
||||
#define DRM_GEM_FOPS \
|
||||
.open = drm_open,\
|
||||
.release = drm_release,\
|
||||
.unlocked_ioctl = drm_ioctl,\
|
||||
.compat_ioctl = drm_compat_ioctl,\
|
||||
.poll = drm_poll,\
|
||||
.read = drm_read,\
|
||||
.llseek = noop_llseek,\
|
||||
.mmap = drm_gem_mmap
|
||||
|
||||
/**
|
||||
* DEFINE_DRM_GEM_FOPS() - macro to generate file operations for GEM drivers
|
||||
* @name: name for the generated structure
|
||||
|
@ -330,14 +347,7 @@ struct drm_gem_object {
|
|||
#define DEFINE_DRM_GEM_FOPS(name) \
|
||||
static const struct file_operations name = {\
|
||||
.owner = THIS_MODULE,\
|
||||
.open = drm_open,\
|
||||
.release = drm_release,\
|
||||
.unlocked_ioctl = drm_ioctl,\
|
||||
.compat_ioctl = drm_compat_ioctl,\
|
||||
.poll = drm_poll,\
|
||||
.read = drm_read,\
|
||||
.llseek = noop_llseek,\
|
||||
.mmap = drm_gem_mmap,\
|
||||
DRM_GEM_FOPS,\
|
||||
}
|
||||
|
||||
void drm_gem_object_release(struct drm_gem_object *obj);
|
||||
|
|
Загрузка…
Ссылка в новой задаче