Skip to contentSkip to conversation

drm: Use EOPNOTSUPP, not ENOTSUPP

PATCH In review Daniel Vetter 4 participants 5 messages Sep 4, 2019 – Sep 6, 2019

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 drm: Use EOPNOTSUPP, not ENOTSUPP

- it's what we recommend in our docs:

https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#recommended-ioctl-return-values

- it's the overwhelmingly used error code for "operation not supported", at least in drm core (slightly less so in drivers):

$ git grep EOPNOTSUP -- drivers/gpu/drm/*c | wc -l
83
$ git grep ENOTSUP -- drivers/gpu/drm/*c | wc -l
5

- include/linux/errno.h makes it fairly clear that these are for nfsv3 (plus they also have error codes above 512, which is the block with some special behaviour ...)

/* Defined for the NFSv3 protocol */

If the above isn't reflecting current practice, then I guess we should at least update the docs.

Cc José Roberto de Souza <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Andres Rodriguez <[email protected]>
Cc Noralf Trønnes <[email protected]>
---
 drivers/gpu/drm/drm_edid.c     | 6 +++---
 drivers/gpu/drm/drm_mipi_dbi.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_edid.c +3 -3
index 82a4ceed3fcf..12c783f4d956 100644
@@ -3719,7 +3719,7 @@ cea_db_offsets(const u8 *cea, int *start, int *end)
 		if (*end < 4 || *end > 127)
 			return -ERANGE;
 	} else {
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 	}
 
 	return 0;
