Merge tag 'drm-misc-next-fixes-2019-03-06' of git://anongit.freedesktop.org/drm/drm-misc into drm-next
- Properly mark the ptr_to_compat argument with the __user tag - Merge __drm_atomic_helper_disable_all into drm_atomic_helper_disable_all Signed-off-by: Dave Airlie <airlied@redhat.com> From: Maxime Ripard <maxime.ripard@bootlin.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190306105454.33ddidiqmsjcvxa4@flea
This commit is contained in:
@@ -3039,9 +3039,31 @@ commit:
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int __drm_atomic_helper_disable_all(struct drm_device *dev,
|
/**
|
||||||
struct drm_modeset_acquire_ctx *ctx,
|
* drm_atomic_helper_disable_all - disable all currently active outputs
|
||||||
bool clean_old_fbs)
|
* @dev: DRM device
|
||||||
|
* @ctx: lock acquisition context
|
||||||
|
*
|
||||||
|
* Loops through all connectors, finding those that aren't turned off and then
|
||||||
|
* turns them off by setting their DPMS mode to OFF and deactivating the CRTC
|
||||||
|
* that they are connected to.
|
||||||
|
*
|
||||||
|
* This is used for example in suspend/resume to disable all currently active
|
||||||
|
* functions when suspending. If you just want to shut down everything at e.g.
|
||||||
|
* driver unload, look at drm_atomic_helper_shutdown().
|
||||||
|
*
|
||||||
|
* Note that if callers haven't already acquired all modeset locks this might
|
||||||
|
* return -EDEADLK, which must be handled by calling drm_modeset_backoff().
|
||||||
|
*
|
||||||
|
* Returns:
|
||||||
|
* 0 on success or a negative error code on failure.
|
||||||
|
*
|
||||||
|
* See also:
|
||||||
|
* drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
|
||||||
|
* drm_atomic_helper_shutdown().
|
||||||
|
*/
|
||||||
|
int drm_atomic_helper_disable_all(struct drm_device *dev,
|
||||||
|
struct drm_modeset_acquire_ctx *ctx)
|
||||||
{
|
{
|
||||||
struct drm_atomic_state *state;
|
struct drm_atomic_state *state;
|
||||||
struct drm_connector_state *conn_state;
|
struct drm_connector_state *conn_state;
|
||||||
@@ -3099,35 +3121,6 @@ free:
|
|||||||
drm_atomic_state_put(state);
|
drm_atomic_state_put(state);
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
|
||||||
* drm_atomic_helper_disable_all - disable all currently active outputs
|
|
||||||
* @dev: DRM device
|
|
||||||
* @ctx: lock acquisition context
|
|
||||||
*
|
|
||||||
* Loops through all connectors, finding those that aren't turned off and then
|
|
||||||
* turns them off by setting their DPMS mode to OFF and deactivating the CRTC
|
|
||||||
* that they are connected to.
|
|
||||||
*
|
|
||||||
* This is used for example in suspend/resume to disable all currently active
|
|
||||||
* functions when suspending. If you just want to shut down everything at e.g.
|
|
||||||
* driver unload, look at drm_atomic_helper_shutdown().
|
|
||||||
*
|
|
||||||
* Note that if callers haven't already acquired all modeset locks this might
|
|
||||||
* return -EDEADLK, which must be handled by calling drm_modeset_backoff().
|
|
||||||
*
|
|
||||||
* Returns:
|
|
||||||
* 0 on success or a negative error code on failure.
|
|
||||||
*
|
|
||||||
* See also:
|
|
||||||
* drm_atomic_helper_suspend(), drm_atomic_helper_resume() and
|
|
||||||
* drm_atomic_helper_shutdown().
|
|
||||||
*/
|
|
||||||
int drm_atomic_helper_disable_all(struct drm_device *dev,
|
|
||||||
struct drm_modeset_acquire_ctx *ctx)
|
|
||||||
{
|
|
||||||
return __drm_atomic_helper_disable_all(dev, ctx, false);
|
|
||||||
}
|
|
||||||
EXPORT_SYMBOL(drm_atomic_helper_disable_all);
|
EXPORT_SYMBOL(drm_atomic_helper_disable_all);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -3148,7 +3141,7 @@ void drm_atomic_helper_shutdown(struct drm_device *dev)
|
|||||||
|
|
||||||
DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
|
DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, 0, ret);
|
||||||
|
|
||||||
ret = __drm_atomic_helper_disable_all(dev, &ctx, true);
|
ret = drm_atomic_helper_disable_all(dev, &ctx);
|
||||||
if (ret)
|
if (ret)
|
||||||
DRM_ERROR("Disabling all crtc's during unload failed with %i\n", ret);
|
DRM_ERROR("Disabling all crtc's during unload failed with %i\n", ret);
|
||||||
|
|
||||||
|
|||||||
@@ -185,7 +185,7 @@ static int compat_drm_getmap(struct file *file, unsigned int cmd,
|
|||||||
m32.size = map.size;
|
m32.size = map.size;
|
||||||
m32.type = map.type;
|
m32.type = map.type;
|
||||||
m32.flags = map.flags;
|
m32.flags = map.flags;
|
||||||
m32.handle = ptr_to_compat(map.handle);
|
m32.handle = ptr_to_compat((void __user *)map.handle);
|
||||||
m32.mtrr = map.mtrr;
|
m32.mtrr = map.mtrr;
|
||||||
if (copy_to_user(argp, &m32, sizeof(m32)))
|
if (copy_to_user(argp, &m32, sizeof(m32)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
@@ -216,7 +216,7 @@ static int compat_drm_addmap(struct file *file, unsigned int cmd,
|
|||||||
|
|
||||||
m32.offset = map.offset;
|
m32.offset = map.offset;
|
||||||
m32.mtrr = map.mtrr;
|
m32.mtrr = map.mtrr;
|
||||||
m32.handle = ptr_to_compat(map.handle);
|
m32.handle = ptr_to_compat((void __user *)map.handle);
|
||||||
if (map.handle != compat_ptr(m32.handle))
|
if (map.handle != compat_ptr(m32.handle))
|
||||||
pr_err_ratelimited("compat_drm_addmap truncated handle %p for type %d offset %x\n",
|
pr_err_ratelimited("compat_drm_addmap truncated handle %p for type %d offset %x\n",
|
||||||
map.handle, m32.type, m32.offset);
|
map.handle, m32.type, m32.offset);
|
||||||
@@ -526,7 +526,7 @@ static int compat_drm_getsareactx(struct file *file, unsigned int cmd,
|
|||||||
if (err)
|
if (err)
|
||||||
return err;
|
return err;
|
||||||
|
|
||||||
req32.handle = ptr_to_compat(req.handle);
|
req32.handle = ptr_to_compat((void __user *)req.handle);
|
||||||
if (copy_to_user(argp, &req32, sizeof(req32)))
|
if (copy_to_user(argp, &req32, sizeof(req32)))
|
||||||
return -EFAULT;
|
return -EFAULT;
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user