drm: Pass struct drm_file * to __drm_mode_object_find [v2]
This will allow __drm_mode_object_file to be extended to perform access control checks based on the file in use. v2: Also fix up vboxvideo driver in staging [airlied: merging early as this is an API change] Suggested-by: Daniel Vetter <daniel.vetter@ffwll.ch> Signed-off-by: Keith Packard <keithp@keithp.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
This commit is contained in:
committed by
Dave Airlie
parent
bb7a9c8d71
commit
418da17214
@@ -939,10 +939,11 @@ static inline unsigned drm_connector_index(struct drm_connector *connector)
|
||||
* add takes a reference to it.
|
||||
*/
|
||||
static inline struct drm_connector *drm_connector_lookup(struct drm_device *dev,
|
||||
struct drm_file *file_priv,
|
||||
uint32_t id)
|
||||
{
|
||||
struct drm_mode_object *mo;
|
||||
mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CONNECTOR);
|
||||
mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CONNECTOR);
|
||||
return mo ? obj_to_connector(mo) : NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -959,10 +959,11 @@ struct drm_crtc *drm_crtc_from_index(struct drm_device *dev, int idx);
|
||||
* userspace interface should be done using &drm_property.
|
||||
*/
|
||||
static inline struct drm_crtc *drm_crtc_find(struct drm_device *dev,
|
||||
uint32_t id)
|
||||
struct drm_file *file_priv,
|
||||
uint32_t id)
|
||||
{
|
||||
struct drm_mode_object *mo;
|
||||
mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_CRTC);
|
||||
mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_CRTC);
|
||||
return mo ? obj_to_crtc(mo) : NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -214,11 +214,12 @@ static inline bool drm_encoder_crtc_ok(struct drm_encoder *encoder,
|
||||
* drm_mode_object_find().
|
||||
*/
|
||||
static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev,
|
||||
struct drm_file *file_priv,
|
||||
uint32_t id)
|
||||
{
|
||||
struct drm_mode_object *mo;
|
||||
|
||||
mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER);
|
||||
mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_ENCODER);
|
||||
|
||||
return mo ? obj_to_encoder(mo) : NULL;
|
||||
}
|
||||
|
||||
@@ -205,6 +205,7 @@ int drm_framebuffer_init(struct drm_device *dev,
|
||||
struct drm_framebuffer *fb,
|
||||
const struct drm_framebuffer_funcs *funcs);
|
||||
struct drm_framebuffer *drm_framebuffer_lookup(struct drm_device *dev,
|
||||
struct drm_file *file_priv,
|
||||
uint32_t id);
|
||||
void drm_framebuffer_remove(struct drm_framebuffer *fb);
|
||||
void drm_framebuffer_cleanup(struct drm_framebuffer *fb);
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
struct drm_object_properties;
|
||||
struct drm_property;
|
||||
struct drm_device;
|
||||
struct drm_file;
|
||||
|
||||
/**
|
||||
* struct drm_mode_object - base structure for modeset objects
|
||||
@@ -113,6 +114,7 @@ struct drm_object_properties {
|
||||
}
|
||||
|
||||
struct drm_mode_object *drm_mode_object_find(struct drm_device *dev,
|
||||
struct drm_file *file_priv,
|
||||
uint32_t id, uint32_t type);
|
||||
void drm_mode_object_get(struct drm_mode_object *obj);
|
||||
void drm_mode_object_put(struct drm_mode_object *obj);
|
||||
|
||||
@@ -597,10 +597,11 @@ int drm_mode_plane_set_obj_prop(struct drm_plane *plane,
|
||||
* drm_mode_object_find().
|
||||
*/
|
||||
static inline struct drm_plane *drm_plane_find(struct drm_device *dev,
|
||||
struct drm_file *file_priv,
|
||||
uint32_t id)
|
||||
{
|
||||
struct drm_mode_object *mo;
|
||||
mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PLANE);
|
||||
mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_PLANE);
|
||||
return mo ? obj_to_plane(mo) : NULL;
|
||||
}
|
||||
|
||||
|
||||
@@ -312,10 +312,11 @@ drm_property_unreference_blob(struct drm_property_blob *blob)
|
||||
* This function looks up the property object specified by id and returns it.
|
||||
*/
|
||||
static inline struct drm_property *drm_property_find(struct drm_device *dev,
|
||||
struct drm_file *file_priv,
|
||||
uint32_t id)
|
||||
{
|
||||
struct drm_mode_object *mo;
|
||||
mo = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_PROPERTY);
|
||||
mo = drm_mode_object_find(dev, file_priv, id, DRM_MODE_OBJECT_PROPERTY);
|
||||
return mo ? obj_to_property(mo) : NULL;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user