@@ -4188,7 +4188,7 @@ int drm_edid_to_sad(struct edid *edid, struct cea_sad **sads)
 
 	if (cea_revision(cea) < 3) {
 		DRM_DEBUG_KMS("SAD: wrong CEA revision\n");
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 	}
 
 	if (cea_db_offsets(cea, &start, &end)) {
@@ -4249,7 +4249,7 @@ int drm_edid_to_speaker_allocation(struct edid *edid, u8 **sadb)
 
 	if (cea_revision(cea) < 3) {
 		DRM_DEBUG_KMS("SAD: wrong CEA revision\n");
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 	}
 
 	if (cea_db_offsets(cea, &start, &end)) {
drivers/gpu/drm/drm_mipi_dbi.c +1 -1
index c4ee2709a6f3..f8154316a3b0 100644
@@ -955,7 +955,7 @@ static int mipi_dbi_typec1_command(struct mipi_dbi *dbi, u8 *cmd,
 	int ret;
 
 	if (mipi_dbi_command_is_read(dbi, *cmd))
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	MIPI_DBI_DEBUG_COMMAND(*cmd, parameters, num);
 
Signature · 6 lines
2.23.0

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
Acked-by on v1 1/1
#1 lore raw

Den 04.09.2019 16.39, skrev Daniel Vetter:

Quoted 29 lines

- it's what we recommend in our docs:

https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#recommended-ioctl-return-values

- it's the overwhelmingly used error code for "operation not supported", at least in drm core (slightly less so in drivers):

$ git grep EOPNOTSUP -- drivers/gpu/drm/*c | wc -l
83
$ git grep ENOTSUP -- drivers/gpu/drm/*c | wc -l
5

- include/linux/errno.h makes it fairly clear that these are for nfsv3 (plus they also have error codes above 512, which is the block with some special behaviour ...)

/* Defined for the NFSv3 protocol */

If the above isn't reflecting current practice, then I guess we should at least update the docs.

Cc José Roberto de Souza <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Andres Rodriguez <[email protected]>
Cc Noralf Trønnes <[email protected]>
Quoted 5 lines
---
 drivers/gpu/drm/drm_edid.c     | 6 +++---
 drivers/gpu/drm/drm_mipi_dbi.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)

Ben Hutchings made this comment[1] in a thread about use of ENOTSUPP in drivers:

glibc's strerror() returns these strings for ENOTSUPP and EOPNOTSUPP respectively:

"Unknown error 524"
"Operation not supported"

So at least for errors returned to userspace EOPNOTSUPP makes sense.

Noralf.

[1] https://patchwork.ozlabs.org/patch/309627/#690997
_______________________________________________
dri-devel mailing list [email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

Reviewed-by on v1 1/1
#2 lore raw
In reply to Daniel Vetter
Quoted 17 lines · Daniel Vetter

- it's what we recommend in our docs:

https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#recommended-ioctl-return-values

- it's the overwhelmingly used error code for "operation not supported", at least in drm core (slightly less so in drivers):

$ git grep EOPNOTSUP -- drivers/gpu/drm/*c | wc -l
83
$ git grep ENOTSUP -- drivers/gpu/drm/*c | wc -l
5

- include/linux/errno.h makes it fairly clear that these are for nfsv3
(plus they also have error codes above 512, which is the block with some special behaviour ...)

Quoted 5 lines

/* Defined for the NFSv3 protocol */

If the above isn't reflecting current practice, then I guess we should
at least update the docs.

Hopefully this will not break any userspace

Quoted 55 lines
Cc José Roberto de Souza <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Andres Rodriguez <[email protected]>
Cc Noralf Trønnes <[email protected]>
---
 drivers/gpu/drm/drm_edid.c     | 6 +++---
 drivers/gpu/drm/drm_mipi_dbi.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_edid.c +1 -1
index 82a4ceed3fcf..12c783f4d956 100644
@@ -3719,7 +3719,7 @@ cea_db_offsets(const u8 *cea, int *start, int
 *end)
 		if (*end < 4 || *end > 127)
 			return -ERANGE;
 	} else {
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 	}
 
drivers/gpu/drm/drm_edid.c +1 -1
 	return 0;
@@ -4188,7 +4188,7 @@ int drm_edid_to_sad(struct edid *edid, struct
 cea_sad **sads)
 
 	if (cea_revision(cea) < 3) {
 		DRM_DEBUG_KMS("SAD: wrong CEA revision\n");
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 	}
 
drivers/gpu/drm/drm_edid.c +1 -1
 	if (cea_db_offsets(cea, &start, &end)) {
@@ -4249,7 +4249,7 @@ int drm_edid_to_speaker_allocation(struct edid
 *edid, u8 **sadb)
 
 	if (cea_revision(cea) < 3) {
 		DRM_DEBUG_KMS("SAD: wrong CEA revision\n");
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 	}
 
drivers/gpu/drm/drm_edid.c +0 -0
 	if (cea_db_offsets(cea, &start, &end)) {
drivers/gpu/drm/drm_mipi_dbi.c +0 -0
index c4ee2709a6f3..f8154316a3b0 100644

drivers/gpu/drm/drm_mipi_dbi.c static int mipi_dbi_typec1_command(struct · line 961

Quoted 8 lines
drivers/gpu/drm/drm_mipi_dbi.c +1 -1
@@ -955,7 +955,7 @@ static int mipi_dbi_typec1_command(struct
 mipi_dbi *dbi, u8 *cmd,
 	int ret;
 
 	if (mipi_dbi_command_is_read(dbi, *cmd))
-		return -ENOTSUPP;
+		return -EOPNOTSUPP;
 
 	MIPI_DBI_DEBUG_COMMAND(*cmd, parameters, num);

_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel

#3 lore raw
Quoted 19 lines · Jose
Quoted 17 lines · Daniel Vetter

- it's what we recommend in our docs:

https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#recommended-ioctl-return-values

- it's the overwhelmingly used error code for "operation not supported", at least in drm core (slightly less so in drivers):

$ git grep EOPNOTSUP -- drivers/gpu/drm/*c | wc -l
83
$ git grep ENOTSUP -- drivers/gpu/drm/*c | wc -l
5

- include/linux/errno.h makes it fairly clear that these are for nfsv3
(plus they also have error codes above 512, which is the block with some special behaviour ...)

Quoted 7 lines
Quoted 5 lines

/* Defined for the NFSv3 protocol */

If the above isn't reflecting current practice, then I guess we should
at least update the docs.

Hopefully this will not break any userspace

None of the functions in drm_edid.c affected by this reach userspace, it's all driver internal.

Same for the mipi function, that error code should be handled by drivers. Drivers are supposed to remap "the hw is on fire" to EIO when reporting up to userspace, but I think if a driver sees this it would be a driver bug.

So no way this goes out to userspace, I really only did this to have the drm core/helpers be 100% consistent with our documented recommendations here.

I'll summarize the above in the commit message when I merge the patch.

Quoted 1 line

Thanks, Daniel

Quoted 64 lines
Quoted 64 lines
Cc José Roberto de Souza <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Andres Rodriguez <[email protected]>
Cc Noralf Trønnes <[email protected]>
---
 drivers/gpu/drm/drm_edid.c     | 6 +++---
 drivers/gpu/drm/drm_mipi_dbi.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_edid.c +1 -1
index 82a4ceed3fcf..12c783f4d956 100644
@@ -3719,7 +3719,7 @@ cea_db_offsets(const u8 *cea, int *start, int
 *end)
              if (*end < 4 || *end > 127)
                      return -ERANGE;
      } else {
-             return -ENOTSUPP;
+             return -EOPNOTSUPP;
      }
 
      return 0;
drivers/gpu/drm/drm_edid.c +1 -1
@@ -4188,7 +4188,7 @@ int drm_edid_to_sad(struct edid *edid, struct
 cea_sad **sads)
 
      if (cea_revision(cea) < 3) {
              DRM_DEBUG_KMS("SAD: wrong CEA revision\n");
-             return -ENOTSUPP;
+             return -EOPNOTSUPP;
      }
 
      if (cea_db_offsets(cea, &start, &end)) {
drivers/gpu/drm/drm_edid.c +1 -1
@@ -4249,7 +4249,7 @@ int drm_edid_to_speaker_allocation(struct edid
 *edid, u8 **sadb)
 
      if (cea_revision(cea) < 3) {
              DRM_DEBUG_KMS("SAD: wrong CEA revision\n");
-             return -ENOTSUPP;
+             return -EOPNOTSUPP;
      }
 
      if (cea_db_offsets(cea, &start, &end)) {
drivers/gpu/drm/drm_mipi_dbi.c +1 -1
index c4ee2709a6f3..f8154316a3b0 100644
@@ -955,7 +955,7 @@ static int mipi_dbi_typec1_command(struct
 mipi_dbi *dbi, u8 *cmd,
      int ret;
 
      if (mipi_dbi_command_is_read(dbi, *cmd))
-             return -ENOTSUPP;
+             return -EOPNOTSUPP;
 
      MIPI_DBI_DEBUG_COMMAND(*cmd, parameters, num);
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel
#4 lore raw
Quoted 40 lines · Daniel Vetter
Quoted 19 lines · Jose
Quoted 17 lines · Daniel Vetter

- it's what we recommend in our docs:

https://dri.freedesktop.org/docs/drm/gpu/drm-uapi.html#recommended-ioctl-return-values

- it's the overwhelmingly used error code for "operation not supported", at least in drm core (slightly less so in drivers):

$ git grep EOPNOTSUP -- drivers/gpu/drm/*c | wc -l
83
$ git grep ENOTSUP -- drivers/gpu/drm/*c | wc -l
5

- include/linux/errno.h makes it fairly clear that these are for nfsv3
(plus they also have error codes above 512, which is the block with some special behaviour ...)

Quoted 7 lines
Quoted 5 lines

/* Defined for the NFSv3 protocol */

If the above isn't reflecting current practice, then I guess we should
at least update the docs.

Hopefully this will not break any userspace

None of the functions in drm_edid.c affected by this reach userspace, it's all driver internal.

Same for the mipi function, that error code should be handled by drivers. Drivers are supposed to remap "the hw is on fire" to EIO when reporting up to userspace, but I think if a driver sees this it would be a driver bug.

So no way this goes out to userspace, I really only did this to have the drm core/helpers be 100% consistent with our documented recommendations here.

Quoted 5 lines

I'll summarize the above in the commit message when I merge the patch.

Quoted 1 line

Thanks, Daniel

Applied now.
-Daniel

Quoted 72 lines
Quoted 65 lines
Quoted 65 lines
Cc José Roberto de Souza <[email protected]>
Cc Maarten Lankhorst <[email protected]>
Cc Maxime Ripard <[email protected]>
Cc Sean Paul <[email protected]>
Cc Alex Deucher <[email protected]>
Cc Andres Rodriguez <[email protected]>
Cc Noralf Trønnes <[email protected]>
---
 drivers/gpu/drm/drm_edid.c     | 6 +++---
 drivers/gpu/drm/drm_mipi_dbi.c | 2 +-
 2 files changed, 4 insertions(+), 4 deletions(-)
drivers/gpu/drm/drm_edid.c +1 -1
index 82a4ceed3fcf..12c783f4d956 100644
@@ -3719,7 +3719,7 @@ cea_db_offsets(const u8 *cea, int *start, int
 *end)
              if (*end < 4 || *end > 127)
                      return -ERANGE;
      } else {
-             return -ENOTSUPP;
+             return -EOPNOTSUPP;
      }
 
      return 0;
drivers/gpu/drm/drm_edid.c +1 -1
@@ -4188,7 +4188,7 @@ int drm_edid_to_sad(struct edid *edid, struct
 cea_sad **sads)
 
      if (cea_revision(cea) < 3) {
              DRM_DEBUG_KMS("SAD: wrong CEA revision\n");
-             return -ENOTSUPP;
+             return -EOPNOTSUPP;
      }
 
      if (cea_db_offsets(cea, &start, &end)) {
drivers/gpu/drm/drm_edid.c +1 -1
@@ -4249,7 +4249,7 @@ int drm_edid_to_speaker_allocation(struct edid
 *edid, u8 **sadb)
 
      if (cea_revision(cea) < 3) {
              DRM_DEBUG_KMS("SAD: wrong CEA revision\n");
-             return -ENOTSUPP;
+             return -EOPNOTSUPP;
      }
 
      if (cea_db_offsets(cea, &start, &end)) {
drivers/gpu/drm/drm_mipi_dbi.c +1 -1
index c4ee2709a6f3..f8154316a3b0 100644
@@ -955,7 +955,7 @@ static int mipi_dbi_typec1_command(struct
 mipi_dbi *dbi, u8 *cmd,
      int ret;
 
      if (mipi_dbi_command_is_read(dbi, *cmd))
-             return -ENOTSUPP;
+             return -EOPNOTSUPP;
 
      MIPI_DBI_DEBUG_COMMAND(*cmd, parameters, num);
Signature · 3 lines
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch
Signature · 7 lines
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
dri-devel mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/dri-devel