Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3170882ybb; Mon, 13 Apr 2020 02:11:57 -0700 (PDT) X-Google-Smtp-Source: APiQypIZPmMAlsG59A/ItR5zU44IlQ54gjU6WtsMSQfTP4hNTxjpMWLVInLfYtr/iXGQcABh0aQB X-Received: by 2002:a50:d5c8:: with SMTP id g8mr15721063edj.370.1586769117664; Mon, 13 Apr 2020 02:11:57 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1586769117; cv=none; d=google.com; s=arc-20160816; b=o7A3iWJ4+f/jigiUym735KsaelE2nIwJGFnZAHCwE3CKpUa/TaXbUQTX7RV68m9aZ6 +QnHrlXd5HQfqyd5ZAnzkqGTCsDz7MQvl9k6AAq6pSpr5a/p7l0uvTZFjA+Gl9GSn+SC GdfyOjrh5/6xj5RO7v9Xo58w+kNmlhqgmPNXC+7lkdIgQ1rQiu2iiFAfAfrrjynIhy5C FFSG6o90oEc43wltrU/8Te9E4yDjCNawgtzkN5HU5itb26aZ9BfXZ/iYqJs8vh2Ln0og CLEZBncq6oTAqTAThg0OwS8crU+yOavwzSkc1tcugeu+V3bwsX9fIJ9DvFVstOPxhSVb 3GGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=2nT3Va3E4vwilp1Fdp7ARRfOyF9O8UdBycnmN+9Xhsw=; b=Tljy1spWTYwDY2uZZFCJlxrz3X24LQANGsczjiD3lrrZb472GUO9wAzODyn4iBgpxh ndsel+nymC+CPtWHPpzz/7h8siLWjhkCvAiwo9ldFw2QiY0cVYA2w07IY2uc1Zi4rPFe hbidbSY5wCYdJCMZsQra8TUpBmoCl96uZ0HUQFi+4jDFzmXBnNGtjOuCvJ/eKLuphlju JgY/6YCsej/RhuBZ6roelupempnEur2F/2QaPH/W+SPGZKl9DTbZJTlZOqT+vAxKd+GX GGbsuGzWgqcSp+iOl7OgGZgfk+uTVQM33rGZ5/6F70SK1eU0i238cAgqRm55Cj/aAzOk gYKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Lm3du3ZN; spf=pass (google.com: best guess record for 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q14si6083434edi.65.2020.04.13.02.11.33; Mon, 13 Apr 2020 02:11:57 -0700 (PDT) Received-SPF: pass (google.com: best guess record for 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=@gmail.com header.s=20161025 header.b=Lm3du3ZN; spf=pass (google.com: best guess record for 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=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729187AbgDMHTV (ORCPT + 99 others); Mon, 13 Apr 2020 03:19:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.18]:58974 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727544AbgDMHTU (ORCPT ); Mon, 13 Apr 2020 03:19:20 -0400 Received: from mail-qt1-x844.google.com (mail-qt1-x844.google.com [IPv6:2607:f8b0:4864:20::844]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E07DC008651; Mon, 13 Apr 2020 00:19:20 -0700 (PDT) Received: by mail-qt1-x844.google.com with SMTP id l13so3718287qtr.7; Mon, 13 Apr 2020 00:19:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc:content-transfer-encoding; bh=2nT3Va3E4vwilp1Fdp7ARRfOyF9O8UdBycnmN+9Xhsw=; b=Lm3du3ZNa8HvaBi6XryhBn8zFP8p7bnaPyDhrcxfNIvLvG0xa9ym0IHVYBQ/nv9i9R sayue0wrNelJykTg46+IjgbVRRHGLYy7MZ6Lc0xIeBoLYkv5gtnJZXaDFqTWw0RZzYAl d9d0fz9wc5Fx2L+T6rvAWERt7aUZ4w8U+UXjORxiMrtg6Vps8Z93DdGOv9qIGL3LYGMQ vjInJ5kMEmKYQfraZHjLv6FpJ0LYJzSJYpJRnhzsCcCaaop1hAG98Uq7m1vU/LImOmDi eiLqXAV1rFX/qITBUBI3RwJIdPorIsc7k32KSrLj8kuzqJDfkJuSRClis03CI5UhSnEg UJxw== 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:content-transfer-encoding; bh=2nT3Va3E4vwilp1Fdp7ARRfOyF9O8UdBycnmN+9Xhsw=; b=X00MONC6kSEwcSUJtQhskjVo8K6S662WDhUd0XE2B07eC5+/wLL8hz0fAGSDti3dR4 /iHMq3sg6iMpMs0KLPso+BbaoFOfhd68vf8zNXYmepnP7o40YD2tQYKcEgf6DqVqyr3z px5HNFHvlRxZ4U3ywzzs3/nVzhQvVgpxGtg68+vcPuWucLOUyYbO0HvbaNHNCIl9ADKG psXKF/LLLbWk5kptX3kxA4xltfiyvpuUsKAYJnckGuIfZldYPu/o8CKlSAe6QHEyXu6/ 5+NOdp3IOKvIeWvLihYXLk0PVbsz1TqM0eUvdhDA4TuWHpUKfx/mXrfbXJLEO6qmRvbd pamQ== X-Gm-Message-State: AGi0PuackcR23og4P0CA4RwzKWsRaQT9eShJ1smcOCgwNkYd+3Rgcfw6 8DC0b4cCwswA8mLdBa/u5hxhSSYYJtnsphi9d7I= X-Received: by 2002:ac8:22ad:: with SMTP id f42mr9986167qta.292.1586762359717; Mon, 13 Apr 2020 00:19:19 -0700 (PDT) MIME-Version: 1.0 References: <93531963f028aabf9176173de3c6038a200acb89.1585726761.git.shengjiu.wang@nxp.com> <20200406234819.GB20945@Asurada-Nvidia.nvidia.com> <20200412020814.GA5984@Asurada> <20200413043143.GA9116@Asurada> In-Reply-To: <20200413043143.GA9116@Asurada> From: Shengjiu Wang Date: Mon, 13 Apr 2020 15:19:08 +0800 Message-ID: Subject: Re: [PATCH v6 5/7] ASoC: fsl_asrc: Move common definition to fsl_asrc_common To: Nicolin Chen Cc: Shengjiu Wang , Mark Rutland , "open list:OPEN FIRMWARE AND FLATTENED DEVICE TREE BINDINGS" , Linux-ALSA , Timur Tabi , Xiubo Li , linuxppc-dev@lists.ozlabs.org, Takashi Iwai , Liam Girdwood , Rob Herring , Mark Brown , Fabio Estevam , linux-kernel Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Apr 13, 2020 at 12:31 PM Nicolin Chen wrot= e: > > On Mon, Apr 13, 2020 at 11:16:31AM +0800, Shengjiu Wang wrote: > > On Sun, Apr 12, 2020 at 10:08 AM Nicolin Chen = wrote: > > > > > > On Sat, Apr 11, 2020 at 01:49:43PM +0800, Shengjiu Wang wrote: > > > > > > > > > diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_a= src_dma.c > > > > > > index b15946e03380..5cf0468ce6e3 100644 > > > > > > --- a/sound/soc/fsl/fsl_asrc_dma.c > > > > > > +++ b/sound/soc/fsl/fsl_asrc_dma.c > > > > > > > > > > > @@ -311,11 +311,12 @@ static int fsl_asrc_dma_startup(struct sn= d_soc_component *component, > > > > > > return ret; > > > > > > } > > > > > > > > > > > > - pair =3D kzalloc(sizeof(struct fsl_asrc_pair), GFP_KERNEL= ); > > > > > > + pair =3D kzalloc(sizeof(struct fsl_asrc_pair) + PAIR_PRIV= AT_SIZE, GFP_KERNEL); > > > > > > > > > > If we only use the PAIR_PRIVATE_SIZE here, maybe we can put the > > > > > define in this file too, rather than in the header file. > > > > > > > > > > And could fit 80 characters: > > > > > > > > > > + pair =3D kzalloc(sizeof(*pair) + PAIR_PRIVAT_SIZE, GFP_KE= RNEL); > > > > > > > I will use a function pointer > > > > int (*get_pair_priv_size)(void) > > > > > > Since it's the size of pair or cts structure, could be just a > > > size_t variable? > > > > Yes, should be "size_t (*get_pair_priv_size)(void)" > > Does it have to be a function? -- how about this: > > struct pair { > ... > size_t private_size; > void *private; > }; > > probe/or-somewhere() { > ... > pair->private =3D pair_priv; we need to know the size of pair_priv before allocate memory. > pair->private_size =3D sizeof(*pair_priv); > ... > } In fsl_asrc_dma_startup, we need to allocate memory for pair and pair->private=EF=BC=8Cbut we don't know the object, so we don't know the size of private, so function pointer is better. best regards wang shengjiu