Skip to contentSkip to conversation

mfd: use DEVICE_ATTR_* macro to simplify code

PATCH Applied Zhen Lei 3 participants 20 messages Jun 2, 2021 – Jun 15, 2021

Subsystems (4)
lore
Share & tools
lore

Zhen Lei

author
#0 lore raw

cover mfd: use DEVICE_ATTR_* macro to simplify code

DEVICE_ATTR_RO marks ReadOnly file, DEVICE_ATTR_RW marks ReadWrite file, etc.. it's clearer than DEVICE_ATTR.

Zhen Lei (9):
mfd: wm831x: use DEVICE_ATTR_RO macro
mfd: ucb1x00-assabet: use DEVICE_ATTR_RO macro
mfd: timberdale: use DEVICE_ATTR_RO macro
mfd: sm501: use DEVICE_ATTR_RO macro
mfd: pcf50633: use DEVICE_ATTR_ADMIN_RO macro
mfd: kempld-core: use DEVICE_ATTR_RO macro
mfd: janz-cmodio: use DEVICE_ATTR_RO macro
mfd: intel_soc_pmic_bxtwc: use DEVICE_ATTR_ADMIN_RW macro
mfd: ab8500-core: use DEVICE_ATTR_RO/RW macro

 drivers/mfd/ab8500-core.c          | 33 +++++++++++++++---------------
 drivers/mfd/intel_soc_pmic_bxtwc.c | 20 +++++++++---------
 drivers/mfd/janz-cmodio.c          |  6 +++---
 drivers/mfd/kempld-core.c          | 19 ++++++++---------
 drivers/mfd/pcf50633-core.c        | 12 +++++------
 drivers/mfd/sm501.c                |  8 ++++----
 drivers/mfd/timberdale.c           |  6 +++---
 drivers/mfd/ucb1x00-assabet.c      |  2 +-
 drivers/mfd/wm831x-otp.c           |  6 +++---
 9 files changed, 55 insertions(+), 57 deletions(-)
Signature · 1 line
2.26.0.106.g9fadedd
author
#1 lore raw

PATCH 1/9 mfd: wm831x: use DEVICE_ATTR_RO macro

Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/wm831x-otp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mfd/wm831x-otp.c +3 -3
index afe59d52dd74d55..25f5d9fe33a18e2 100644
@@ -38,8 +38,8 @@ static int wm831x_unique_id_read(struct wm831x *wm831x, char *id)
 	return 0;
 }
 
-static ssize_t wm831x_unique_id_show(struct device *dev,
-				     struct device_attribute *attr, char *buf)
+static ssize_t unique_id_show(struct device *dev,
+			      struct device_attribute *attr, char *buf)
 {
 	struct wm831x *wm831x = dev_get_drvdata(dev);
 	int rval;
@@ -52,7 +52,7 @@ static ssize_t wm831x_unique_id_show(struct device *dev,
 	return sprintf(buf, "%*phN\n", WM831X_UNIQUE_ID_LEN, id);
 }
 
-static DEVICE_ATTR(unique_id, 0444, wm831x_unique_id_show, NULL);
+static DEVICE_ATTR_RO(unique_id);
 
 int wm831x_otp_init(struct wm831x *wm831x)
 {
Signature · 1 line
2.26.0.106.g9fadedd
Applied
#3 lore raw

Re: [PATCH 1/9] mfd: wm831x: use DEVICE_ATTR_RO macro

In reply to Zhen Lei
Quoted 7 lines · Zhen Lei

Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/wm831x-otp.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#4 lore raw

PATCH 2/9 mfd: ucb1x00-assabet: use DEVICE_ATTR_RO macro

In reply to Zhen Lei

Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/ucb1x00-assabet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/mfd/ucb1x00-assabet.c +1 -1
index ecc9e9fc331d6a3..6a389737c6153bc 100644
@@ -28,7 +28,7 @@ static ssize_t name##_show(struct device *dev, struct device_attribute *attr, \
 	ucb1x00_adc_disable(ucb);				\
 	return sprintf(buf, "%d\n", val);			\
 }								\
-static DEVICE_ATTR(name,0444,name##_show,NULL)
+static DEVICE_ATTR_RO(name)
 
 UCB1X00_ATTR(vbatt, UCB_ADC_INP_AD1);
 UCB1X00_ATTR(vcharger, UCB_ADC_INP_AD0);
Signature · 1 line
2.26.0.106.g9fadedd
Applied
#5 lore raw

Re: [PATCH 2/9] mfd: ucb1x00-assabet: use DEVICE_ATTR_RO macro

Quoted 7 lines · Zhen Lei

Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/ucb1x00-assabet.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#6 lore raw

PATCH 3/9 mfd: timberdale: use DEVICE_ATTR_RO macro

In reply to Zhen Lei

Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/timberdale.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mfd/timberdale.c +3 -3
index faecbca6dba3dc0..9393ee60a656cd4 100644
@@ -623,8 +623,8 @@ static const struct mfd_cell timberdale_cells_bar2[] = {
 	},
 };
 
-static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr,
-	char *buf)
+static ssize_t fw_ver_show(struct device *dev,
+			   struct device_attribute *attr, char *buf)
 {
 	struct timberdale_device *priv = dev_get_drvdata(dev);
 
@@ -632,7 +632,7 @@ static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr,
 		priv->fw.config);
 }
 
