mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Baole Ni <baolex.ni@intel.com>
To: ubraun@linux.vnet.ibm.com, schwidefsky@de.ibm.com,
	heiko.carstens@de.ibm.com, dwmw2@infradead.org,
	m.chehab@samsung.com, pawel@osciak.com, m.szyprowski@samsung.com,
	kyungmin.park@samsung.com, k.kozlowski@samsung.com
Cc: linux-s390@vger.kernel.org, linux-kernel@vger.kernel.org,
	chuansheng.liu@intel.com, baolex.ni@intel.com
Subject: [PATCH 0893/1285] Replace numeric parameter like 0444 with macro
Date: Tue,  2 Aug 2016 19:55:50 +0800	[thread overview]
Message-ID: <20160802115550.9511-1-baolex.ni@intel.com> (raw)

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/s390/net/netiucv.c | 28 ++++++++++++++--------------
 1 file changed, 14 insertions(+), 14 deletions(-)

diff --git a/drivers/s390/net/netiucv.c b/drivers/s390/net/netiucv.c
index b0e8ffd..1c7ca8f 100644
--- a/drivers/s390/net/netiucv.c
+++ b/drivers/s390/net/netiucv.c
@@ -1548,7 +1548,7 @@ static ssize_t user_write(struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-static DEVICE_ATTR(user, 0644, user_show, user_write);
+static DEVICE_ATTR(user, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, user_show, user_write);
 
 static ssize_t buffer_show (struct device *dev, struct device_attribute *attr,
 			    char *buf)
@@ -1606,7 +1606,7 @@ static ssize_t buffer_write (struct device *dev, struct device_attribute *attr,
 
 }
 
-static DEVICE_ATTR(buffer, 0644, buffer_show, buffer_write);
+static DEVICE_ATTR(buffer, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, buffer_show, buffer_write);
 
 static ssize_t dev_fsm_show (struct device *dev, struct device_attribute *attr,
 			     char *buf)
@@ -1617,7 +1617,7 @@ static ssize_t dev_fsm_show (struct device *dev, struct device_attribute *attr,
 	return sprintf(buf, "%s\n", fsm_getstate_str(priv->fsm));
 }
 
-static DEVICE_ATTR(device_fsm_state, 0444, dev_fsm_show, NULL);
+static DEVICE_ATTR(device_fsm_state, S_IRUSR | S_IRGRP | S_IROTH, dev_fsm_show, NULL);
 
 static ssize_t conn_fsm_show (struct device *dev,
 			      struct device_attribute *attr, char *buf)
@@ -1628,7 +1628,7 @@ static ssize_t conn_fsm_show (struct device *dev,
 	return sprintf(buf, "%s\n", fsm_getstate_str(priv->conn->fsm));
 }
 
-static DEVICE_ATTR(connection_fsm_state, 0444, conn_fsm_show, NULL);
+static DEVICE_ATTR(connection_fsm_state, S_IRUSR | S_IRGRP | S_IROTH, conn_fsm_show, NULL);
 
 static ssize_t maxmulti_show (struct device *dev,
 			      struct device_attribute *attr, char *buf)
@@ -1650,7 +1650,7 @@ static ssize_t maxmulti_write (struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(max_tx_buffer_used, 0644, maxmulti_show, maxmulti_write);
+static DEVICE_ATTR(max_tx_buffer_used, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, maxmulti_show, maxmulti_write);
 
 static ssize_t maxcq_show (struct device *dev, struct device_attribute *attr,
 			   char *buf)
@@ -1671,7 +1671,7 @@ static ssize_t maxcq_write (struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-static DEVICE_ATTR(max_chained_skbs, 0644, maxcq_show, maxcq_write);
+static DEVICE_ATTR(max_chained_skbs, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, maxcq_show, maxcq_write);
 
 static ssize_t sdoio_show (struct device *dev, struct device_attribute *attr,
 			   char *buf)
@@ -1692,7 +1692,7 @@ static ssize_t sdoio_write (struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-static DEVICE_ATTR(tx_single_write_ops, 0644, sdoio_show, sdoio_write);
+static DEVICE_ATTR(tx_single_write_ops, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, sdoio_show, sdoio_write);
 
 static ssize_t mdoio_show (struct device *dev, struct device_attribute *attr,
 			   char *buf)
@@ -1713,7 +1713,7 @@ static ssize_t mdoio_write (struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-static DEVICE_ATTR(tx_multi_write_ops, 0644, mdoio_show, mdoio_write);
+static DEVICE_ATTR(tx_multi_write_ops, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, mdoio_show, mdoio_write);
 
 static ssize_t txlen_show (struct device *dev, struct device_attribute *attr,
 			   char *buf)
@@ -1734,7 +1734,7 @@ static ssize_t txlen_write (struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-static DEVICE_ATTR(netto_bytes, 0644, txlen_show, txlen_write);
+static DEVICE_ATTR(netto_bytes, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, txlen_show, txlen_write);
 
 static ssize_t txtime_show (struct device *dev, struct device_attribute *attr,
 			    char *buf)
@@ -1755,7 +1755,7 @@ static ssize_t txtime_write (struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-static DEVICE_ATTR(max_tx_io_time, 0644, txtime_show, txtime_write);
+static DEVICE_ATTR(max_tx_io_time, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, txtime_show, txtime_write);
 
 static ssize_t txpend_show (struct device *dev, struct device_attribute *attr,
 			    char *buf)
@@ -1776,7 +1776,7 @@ static ssize_t txpend_write (struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-static DEVICE_ATTR(tx_pending, 0644, txpend_show, txpend_write);
+static DEVICE_ATTR(tx_pending, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, txpend_show, txpend_write);
 
 static ssize_t txmpnd_show (struct device *dev, struct device_attribute *attr,
 			    char *buf)
@@ -1797,7 +1797,7 @@ static ssize_t txmpnd_write (struct device *dev, struct device_attribute *attr,
 	return count;
 }
 
-static DEVICE_ATTR(tx_max_pending, 0644, txmpnd_show, txmpnd_write);
+static DEVICE_ATTR(tx_max_pending, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, txmpnd_show, txmpnd_write);
 
 static struct attribute *netiucv_attrs[] = {
 	&dev_attr_buffer.attr,
@@ -2104,7 +2104,7 @@ out_free_ndev:
 	return rc;
 }
 
-static DRIVER_ATTR(connection, 0200, NULL, conn_write);
+static DRIVER_ATTR(connection, S_IWUSR, NULL, conn_write);
 
 static ssize_t remove_write (struct device_driver *drv,
 			     const char *buf, size_t count)
@@ -2154,7 +2154,7 @@ static ssize_t remove_write (struct device_driver *drv,
         return -EINVAL;
 }
 
-static DRIVER_ATTR(remove, 0200, NULL, remove_write);
+static DRIVER_ATTR(remove, S_IWUSR, NULL, remove_write);
 
 static struct attribute * netiucv_drv_attrs[] = {
 	&driver_attr_connection.attr,
-- 
2.9.2

                 reply	other threads:[~2016-08-02 15:16 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=20160802115550.9511-1-baolex.ni@intel.com \
    --to=baolex.ni@intel.com \
    --cc=chuansheng.liu@intel.com \
    --cc=dwmw2@infradead.org \
    --cc=heiko.carstens@de.ibm.com \
    --cc=k.kozlowski@samsung.com \
    --cc=kyungmin.park@samsung.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-s390@vger.kernel.org \
    --cc=m.chehab@samsung.com \
    --cc=m.szyprowski@samsung.com \
    --cc=pawel@osciak.com \
    --cc=schwidefsky@de.ibm.com \
    --cc=ubraun@linux.vnet.ibm.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®