At Fri, 15 Sep 2006 14:22:12 +0100, Liam Girdwood wrote: > > +/* set up initial codec paths */ > +static void dapm_set_path_status(struct snd_soc_dapm_widget *w, > + struct snd_soc_dapm_path *p, int i) > +{ > + switch (w->id) { (snip) > + /* does not effect routing - always connected */ > + case snd_soc_dapm_pga: > + case snd_soc_dapm_output: > + case snd_soc_dapm_adc: > + case snd_soc_dapm_input: > + case snd_soc_dapm_dac: > + case snd_soc_dapm_micbias: > + case snd_soc_dapm_vmid: > + p->connect = 1; Missing break. > +/* create new dapm mixer control */ > +static int dapm_new_mixer(struct snd_soc_codec *codec, > + struct snd_soc_dapm_widget *w) > +{ > + int i, ret = 0; > + char name[32]; > + struct list_head *lp; > + struct snd_soc_dapm_path *path; > + > + /* add kcontrol */ > + for (i = 0; i < w->num_kcontrols; i++) { > + > + /* match name */ > + list_for_each(lp, &w->sources) > + { You can use list_for_each_entry(). (And put brace in the same line.) > + if ((ret = snd_ctl_add(codec->card, path->kcontrol)) < 0) { Note that some people don't like "if ((a = b) < 0)" style, so better to write in two lines, "a = b; if (a < 0) ...", for avoiding unnecessary flames in general for the new codes. > +/* show dapm widget status in sys fs */ > +static ssize_t dapm_widget_show(struct device *dev, > + struct device_attribute *attr, char *buf) > +{ > + struct snd_soc_device *devdata = dev_get_drvdata(dev); > + struct snd_soc_codec *codec = devdata->codec; > + struct snd_soc_dapm_widget *w = NULL; > + struct list_head *l = NULL; > + int count = 0; > + char *state = "not set"; > + > + list_for_each(l, &codec->dapm_widgets) > + { > + w = list_entry(l, struct snd_soc_dapm_widget, list); > + /* only display widgets that burnm power */ > + switch (w->id) { > + case snd_soc_dapm_switch: > + case snd_soc_dapm_pre: > + case snd_soc_dapm_post: > + case snd_soc_dapm_mux: > + case snd_soc_dapm_output: > + case snd_soc_dapm_input: > + case snd_soc_dapm_vmid: > + continue; These can be default case. > + case snd_soc_dapm_hp: > + case snd_soc_dapm_mic: > + case snd_soc_dapm_spk: > + case snd_soc_dapm_line: > + case snd_soc_dapm_micbias: > + case snd_soc_dapm_dac: > + case snd_soc_dapm_adc: > + case snd_soc_dapm_pga: > + case snd_soc_dapm_mixer: > + if (w->name) > + count += sprintf(buf + count, "%s: %s\n", w->name, w->power ? "On":"Off"); Wrong indentation? > + > +/* free all dapm widgets and resources */ > +void dapm_free_widgets(struct snd_soc_codec *codec) > +{ > + struct snd_soc_dapm_widget *w, *lw = NULL; > + struct snd_soc_dapm_path *p, *lp = NULL; > + struct list_head *l; > + > + list_for_each(l, &codec->dapm_widgets) > + { > + w = list_entry(l, struct snd_soc_dapm_widget, list); > + if (lw) > + kfree(lw); You can skip if (lw). kfree() takes NULL safely. > + lw = w; > + } > + kfree(lw); No need for list_del(), BTW? Takashi ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys -- and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxxxxxxx https://lists.sourceforge.net/lists/listinfo/alsa-devel