Re: [PATCH v2 1/2] drm: vmwgfx: remove drm_driver::master_set() return typ

2020-06-15 Thread Emil Velikov
On Fri, 5 Jun 2020 at 15:07, Emil Velikov  wrote:
>
> On Wed, 3 Jun 2020 at 19:37, Roland Scheidegger  wrote:
> >
> > Looks like a nice cleanup to me. (No idea if at some point there
> > actually was a reason for a return value...)
> >
> It was required up-to quite recently actually:
>
> commit 9c84aeba67cce6514374f134c9ce2c5f35ac3831
> Author: Thomas Hellstrom 
> AuthorDate: Tue May 28 08:08:55 2019 +0200
> Commit: Thomas Hellstrom 
> CommitDate: Thu Aug 15 08:39:27 2019 +0200
>
> drm/vmwgfx: Kill unneeded legacy security features
>
> > Reviewed-by: Roland Scheidegger 
> >
> Thank you. Will push to drm-misc in a moment.
>
... and finally pushed to drm-misc/next.

Thanks again.
-Emil
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 1/2] drm: vmwgfx: remove drm_driver::master_set() return typ

2020-06-05 Thread Emil Velikov
On Wed, 3 Jun 2020 at 19:37, Roland Scheidegger  wrote:
>
> Looks like a nice cleanup to me. (No idea if at some point there
> actually was a reason for a return value...)
>
It was required up-to quite recently actually:

commit 9c84aeba67cce6514374f134c9ce2c5f35ac3831
Author: Thomas Hellstrom 
AuthorDate: Tue May 28 08:08:55 2019 +0200
Commit: Thomas Hellstrom 
CommitDate: Thu Aug 15 08:39:27 2019 +0200

drm/vmwgfx: Kill unneeded legacy security features

> Reviewed-by: Roland Scheidegger 
>
Thank you. Will push to drm-misc in a moment.

-Emil
___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


Re: [PATCH v2 1/2] drm: vmwgfx: remove drm_driver::master_set() return typ

2020-06-03 Thread Roland Scheidegger
Looks like a nice cleanup to me. (No idea if at some point there
actually was a reason for a return value...)

Reviewed-by: Roland Scheidegger 

