[PATCH 0893/1285] Replace numeric parameter like 0444 with macro

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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@xxxxxxxxx>
Signed-off-by: Baole Ni <baolex.ni@xxxxxxxxx>
---
 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

--
To unsubscribe from this list: send the line "unsubscribe linux-s390" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html



[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Index of Archives]     [Kernel Development]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite Info]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Linux Media]     [Device Mapper]

  Powered by Linux