Commit 907f5320 authored by Emil Velikov's avatar Emil Velikov

drm: vmwgfx: remove drm_driver::master_set() return type

The function always returns zero (success). Ideally we'll remove it all
together - although that's requires a little more work.

For now, we can drop the return type and simplify the drm core code
surrounding it.

v2: remove redundant assignment (Sam)

Cc: David Airlie <airlied@linux.ie>
Cc: Daniel Vetter <daniel@ffwll.ch>
Cc: VMware Graphics <linux-graphics-maintainer@vmware.com>
Cc: Roland Scheidegger <sroland@vmware.com>
Signed-off-by: default avatarEmil Velikov <emil.l.velikov@gmail.com>
Cc: Sam Ravnborg <sam@ravnborg.org>
Reviewed-by: default avatarSam Ravnborg <sam@ravnborg.org>
Reviewed-by: default avatarRoland Scheidegger <sroland@vmware.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200530124640.4176323-1-emil.l.velikov@gmail.com
parent d2fb716a
...@@ -122,27 +122,19 @@ struct drm_master *drm_master_create(struct drm_device *dev) ...@@ -122,27 +122,19 @@ struct drm_master *drm_master_create(struct drm_device *dev)
return master; return master;
} }
static int drm_set_master(struct drm_device *dev, struct drm_file *fpriv, static void drm_set_master(struct drm_device *dev, struct drm_file *fpriv,
bool new_master) bool new_master)
{ {
int ret = 0;
dev->master = drm_master_get(fpriv->master); dev->master = drm_master_get(fpriv->master);
if (dev->driver->master_set) { if (dev->driver->master_set)
ret = dev->driver->master_set(dev, fpriv, new_master); dev->driver->master_set(dev, fpriv, new_master);
if (unlikely(ret != 0)) {
drm_master_put(&dev->master);
}
}
fpriv->was_master = (ret == 0); fpriv->was_master = true;
return ret;
} }
static int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv) static int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv)
{ {
struct drm_master *old_master; struct drm_master *old_master;
int ret;
lockdep_assert_held_once(&dev->master_mutex); lockdep_assert_held_once(&dev->master_mutex);
...@@ -157,22 +149,12 @@ static int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv) ...@@ -157,22 +149,12 @@ static int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv)
fpriv->is_master = 1; fpriv->is_master = 1;
fpriv->authenticated = 1; fpriv->authenticated = 1;
ret = drm_set_master(dev, fpriv, true); drm_set_master(dev, fpriv, true);
if (ret)
goto out_err;
if (old_master) if (old_master)
drm_master_put(&old_master); drm_master_put(&old_master);
return 0; return 0;
out_err:
/* drop references and restore old master on failure */
drm_master_put(&fpriv->master);
fpriv->master = old_master;
fpriv->is_master = 0;
return ret;
} }
/* /*
...@@ -265,7 +247,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data, ...@@ -265,7 +247,7 @@ int drm_setmaster_ioctl(struct drm_device *dev, void *data,
goto out_unlock; goto out_unlock;
} }
ret = drm_set_master(dev, file_priv, false); drm_set_master(dev, file_priv, false);
out_unlock: out_unlock:
mutex_unlock(&dev->master_mutex); mutex_unlock(&dev->master_mutex);
return ret; return ret;
......
...@@ -1129,9 +1129,9 @@ static long vmw_compat_ioctl(struct file *filp, unsigned int cmd, ...@@ -1129,9 +1129,9 @@ static long vmw_compat_ioctl(struct file *filp, unsigned int cmd,
} }
#endif #endif
static int vmw_master_set(struct drm_device *dev, static void vmw_master_set(struct drm_device *dev,
struct drm_file *file_priv, struct drm_file *file_priv,
bool from_open) bool from_open)
{ {
/* /*
* Inform a new master that the layout may have changed while * Inform a new master that the layout may have changed while
...@@ -1139,8 +1139,6 @@ static int vmw_master_set(struct drm_device *dev, ...@@ -1139,8 +1139,6 @@ static int vmw_master_set(struct drm_device *dev,
*/ */
if (!from_open) if (!from_open)
drm_sysfs_hotplug_event(dev); drm_sysfs_hotplug_event(dev);
return 0;
} }
static void vmw_master_drop(struct drm_device *dev, static void vmw_master_drop(struct drm_device *dev,
......
...@@ -311,8 +311,8 @@ struct drm_driver { ...@@ -311,8 +311,8 @@ struct drm_driver {
* *
* Called whenever the minor master is set. Only used by vmwgfx. * Called whenever the minor master is set. Only used by vmwgfx.
*/ */
int (*master_set)(struct drm_device *dev, struct drm_file *file_priv, void (*master_set)(struct drm_device *dev, struct drm_file *file_priv,
bool from_open); bool from_open);
/** /**
* @master_drop: * @master_drop:
* *
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment