diff options
author | Jani Nikula <jani.nikula@intel.com> | 2019-12-05 16:43:41 +0100 |
---|---|---|
committer | Jani Nikula <jani.nikula@intel.com> | 2020-01-15 14:10:45 +0100 |
commit | a267ab8dec061c5a379a75a4c4f8206c63d87db9 (patch) | |
tree | f841b51392ff7220e38cce49740bb41cb61c788c /drivers/gpu/drm/i915/i915_debugfs_params.c | |
parent | drm/i915/params: add i915 parameters to debugfs (diff) | |
download | linux-a267ab8dec061c5a379a75a4c4f8206c63d87db9.tar.xz linux-a267ab8dec061c5a379a75a4c4f8206c63d87db9.zip |
drm/i915/params: support bool values for int and uint params
It's not uncommon for us to switch param types between bools and ints,
often having otherwise bool semantics but -1 value for platform
default. Allow bool values (such as YyNn) for ints.
Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk>
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/c945ac7b08e0eb0827cf647609885f4abdb84f1d.1575560168.git.jani.nikula@intel.com
Diffstat (limited to 'drivers/gpu/drm/i915/i915_debugfs_params.c')
-rw-r--r-- | drivers/gpu/drm/i915/i915_debugfs_params.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/i915_debugfs_params.c b/drivers/gpu/drm/i915/i915_debugfs_params.c index 7f1af5a35ca1..12cbdbdf4d80 100644 --- a/drivers/gpu/drm/i915/i915_debugfs_params.c +++ b/drivers/gpu/drm/i915/i915_debugfs_params.c @@ -32,6 +32,14 @@ static ssize_t i915_param_int_write(struct file *file, int ret; ret = kstrtoint_from_user(ubuf, len, 0, value); + if (ret) { + /* support boolean values too */ + bool b; + + ret = kstrtobool_from_user(ubuf, len, &b); + if (!ret) + *value = b; + } return ret ?: len; } @@ -77,6 +85,14 @@ static ssize_t i915_param_uint_write(struct file *file, int ret; ret = kstrtouint_from_user(ubuf, len, 0, value); + if (ret) { + /* support boolean values too */ + bool b; + + ret = kstrtobool_from_user(ubuf, len, &b); + if (!ret) + *value = b; + } return ret ?: len; } |