[<prev] [next>] [day] [month] [year] [list]
Message-Id: <20160802113621.27465-1-baolex.ni@intel.com>
Date: Tue, 2 Aug 2016 19:36:21 +0800
From: Baole Ni <baolex.ni@...el.com>
To: lee.jones@...aro.org, chaitra.basappa@...adcom.com,
suganath-prabu.subramani@...adcom.com, mchehab@...hat.com,
m.chehab@...sung.com, pawel@...iak.com, m.szyprowski@...sung.com,
kyungmin.park@...sung.com, k.kozlowski@...sung.com
Cc: linux-kernel@...r.kernel.org, viresh.kumar@...aro.org,
gregkh@...uxfoundation.org, jkosina@...e.cz, geliangtang@....com,
chuansheng.liu@...el.com, baolex.ni@...el.com
Subject: [PATCH 0681/1285] Replace numeric parameter like 0444 with macro
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@...el.com>
Signed-off-by: Baole Ni <baolex.ni@...el.com>
---
drivers/misc/c2port/core.c | 20 ++++++++++----------
1 file changed, 10 insertions(+), 10 deletions(-)
diff --git a/drivers/misc/c2port/core.c b/drivers/misc/c2port/core.c
index 1922cb8..4acad6d 100644
--- a/drivers/misc/c2port/core.c
+++ b/drivers/misc/c2port/core.c
@@ -311,7 +311,7 @@ static ssize_t c2port_show_name(struct device *dev,
return sprintf(buf, "%s\n", c2dev->name);
}
-static DEVICE_ATTR(name, 0444, c2port_show_name, NULL);
+static DEVICE_ATTR(name, S_IRUSR | S_IRGRP | S_IROTH, c2port_show_name, NULL);
static ssize_t c2port_show_flash_blocks_num(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -321,7 +321,7 @@ static ssize_t c2port_show_flash_blocks_num(struct device *dev,
return sprintf(buf, "%d\n", ops->blocks_num);
}
-static DEVICE_ATTR(flash_blocks_num, 0444, c2port_show_flash_blocks_num, NULL);
+static DEVICE_ATTR(flash_blocks_num, S_IRUSR | S_IRGRP | S_IROTH, c2port_show_flash_blocks_num, NULL);
static ssize_t c2port_show_flash_block_size(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -331,7 +331,7 @@ static ssize_t c2port_show_flash_block_size(struct device *dev,
return sprintf(buf, "%d\n", ops->block_size);
}
-static DEVICE_ATTR(flash_block_size, 0444, c2port_show_flash_block_size, NULL);
+static DEVICE_ATTR(flash_block_size, S_IRUSR | S_IRGRP | S_IROTH, c2port_show_flash_block_size, NULL);
static ssize_t c2port_show_flash_size(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -341,7 +341,7 @@ static ssize_t c2port_show_flash_size(struct device *dev,
return sprintf(buf, "%d\n", ops->blocks_num * ops->block_size);
}
-static DEVICE_ATTR(flash_size, 0444, c2port_show_flash_size, NULL);
+static DEVICE_ATTR(flash_size, S_IRUSR | S_IRGRP | S_IROTH, c2port_show_flash_size, NULL);
static ssize_t access_show(struct device *dev, struct device_attribute *attr,
char *buf)
@@ -399,7 +399,7 @@ static ssize_t c2port_store_reset(struct device *dev,
return count;
}
-static DEVICE_ATTR(reset, 0200, NULL, c2port_store_reset);
+static DEVICE_ATTR(reset, S_IWUSR, NULL, c2port_store_reset);
static ssize_t __c2port_show_dev_id(struct c2port_device *dev, char *buf)
{
@@ -436,7 +436,7 @@ static ssize_t c2port_show_dev_id(struct device *dev,
return ret;
}
-static DEVICE_ATTR(dev_id, 0444, c2port_show_dev_id, NULL);
+static DEVICE_ATTR(dev_id, S_IRUSR | S_IRGRP | S_IROTH, c2port_show_dev_id, NULL);
static ssize_t __c2port_show_rev_id(struct c2port_device *dev, char *buf)
{
@@ -473,7 +473,7 @@ static ssize_t c2port_show_rev_id(struct device *dev,
return ret;
}
-static DEVICE_ATTR(rev_id, 0444, c2port_show_rev_id, NULL);
+static DEVICE_ATTR(rev_id, S_IRUSR | S_IRGRP | S_IROTH, c2port_show_rev_id, NULL);
static ssize_t c2port_show_flash_access(struct device *dev,
struct device_attribute *attr, char *buf)
@@ -543,7 +543,7 @@ static ssize_t c2port_store_flash_access(struct device *dev,
return count;
}
-static DEVICE_ATTR(flash_access, 0644, c2port_show_flash_access,
+static DEVICE_ATTR(flash_access, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, c2port_show_flash_access,
c2port_store_flash_access);
static ssize_t __c2port_write_flash_erase(struct c2port_device *dev)
@@ -625,7 +625,7 @@ static ssize_t c2port_store_flash_erase(struct device *dev,
return count;
}
-static DEVICE_ATTR(flash_erase, 0200, NULL, c2port_store_flash_erase);
+static DEVICE_ATTR(flash_erase, S_IWUSR, NULL, c2port_store_flash_erase);
static ssize_t __c2port_read_flash_data(struct c2port_device *dev,
char *buffer, loff_t offset, size_t count)
@@ -853,7 +853,7 @@ static ssize_t c2port_write_flash_data(struct file *filp, struct kobject *kobj,
return ret;
}
/* size is computed at run-time */
-static BIN_ATTR(flash_data, 0644, c2port_read_flash_data,
+static BIN_ATTR(flash_data, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH, c2port_read_flash_data,
c2port_write_flash_data, 0);
/*
--
2.9.2
Powered by blists - more mailing lists