Intel-GFX Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Jani Nikula <jani.nikula@intel.com>
To: intel-gfx@lists.freedesktop.org
Subject: Re: [RFC PATCH 08/11] drm/i915/debugfs: support bool values for int and uint params
Date: Fri, 21 Dec 2018 15:42:17 +0200	[thread overview]
Message-ID: <87fturuhc6.fsf@intel.com> (raw)
In-Reply-To: <aa89c76e78e5e7b80bd7be2aacc0fe591d721a75.1545396674.git.jani.nikula@intel.com>


Argh, stray file accidentally sent, ignore.

On Fri, 21 Dec 2018, Jani Nikula <jani.nikula@intel.com> wrote:
> 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.nikula@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;
>  }

-- 
Jani Nikula, Intel Open Source Graphics Center
_______________________________________________
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/intel-gfx

  reply	other threads:[~2018-12-21 13:40 UTC|newest]

Thread overview: 18+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-12-21 13:31 [RFC PATCH 00/11] drm/i915: from module params to device params Jani Nikula
2018-12-21 13:31 ` [RFC PATCH 01/11] drm/i915: add a helper to make a copy of i915_params Jani Nikula
2018-12-21 13:31 ` [RFC PATCH 02/11] drm/i915: add a helper to free the members " Jani Nikula
2018-12-21 13:31 ` [RFC PATCH 03/11] drm/i915/uc: add dev_priv parameter to intel_uc_is_using_* functions Jani Nikula
2018-12-21 14:59   ` Michal Wajdeczko
2018-12-21 13:31 ` [RFC PATCH 04/11] drm/i915/params: set i915.enable_hangcheck permissions to 0600 Jani Nikula
2018-12-21 13:31 ` [RFC PATCH 05/11] drm/i915: move load failure injection to selftests Jani Nikula
2018-12-21 13:31 ` [RFC PATCH 06/11] drm/i915/params: document I915_PARAMS_FOR_EACH() Jani Nikula
2018-12-21 13:31 ` [RFC PATCH 07/11] drm/i915/params: add i915 parameters to debugfs Jani Nikula
     [not found] ` <cover.1545396674.git.jani.nikula@intel.com>
2018-12-21 13:31   ` [RFC PATCH 08/11] drm/i915/debugfs: support bool values for int and uint params Jani Nikula
2018-12-21 13:42     ` Jani Nikula [this message]
2018-12-21 13:31 ` [RFC PATCH 08/11] drm/i915/params: " Jani Nikula
2018-12-21 13:31 ` [RFC PATCH 09/11] drm/i915/params: prevent changing module params runtime Jani Nikula
2018-12-21 13:31 ` [RFC PATCH 10/11] drm/i915/params: switch to device specific parameters Jani Nikula
2018-12-21 13:31 ` [RFC PATCH 11/11] drm/i915/params: hide i915_modparams within i915_params.c Jani Nikula
2018-12-21 14:53 ` ✗ Fi.CI.CHECKPATCH: warning for drm/i915: from module params to device params Patchwork
2018-12-21 14:58 ` ✗ Fi.CI.SPARSE: " Patchwork
2018-12-21 15:10 ` ✗ Fi.CI.BAT: failure " Patchwork

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=87fturuhc6.fsf@intel.com \
    --to=jani.nikula@intel.com \
    --cc=intel-gfx@lists.freedesktop.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox