Commit e1dc219a authored by YueHaibing's avatar YueHaibing Committed by Takashi Iwai

ALSA: pcm: use DEVICE_ATTR_RO macro

Use DEVICE_ATTR_RO() helper instead of plain DEVICE_ATTR(),
which makes the code a bit shorter and easier to read.
Signed-off-by: default avatarYueHaibing <yuehaibing@huawei.com>
Link: https://lore.kernel.org/r/20210524120007.39728-1-yuehaibing@huawei.comSigned-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent a38e9330
...@@ -1004,7 +1004,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream) ...@@ -1004,7 +1004,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
substream->pstr->substream_opened--; substream->pstr->substream_opened--;
} }
static ssize_t show_pcm_class(struct device *dev, static ssize_t pcm_class_show(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct snd_pcm_str *pstr = container_of(dev, struct snd_pcm_str, dev); struct snd_pcm_str *pstr = container_of(dev, struct snd_pcm_str, dev);
...@@ -1024,7 +1024,7 @@ static ssize_t show_pcm_class(struct device *dev, ...@@ -1024,7 +1024,7 @@ static ssize_t show_pcm_class(struct device *dev,
return sprintf(buf, "%s\n", str); return sprintf(buf, "%s\n", str);
} }
static DEVICE_ATTR(pcm_class, 0444, show_pcm_class, NULL); static DEVICE_ATTR_RO(pcm_class);
static struct attribute *pcm_dev_attrs[] = { static struct attribute *pcm_dev_attrs[] = {
&dev_attr_pcm_class.attr, &dev_attr_pcm_class.attr,
NULL NULL
......
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