summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/drm_debugfs.c
diff options
context:
space:
mode:
authorMichael Tretter <m.tretter@pengutronix.de>2017-08-17 12:43:07 +0200
committerEmil Velikov <emil.l.velikov@gmail.com>2020-05-17 17:27:57 +0100
commitc704b17071c4dc571dca3af4e4151dac51de081a (patch)
treec016ab65c72baa0ff73c731f19a05a691d370fba /drivers/gpu/drm/drm_debugfs.c
parentec0bb482de0ad5e4aba2a4537ea53eaeb77d11a6 (diff)
downloadlinux-next-c704b17071c4dc571dca3af4e4151dac51de081a.tar.gz
drm/debugfs: fix plain echo to connector "force" attribute
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@pengutronix.de> Reviewed-by: Jani Nikula <jani.nikula@intel.com> Signed-off-by: Emil Velikov <emil.l.velikov@gmail.com> Link: https://patchwork.freedesktop.org/patch/msgid/20170817104307.17124-1-m.tretter@pengutronix.de
Diffstat (limited to 'drivers/gpu/drm/drm_debugfs.c')
-rw-r--r--drivers/gpu/drm/drm_debugfs.c8
1 files changed, 4 insertions, 4 deletions
diff --git a/drivers/gpu/drm/drm_debugfs.c b/drivers/gpu/drm/drm_debugfs.c
index 2bea22130703..bfe4602f206b 100644
--- a/drivers/gpu/drm/drm_debugfs.c
+++ b/drivers/gpu/drm/drm_debugfs.c
@@ -311,13 +311,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;