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 for ints.

Signed-off-by: Jani Nikula <jani.nik...@intel.com>
---
 drivers/gpu/drm/i915/i915_debugfs.c | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/drivers/gpu/drm/i915/i915_debugfs.c 
b/drivers/gpu/drm/i915/i915_debugfs.c
index 33375cf79713..c9e2cf8e071a 100644
--- a/drivers/gpu/drm/i915/i915_debugfs.c
+++ b/drivers/gpu/drm/i915/i915_debugfs.c
@@ -61,6 +61,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;
 }
@@ -106,6 +113,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.11.0

_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

Reply via email to