Commit 5089e34f authored by Zhen Lei's avatar Zhen Lei Committed by Lee Jones

mfd: intel_soc_pmic_bxtwc: Use DEVICE_ATTR_ADMIN_RW macro

Use DEVICE_ATTR_ADMIN_RW macro helper instead of plain DEVICE_ATTR, which
makes the code a bit shorter and easier to read.
Signed-off-by: default avatarZhen Lei <thunder.leizhen@huawei.com>
Signed-off-by: default avatarLee Jones <lee.jones@linaro.org>
parent 24676b3e
...@@ -330,13 +330,13 @@ static int regmap_ipc_byte_reg_write(void *context, unsigned int reg, ...@@ -330,13 +330,13 @@ static int regmap_ipc_byte_reg_write(void *context, unsigned int reg,
/* sysfs interfaces to r/w PMIC registers, required by initial script */ /* sysfs interfaces to r/w PMIC registers, required by initial script */
static unsigned long bxtwc_reg_addr; static unsigned long bxtwc_reg_addr;
static ssize_t bxtwc_reg_show(struct device *dev, static ssize_t addr_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
return sprintf(buf, "0x%lx\n", bxtwc_reg_addr); return sprintf(buf, "0x%lx\n", bxtwc_reg_addr);
} }
static ssize_t bxtwc_reg_store(struct device *dev, static ssize_t addr_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
if (kstrtoul(buf, 0, &bxtwc_reg_addr)) { if (kstrtoul(buf, 0, &bxtwc_reg_addr)) {
...@@ -346,7 +346,7 @@ static ssize_t bxtwc_reg_store(struct device *dev, ...@@ -346,7 +346,7 @@ static ssize_t bxtwc_reg_store(struct device *dev,
return (ssize_t)count; return (ssize_t)count;
} }
static ssize_t bxtwc_val_show(struct device *dev, static ssize_t val_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
int ret; int ret;
...@@ -362,7 +362,7 @@ static ssize_t bxtwc_val_show(struct device *dev, ...@@ -362,7 +362,7 @@ static ssize_t bxtwc_val_show(struct device *dev,
return sprintf(buf, "0x%02x\n", val); return sprintf(buf, "0x%02x\n", val);
} }
static ssize_t bxtwc_val_store(struct device *dev, static ssize_t val_store(struct device *dev,
struct device_attribute *attr, const char *buf, size_t count) struct device_attribute *attr, const char *buf, size_t count)
{ {
int ret; int ret;
...@@ -382,8 +382,8 @@ static ssize_t bxtwc_val_store(struct device *dev, ...@@ -382,8 +382,8 @@ static ssize_t bxtwc_val_store(struct device *dev,
return count; return count;
} }
static DEVICE_ATTR(addr, S_IWUSR | S_IRUSR, bxtwc_reg_show, bxtwc_reg_store); static DEVICE_ATTR_ADMIN_RW(addr);
static DEVICE_ATTR(val, S_IWUSR | S_IRUSR, bxtwc_val_show, bxtwc_val_store); static DEVICE_ATTR_ADMIN_RW(val);
static struct attribute *bxtwc_attrs[] = { static struct attribute *bxtwc_attrs[] = {
&dev_attr_addr.attr, &dev_attr_addr.attr,
&dev_attr_val.attr, &dev_attr_val.attr,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment