Re: [PATCH v3] drm: Differentiate the lack of an interface from invalid parameter

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Sep 12, 2018 at 10:29:42AM +0100, Chris Wilson wrote:
> If the ioctl is not supported on a particular piece of HW/driver
> combination, report ENOTSUPP so that it can be easily distinguished from
> both the lack of the ioctl and from a regular invalid parameter.
> 
> v2: Across all the kms ioctls we had a mixture of reporting EINVAL,
> ENODEV and a few ENOTSUPP (most where EINVAL) for a failed
> drm_core_check_feature(). Update everybody to report ENOTSUPP.
> 
> Signed-off-by: Chris Wilson <chris@xxxxxxxxxxxxxxxxxx>
> Cc: Daniel Vetter <daniel@xxxxxxxx>
> Cc: Ville Syrjälä <ville.syrjala@xxxxxxxxxxxxxxx>

I think there's a few somewhat questionable ones among the legacy
functions (not sure we should throw an ENOTSUPP when it's only called by
driver code, not userspace, WARN_ON feels more appropriate).

But I only spotted that for legacy functionality, nothing we'll ever care
about. Ang sprinkling this all over definitely increases the odds that
it'll be adopted successfully.

As-is:

Reviewed-by: Daniel Vetter <daniel.vetter@xxxxxxxx>
> ---
>  drivers/gpu/drm/drm_atomic_uapi.c |  2 +-
>  drivers/gpu/drm/drm_bufs.c        | 32 +++++++++++++++----------------
>  drivers/gpu/drm/drm_color_mgmt.c  |  4 ++--
>  drivers/gpu/drm/drm_connector.c   |  2 +-
>  drivers/gpu/drm/drm_context.c     | 16 ++++++++--------
>  drivers/gpu/drm/drm_crtc.c        |  4 ++--
>  drivers/gpu/drm/drm_encoder.c     |  2 +-
>  drivers/gpu/drm/drm_framebuffer.c | 13 ++++++++-----
>  drivers/gpu/drm/drm_gem.c         |  6 +++---
>  drivers/gpu/drm/drm_ioctl.c       |  2 +-
>  drivers/gpu/drm/drm_irq.c         |  4 ++--
>  drivers/gpu/drm/drm_lease.c       |  8 ++++----
>  drivers/gpu/drm/drm_lock.c        |  4 ++--
>  drivers/gpu/drm/drm_mode_config.c |  2 +-
>  drivers/gpu/drm/drm_mode_object.c |  4 ++--
>  drivers/gpu/drm/drm_pci.c         |  4 ++--
>  drivers/gpu/drm/drm_plane.c       | 10 +++++-----
>  drivers/gpu/drm/drm_prime.c       |  4 ++--
>  drivers/gpu/drm/drm_property.c    |  8 ++++----
>  drivers/gpu/drm/drm_scatter.c     |  8 ++++----
>  drivers/gpu/drm/drm_syncobj.c     | 14 +++++++-------
>  drivers/gpu/drm/drm_vblank.c      |  4 ++--
>  22 files changed, 80 insertions(+), 77 deletions(-)
> 
> diff --git a/drivers/gpu/drm/drm_atomic_uapi.c b/drivers/gpu/drm/drm_atomic_uapi.c
> index 26690a664ec6..dc4502464126 100644
> --- a/drivers/gpu/drm/drm_atomic_uapi.c
> +++ b/drivers/gpu/drm/drm_atomic_uapi.c
> @@ -1251,7 +1251,7 @@ int drm_mode_atomic_ioctl(struct drm_device *dev,
>  
>  	/* disallow for drivers not supporting atomic: */
>  	if (!drm_core_check_feature(dev, DRIVER_ATOMIC))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	/* disallow for userspace that has not enabled atomic cap (even
>  	 * though this may be a bit overkill, since legacy userspace
> diff --git a/drivers/gpu/drm/drm_bufs.c b/drivers/gpu/drm/drm_bufs.c
> index ba8cfe65c65b..a07e7a781d64 100644
> --- a/drivers/gpu/drm/drm_bufs.c
> +++ b/drivers/gpu/drm/drm_bufs.c
> @@ -398,7 +398,7 @@ int drm_legacy_addmap_ioctl(struct drm_device *dev, void *data,
>  
>  	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
>  	    !drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	err = drm_addmap_core(dev, map->offset, map->size, map->type,
>  			      map->flags, &maplist);
> @@ -444,7 +444,7 @@ int drm_legacy_getmap_ioctl(struct drm_device *dev, void *data,
>  
>  	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
>  	    !drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	idx = map->offset;
>  	if (idx < 0)
> @@ -596,7 +596,7 @@ int drm_legacy_rmmap_ioctl(struct drm_device *dev, void *data,
>  
>  	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
>  	    !drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	mutex_lock(&dev->struct_mutex);
>  	list_for_each_entry(r_list, &dev->maplist, head) {
> @@ -860,7 +860,7 @@ int drm_legacy_addbufs_pci(struct drm_device *dev,
>  	struct drm_buf **temp_buflist;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_PCI_DMA))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!dma)
>  		return -EINVAL;
> @@ -1064,7 +1064,7 @@ static int drm_legacy_addbufs_sg(struct drm_device *dev,
>  	struct drm_buf **temp_buflist;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_SG))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!dma)
>  		return -EINVAL;
> @@ -1221,10 +1221,10 @@ int drm_legacy_addbufs(struct drm_device *dev, void *data,
>  	int ret;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  #if IS_ENABLED(CONFIG_AGP)
>  	if (request->flags & _DRM_AGP_BUFFER)
> @@ -1267,10 +1267,10 @@ int __drm_legacy_infobufs(struct drm_device *dev,
>  	int count;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!dma)
>  		return -EINVAL;
> @@ -1352,10 +1352,10 @@ int drm_legacy_markbufs(struct drm_device *dev, void *data,
>  	struct drm_buf_entry *entry;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!dma)
>  		return -EINVAL;
> @@ -1400,10 +1400,10 @@ int drm_legacy_freebufs(struct drm_device *dev, void *data,
>  	struct drm_buf *buf;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!dma)
>  		return -EINVAL;
> @@ -1455,10 +1455,10 @@ int __drm_legacy_mapbufs(struct drm_device *dev, void *data, int *p,
>  	int i;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_HAVE_DMA))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!dma)
>  		return -EINVAL;
> @@ -1545,7 +1545,7 @@ int drm_legacy_dma_ioctl(struct drm_device *dev, void *data,
>  		  struct drm_file *file_priv)
>  {
>  	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (dev->driver->dma_ioctl)
>  		return dev->driver->dma_ioctl(dev, data, file_priv);
> diff --git a/drivers/gpu/drm/drm_color_mgmt.c b/drivers/gpu/drm/drm_color_mgmt.c
> index b97e2de2c029..a7a74f2e3d89 100644
> --- a/drivers/gpu/drm/drm_color_mgmt.c
> +++ b/drivers/gpu/drm/drm_color_mgmt.c
> @@ -242,7 +242,7 @@ int drm_mode_gamma_set_ioctl(struct drm_device *dev,
>  	int ret = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	crtc = drm_crtc_find(dev, file_priv, crtc_lut->crtc_id);
>  	if (!crtc)
> @@ -320,7 +320,7 @@ int drm_mode_gamma_get_ioctl(struct drm_device *dev,
>  	int ret = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	crtc = drm_crtc_find(dev, file_priv, crtc_lut->crtc_id);
>  	if (!crtc)
> diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c
> index 526619f963e5..abf912d1eb90 100644
> --- a/drivers/gpu/drm/drm_connector.c
> +++ b/drivers/gpu/drm/drm_connector.c
> @@ -1725,7 +1725,7 @@ int drm_mode_getconnector(struct drm_device *dev, void *data,
>  	LIST_HEAD(export_list);
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	memset(&u_mode, 0, sizeof(struct drm_mode_modeinfo));
>  
> diff --git a/drivers/gpu/drm/drm_context.c b/drivers/gpu/drm/drm_context.c
> index f973d287696a..f33fc1fdbaa9 100644
> --- a/drivers/gpu/drm/drm_context.c
> +++ b/drivers/gpu/drm/drm_context.c
> @@ -178,7 +178,7 @@ int drm_legacy_getsareactx(struct drm_device *dev, void *data,
>  
>  	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
>  	    !drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	mutex_lock(&dev->struct_mutex);
>  
> @@ -226,7 +226,7 @@ int drm_legacy_setsareactx(struct drm_device *dev, void *data,
>  
>  	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
>  	    !drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	mutex_lock(&dev->struct_mutex);
>  	list_for_each_entry(r_list, &dev->maplist, head) {
> @@ -330,7 +330,7 @@ int drm_legacy_resctx(struct drm_device *dev, void *data,
>  
>  	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
>  	    !drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (res->count >= DRM_RESERVED_CONTEXTS) {
>  		memset(&ctx, 0, sizeof(ctx));
> @@ -364,7 +364,7 @@ int drm_legacy_addctx(struct drm_device *dev, void *data,
>  
>  	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
>  	    !drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	ctx->handle = drm_legacy_ctxbitmap_next(dev);
>  	if (ctx->handle == DRM_KERNEL_CONTEXT) {
> @@ -411,7 +411,7 @@ int drm_legacy_getctx(struct drm_device *dev, void *data,
>  
>  	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
>  	    !drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	/* This is 0, because we don't handle any context flags */
>  	ctx->flags = 0;
> @@ -437,7 +437,7 @@ int drm_legacy_switchctx(struct drm_device *dev, void *data,
>  
>  	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
>  	    !drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	DRM_DEBUG("%d\n", ctx->handle);
>  	return drm_context_switch(dev, dev->last_context, ctx->handle);
> @@ -461,7 +461,7 @@ int drm_legacy_newctx(struct drm_device *dev, void *data,
>  
>  	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
>  	    !drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	DRM_DEBUG("%d\n", ctx->handle);
>  	drm_context_switch_complete(dev, file_priv, ctx->handle);
> @@ -487,7 +487,7 @@ int drm_legacy_rmctx(struct drm_device *dev, void *data,
>  
>  	if (!drm_core_check_feature(dev, DRIVER_KMS_LEGACY_CONTEXT) &&
>  	    !drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	DRM_DEBUG("%d\n", ctx->handle);
>  	if (ctx->handle != DRM_KERNEL_CONTEXT) {
> diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c
> index 2f6c877299e4..9648c4bc6abf 100644
> --- a/drivers/gpu/drm/drm_crtc.c
> +++ b/drivers/gpu/drm/drm_crtc.c
> @@ -405,7 +405,7 @@ int drm_mode_getcrtc(struct drm_device *dev,
>  	struct drm_plane *plane;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	crtc = drm_crtc_find(dev, file_priv, crtc_resp->crtc_id);
>  	if (!crtc)
> @@ -580,7 +580,7 @@ int drm_mode_setcrtc(struct drm_device *dev, void *data,
>  	int i;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	/*
>  	 * Universal plane src offsets are only 16.16, prevent havoc for
> diff --git a/drivers/gpu/drm/drm_encoder.c b/drivers/gpu/drm/drm_encoder.c
> index 273e1c59c54a..16f584e8033a 100644
> --- a/drivers/gpu/drm/drm_encoder.c
> +++ b/drivers/gpu/drm/drm_encoder.c
> @@ -222,7 +222,7 @@ int drm_mode_getencoder(struct drm_device *dev, void *data,
>  	struct drm_crtc *crtc;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	encoder = drm_encoder_find(dev, file_priv, enc_resp->encoder_id);
>  	if (!encoder)
> diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
> index 6eaacd4eb8cc..3e3101735d1d 100644
> --- a/drivers/gpu/drm/drm_framebuffer.c
> +++ b/drivers/gpu/drm/drm_framebuffer.c
> @@ -113,6 +113,9 @@ int drm_mode_addfb(struct drm_device *dev, struct drm_mode_fb_cmd *or,
>  	struct drm_mode_fb_cmd2 r = {};
>  	int ret;
>  
> +	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> +		return -ENOTSUPP;
> +
>  	r.pixel_format = drm_mode_legacy_fb_format(or->bpp, or->depth);
>  	if (r.pixel_format == DRM_FORMAT_INVALID) {
>  		DRM_DEBUG("bad {bpp:%d, depth:%d}\n", or->bpp, or->depth);
> @@ -352,7 +355,7 @@ int drm_mode_addfb2(struct drm_device *dev,
>  	struct drm_framebuffer *fb;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	fb = drm_internal_framebuffer_create(dev, r, file_priv);
>  	if (IS_ERR(fb))
> @@ -387,7 +390,7 @@ int drm_mode_addfb2_ioctl(struct drm_device *dev,
>  		 * ADDFB.
>  		 */
>  		DRM_DEBUG_KMS("addfb2 broken on bigendian");
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  	}
>  #endif
>  	return drm_mode_addfb2(dev, data, file_priv);
> @@ -432,7 +435,7 @@ int drm_mode_rmfb(struct drm_device *dev, u32 fb_id,
>  	int found = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	fb = drm_framebuffer_lookup(dev, file_priv, fb_id);
>  	if (!fb)
> @@ -509,7 +512,7 @@ int drm_mode_getfb(struct drm_device *dev,
>  	int ret;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id);
>  	if (!fb)
> @@ -582,7 +585,7 @@ int drm_mode_dirtyfb_ioctl(struct drm_device *dev,
>  	int ret;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id);
>  	if (!fb)
> diff --git a/drivers/gpu/drm/drm_gem.c b/drivers/gpu/drm/drm_gem.c
> index bf90625df3c5..aa5967c8ef53 100644
> --- a/drivers/gpu/drm/drm_gem.c
> +++ b/drivers/gpu/drm/drm_gem.c
> @@ -667,7 +667,7 @@ drm_gem_close_ioctl(struct drm_device *dev, void *data,
>  	int ret;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_GEM))
> -		return -ENODEV;
> +		return -ENOTSUPP;
>  
>  	ret = drm_gem_handle_delete(file_priv, args->handle);
>  
> @@ -694,7 +694,7 @@ drm_gem_flink_ioctl(struct drm_device *dev, void *data,
>  	int ret;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_GEM))
> -		return -ENODEV;
> +		return -ENOTSUPP;
>  
>  	obj = drm_gem_object_lookup(file_priv, args->handle);
>  	if (obj == NULL)
> @@ -745,7 +745,7 @@ drm_gem_open_ioctl(struct drm_device *dev, void *data,
>  	u32 handle;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_GEM))
> -		return -ENODEV;
> +		return -ENOTSUPP;
>  
>  	mutex_lock(&dev->object_name_lock);
>  	obj = idr_find(&dev->object_name_idr, (int) args->name);
> diff --git a/drivers/gpu/drm/drm_ioctl.c b/drivers/gpu/drm/drm_ioctl.c
> index 6b4a633b4240..eafea8ae2243 100644
> --- a/drivers/gpu/drm/drm_ioctl.c
> +++ b/drivers/gpu/drm/drm_ioctl.c
> @@ -319,7 +319,7 @@ drm_setclientcap(struct drm_device *dev, void *data, struct drm_file *file_priv)
>  		break;
>  	case DRM_CLIENT_CAP_ATOMIC:
>  		if (!drm_core_check_feature(dev, DRIVER_ATOMIC))
> -			return -EINVAL;
> +			return -ENOTSUPP;
>  		if (req->value > 1)
>  			return -EINVAL;
>  		file_priv->atomic = req->value;
> diff --git a/drivers/gpu/drm/drm_irq.c b/drivers/gpu/drm/drm_irq.c
> index 3b04c25100ae..83c34950c88f 100644
> --- a/drivers/gpu/drm/drm_irq.c
> +++ b/drivers/gpu/drm/drm_irq.c
> @@ -104,7 +104,7 @@ int drm_irq_install(struct drm_device *dev, int irq)
>  	unsigned long sh_flags = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (irq == 0)
>  		return -EINVAL;
> @@ -175,7 +175,7 @@ int drm_irq_uninstall(struct drm_device *dev)
>  	int i;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	irq_enabled = dev->irq_enabled;
>  	dev->irq_enabled = false;
> diff --git a/drivers/gpu/drm/drm_lease.c b/drivers/gpu/drm/drm_lease.c
> index b54fb78a283c..642174f528e4 100644
> --- a/drivers/gpu/drm/drm_lease.c
> +++ b/drivers/gpu/drm/drm_lease.c
> @@ -506,7 +506,7 @@ int drm_mode_create_lease_ioctl(struct drm_device *dev,
>  
>  	/* Can't lease without MODESET */
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	/* Do not allow sub-leases */
>  	if (lessor->lessor)
> @@ -615,7 +615,7 @@ int drm_mode_list_lessees_ioctl(struct drm_device *dev,
>  
>  	/* Can't lease without MODESET */
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	DRM_DEBUG_LEASE("List lessees for %d\n", lessor->lessee_id);
>  
> @@ -671,7 +671,7 @@ int drm_mode_get_lease_ioctl(struct drm_device *dev,
>  
>  	/* Can't lease without MODESET */
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	DRM_DEBUG_LEASE("get lease for %d\n", lessee->lessee_id);
>  
> @@ -726,7 +726,7 @@ int drm_mode_revoke_lease_ioctl(struct drm_device *dev,
>  
>  	/* Can't lease without MODESET */
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	mutex_lock(&dev->mode_config.idr_mutex);
>  
> diff --git a/drivers/gpu/drm/drm_lock.c b/drivers/gpu/drm/drm_lock.c
> index 96bb6badb818..ee58697c4ad9 100644
> --- a/drivers/gpu/drm/drm_lock.c
> +++ b/drivers/gpu/drm/drm_lock.c
> @@ -166,7 +166,7 @@ int drm_legacy_lock(struct drm_device *dev, void *data,
>  	int ret = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	++file_priv->lock_count;
>  
> @@ -256,7 +256,7 @@ int drm_legacy_unlock(struct drm_device *dev, void *data, struct drm_file *file_
>  	struct drm_master *master = file_priv->master;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (lock->context == DRM_KERNEL_CONTEXT) {
>  		DRM_ERROR("Process %d using kernel context %d\n",
> diff --git a/drivers/gpu/drm/drm_mode_config.c b/drivers/gpu/drm/drm_mode_config.c
> index 21e353bd3948..9ba8f0b91cfb 100644
> --- a/drivers/gpu/drm/drm_mode_config.c
> +++ b/drivers/gpu/drm/drm_mode_config.c
> @@ -97,7 +97,7 @@ int drm_mode_getresources(struct drm_device *dev, void *data,
>  	struct drm_connector_list_iter conn_iter;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  
>  	mutex_lock(&file_priv->fbs_lock);
> diff --git a/drivers/gpu/drm/drm_mode_object.c b/drivers/gpu/drm/drm_mode_object.c
> index fcb0ab0abb75..ad5a64eb671d 100644
> --- a/drivers/gpu/drm/drm_mode_object.c
> +++ b/drivers/gpu/drm/drm_mode_object.c
> @@ -381,7 +381,7 @@ int drm_mode_obj_get_properties_ioctl(struct drm_device *dev, void *data,
>  	int ret = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	drm_modeset_lock_all(dev);
>  
> @@ -504,7 +504,7 @@ int drm_mode_obj_set_property_ioctl(struct drm_device *dev, void *data,
>  	int ret = -EINVAL;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	arg_obj = drm_mode_object_find(dev, file_priv, arg->obj_id, arg->obj_type);
>  	if (!arg_obj)
> diff --git a/drivers/gpu/drm/drm_pci.c b/drivers/gpu/drm/drm_pci.c
> index 896e42a34895..209f1e649c02 100644
> --- a/drivers/gpu/drm/drm_pci.c
> +++ b/drivers/gpu/drm/drm_pci.c
> @@ -182,14 +182,14 @@ int drm_irq_by_busid(struct drm_device *dev, void *data,
>  	struct drm_irq_busid *p = data;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	/* UMS was only ever support on PCI devices. */
>  	if (WARN_ON(!dev->pdev))
>  		return -EINVAL;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_HAVE_IRQ))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	return drm_pci_irq_by_busid(dev, p);
>  }
> diff --git a/drivers/gpu/drm/drm_plane.c b/drivers/gpu/drm/drm_plane.c
> index 4a72c6829d73..f9737b7c5e89 100644
> --- a/drivers/gpu/drm/drm_plane.c
> +++ b/drivers/gpu/drm/drm_plane.c
> @@ -477,7 +477,7 @@ int drm_mode_getplane_res(struct drm_device *dev, void *data,
>  	int count = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	plane_ptr = u64_to_user_ptr(plane_resp->plane_id_ptr);
>  
> @@ -514,7 +514,7 @@ int drm_mode_getplane(struct drm_device *dev, void *data,
>  	uint32_t __user *format_ptr;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	plane = drm_plane_find(dev, file_priv, plane_resp->plane_id);
>  	if (!plane)
> @@ -781,7 +781,7 @@ int drm_mode_setplane(struct drm_device *dev, void *data,
>  	int ret;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	/*
>  	 * First, find the plane, crtc, and fb objects.  If not available,
> @@ -919,7 +919,7 @@ static int drm_mode_cursor_common(struct drm_device *dev,
>  	int ret = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!req->flags || (~DRM_MODE_CURSOR_FLAGS & req->flags))
>  		return -EINVAL;
> @@ -1023,7 +1023,7 @@ int drm_mode_page_flip_ioctl(struct drm_device *dev,
>  	int ret = -EINVAL;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (page_flip->flags & ~DRM_MODE_PAGE_FLIP_FLAGS)
>  		return -EINVAL;
> diff --git a/drivers/gpu/drm/drm_prime.c b/drivers/gpu/drm/drm_prime.c
> index 186db2e4c57a..76253e15b41f 100644
> --- a/drivers/gpu/drm/drm_prime.c
> +++ b/drivers/gpu/drm/drm_prime.c
> @@ -844,7 +844,7 @@ int drm_prime_handle_to_fd_ioctl(struct drm_device *dev, void *data,
>  	struct drm_prime_handle *args = data;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_PRIME))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!dev->driver->prime_handle_to_fd)
>  		return -ENOSYS;
> @@ -863,7 +863,7 @@ int drm_prime_fd_to_handle_ioctl(struct drm_device *dev, void *data,
>  	struct drm_prime_handle *args = data;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_PRIME))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!dev->driver->prime_fd_to_handle)
>  		return -ENOSYS;
> diff --git a/drivers/gpu/drm/drm_property.c b/drivers/gpu/drm/drm_property.c
> index cdb10f885a4f..2411a31e6891 100644
> --- a/drivers/gpu/drm/drm_property.c
> +++ b/drivers/gpu/drm/drm_property.c
> @@ -464,7 +464,7 @@ int drm_mode_getproperty_ioctl(struct drm_device *dev,
>  	uint64_t __user *values_ptr;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	property = drm_property_find(dev, file_priv, out_resp->prop_id);
>  	if (!property)
> @@ -757,7 +757,7 @@ int drm_mode_getblob_ioctl(struct drm_device *dev,
>  	int ret = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	blob = drm_property_lookup_blob(dev, out_resp->blob_id);
>  	if (!blob)
> @@ -786,7 +786,7 @@ int drm_mode_createblob_ioctl(struct drm_device *dev,
>  	int ret = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	blob = drm_property_create_blob(dev, out_resp->length, NULL);
>  	if (IS_ERR(blob))
> @@ -823,7 +823,7 @@ int drm_mode_destroyblob_ioctl(struct drm_device *dev,
>  	int ret = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	blob = drm_property_lookup_blob(dev, out_resp->blob_id);
>  	if (!blob)
> diff --git a/drivers/gpu/drm/drm_scatter.c b/drivers/gpu/drm/drm_scatter.c
> index 275bca44f38c..ceaa04b530c1 100644
> --- a/drivers/gpu/drm/drm_scatter.c
> +++ b/drivers/gpu/drm/drm_scatter.c
> @@ -89,10 +89,10 @@ int drm_legacy_sg_alloc(struct drm_device *dev, void *data,
>  	DRM_DEBUG("\n");
>  
>  	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_SG))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (dev->sg)
>  		return -EINVAL;
> @@ -202,10 +202,10 @@ int drm_legacy_sg_free(struct drm_device *dev, void *data,
>  	struct drm_sg_mem *entry;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_LEGACY))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_SG))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	entry = dev->sg;
>  	dev->sg = NULL;
> diff --git a/drivers/gpu/drm/drm_syncobj.c b/drivers/gpu/drm/drm_syncobj.c
> index e9ce623d049e..b6590591c25d 100644
> --- a/drivers/gpu/drm/drm_syncobj.c
> +++ b/drivers/gpu/drm/drm_syncobj.c
> @@ -573,7 +573,7 @@ drm_syncobj_create_ioctl(struct drm_device *dev, void *data,
>  	struct drm_syncobj_create *args = data;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> -		return -ENODEV;
> +		return -ENOTSUPP;
>  
>  	/* no valid flags yet */
>  	if (args->flags & ~DRM_SYNCOBJ_CREATE_SIGNALED)
> @@ -590,7 +590,7 @@ drm_syncobj_destroy_ioctl(struct drm_device *dev, void *data,
>  	struct drm_syncobj_destroy *args = data;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> -		return -ENODEV;
> +		return -ENOTSUPP;
>  
>  	/* make sure padding is empty */
>  	if (args->pad)
> @@ -605,7 +605,7 @@ drm_syncobj_handle_to_fd_ioctl(struct drm_device *dev, void *data,
>  	struct drm_syncobj_handle *args = data;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> -		return -ENODEV;
> +		return -ENOTSUPP;
>  
>  	if (args->pad)
>  		return -EINVAL;
> @@ -629,7 +629,7 @@ drm_syncobj_fd_to_handle_ioctl(struct drm_device *dev, void *data,
>  	struct drm_syncobj_handle *args = data;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> -		return -ENODEV;
> +		return -ENOTSUPP;
>  
>  	if (args->pad)
>  		return -EINVAL;
> @@ -921,7 +921,7 @@ drm_syncobj_wait_ioctl(struct drm_device *dev, void *data,
>  	int ret = 0;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> -		return -ENODEV;
> +		return -ENOTSUPP;
>  
>  	if (args->flags & ~(DRM_SYNCOBJ_WAIT_FLAGS_WAIT_ALL |
>  			    DRM_SYNCOBJ_WAIT_FLAGS_WAIT_FOR_SUBMIT))
> @@ -955,7 +955,7 @@ drm_syncobj_reset_ioctl(struct drm_device *dev, void *data,
>  	int ret;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> -		return -ENODEV;
> +		return -ENOTSUPP;
>  
>  	if (args->pad != 0)
>  		return -EINVAL;
> @@ -988,7 +988,7 @@ drm_syncobj_signal_ioctl(struct drm_device *dev, void *data,
>  	int ret;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_SYNCOBJ))
> -		return -ENODEV;
> +		return -ENOTSUPP;
>  
>  	if (args->pad != 0)
>  		return -EINVAL;
> diff --git a/drivers/gpu/drm/drm_vblank.c b/drivers/gpu/drm/drm_vblank.c
> index ec2dcfdac8ef..176004d05934 100644
> --- a/drivers/gpu/drm/drm_vblank.c
> +++ b/drivers/gpu/drm/drm_vblank.c
> @@ -1771,7 +1771,7 @@ int drm_crtc_get_sequence_ioctl(struct drm_device *dev, void *data,
>  	int ret;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!dev->irq_enabled)
>  		return -EINVAL;
> @@ -1829,7 +1829,7 @@ int drm_crtc_queue_sequence_ioctl(struct drm_device *dev, void *data,
>  	unsigned long spin_flags;
>  
>  	if (!drm_core_check_feature(dev, DRIVER_MODESET))
> -		return -EINVAL;
> +		return -ENOTSUPP;
>  
>  	if (!dev->irq_enabled)
>  		return -EINVAL;
> -- 
> 2.19.0
> 

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
dri-devel@xxxxxxxxxxxxxxxxxxxxx
https://lists.freedesktop.org/mailman/listinfo/dri-devel




[Index of Archives]     [Linux DRI Users]     [Linux Intel Graphics]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Linux USB Devel]     [Video for Linux]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]
  Powered by Linux