Thread (7 messages) 7 messages, 3 authors, 2020-11-02

Re: [PATCH v2 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic

From: Ajye Huang <hidden>
Date: 2020-10-30 10:55:31
Also in: alsa-devel, linux-arm-msm, linux-devicetree, lkml

On Fri, Oct 30, 2020 at 5:23 PM Tzung-Bi Shih [off-list ref] wrote:
On Fri, Oct 30, 2020 at 3:57 PM Ajye Huang [off-list ref] wrote:
quoted
+static struct gpio_desc *dmic_sel;
+static int dmic_switch;
If you really need them, you should put them in struct sc7180_snd_data.
Thank you, I will do it.
quoted
+static int dmic_set(struct snd_kcontrol *kcontrol,
+                   struct snd_ctl_elem_value *ucontrol)
+{
+       if (dmic_sel) {
if (IS_ERR(dmic_sel))
But I think you don't need to check dmic_sel.  Suppose your _probe()
already returned error, the code here shouldn't be called.
OK, I will remove the discriminant if (dmic_sel) {
quoted
+               dmic_switch = ucontrol->value.integer.value[0];
Looks like it can be a local variable.  You don't need to save dmic_switch.
But dmic_get() will need dmic_switch, should i keep dmic_switch?
static int dmic_get(struct snd_kcontrol *kcontrol,
    struct snd_ctl_elem_value *ucontrol)
{
ucontrol->value.integer.value[0] = dmic_switch;
return 0;
}

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help