mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/netdev/net.git/
synced 2026-04-21 08:03:45 -04:00
drm: Differentiate the lack of an interface from invalid parameter
If the ioctl is not supported on a particular piece of HW/driver combination, report ENOTSUP (aka EOPNOTSUPP) 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. v3: ENOTSUPP is an internal errno! It's value (524) does not correspond to a POSIX errno, the one we want is ENOTSUP. However, uapi/asm-generic/errno.h doesn't include ENOTSUP but man errno says "ENOTSUP and EOPNOTSUPP have the same value on Linux, but according to POSIX.1 these error values should be distinct." so use EOPNOTSUPP as its equivalent. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Daniel Vetter <daniel@ffwll.ch> Cc: Ville Syrjälä <ville.syrjala@linux.intel.com> Reviewed-by: Daniel Vetter <daniel.vetter@ffwll.ch> #v2 Link: https://patchwork.freedesktop.org/patch/msgid/20180913192050.24812-1-chris@chris-wilson.co.uk
This commit is contained in:
@@ -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 -EOPNOTSUPP;
|
||||
|
||||
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 -EOPNOTSUPP;
|
||||
|
||||
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 -EOPNOTSUPP;
|
||||
|
||||
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 -EOPNOTSUPP;
|
||||
|
||||
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 -EOPNOTSUPP;
|
||||
|
||||
/* 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 -EOPNOTSUPP;
|
||||
|
||||
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 -EOPNOTSUPP;
|
||||
|
||||
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 -EOPNOTSUPP;
|
||||
|
||||
DRM_DEBUG("%d\n", ctx->handle);
|
||||
if (ctx->handle != DRM_KERNEL_CONTEXT) {
|
||||
|
||||
Reference in New Issue
Block a user