-static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL);
+static DEVICE_ATTR_RO(fw_ver);
 
 /*--------------------------------------------------------------------------*/
 
Signature · 1 line
2.26.0.106.g9fadedd
Applied
#7 lore raw

Re: [PATCH 3/9] mfd: timberdale: use DEVICE_ATTR_RO macro

Quoted 7 lines · Zhen Lei

Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/timberdale.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#8 lore raw

PATCH 4/9 mfd: sm501: use DEVICE_ATTR_RO macro

In reply to Zhen Lei

Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/sm501.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/mfd/sm501.c +4 -4
index 6d2f4a0a901dc08..bc0a2c38653e51c 100644
@@ -1190,13 +1190,13 @@ static int sm501_register_gpio_i2c(struct sm501_devdata *sm,
 	return 0;
 }
 
-/* sm501_dbg_regs
+/* dbg_regs_show
  *
  * Debug attribute to attach to parent device to show core registers
 */
 
-static ssize_t sm501_dbg_regs(struct device *dev,
-			      struct device_attribute *attr, char *buff)
+static ssize_t dbg_regs_show(struct device *dev,
+			     struct device_attribute *attr, char *buff)
 {
 	struct sm501_devdata *sm = dev_get_drvdata(dev)	;
 	unsigned int reg;
@@ -1213,7 +1213,7 @@ static ssize_t sm501_dbg_regs(struct device *dev,
 }
 
 
-static DEVICE_ATTR(dbg_regs, 0444, sm501_dbg_regs, NULL);
+static DEVICE_ATTR_RO(dbg_regs);
 
 /* sm501_init_reg
  *
Signature · 1 line
2.26.0.106.g9fadedd
Applied
#9 lore raw

Re: [PATCH 4/9] mfd: sm501: use DEVICE_ATTR_RO macro

Quoted 7 lines · Zhen Lei

Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/sm501.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#10 lore raw

PATCH 5/9 mfd: pcf50633: use DEVICE_ATTR_ADMIN_RO macro

In reply to Zhen Lei

Use DEVICE_ATTR_ADMIN_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/pcf50633-core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)
drivers/mfd/pcf50633-core.c +6 -6
index 148bcd6120f45a3..e9c565cf0f54f29 100644
@@ -77,8 +77,8 @@ int pcf50633_reg_clear_bits(struct pcf50633 *pcf, u8 reg, u8 val)
 EXPORT_SYMBOL_GPL(pcf50633_reg_clear_bits);
 
 /* sysfs attributes */
-static ssize_t show_dump_regs(struct device *dev, struct device_attribute *attr,
-			    char *buf)
+static ssize_t dump_regs_show(struct device *dev,
+			      struct device_attribute *attr, char *buf)
 {
 	struct pcf50633 *pcf = dev_get_drvdata(dev);
 	u8 dump[16];
@@ -106,10 +106,10 @@ static ssize_t show_dump_regs(struct device *dev, struct device_attribute *attr,
 
 	return buf1 - buf;
 }
-static DEVICE_ATTR(dump_regs, 0400, show_dump_regs, NULL);
+static DEVICE_ATTR_ADMIN_RO(dump_regs);
 
-static ssize_t show_resume_reason(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t resume_reason_show(struct device *dev,
+				  struct device_attribute *attr, char *buf)
 {
 	struct pcf50633 *pcf = dev_get_drvdata(dev);
 	int n;
@@ -123,7 +123,7 @@ static ssize_t show_resume_reason(struct device *dev,
 
 	return n;
 }
-static DEVICE_ATTR(resume_reason, 0400, show_resume_reason, NULL);
+static DEVICE_ATTR_ADMIN_RO(resume_reason);
 
 static struct attribute *pcf_sysfs_entries[] = {
 	&dev_attr_dump_regs.attr,
Signature · 1 line
2.26.0.106.g9fadedd
Applied
#11 lore raw

Re: [PATCH 5/9] mfd: pcf50633: use DEVICE_ATTR_ADMIN_RO macro

Quoted 7 lines · Zhen Lei

Use DEVICE_ATTR_ADMIN_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/pcf50633-core.c | 12 ++++++------
 1 file changed, 6 insertions(+), 6 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#12 lore raw

PATCH 6/9 mfd: kempld-core: use DEVICE_ATTR_RO macro

In reply to Zhen Lei

Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/kempld-core.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)
drivers/mfd/kempld-core.c +9 -10
index 9166075c1f321a4..bb26241c73bdb8f 100644
@@ -344,16 +344,16 @@ static const char *kempld_get_type_string(struct kempld_device_data *pld)
 	return version_type;
 }
 
-static ssize_t kempld_version_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
+static ssize_t pld_version_show(struct device *dev,
+				struct device_attribute *attr, char *buf)
 {
 	struct kempld_device_data *pld = dev_get_drvdata(dev);
 
 	return scnprintf(buf, PAGE_SIZE, "%s\n", pld->info.version);
 }
 
-static ssize_t kempld_specification_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
+static ssize_t pld_specification_show(struct device *dev,
+				      struct device_attribute *attr, char *buf)
 {
 	struct kempld_device_data *pld = dev_get_drvdata(dev);
 
@@ -361,18 +361,17 @@ static ssize_t kempld_specification_show(struct device *dev,
 		       pld->info.spec_minor);
 }
 
-static ssize_t kempld_type_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
+static ssize_t pld_type_show(struct device *dev,
+			     struct device_attribute *attr, char *buf)
 {
 	struct kempld_device_data *pld = dev_get_drvdata(dev);
 
 	return scnprintf(buf, PAGE_SIZE, "%s\n", kempld_get_type_string(pld));
 }
 
-static DEVICE_ATTR(pld_version, S_IRUGO, kempld_version_show, NULL);
-static DEVICE_ATTR(pld_specification, S_IRUGO, kempld_specification_show,
-		   NULL);
-static DEVICE_ATTR(pld_type, S_IRUGO, kempld_type_show, NULL);
+static DEVICE_ATTR_RO(pld_version);
+static DEVICE_ATTR_RO(pld_specification);
+static DEVICE_ATTR_RO(pld_type);
 
 static struct attribute *pld_attributes[] = {
 	&dev_attr_pld_version.attr,
Signature · 1 line
2.26.0.106.g9fadedd
Applied
#13 lore raw

Re: [PATCH 6/9] mfd: kempld-core: use DEVICE_ATTR_RO macro

Quoted 7 lines · Zhen Lei

Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/kempld-core.c | 19 +++++++++----------
 1 file changed, 9 insertions(+), 10 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#14 lore raw

PATCH 7/9 mfd: janz-cmodio: use DEVICE_ATTR_RO macro

In reply to Zhen Lei

Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/janz-cmodio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/mfd/janz-cmodio.c +3 -3
index 3df4e9a2998f490..70eba4ce496faa3 100644
@@ -149,15 +149,15 @@ static int cmodio_probe_submodules(struct cmodio_device *priv)
  * SYSFS Attributes
  */
 
-static ssize_t mbus_show(struct device *dev, struct device_attribute *attr,
-			 char *buf)
+static ssize_t modulbus_number_show(struct device *dev,
+				    struct device_attribute *attr, char *buf)
 {
 	struct cmodio_device *priv = dev_get_drvdata(dev);
 
 	return snprintf(buf, PAGE_SIZE, "%x\n", priv->hex);
 }
 
-static DEVICE_ATTR(modulbus_number, S_IRUGO, mbus_show, NULL);
+static DEVICE_ATTR_RO(modulbus_number);
 
 static struct attribute *cmodio_sysfs_attrs[] = {
 	&dev_attr_modulbus_number.attr,
Signature · 1 line
2.26.0.106.g9fadedd
Applied
#15 lore raw

Re: [PATCH 7/9] mfd: janz-cmodio: use DEVICE_ATTR_RO macro

Quoted 7 lines · Zhen Lei

Use DEVICE_ATTR_RO macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/janz-cmodio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#16 lore raw

PATCH 8/9 mfd: intel_soc_pmic_bxtwc: use DEVICE_ATTR_ADMIN_RW macro

In reply to Zhen Lei

Use DEVICE_ATTR_ADMIN_RW macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/intel_soc_pmic_bxtwc.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/mfd/intel_soc_pmic_bxtwc.c +10 -10
index 47d0d3a69a58a37..bc069c4daa60393 100644
@@ -330,14 +330,14 @@ static int regmap_ipc_byte_reg_write(void *context, unsigned int reg,
 
 /* sysfs interfaces to r/w PMIC registers, required by initial script */
 static unsigned long bxtwc_reg_addr;
-static ssize_t bxtwc_reg_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
+static ssize_t addr_show(struct device *dev,
+			 struct device_attribute *attr, char *buf)
 {
 	return sprintf(buf, "0x%lx\n", bxtwc_reg_addr);
 }
 
-static ssize_t bxtwc_reg_store(struct device *dev,
-	struct device_attribute *attr, const char *buf, size_t count)
+static ssize_t addr_store(struct device *dev,
+			  struct device_attribute *attr, const char *buf, size_t count)
 {
 	if (kstrtoul(buf, 0, &bxtwc_reg_addr)) {
 		dev_err(dev, "Invalid register address\n");
@@ -346,8 +346,8 @@ static ssize_t bxtwc_reg_store(struct device *dev,
 	return (ssize_t)count;
 }
 
-static ssize_t bxtwc_val_show(struct device *dev,
-		struct device_attribute *attr, char *buf)
+static ssize_t val_show(struct device *dev,
+			struct device_attribute *attr, char *buf)
 {
 	int ret;
 	unsigned int val;
@@ -362,8 +362,8 @@ static ssize_t bxtwc_val_show(struct device *dev,
 	return sprintf(buf, "0x%02x\n", val);
 }
 
-static ssize_t bxtwc_val_store(struct device *dev,
-	struct device_attribute *attr, const char *buf, size_t count)
+static ssize_t val_store(struct device *dev,
+			 struct device_attribute *attr, const char *buf, size_t count)
 {
 	int ret;
 	unsigned int val;
@@ -382,8 +382,8 @@ static ssize_t bxtwc_val_store(struct device *dev,
 	return count;
 }
 
-static DEVICE_ATTR(addr, S_IWUSR | S_IRUSR, bxtwc_reg_show, bxtwc_reg_store);
-static DEVICE_ATTR(val, S_IWUSR | S_IRUSR, bxtwc_val_show, bxtwc_val_store);
+static DEVICE_ATTR_ADMIN_RW(addr);
+static DEVICE_ATTR_ADMIN_RW(val);
 static struct attribute *bxtwc_attrs[] = {
 	&dev_attr_addr.attr,
 	&dev_attr_val.attr,
Signature · 1 line
2.26.0.106.g9fadedd
Applied
#17 lore raw

Re: [PATCH 8/9] mfd: intel_soc_pmic_bxtwc: use DEVICE_ATTR_ADMIN_RW macro

Quoted 7 lines · Zhen Lei

Use DEVICE_ATTR_ADMIN_RW macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/intel_soc_pmic_bxtwc.c | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog
author
#18 lore raw

PATCH 9/9 mfd: ab8500-core: use DEVICE_ATTR_RO/RW macro

In reply to Zhen Lei

Use DEVICE_ATTR_RO/RW macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/ab8500-core.c | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)
drivers/mfd/ab8500-core.c +16 -17
index c2ba498ad302dcd..30489670ea528ce 100644
@@ -827,8 +827,8 @@ static const struct mfd_cell ab8540_cut2_devs[] = {
 	},
 };
 
-static ssize_t show_chip_id(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t chip_id_show(struct device *dev,
+			    struct device_attribute *attr, char *buf)
 {
 	struct ab8500 *ab8500;
 
@@ -848,8 +848,8 @@ static ssize_t show_chip_id(struct device *dev,
  * 0x40 Power on key 1 pressed longer than 10 seconds
  * 0x80 DB8500 thermal shutdown
  */
-static ssize_t show_switch_off_status(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t switch_off_status_show(struct device *dev,
+				      struct device_attribute *attr, char *buf)
 {
 	int ret;
 	u8 value;
@@ -883,8 +883,8 @@ void ab8500_override_turn_on_stat(u8 mask, u8 set)
  * 0x40 UsbIDDetect
  * 0x80 Reserved
  */
-static ssize_t show_turn_on_status(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t turn_on_status_show(struct device *dev,
+				   struct device_attribute *attr, char *buf)
 {
 	int ret;
 	u8 value;
@@ -912,8 +912,8 @@ static ssize_t show_turn_on_status(struct device *dev,
 	return sprintf(buf, "%#x\n", value);
 }
 
-static ssize_t show_turn_on_status_2(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t turn_on_status_2_show(struct device *dev,
+				     struct device_attribute *attr, char *buf)
 {
 	int ret;
 	u8 value;
@@ -927,8 +927,8 @@ static ssize_t show_turn_on_status_2(struct device *dev,
 	return sprintf(buf, "%#x\n", (value & 0x1));
 }
 
-static ssize_t show_ab9540_dbbrstn(struct device *dev,
-				struct device_attribute *attr, char *buf)
+static ssize_t dbbrstn_show(struct device *dev,
+			    struct device_attribute *attr, char *buf)
 {
 	struct ab8500 *ab8500;
 	int ret;
@@ -945,7 +945,7 @@ static ssize_t show_ab9540_dbbrstn(struct device *dev,
 			(value & AB9540_MODEM_CTRL2_SWDBBRSTN_BIT) ? 1 : 0);
 }
 
-static ssize_t store_ab9540_dbbrstn(struct device *dev,
+static ssize_t dbbrstn_store(struct device *dev,
 	struct device_attribute *attr, const char *buf, size_t count)
 {
 	struct ab8500 *ab8500;
@@ -980,12 +980,11 @@ static ssize_t store_ab9540_dbbrstn(struct device *dev,
 	return ret;
 }
 
-static DEVICE_ATTR(chip_id, S_IRUGO, show_chip_id, NULL);
-static DEVICE_ATTR(switch_off_status, S_IRUGO, show_switch_off_status, NULL);
-static DEVICE_ATTR(turn_on_status, S_IRUGO, show_turn_on_status, NULL);
-static DEVICE_ATTR(turn_on_status_2, S_IRUGO, show_turn_on_status_2, NULL);
-static DEVICE_ATTR(dbbrstn, S_IRUGO | S_IWUSR,
-			show_ab9540_dbbrstn, store_ab9540_dbbrstn);
+static DEVICE_ATTR_RO(chip_id);
+static DEVICE_ATTR_RO(switch_off_status);
+static DEVICE_ATTR_RO(turn_on_status);
+static DEVICE_ATTR_RO(turn_on_status_2);
+static DEVICE_ATTR_RW(dbbrstn);
 
 static struct attribute *ab8500_sysfs_entries[] = {
 	&dev_attr_chip_id.attr,
Signature · 1 line
2.26.0.106.g9fadedd
Applied
#19 lore raw

Re: [PATCH 9/9] mfd: ab8500-core: use DEVICE_ATTR_RO/RW macro

Quoted 7 lines · Zhen Lei

Use DEVICE_ATTR_RO/RW macro helper instead of plain DEVICE_ATTR, which makes the code a bit shorter and easier to read.

---
 drivers/mfd/ab8500-core.c | 33 ++++++++++++++++-----------------
 1 file changed, 16 insertions(+), 17 deletions(-)

Applied, thanks.

Signature · 4 lines
Lee Jones [李琼斯]
Senior Technical Lead - Developer Services
Linaro.org │ Open source software for Arm SoCs
Follow Linaro: Facebook | Twitter | Blog