diff mbox series

[v2] drm: Return -EOPNOTSUPP in drm_setclientcap() when driver do not support KMS

Message ID 20180917212244.19309-1-jose.souza@intel.com (mailing list archive)
State New, archived
Headers show
Series [v2] drm: Return -EOPNOTSUPP in drm_setclientcap() when driver do not support KMS | expand

Commit Message

Souza, Jose Sept. 17, 2018, 9:22 p.m. UTC
All DRM_CLIENT capabilities are tied to KMS support, so returning
-EOPNOTSUPP when KMS is not supported.

v2: returning -EOPNOTSUPP(same value as posix ENOTSUP and available
in uapi) instead of -ENOTSUPP

Cc: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
---
 drivers/gpu/drm/drm_ioctl.c      | 3 +++
 drivers/gpu/drm/i915/i915_perf.c | 2 +-
 2 files changed, 4 insertions(+), 1 deletion(-)

Comments

Chris Wilson Sept. 18, 2018, 8:34 a.m. UTC | #1
Quoting José Roberto de Souza (2018-09-17 22:22:44)
> All DRM_CLIENT capabilities are tied to KMS support, so returning
> -EOPNOTSUPP when KMS is not supported.
> 
> v2: returning -EOPNOTSUPP(same value as posix ENOTSUP and available
> in uapi) instead of -ENOTSUPP
> 
> Cc: Chris Wilson <chris@chris-wilson.co.uk>
> Signed-off-by: José Roberto de Souza <jose.souza@intel.com>
> ---
>  drivers/gpu/drm/drm_ioctl.c      | 3 +++
>  drivers/gpu/drm/i915/i915_perf.c | 2 +-
>  2 files changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 60dfbfae6a02..c0de628c194c 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -306,6 +306,9 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
>  {
>         struct drm_set_client_cap *req = data;
>  

I liked Daniel's comment suggestion.

> +       if (!drm_core_check_feature(dev, DRIVER_MODESET))
> +               return -EOPNOTSUPP;
> +
>         switch (req->capability) {
>         case DRM_CLIENT_CAP_STEREO_3D:
>                 if (req->value > 1)
> diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
> index 664b96bb65a3..c1edd1e69a3e 100644
> --- a/drivers/gpu/drm/i915/i915_perf.c
> +++ b/drivers/gpu/drm/i915/i915_perf.c
> @@ -2817,7 +2817,7 @@ int i915_perf_open_ioctl(struct drm_device *dev, void *data,
>  
>         if (!dev_priv->perf.initialized) {
>                 DRM_DEBUG("i915 perf interface not available for this system\n");
> -               return -ENOTSUPP;
> +               return -EOPNOTSUPP;

Better served as a separate patch, so it can be applied to different
trees.
-Chris
diff mbox series

Patch

diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
index 60dfbfae6a02..c0de628c194c 100644
--- a/drivers/gpu/drm/drm_ioctl.c
+++ b/drivers/gpu/drm/drm_ioctl.c
@@ -306,6 +306,9 @@  drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
 {
 	struct drm_set_client_cap *req = data;
 
+	if (!drm_core_check_feature(dev, DRIVER_MODESET))
+		return -EOPNOTSUPP;
+
 	switch (req->capability) {
 	case DRM_CLIENT_CAP_STEREO_3D:
 		if (req->value > 1)
diff --git a/drivers/gpu/drm/i915/i915_perf.c b/drivers/gpu/drm/i915/i915_perf.c
index 664b96bb65a3..c1edd1e69a3e 100644
--- a/drivers/gpu/drm/i915/i915_perf.c
+++ b/drivers/gpu/drm/i915/i915_perf.c
@@ -2817,7 +2817,7 @@  int i915_perf_open_ioctl(struct drm_device *dev, void *data,
 
 	if (!dev_priv->perf.initialized) {
 		DRM_DEBUG("i915 perf interface not available for this system\n");
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 	}
 
 	known_open_flags = I915_PERF_FLAG_FD_CLOEXEC |