Am 30.05.20 um 14:46 schrieb Emil Velikov:
> 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 
> Cc: Daniel Vetter 
> Cc: VMware Graphics 
> Cc: Roland Scheidegger 
> Signed-off-by: Emil Velikov 
> Cc: Sam Ravnborg 
> Reviewed-by: Sam Ravnborg 
> ---
> VMWare team, I'm planning to push this via drm-misc. Review, ack and
> comments are appreciated.
> ---
>  drivers/gpu/drm/drm_auth.c  | 32 +++--
>  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |  8 +++-
>  include/drm/drm_drv.h   |  4 ++--
>  3 files changed, 12 insertions(+), 32 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
> index 74ce0c29c960..4c723e3a689c 100644
> --- a/drivers/gpu/drm/drm_auth.c
> +++ b/drivers/gpu/drm/drm_auth.c
> @@ -122,27 +122,19 @@ struct drm_master *drm_master_create(struct drm_device 
> *dev)
>   return master;
>  }
>  
> -static int drm_set_master(struct drm_device *dev, struct drm_file *fpriv,
> -   bool new_master)
> +static void drm_set_master(struct drm_device *dev, struct drm_file *fpriv,
> +bool new_master)
>  {
> - int ret = 0;
> -
>   dev->master = drm_master_get(fpriv->master);
> - if (dev->driver->master_set) {
> - ret = dev->driver->master_set(dev, fpriv, new_master);
> - if (unlikely(ret != 0)) {
> - drm_master_put(>master);
> - }
> - }
> + if (dev->driver->master_set)
> + dev->driver->master_set(dev, fpriv, new_master);
>  
> - fpriv->was_master = (ret == 0);
> - return ret;
> + fpriv->was_master = true;
>  }
>  
>  static int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv)
>  {
>   struct drm_master *old_master;
> - int ret;
>  
>   lockdep_assert_held_once(>master_mutex);
>  
> @@ -157,22 +149,12 @@ static int drm_new_set_master(struct drm_device *dev, 
> struct drm_file *fpriv)
>   fpriv->is_master = 1;
>   fpriv->authenticated = 1;
>  
> - ret = drm_set_master(dev, fpriv, true);
> - if (ret)
> - goto out_err;
> + drm_set_master(dev, fpriv, true);
>  
>   if (old_master)
>   drm_master_put(_master);
>  
>   return 0;
> -
> -out_err:
> - /* drop references and restore old master on failure */
> - drm_master_put(>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,
>   goto out_unlock;
>   }
>  
> - ret = drm_set_master(dev, file_priv, false);
> + drm_set_master(dev, file_priv, false);
>  out_unlock:
>   mutex_unlock(>master_mutex);
>   return ret;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c 
> b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> index c2247a893ed4..470428387878 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> @@ -1129,9 +1129,9 @@ static long vmw_compat_ioctl(struct file *filp, 
> unsigned int cmd,
>  }
>  #endif
>  
> -static int vmw_master_set(struct drm_device *dev,
> -   struct drm_file *file_priv,
> -   bool from_open)
> +static void vmw_master_set(struct drm_device *dev,
> +struct drm_file *file_priv,
> +bool from_open)
>  {
>   /*
>* Inform a new master that the layout may have changed while
> @@ -1139,8 +1139,6 @@ static int vmw_master_set(struct drm_device *dev,
>*/
>   if (!from_open)
>   drm_sysfs_hotplug_event(dev);
> -
> - return 0;
>  }
>  
>  static void vmw_master_drop(struct drm_device *dev,
> diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
> index bb924cddc09c..835c38a76ef6 100644
> --- a/include/drm/drm_drv.h
> +++ b/include/drm/drm_drv.h
> @@ -311,8 +311,8 @@ struct drm_driver {
>*
>* Called whenever the minor master is set. Only used by vmwgfx.
>*/
> - int (*master_set)(struct drm_device *dev, struct drm_file *file_priv,
> -   bool from_open);
> + void (*master_set)(struct drm_device *dev, struct drm_file *file_priv,
> +bool from_open);
>   /**
>* @master_drop:
>*
> 

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel


[PATCH v2 1/2] drm: vmwgfx: remove drm_driver::master_set() return typ

2020-05-30 Thread Emil Velikov
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 
Cc: Daniel Vetter 
Cc: VMware Graphics 
Cc: Roland Scheidegger 
Signed-off-by: Emil Velikov 
Cc: Sam Ravnborg 
Reviewed-by: Sam Ravnborg 
---
VMWare team, I'm planning to push this via drm-misc. Review, ack and
comments are appreciated.
---
 drivers/gpu/drm/drm_auth.c  | 32 +++--
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c |  8 +++-
 include/drm/drm_drv.h   |  4 ++--
 3 files changed, 12 insertions(+), 32 deletions(-)

diff --git a/drivers/gpu/drm/drm_auth.c b/drivers/gpu/drm/drm_auth.c
index 74ce0c29c960..4c723e3a689c 100644
--- a/drivers/gpu/drm/drm_auth.c
+++ b/drivers/gpu/drm/drm_auth.c
@@ -122,27 +122,19 @@ struct drm_master *drm_master_create(struct drm_device 
*dev)
return master;
 }
 
-static int drm_set_master(struct drm_device *dev, struct drm_file *fpriv,
- bool new_master)
+static void drm_set_master(struct drm_device *dev, struct drm_file *fpriv,
+  bool new_master)
 {
-   int ret = 0;
-
dev->master = drm_master_get(fpriv->master);
-   if (dev->driver->master_set) {
-   ret = dev->driver->master_set(dev, fpriv, new_master);
-   if (unlikely(ret != 0)) {
-   drm_master_put(>master);
-   }
-   }
+   if (dev->driver->master_set)
+   dev->driver->master_set(dev, fpriv, new_master);
 
-   fpriv->was_master = (ret == 0);
-   return ret;
+   fpriv->was_master = true;
 }
 
 static int drm_new_set_master(struct drm_device *dev, struct drm_file *fpriv)
 {
struct drm_master *old_master;
-   int ret;
 
lockdep_assert_held_once(>master_mutex);
 
@@ -157,22 +149,12 @@ static int drm_new_set_master(struct drm_device *dev, 
struct drm_file *fpriv)
fpriv->is_master = 1;
fpriv->authenticated = 1;
 
-   ret = drm_set_master(dev, fpriv, true);
-   if (ret)
-   goto out_err;
+   drm_set_master(dev, fpriv, true);
 
if (old_master)
drm_master_put(_master);
 
return 0;
-
-out_err:
-   /* drop references and restore old master on failure */
-   drm_master_put(>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,
goto out_unlock;
}
 
-   ret = drm_set_master(dev, file_priv, false);
+   drm_set_master(dev, file_priv, false);
 out_unlock:
mutex_unlock(>master_mutex);
return ret;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c 
b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index c2247a893ed4..470428387878 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -1129,9 +1129,9 @@ static long vmw_compat_ioctl(struct file *filp, unsigned 
int cmd,
 }
 #endif
 
-static int vmw_master_set(struct drm_device *dev,
- struct drm_file *file_priv,
- bool from_open)
+static void vmw_master_set(struct drm_device *dev,
+  struct drm_file *file_priv,
+  bool from_open)
 {
/*
 * Inform a new master that the layout may have changed while
@@ -1139,8 +1139,6 @@ static int vmw_master_set(struct drm_device *dev,
 */
if (!from_open)
drm_sysfs_hotplug_event(dev);
-
-   return 0;
 }
 
 static void vmw_master_drop(struct drm_device *dev,
diff --git a/include/drm/drm_drv.h b/include/drm/drm_drv.h
index bb924cddc09c..835c38a76ef6 100644
--- a/include/drm/drm_drv.h
+++ b/include/drm/drm_drv.h
@@ -311,8 +311,8 @@ struct drm_driver {
 *
 * Called whenever the minor master is set. Only used by vmwgfx.
 */
-   int (*master_set)(struct drm_device *dev, struct drm_file *file_priv,
- bool from_open);
+   void (*master_set)(struct drm_device *dev, struct drm_file *file_priv,
+  bool from_open);
/**
 * @master_drop:
 *
-- 
2.25.1

___
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel