Received: by 2002:a17:90a:c8b:0:0:0:0 with SMTP id v11csp2291459pja; Fri, 19 Apr 2019 11:23:48 -0700 (PDT) X-Google-Smtp-Source: APXvYqwkRw4erbUMaAWP/9lkK6qiPhOf4OHvnl9UFOIjIBUOx3kQua5+VidnZoQEMaougCcZRZjN X-Received: by 2002:a63:d602:: with SMTP id q2mr5163190pgg.199.1555698228860; Fri, 19 Apr 2019 11:23:48 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1555698228; cv=none; d=google.com; s=arc-20160816; b=Jt+Bi+uTpeQNhVfQfIGwWOzSQUp3HmPDD2GWmMC6UVQCUNgXsI/b728a3OfzI3EGm7 6H+dADYnjuL/AgiBSBnfdFm8U58mRyiqMVs+NETc7mycWSAEVCBeTQoFC9gWT4V/Zr/4 qaoMDxKRtD2u2ZoprcDuz5OfZnT3YG6Lpz39eItR5Ht7PRT4ug2FNenaoGC0rP0qhCX0 lxOyZWMn1LsezxCFUEv0BCiK6zmjWqkyrSBWzCQpzAYwsFG59TjZA4TkCQkvX2oKIBFI m99mryHRC/ObJlxdzll9LXpuFXg808itLbwV9ISZUYjlVqbVykkY1FHtCOHYcmrfcJXu CasA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=Mwip4xZezPK38BfWEq5HR+HyqGo66D590Ox/hie+rI0=; b=Z58ey5+qe4LkHXqkyuTfcPJQAUtc9X03XKOfWOqVOOzNaBgwPRAWdqO6sdaE67pvZB o+U8RlNCV3l1M5p+4NkjRWhIp0+9nhKFqhA9AimC/pVHJy0bQvvts70+VLLNAufGe7vT aORKnxz7KFEHbEmlMVz2+xYDa7jTEUyxIV6KDH8U8KGNnj3NDVonk+Jx13gh2vwFMz+C vvpyMwIwHjBP6YV5MXuMfh4ojnxLRUqXSQoW3cHCcF0WD4Sy5RFxg7bwRUhiDa95HXiE KV0yfqxwN4/K+pWCPbtQxL5NXJH/Lk8fDDfpRJ0kEAyf3sfBuywCrchsymNqdHX3UqOv iIoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SeQY8qwS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id f3si6114120pfc.92.2019.04.19.11.23.34; Fri, 19 Apr 2019 11:23:48 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=SeQY8qwS; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727825AbfDSSWt (ORCPT + 99 others); Fri, 19 Apr 2019 14:22:49 -0400 Received: from mail-pf1-f193.google.com ([209.85.210.193]:44368 "EHLO mail-pf1-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727580AbfDSSWq (ORCPT ); Fri, 19 Apr 2019 14:22:46 -0400 Received: by mail-pf1-f193.google.com with SMTP id y13so2871133pfm.11 for ; Fri, 19 Apr 2019 11:22:46 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=Mwip4xZezPK38BfWEq5HR+HyqGo66D590Ox/hie+rI0=; b=SeQY8qwSDlpnGOISH0mOfevIBeUOKABdZwGg58V61jewHL90Zin0piuB9cXNkucHYB NjyqKWIGD8TOXK4SBfQKo//dTl5Mzrmcyex9yTzA3zlgfV7zJPF3adCqL1xLjyrDRTvQ RoiMuNuDmU6tvUDSmsYO4cXoDvGObu9Vg2QTTzbH9UlK8iyDtYSe4NCur9F/7kSR5C9T emJnwjm5lspYnxE9H0fk6P8AcD/iUT0VQpuBXRRULrhgdduJOsRT9KQAmBiiYem47GmO Fl5WvY9lp/tjOvgc261fc/K2Hlao5xws8CHm8wJgn4vhInVhYYKKAS3MWENqay3Q2KhQ t9iw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=Mwip4xZezPK38BfWEq5HR+HyqGo66D590Ox/hie+rI0=; b=HjEnkwKKsQ1FLoLLrEt+On+00DD3NvmKu5oOnvQPoiZmEAsbK/4dPsZldQsNDG+nQk oJbatxvO4tq45HZ/uIA6zMH2nPqT+1VsivClEfw4Rx0J01Y3yX9330fI6wXuQOEBQ6iu Bh3LT0eRN4FhiI1jABt8aO5ghOOaItYtrJutjmFgq14Z4FAq0rbAX2lFfxse4m5jREe1 8qm0gGyCpBGtVEiwO1+VjvGtk3mjsOy91W8uphws2dvYQGLg604qCRex6F5uZWP/aLws RkP9aYJFNlETTXHf0ayK2R6zaogZ0O5An+pLTT0MAACeI2452XhtYWRbT84urH1Y9CTz Vbsw== X-Gm-Message-State: APjAAAWy3k4bPein1MHGYCNm0F3JHcVRnZ/fmDDSoiEwxQ5IOcVnKbew cepyr0RuP0cCwWGvTJMWXYQ= X-Received: by 2002:a62:ee0a:: with SMTP id e10mr5392640pfi.6.1555698165677; Fri, 19 Apr 2019 11:22:45 -0700 (PDT) Received: from Asurada-Nvidia.nvidia.com (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id i15sm7397966pfd.162.2019.04.19.11.22.44 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 19 Apr 2019 11:22:45 -0700 (PDT) Date: Fri, 19 Apr 2019 11:22:42 -0700 From: Nicolin Chen To: "S.j. Wang" Cc: "timur@kernel.org" , "Xiubo.Lee@gmail.com" , "festevam@gmail.com" , "broonie@kernel.org" , "alsa-devel@alsa-project.org" , "linuxppc-dev@lists.ozlabs.org" , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH V4 2/3] ASoC: fsl_asrc: replace the process_option table with function Message-ID: <20190419182241.GB1136@Asurada-Nvidia.nvidia.com> References: <0f7a6907c73e110c797b478fedaba2fc47b5e994.1555669068.git.shengjiu.wang@nxp.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0f7a6907c73e110c797b478fedaba2fc47b5e994.1555669068.git.shengjiu.wang@nxp.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Apr 19, 2019 at 10:23:53AM +0000, S.j. Wang wrote: > @@ -289,6 +318,12 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair) > return -EINVAL; > } > > + ret = fsl_asrc_sel_proc(inrate, outrate, &pre_proc, &post_proc); Since the function always return 0, I am thinking of treating this function as a lookup function, and then moving this call right before the register settings -- as we have already made sure that both inrate and outrate are supported. > + if (ret) { > + pair_err("No supported pre-processing options\n"); > + return ret; > + } And probably no longer need this error-out. If there's a new limitation related to this function, I believe we can add it to the rate validation section as we are doing now -- better to have rate validation code at one place. > @@ -380,8 +415,8 @@ static int fsl_asrc_config_pair(struct fsl_asrc_pair *pair) > /* Apply configurations for pre- and post-processing */ Here: - /* Apply configurations for pre- and post-processing */ + /* Select and apply configurations for pre- and post-processing */ + fsl_asrc_sel_proc(inrate, outrate, &pre_proc, &post_proc); > regmap_update_bits(asrc_priv->regmap, REG_ASRCFG, > ASRCFG_PREMODi_MASK(index) | ASRCFG_POSTMODi_MASK(index), > - ASRCFG_PREMOD(index, process_option[in][out][0]) | > - ASRCFG_POSTMOD(index, process_option[in][out][1])); > + ASRCFG_PREMOD(index, pre_proc) | > + ASRCFG_POSTMOD(index, post_proc));