All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] drm: Differentiate the lack of an interface from invalid parameter
@ 2018-09-12  8:27 Chris Wilson
  2018-09-12  8:39 ` Daniel Vetter
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Chris Wilson @ 2018-09-12  8:27 UTC (permalink / raw)
  To: dri-devel; +Cc: intel-gfx

If the ioctl is not supported on a particular piece of HW/driver
combination, report ENODEV so that it can be easily distinguished from
both the lack of the ioctl and from a regular invalid parameter.

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>
---
 drivers/gpu/drm/drm_framebuffer.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/drivers/gpu/drm/drm_framebuffer.c b/drivers/gpu/drm/drm_framebuffer.c
index 6eaacd4eb8cc..eed6ad0fe84a 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 -ENODEV;
+
 	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 -ENODEV;
 
 	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 -ENODEV;
 	}
 #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 -ENODEV;
 
 	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 -ENODEV;
 
 	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 -ENODEV;
 
 	fb = drm_framebuffer_lookup(dev, file_priv, r->fb_id);
 	if (!fb)
-- 
2.19.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

^ permalink raw reply related	[flat|nested] 16+ messages in thread

end of thread, other threads:[~2018-09-14 16:58 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-12  8:27 [PATCH] drm: Differentiate the lack of an interface from invalid parameter Chris Wilson
2018-09-12  8:39 ` Daniel Vetter
2018-09-12  8:50   ` Chris Wilson
2018-09-12  9:02     ` Daniel Vetter
2018-09-12  9:12       ` Chris Wilson
2018-09-12 16:26         ` Christian König
2018-09-12  8:58 ` ✓ Fi.CI.BAT: success for " Patchwork
2018-09-12  9:26 ` [PATCH v2] " Chris Wilson
2018-09-12  9:29 ` [PATCH v3] " Chris Wilson
2018-09-13 13:30   ` Daniel Vetter
2018-09-13 19:20     ` Chris Wilson
2018-09-14 16:58       ` Chris Wilson
2018-09-12  9:58 ` ✓ Fi.CI.BAT: success for drm: Differentiate the lack of an interface from invalid parameter (rev3) Patchwork
2018-09-12 12:23 ` ✓ Fi.CI.IGT: " Patchwork
2018-09-13 19:50 ` ✓ Fi.CI.BAT: success for drm: Differentiate the lack of an interface from invalid parameter (rev4) Patchwork
2018-09-13 21:37 ` ✓ Fi.CI.IGT: " Patchwork

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.