Message ID | 20190904143942.31756-1-daniel.vetter@ffwll.ch (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Series | drm: Use EOPNOTSUPP, not ENOTSUPP | expand |
Den 04.09.2019 16.39, skrev 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 ...) > > /* 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 <jose.souza@intel.com> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> > Cc: Maxime Ripard <mripard@kernel.org> > Cc: Sean Paul <sean@poorly.run> > Cc: Alex Deucher <alexander.deucher@amd.com> > Cc: Andres Rodriguez <andresx7@gmail.com> > Cc: Noralf Trønnes <noralf@tronnes.org> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> > --- > drivers/gpu/drm/drm_edid.c | 6 +++--- > drivers/gpu/drm/drm_mipi_dbi.c | 2 +- > 2 files changed, 4 insertions(+), 4 deletions(-) > Acked-by: Noralf Trønnes <noralf@tronnes.org> 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
On Wed, 2019-09-04 at 16:39 +0200, Daniel Vetter wrote: > - 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. Hopefully this will not break any userspace Reviewed-by: José Roberto de Souza <jose.souza@intel.com> > > Cc: José Roberto de Souza <jose.souza@intel.com> > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> > Cc: Maxime Ripard <mripard@kernel.org> > Cc: Sean Paul <sean@poorly.run> > Cc: Alex Deucher <alexander.deucher@amd.com> > Cc: Andres Rodriguez <andresx7@gmail.com> > Cc: Noralf Trønnes <noralf@tronnes.org> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> > --- > drivers/gpu/drm/drm_edid.c | 6 +++--- > drivers/gpu/drm/drm_mipi_dbi.c | 2 +- > 2 files changed, 4 insertions(+), 4 deletions(-) > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > index 82a4ceed3fcf..12c783f4d956 100644 > --- a/drivers/gpu/drm/drm_edid.c > +++ b/drivers/gpu/drm/drm_edid.c > @@ -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)) { > diff --git a/drivers/gpu/drm/drm_mipi_dbi.c > b/drivers/gpu/drm/drm_mipi_dbi.c > index c4ee2709a6f3..f8154316a3b0 100644 > --- a/drivers/gpu/drm/drm_mipi_dbi.c > +++ b/drivers/gpu/drm/drm_mipi_dbi.c > @@ -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); >
On Wed, Sep 4, 2019 at 9:58 PM Souza, Jose <jose.souza@intel.com> wrote: > > On Wed, 2019-09-04 at 16:39 +0200, Daniel Vetter wrote: > > - 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. > > 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. > Reviewed-by: José Roberto de Souza <jose.souza@intel.com> Thanks, Daniel > > > > > Cc: José Roberto de Souza <jose.souza@intel.com> > > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> > > Cc: Maxime Ripard <mripard@kernel.org> > > Cc: Sean Paul <sean@poorly.run> > > Cc: Alex Deucher <alexander.deucher@amd.com> > > Cc: Andres Rodriguez <andresx7@gmail.com> > > Cc: Noralf Trønnes <noralf@tronnes.org> > > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> > > --- > > drivers/gpu/drm/drm_edid.c | 6 +++--- > > drivers/gpu/drm/drm_mipi_dbi.c | 2 +- > > 2 files changed, 4 insertions(+), 4 deletions(-) > > > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > > index 82a4ceed3fcf..12c783f4d956 100644 > > --- a/drivers/gpu/drm/drm_edid.c > > +++ b/drivers/gpu/drm/drm_edid.c > > @@ -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)) { > > diff --git a/drivers/gpu/drm/drm_mipi_dbi.c > > b/drivers/gpu/drm/drm_mipi_dbi.c > > index c4ee2709a6f3..f8154316a3b0 100644 > > --- a/drivers/gpu/drm/drm_mipi_dbi.c > > +++ b/drivers/gpu/drm/drm_mipi_dbi.c > > @@ -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); > >
On Wed, Sep 04, 2019 at 10:05:09PM +0200, Daniel Vetter wrote: > On Wed, Sep 4, 2019 at 9:58 PM Souza, Jose <jose.souza@intel.com> wrote: > > > > On Wed, 2019-09-04 at 16:39 +0200, Daniel Vetter wrote: > > > - 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. > > > > 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. > > > Reviewed-by: José Roberto de Souza <jose.souza@intel.com> > > Thanks, Daniel Applied now. -Daniel > > > > > > > > > Cc: José Roberto de Souza <jose.souza@intel.com> > > > Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> > > > Cc: Maxime Ripard <mripard@kernel.org> > > > Cc: Sean Paul <sean@poorly.run> > > > Cc: Alex Deucher <alexander.deucher@amd.com> > > > Cc: Andres Rodriguez <andresx7@gmail.com> > > > Cc: Noralf Trønnes <noralf@tronnes.org> > > > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> > > > --- > > > drivers/gpu/drm/drm_edid.c | 6 +++--- > > > drivers/gpu/drm/drm_mipi_dbi.c | 2 +- > > > 2 files changed, 4 insertions(+), 4 deletions(-) > > > > > > diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c > > > index 82a4ceed3fcf..12c783f4d956 100644 > > > --- a/drivers/gpu/drm/drm_edid.c > > > +++ b/drivers/gpu/drm/drm_edid.c > > > @@ -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)) { > > > diff --git a/drivers/gpu/drm/drm_mipi_dbi.c > > > b/drivers/gpu/drm/drm_mipi_dbi.c > > > index c4ee2709a6f3..f8154316a3b0 100644 > > > --- a/drivers/gpu/drm/drm_mipi_dbi.c > > > +++ b/drivers/gpu/drm/drm_mipi_dbi.c > > > @@ -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); > > > > > > > -- > Daniel Vetter > Software Engineer, Intel Corporation > +41 (0) 79 365 57 48 - http://blog.ffwll.ch
diff --git a/drivers/gpu/drm/drm_edid.c b/drivers/gpu/drm/drm_edid.c index 82a4ceed3fcf..12c783f4d956 100644 --- a/drivers/gpu/drm/drm_edid.c +++ b/drivers/gpu/drm/drm_edid.c @@ -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)) { diff --git a/drivers/gpu/drm/drm_mipi_dbi.c b/drivers/gpu/drm/drm_mipi_dbi.c index c4ee2709a6f3..f8154316a3b0 100644 --- a/drivers/gpu/drm/drm_mipi_dbi.c +++ b/drivers/gpu/drm/drm_mipi_dbi.c @@ -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);
- 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 <jose.souza@intel.com> Cc: Maarten Lankhorst <maarten.lankhorst@linux.intel.com> Cc: Maxime Ripard <mripard@kernel.org> Cc: Sean Paul <sean@poorly.run> Cc: Alex Deucher <alexander.deucher@amd.com> Cc: Andres Rodriguez <andresx7@gmail.com> Cc: Noralf Trønnes <noralf@tronnes.org> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com> --- drivers/gpu/drm/drm_edid.c | 6 +++--- drivers/gpu/drm/drm_mipi_dbi.c | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-)