Skip to content

Commit

Permalink
ALSA: pcm: Fix pcm_class sysfs output
Browse files Browse the repository at this point in the history
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: ef46c7a ('ALSA: pcm: Embed struct device')
Cc: <[email protected]> # v4.0+
Signed-off-by: Takashi Iwai <[email protected]>
  • Loading branch information
tiwai committed Jun 23, 2015
1 parent c7988af commit 60b9303
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions sound/core/pcm.c
Original file line number Diff line number Diff line change
Expand Up @@ -1027,7 +1027,8 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
static ssize_t show_pcm_class(struct device *dev,
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;
static const char *strs[SNDRV_PCM_CLASS_LAST + 1] = {
[SNDRV_PCM_CLASS_GENERIC] = "generic",
Expand All @@ -1036,8 +1037,7 @@ static ssize_t show_pcm_class(struct device *dev,
[SNDRV_PCM_CLASS_DIGITIZER] = "digitizer",
};

if (! (pcm = dev_get_drvdata(dev)) ||
pcm->dev_class > SNDRV_PCM_CLASS_LAST)
if (pcm->dev_class > SNDRV_PCM_CLASS_LAST)
str = "none";
else
str = strs[pcm->dev_class];
Expand Down

0 comments on commit 60b9303

Please sign in to comment.