On Thu, 31 Dec 2015 02:22:20 +0100, libin.yang@xxxxxxxxxxxxxxx wrote: > > From: Libin Yang <libin.yang@xxxxxxxxxxxxxxx> > > Use struct hdmi_pcm wrapper for hdmi pcm management. > All PCM related features, like jack, will be put in this structure. > > Signed-off-by: Libin Yang <libin.yang@xxxxxxxxxxxxxxx> > --- > sound/pci/hda/patch_hdmi.c | 44 ++++++++++++++++++++++++-------------------- > 1 file changed, 24 insertions(+), 20 deletions(-) > > diff --git a/sound/pci/hda/patch_hdmi.c b/sound/pci/hda/patch_hdmi.c > index 6d6dba4..5549ddf 100644 > --- a/sound/pci/hda/patch_hdmi.c > +++ b/sound/pci/hda/patch_hdmi.c > @@ -86,7 +86,7 @@ struct hdmi_spec_per_pin { > struct delayed_work work; > struct snd_kcontrol *eld_ctl; > struct snd_jack *acomp_jack; /* jack via audio component */ > - struct hda_pcm *pcm; /* pointer to spec->pcm_rec[n] dynamically*/ > + struct hdmi_pcm *pcm; /* pointer to spec->pcm_rec[n] dynamically*/ > int pcm_idx; /* which pcm is attached. -1 means no pcm is attached */ > int repoll_count; > bool setup; /* the stream has been set up by prepare callback */ > @@ -132,6 +132,11 @@ struct hdmi_ops { > int (*chmap_validate)(int ca, int channels, unsigned char *chmap); > }; > > +struct hdmi_pcm { > + struct hda_pcm *pcm; > + struct snd_jack *jack; > +}; > + > struct hdmi_spec { > int num_cvts; > struct snd_array cvts; /* struct hdmi_spec_per_cvt */ > @@ -139,7 +144,7 @@ struct hdmi_spec { > > int num_pins; > struct snd_array pins; /* struct hdmi_spec_per_pin */ > - struct hda_pcm *pcm_rec[16]; > + struct hdmi_pcm pcm_rec[16]; > struct mutex pcm_lock; > /* pcm_bitmap means which pcms have been assigned to pins*/ > unsigned long pcm_bitmap; > @@ -403,7 +408,7 @@ static int hinfo_to_pcm_index(struct hda_codec *codec, > int pcm_idx; > > for (pcm_idx = 0; pcm_idx < spec->pcm_used; pcm_idx++) > - if (get_pcm_rec(spec, pcm_idx)->stream == hinfo) > + if (get_pcm_rec(spec, pcm_idx).pcm->stream == hinfo) I would change rather get_pcm_rec() itself to point to hda_pcm. For referencing to hdmi_pcm, we can introduce another macro, e.g. get_hdmi_pcm(spec, idx). For example: /* obtain hdmi_pcm object assigned to idx */ #define get_hdmi_pcm(spec, idx) (&(spec)->pcm_rec[idx]) /* obtain hda_pcm object assigned to idx */ #define get_pcm_rec(spec, idx) get_hdmi_pcm(spec, idx)->pcm Takashi _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel