提交 60b93030 编写于 作者: T Takashi Iwai

ALSA: pcm: Fix pcm_class sysfs output

The pcm_class sysfs of each PCM substream gives only "none" since the
recent code change to embed the struct device.  Fix the code to point
directly to the embedded device object properly.

Fixes: ef46c7af ('ALSA: pcm: Embed struct device')
Cc: <stable@vger.kernel.org> # v4.0+
Signed-off-by: NTakashi Iwai <tiwai@suse.de>
上级 c7988afd
...@@ -1027,7 +1027,8 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream) ...@@ -1027,7 +1027,8 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
static ssize_t show_pcm_class(struct device *dev, static ssize_t show_pcm_class(struct device *dev,
struct device_attribute *attr, char *buf) struct device_attribute *attr, char *buf)
{ {
struct snd_pcm *pcm; struct snd_pcm_str *pstr = container_of(dev, struct snd_pcm_str, dev);
struct snd_pcm *pcm = pstr->pcm;
const char *str; const char *str;
static const char *strs[SNDRV_PCM_CLASS_LAST + 1] = { static const char *strs[SNDRV_PCM_CLASS_LAST + 1] = {
[SNDRV_PCM_CLASS_GENERIC] = "generic", [SNDRV_PCM_CLASS_GENERIC] = "generic",
...@@ -1036,8 +1037,7 @@ static ssize_t show_pcm_class(struct device *dev, ...@@ -1036,8 +1037,7 @@ static ssize_t show_pcm_class(struct device *dev,
[SNDRV_PCM_CLASS_DIGITIZER] = "digitizer", [SNDRV_PCM_CLASS_DIGITIZER] = "digitizer",
}; };
if (! (pcm = dev_get_drvdata(dev)) || if (pcm->dev_class > SNDRV_PCM_CLASS_LAST)
pcm->dev_class > SNDRV_PCM_CLASS_LAST)
str = "none"; str = "none";
else else
str = strs[pcm->dev_class]; str = strs[pcm->dev_class];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册