Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1455173

Re: [PATCH 0290/1285] Replace numeric parameter like 0444 with macro

Path csiph.com!eternal-september.org!feeder.eternal-september.org!aioe.org!gothmog.csi.it!bofh.it!news.nic.it!robomod
From Dmitry Torokhov <dmitry.torokhov@gmail.com>
Newsgroups linux.kernel
Subject Re: [PATCH 0290/1285] Replace numeric parameter like 0444 with macro
Date Tue, 02 Aug 2016 19:40:03 +0200
Message-ID <s1LPB-7DB-73@gated-at.bofh.it> (permalink)
References <s1GmS-3Sw-57@gated-at.bofh.it>
X-Original-To Baole Ni <baolex.ni@intel.com>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=xVbvjvHDTffOGIA8nVIeER5Xu/f4GHJOlZvi4sTtvAs=; b=MW0rJI7Eva47jxn9kc7Ry7bQMP0KbHpz0719bKw7Ylm8BDHNfECXyWFGyzkL5lXLiF W8jjHeJmHub7TQF3t23tok6xjvN/dv4Y6jLj+Y2rZ4H/i5fmuP1pnCytZD4FHrLGWmj1 WCPdlCIl2gdF1+P7jRDVdbLw8d1jmJIe1S2g2WqridHna2G+rvfmB7OPJtgsF92alrKs 9mCHLlTA7ketMbPhAY9newYE+h/vZvaXnnPIon4N0SWWzv3tvt+Tj+XPzJ1+l4ZD56ni ker4kMz7bbJ4Ey82/ilR+5tjS52Hx4q70npRac4DwxPNg4ZxUbNvETKJ3dxhWXjQ3o7R yM3A==
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=xVbvjvHDTffOGIA8nVIeER5Xu/f4GHJOlZvi4sTtvAs=; b=drvmULlzTbCzs62rcZ2FQgTcSneMZ+XPzXLOlfrUdhrrm+GjdcbXPeg5oajL4N2dUW Za0zF2MvnOT3PwV9CJ9LW4dD4db6+95FS1xU2+zzq/8Rqw0iFqAbsqsfzgUe4jCl/8Hj LN5WBAmqJKKjRUVjQBKHSYNLwSMfs4FVKsx40wO+ANh6lKo36HDej44AIbunYClmhIyt E9gBRoVPg+6mMupeYQyt7R5B1+Df7GnphMUdGA0vW6coR/prrmTqsAZqYnB7ZujLfrNY 2w6ogAD4uYuv+yqnBxOt/aw/Wm28FqFh/WUizvwuOtBjZNERnIEzI6LWrWj8STl/GNoS tp7g==
X-Gm-Message-State AEkooutg/way3sYAxXmYo5kSTXeDuZJbJDAmrHa6Bc9dUoDcYXpBVYEgR8ULwwkHN2M9tw==
X-Received by 10.98.81.1 with SMTP id f1mr108252702pfb.35.1470158880349; Tue, 02 Aug 2016 10:28:00 -0700 (PDT)
MIME-Version 1.0
Content-Type text/plain; charset=us-ascii
Content-Disposition inline
User-Agent Mutt/1.5.21 (2010-09-15)
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 30
Organization linux.* mail to news gateway
X-Original-Cc hal.rosenstock@gmail.com, dledford@redhat.com, sean.hefty@intel.com, bp@alien8.de, linux-input@vger.kernel.org, linux-kernel@vger.kernel.org, haibo.chen@freescale.com, andrey.gelman@compulab.co.il, broonie@kernel.org, afd@ti.com, javier@osg.samsung.com, chuansheng.liu@intel.com
X-Original-Date Tue, 2 Aug 2016 10:27:56 -0700
X-Original-Message-ID <20160802172756.GA5012@dtor-ws>
X-Original-References <20160802105711.703-1-baolex.ni@intel.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1455173

Show key headers only | View raw


On Tue, Aug 02, 2016 at 06:57:11PM +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/input/touchscreen/ads7846.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/input/touchscreen/ads7846.c b/drivers/input/touchscreen/ads7846.c
> index a61b215..0f882cb 100644
> --- a/drivers/input/touchscreen/ads7846.c
> +++ b/drivers/input/touchscreen/ads7846.c
> @@ -591,7 +591,7 @@ static ssize_t ads7846_disable_store(struct device *dev,
>  	return count;
>  }
>  
> -static DEVICE_ATTR(disable, 0664, ads7846_disable_show, ads7846_disable_store);
> +static DEVICE_ATTR(disable, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH, ads7846_disable_show, ads7846_disable_store);

No, this does not improve neither robustness nor readability.

Thanks.

-- 
Dmitry

Back to linux.kernel | Previous | NextPrevious in thread | Find similar | Unroll thread


Thread

[PATCH 0290/1285] Replace numeric parameter like 0444 with macro Baole Ni <baolex.ni@intel.com> - 2016-08-02 13:50 +0200
  Re: [PATCH 0290/1285] Replace numeric parameter like 0444 with macro Mark Brown <broonie@kernel.org> - 2016-08-02 16:40 +0200
    Re: [PATCH 0290/1285] Replace numeric parameter like 0444 with macro "Andrew F. Davis" <afd@ti.com> - 2016-08-02 17:00 +0200
  Re: [PATCH 0290/1285] Replace numeric parameter like 0444 with macro Dmitry Torokhov <dmitry.torokhov@gmail.com> - 2016-08-02 19:40 +0200

csiph-web