Received: by 2002:a05:6a10:9e8c:0:0:0:0 with SMTP id y12csp1166992pxx; Fri, 30 Oct 2020 03:57:59 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxA2z4nGyEiQnaYWNSZQ3bQ7zSmoxAeKYJRf+eMCBfjDejqCNOefCcTzBknslHwdrSiwgpO X-Received: by 2002:a05:6402:1119:: with SMTP id u25mr1696023edv.37.1604055478861; Fri, 30 Oct 2020 03:57:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1604055478; cv=none; d=google.com; s=arc-20160816; b=Dt2dCBhuNiwI3BeGplPxXaL5gLzaqOhN3FSH2VY+7/2+9Tc3Ax9EzecmECZ+6EVPwJ eHwWwDwdlUuGJ3p0qm40yGy3Y881iI1X7enoCVmXF9oQw62861PL6J53AFAED5XttXp8 4Z7D1S5nbLIMqOXhTjZ2/EsbmaPjH8RPHZDynZg4DXfaqXirGvcoLD+kbgfs8+zfbG/d 54HcYZpA54Hk3P2VCfVXI0vNqX9KyYecjMSZ8NRLpymv9Q1DIEJLwTfAY/qqacchITtF hB3bn/WhG6ahLkh2cN8BmzbhKWzIO87KaNQlXBcXoauslBAPsnt9L8jnr7JDP4rxOc3q lFeQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=OrDPQCETMONsdP1Wo5HDq5W2Iv1t7cbpuMuL/V4LMYs=; b=ihjsrSFPakmdfXTm09F6WVgg7vTHFkkOt3ratlEZQBl9jRLPuCKGaFLK2mqLLVdYWP bU1hwWT3cidb1IRKkisfwlW+AedUkoVSh3zp9r+LIrbJDwoHWs7pRhZoh1r9Y6xG5pA9 ApnsYVGrdiyBEq9Qd1u8Hscp7P8x9AmTJSa1JdWv2sjT+YdbbcS8E3P9Z6drTuFBiB+G rdN8Bws5VP2adJBCtKnIxQdmF6JuvRc3/YkHoMw8l4xC1bsa6qmwt+p4+ZBsGoY3K0Ef iIoyEc0AKi777LRy4Huu3fMh6od5RYE+/7Ox4P6ZjCZcTtRuIOaX9mb2tMx5t6mjtFWe l0bA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cjplITYQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id bu8si4985377edb.95.2020.10.30.03.57.36; Fri, 30 Oct 2020 03:57:58 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=cjplITYQ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726293AbgJ3Kz3 (ORCPT + 99 others); Fri, 30 Oct 2020 06:55:29 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:57738 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726264AbgJ3Kz3 (ORCPT ); Fri, 30 Oct 2020 06:55:29 -0400 Received: from mail-lj1-x243.google.com (mail-lj1-x243.google.com [IPv6:2a00:1450:4864:20::243]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC30FC0613CF for ; Fri, 30 Oct 2020 03:55:28 -0700 (PDT) Received: by mail-lj1-x243.google.com with SMTP id d25so6348452ljc.11 for ; Fri, 30 Oct 2020 03:55:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=OrDPQCETMONsdP1Wo5HDq5W2Iv1t7cbpuMuL/V4LMYs=; b=cjplITYQXQCRVceOSq28/kTtGwdbqumx3pVwhPkbIPzBWV9e8DJ77sLhvzUVaUrySo br4uT+RnaqqI3JBrwn5G8MQXj9fJ/08Y/iqO17312PkfdI45gGGVEX+R1JhiuSGgACLt m9V6o3BEpPQ3SmnS20Wuog9+qrP+XfV4oZImU6SAJ78N4ksYTMljgAoYLk++PxTjig93 0aaFLVJ1sT1cdQhkgosIDxv8tha554npZmsyjaapwvOI09iU0o0lolyeLfIzLMkj2KCF TgQB87wggPvnaUzn8d8Zdmm22xv5L/p3rL24aCGk4/YocDFQXK8iSkj3FXdM3Bz2/RAf mpVQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=OrDPQCETMONsdP1Wo5HDq5W2Iv1t7cbpuMuL/V4LMYs=; b=RsRbZh3XXgyuim9SnqB+nsNRWcv/K0NoWpDJlgUqxY84HudUeFGJdm25vGdnG/xnFP SvCIazR/uHmS4usrn27NNeHG1/pkcBECrRAbbMEezt9vLFURtWcKUoW2mvEMTiUexhPC x7w0rsqjRPdJUaSrosrja4klobiZuASUhVBHLrqmo9hvboP0wN5/FbAVoxTda+0sVLaZ HLnVnfoJ6C3PaSalBIwxIE3Oxc0rOt7wnt0vdvjazR2enTCklUotHbvvO1QkiCvHzf1H QyIw6wZAeZSL8FOWud6fEd/jsPVKzqVHXf3FxDW434uWIcC8rGUII75eUJ2Wx5gN4Ca2 2PfQ== X-Gm-Message-State: AOAM533pIldS8mWusphORJYqggGtvHbDMSzknVbG96mBTbB5AqnkV7gt JQrQmtB8ILOpGu6VE5qH49Siz/SAhjgDL6JLm3mR+Q== X-Received: by 2002:a2e:9449:: with SMTP id o9mr83255ljh.457.1604055327434; Fri, 30 Oct 2020 03:55:27 -0700 (PDT) MIME-Version: 1.0 References: <20201030075724.1616766-1-ajye_huang@compal.corp-partner.google.com> <20201030075724.1616766-3-ajye_huang@compal.corp-partner.google.com> In-Reply-To: From: Ajye Huang Date: Fri, 30 Oct 2020 18:55:16 +0800 Message-ID: Subject: Re: [PATCH v2 2/2] ASoC: qcom: sc7180: Modify machine driver for 2mic To: Tzung-Bi Shih Cc: Ajye Huang , Linux Kernel Mailing List , Mark Brown , Rohit kumar , Banajit Goswami , Patrick Lai , Srinivasa Rao Mandadapu , Srini Kandagatla , Andy Gross , Bjorn Andersson , Liam Girdwood , Rob Herring , Jaroslav Kysela , Cheng-Yi Chiang , Tzung-Bi Shih , Douglas Anderson , "moderated list:ARM/Mediatek SoC support" , linux-arm-msm , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , ALSA development Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Oct 30, 2020 at 5:23 PM Tzung-Bi Shih wrote: > > On Fri, Oct 30, 2020 at 3:57 PM Ajye Huang wrote: > > +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. > > +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) { > > + 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; }