OSDN Git Service

ASoC: soc-core: use DEVICE_ATTR_RO macro
authorYueHaibing <yuehaibing@huawei.com>
Fri, 14 May 2021 08:11:00 +0000 (16:11 +0800)
committerMark Brown <broonie@kernel.org>
Tue, 18 May 2021 13:04:31 +0000 (14:04 +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>
Link: https://lore.kernel.org/r/20210514081100.16196-1-yuehaibing@huawei.com
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/soc-core.c

index 1c0904a..2d969e3 100644 (file)
@@ -75,9 +75,9 @@ static ssize_t pmdown_time_show(struct device *dev,
        return sprintf(buf, "%ld\n", rtd->pmdown_time);
 }
 
-static ssize_t pmdown_time_set(struct device *dev,
-                              struct device_attribute *attr,
-                              const char *buf, size_t count)
+static ssize_t pmdown_time_store(struct device *dev,
+                                struct device_attribute *attr,
+                                const char *buf, size_t count)
 {
        struct snd_soc_pcm_runtime *rtd = dev_get_drvdata(dev);
        int ret;
@@ -89,7 +89,7 @@ static ssize_t pmdown_time_set(struct device *dev,
        return count;
 }
 
-static DEVICE_ATTR(pmdown_time, 0644, pmdown_time_show, pmdown_time_set);
+static DEVICE_ATTR_RW(pmdown_time);
 
 static struct attribute *soc_dev_attrs[] = {
        &dev_attr_pmdown_time.attr,