[PATCH v2] drm/debugfs: fix plain echo to connector "force" attribute
Jani Nikula
jani.nikula at linux.intel.com
Thu Aug 17 11:39:10 UTC 2017
On Thu, 17 Aug 2017, Michael Tretter <m.tretter at pengutronix.de> wrote:
> Using plain echo to set the "force" connector attribute fails with
> -EINVAL, because echo appends a newline to the output.
>
> Replace strcmp with sysfs_streq to also accept strings that end with a
> newline.
>
> v2: use sysfs_streq instead of stripping trailing whitespace
>
> Signed-off-by: Michael Tretter <m.tretter at pengutronix.de>
Reviewed-by: Jani Nikula <jani.nikula at intel.com>
> ---
> drivers/gpu/drm/drm_debugfs.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
> index c1807d5754b2..454deba13ee5 100644
> --- a/drivers/gpu/drm/drm_debugfs.c
> +++ b/drivers/gpu/drm/drm_debugfs.c
> @@ -250,13 +250,13 @@ static ssize_t connector_write(struct file *file, const char __user *ubuf,
>
> buf[len] = '\0';
>
> - if (!strcmp(buf, "on"))
> + if (sysfs_streq(buf, "on"))
> connector->force = DRM_FORCE_ON;
> - else if (!strcmp(buf, "digital"))
> + else if (sysfs_streq(buf, "digital"))
> connector->force = DRM_FORCE_ON_DIGITAL;
> - else if (!strcmp(buf, "off"))
> + else if (sysfs_streq(buf, "off"))
> connector->force = DRM_FORCE_OFF;
> - else if (!strcmp(buf, "unspecified"))
> + else if (sysfs_streq(buf, "unspecified"))
> connector->force = DRM_FORCE_UNSPECIFIED;
> else
> return -EINVAL;
--
Jani Nikula, Intel Open Source Technology Center
More information about the dri-devel
mailing list