* [PATCH -next] ALSA: pcm: use DEVICE_ATTR_RO macro
@ 2021-05-24 12:00 ` YueHaibing
0 siblings, 0 replies; 4+ messages in thread
From: YueHaibing @ 2021-05-24 12:00 UTC (permalink / raw)
To: perex, tiwai; +Cc: alsa-devel, linux-kernel, YueHaibing
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>
---
sound/core/pcm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index b163164a83ec..6fd3677685d7 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -1004,7 +1004,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
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 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,
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[] = {
&dev_attr_pcm_class.attr,
NULL
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [PATCH -next] ALSA: pcm: use DEVICE_ATTR_RO macro
@ 2021-05-24 12:00 ` YueHaibing
0 siblings, 0 replies; 4+ messages in thread
From: YueHaibing @ 2021-05-24 12:00 UTC (permalink / raw)
To: perex, tiwai; +Cc: alsa-devel, YueHaibing, linux-kernel
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>
---
sound/core/pcm.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index b163164a83ec..6fd3677685d7 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -1004,7 +1004,7 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
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 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,
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[] = {
&dev_attr_pcm_class.attr,
NULL
--
2.17.1
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH -next] ALSA: pcm: use DEVICE_ATTR_RO macro
2021-05-24 12:00 ` YueHaibing
@ 2021-05-25 7:00 ` Takashi Iwai
-1 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2021-05-25 7:00 UTC (permalink / raw)
To: YueHaibing; +Cc: perex, tiwai, alsa-devel, linux-kernel
On Mon, 24 May 2021 14:00:07 +0200,
YueHaibing wrote:
>
> 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>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH -next] ALSA: pcm: use DEVICE_ATTR_RO macro
@ 2021-05-25 7:00 ` Takashi Iwai
0 siblings, 0 replies; 4+ messages in thread
From: Takashi Iwai @ 2021-05-25 7:00 UTC (permalink / raw)
To: YueHaibing; +Cc: linux-kernel, alsa-devel, tiwai
On Mon, 24 May 2021 14:00:07 +0200,
YueHaibing wrote:
>
> 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>
Thanks, applied.
Takashi
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2021-05-25 7:01 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-05-24 12:00 [PATCH -next] ALSA: pcm: use DEVICE_ATTR_RO macro YueHaibing
2021-05-24 12:00 ` YueHaibing
2021-05-25 7:00 ` Takashi Iwai
2021-05-25 7:00 ` Takashi Iwai
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.