All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lukas Wunner <lukas@wunner.de>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: wuninsu@gmail.com, k.kozlowski@samsung.com,
	chuansheng.liu@intel.com, intel-gfx@lists.freedesktop.org,
	linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
	Baole Ni <baolex.ni@intel.com>,
	kyungmin.park@samsung.com, kgene@kernel.org, bp@alien8.de,
	dougthompson@xmission.com, daniel.vetter@intel.com,
	treding@nvidia.com
Subject: Re: [Intel-gfx] [PATCH 0197/1285] Replace numeric parameter like 0444 with macro
Date: Tue, 2 Aug 2016 16:27:23 +0200	[thread overview]
Message-ID: <20160802142723.GA3978@wunner.de> (raw)
In-Reply-To: <20160802113737.GT4329@intel.com>

On Tue, Aug 02, 2016 at 02:37:37PM +0300, Ville Syrjälä wrote:
> On Tue, Aug 02, 2016 at 06:48:47PM +0800, Baole Ni wrote:
> > I find that the developers often just specified the numeric value
> > when calling a macro which is defined with a parameter for access permission.
> > As we know, these numeric value for access permission have had the corresponding macro,
> > and that using macro can improve the robustness and readability of the code,
> > thus, I suggest replacing the numeric parameter with the macro.
> > 
> > Signed-off-by: Chuansheng Liu <chuansheng.liu@intel.com>
> > Signed-off-by: Baole Ni <baolex.ni@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_params.c | 64 +++++++++++++++++++-------------------
> >  1 file changed, 32 insertions(+), 32 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
> > index 1779f02..7184e06 100644
> > --- a/drivers/gpu/drm/i915/i915_params.c
> > +++ b/drivers/gpu/drm/i915/i915_params.c
> > @@ -60,22 +60,22 @@ struct i915_params i915 __read_mostly = {
> >  	.inject_load_failure = 0,
> >  };
> >  
> > -module_param_named(modeset, i915.modeset, int, 0400);
> > +module_param_named(modeset, i915.modeset, int, S_IRUSR);
> 
> At least I can't read those macros. Octal is much clearer IMO.

It's also easier to grep for, say, 644, rather than formulating a
regex with all possible ordering permutations of these macros.

Best regards,

Lukas
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel

WARNING: multiple messages have this Message-ID (diff)
From: Lukas Wunner <lukas@wunner.de>
To: "Ville Syrjälä" <ville.syrjala@linux.intel.com>
Cc: Baole Ni <baolex.ni@intel.com>,
	wuninsu@gmail.com, k.kozlowski@samsung.com, treding@nvidia.com,
	intel-gfx@lists.freedesktop.org, linux-kernel@vger.kernel.org,
	kyungmin.park@samsung.com, kgene@kernel.org, bp@alien8.de,
	dri-devel@lists.freedesktop.org, dougthompson@xmission.com,
	daniel.vetter@intel.com, chuansheng.liu@intel.com
Subject: Re: [Intel-gfx] [PATCH 0197/1285] Replace numeric parameter like 0444 with macro
Date: Tue, 2 Aug 2016 16:27:23 +0200	[thread overview]
Message-ID: <20160802142723.GA3978@wunner.de> (raw)
In-Reply-To: <20160802113737.GT4329@intel.com>

On Tue, Aug 02, 2016 at 02:37:37PM +0300, Ville Syrjälä wrote:
> On Tue, Aug 02, 2016 at 06:48:47PM +0800, Baole Ni wrote:
> > I find that the developers often just specified the numeric value
> > when calling a macro which is defined with a parameter for access permission.
> > As we know, these numeric value for access permission have had the corresponding macro,
> > and that using macro can improve the robustness and readability of the code,
> > thus, I suggest replacing the numeric parameter with the macro.
> > 
> > Signed-off-by: Chuansheng Liu <chuansheng.liu@intel.com>
> > Signed-off-by: Baole Ni <baolex.ni@intel.com>
> > ---
> >  drivers/gpu/drm/i915/i915_params.c | 64 +++++++++++++++++++-------------------
> >  1 file changed, 32 insertions(+), 32 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/i915/i915_params.c b/drivers/gpu/drm/i915/i915_params.c
> > index 1779f02..7184e06 100644
> > --- a/drivers/gpu/drm/i915/i915_params.c
> > +++ b/drivers/gpu/drm/i915/i915_params.c
> > @@ -60,22 +60,22 @@ struct i915_params i915 __read_mostly = {
> >  	.inject_load_failure = 0,
> >  };
> >  
> > -module_param_named(modeset, i915.modeset, int, 0400);
> > +module_param_named(modeset, i915.modeset, int, S_IRUSR);
> 
> At least I can't read those macros. Octal is much clearer IMO.

It's also easier to grep for, say, 644, rather than formulating a
regex with all possible ordering permutations of these macros.

Best regards,

Lukas

  parent reply	other threads:[~2016-08-02 14:26 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-08-02 10:48 [PATCH 0197/1285] Replace numeric parameter like 0444 with macro Baole Ni
2016-08-02 10:48 ` Baole Ni
2016-08-02 11:37 ` [Intel-gfx] " Ville Syrjälä
2016-08-02 11:37   ` Ville Syrjälä
2016-08-02 12:34   ` Jani Nikula
2016-08-02 12:34     ` [Intel-gfx] " Jani Nikula
2016-08-02 14:00   ` Daniel Vetter
2016-08-02 14:00     ` [Intel-gfx] " Daniel Vetter
2016-08-02 14:27   ` Lukas Wunner [this message]
2016-08-02 14:27     ` Lukas Wunner

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=20160802142723.GA3978@wunner.de \
    --to=lukas@wunner.de \
    --cc=baolex.ni@intel.com \
    --cc=bp@alien8.de \
    --cc=chuansheng.liu@intel.com \
    --cc=daniel.vetter@intel.com \
    --cc=dougthompson@xmission.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=k.kozlowski@samsung.com \
    --cc=kgene@kernel.org \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=treding@nvidia.com \
    --cc=ville.syrjala@linux.intel.com \
    --cc=wuninsu@gmail.com \
    /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.