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.

Signed-off-by: Jani Nikula <[email protected]>
---
 drivers/gpu/drm/i915/i915_debugfs_params.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs_params.c 
b/drivers/gpu/drm/i915/i915_debugfs_params.c
index 7f1af5a35ca1..9acb755714cf 100644
--- a/drivers/gpu/drm/i915/i915_debugfs_params.c
+++ b/drivers/gpu/drm/i915/i915_debugfs_params.c
@@ -32,6 +32,13 @@ 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 +84,13 @@ 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;
 }
-- 
2.20.1

_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to