From: Jani Nikula <jani.nikula@linux.intel.com>
To: dri-devel@lists.freedesktop.org
Cc: Daniel Vetter <daniel.vetter@intel.com>,
Michael Tretter <m.tretter@pengutronix.de>,
kernel@pengutronix.de
Subject: Re: [PATCH v2] drm/debugfs: fix plain echo to connector "force" attribute
Date: Thu, 17 Aug 2017 14:39:10 +0300 [thread overview]
Message-ID: <87mv6y8lup.fsf@nikula.org> (raw)
In-Reply-To: <20170817104307.17124-1-m.tretter@pengutronix.de>
On Thu, 17 Aug 2017, Michael Tretter <m.tretter@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@pengutronix.de>
Reviewed-by: Jani Nikula <jani.nikula@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
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2017-08-17 11:34 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2017-08-16 15:39 [PATCH] drm/debugfs: accept trailing whitespace in "force" attribute Michael Tretter
2017-08-17 9:59 ` Jani Nikula
2017-08-17 10:43 ` [PATCH v2] drm/debugfs: fix plain echo to connector " Michael Tretter
2017-08-17 11:39 ` Jani Nikula [this message]
2020-05-17 20:49 ` Emil Velikov
2020-05-18 9:22 ` Jani Nikula
2020-05-18 10:39 ` Emil Velikov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=87mv6y8lup.fsf@nikula.org \
--to=jani.nikula@linux.intel.com \
--cc=daniel.vetter@intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=kernel@pengutronix.de \
--cc=m.tretter@pengutronix.de \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.