ASoC: cs43130: Use DEVICE_ATTR_RO macro
authorYueHaibing <yuehaibing@huawei.com>
Mon, 24 May 2021 11:40:17 +0000 (19:40 +0800)
committerMark Brown <broonie@kernel.org>
Wed, 26 May 2021 11:07:15 +0000 (12:07 +0100)
Use DEVICE_ATTR_RO() helper instead of plain DEVICE_ATTR(),
which makes the code a bit shorter and easier to read.

Signed-off-by: YueHaibing <yuehaibing@huawei.com>
Reviewed-by: Charles Keepax <ckeepax@opensource.cirrus.com>
Message-Id: <20210524114017.18672-1-yuehaibing@huawei.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/codecs/cs43130.c

index 642338c..7c521bd 100644 (file)
@@ -1672,14 +1672,14 @@ static int cs43130_show_dc(struct device *dev, char *buf, u8 ch)
                                 cs43130->hpload_dc[ch]);
 }
 
-static ssize_t cs43130_show_dc_l(struct device *dev,
-                                struct device_attribute *attr, char *buf)
+static ssize_t hpload_dc_l_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
 {
        return cs43130_show_dc(dev, buf, HP_LEFT);
 }
 
-static ssize_t cs43130_show_dc_r(struct device *dev,
-                                struct device_attribute *attr, char *buf)
+static ssize_t hpload_dc_r_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
 {
        return cs43130_show_dc(dev, buf, HP_RIGHT);
 }
@@ -1719,22 +1719,22 @@ static int cs43130_show_ac(struct device *dev, char *buf, u8 ch)
        }
 }
 
-static ssize_t cs43130_show_ac_l(struct device *dev,
-                                struct device_attribute *attr, char *buf)
+static ssize_t hpload_ac_l_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
 {
        return cs43130_show_ac(dev, buf, HP_LEFT);
 }
 
-static ssize_t cs43130_show_ac_r(struct device *dev,
-                                struct device_attribute *attr, char *buf)
+static ssize_t hpload_ac_r_show(struct device *dev,
+                               struct device_attribute *attr, char *buf)
 {
        return cs43130_show_ac(dev, buf, HP_RIGHT);
 }
 
-static DEVICE_ATTR(hpload_dc_l, 0444, cs43130_show_dc_l, NULL);
-static DEVICE_ATTR(hpload_dc_r, 0444, cs43130_show_dc_r, NULL);
-static DEVICE_ATTR(hpload_ac_l, 0444, cs43130_show_ac_l, NULL);
-static DEVICE_ATTR(hpload_ac_r, 0444, cs43130_show_ac_r, NULL);
+static DEVICE_ATTR_RO(hpload_dc_l);
+static DEVICE_ATTR_RO(hpload_dc_r);
+static DEVICE_ATTR_RO(hpload_ac_l);
+static DEVICE_ATTR_RO(hpload_ac_r);
 
 static struct reg_sequence hp_en_cal_seq[] = {
        {CS43130_INT_MASK_4, CS43130_INT_MASK_ALL},