From patchwork Thu Jan 15 08:08:34 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 5637511 Return-Path: X-Original-To: patchwork-alsa-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 43F379F358 for ; Thu, 15 Jan 2015 08:13:02 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 50D692015A for ; Thu, 15 Jan 2015 08:13:01 +0000 (UTC) Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) by mail.kernel.org (Postfix) with ESMTP id 111A420149 for ; Thu, 15 Jan 2015 08:13:00 +0000 (UTC) Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2D772260575; Thu, 15 Jan 2015 09:12:59 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 Received: from alsa0.perex.cz (localhost [IPv6:::1]) by alsa0.perex.cz (Postfix) with ESMTP id 151A1260426; Thu, 15 Jan 2015 09:10:34 +0100 (CET) X-Original-To: alsa-devel@alsa-project.org Delivered-To: alsa-devel@alsa-project.org Received: by alsa0.perex.cz (Postfix, from userid 1000) id 2BC0A260651; Thu, 15 Jan 2015 09:10:31 +0100 (CET) Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id F326D260441 for ; Thu, 15 Jan 2015 09:08:37 +0100 (CET) Received: from unknown (HELO relmlir2.idc.renesas.com) ([10.200.68.152]) by relmlie2.idc.renesas.com with ESMTP; 15 Jan 2015 17:08:36 +0900 Received: from relmlac3.idc.renesas.com (relmlac3.idc.renesas.com [10.200.69.23]) by relmlir2.idc.renesas.com (Postfix) with ESMTP id 92C3E4AE19; Thu, 15 Jan 2015 17:08:36 +0900 (JST) Received: by relmlac3.idc.renesas.com (Postfix, from userid 0) id 8C5C918070; Thu, 15 Jan 2015 17:08:36 +0900 (JST) Received: from relmlac3.idc.renesas.com (localhost [127.0.0.1]) by relmlac3.idc.renesas.com (Postfix) with ESMTP id 8B12B1806F; Thu, 15 Jan 2015 17:08:36 +0900 (JST) Received: from relmlii2.idc.renesas.com [10.200.68.66] by relmlac3.idc.renesas.com with ESMTP id TBD20321; Thu, 15 Jan 2015 17:08:36 +0900 X-IronPort-AV: E=Sophos;i="5.09,402,1418050800"; d="scan'208";a="178817051" Received: from mail-hk1lp0120.outbound.protection.outlook.com (HELO APAC01-HK1-obe.outbound.protection.outlook.com) ([207.46.51.120]) by relmlii2.idc.renesas.com with ESMTP/TLS/AES256-SHA; 15 Jan 2015 17:08:35 +0900 Received: from remon.renesas.com (211.11.155.132) by HKXPR06MB165.apcprd06.prod.outlook.com (10.242.124.16) with Microsoft SMTP Server (TLS) id 15.1.59.20; Thu, 15 Jan 2015 08:08:34 +0000 Message-ID: <87twzstqhm.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto User-Agent: Wanderlust/2.14.0 Emacs/23.3 Mule/6.0 To: Mark Brown In-Reply-To: <87bnm0v5d0.wl%kuninori.morimoto.gx@renesas.com> References: <87bnm0v5d0.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI 1.14.6 - "Maruoka") Date: Thu, 15 Jan 2015 08:08:34 +0000 X-Originating-IP: [211.11.155.132] X-ClientProxiedBy: SINPR01CA0016.apcprd01.prod.exchangelabs.com (10.141.109.16) To HKXPR06MB165.apcprd06.prod.outlook.com (10.242.124.16) Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; X-DmarcAction-Test: None X-Microsoft-Antispam: UriScan:; X-Microsoft-Antispam: BCL:0;PCL:0;RULEID:(3005004);SRVR:HKXPR06MB165; X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004); SRVR:HKXPR06MB165; X-Forefront-PRVS: 0457F11EAF X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10019020)(6009001)(189002)(199003)(33646002)(86362001)(68736005)(575784001)(23726002)(101416001)(77096005)(2950100001)(83506001)(50986999)(69596002)(76176999)(62966003)(77156002)(64706001)(19580395003)(19580405001)(54356999)(87976001)(47776003)(50466002)(66066001)(92566002)(53416004)(106356001)(81156004)(105586002)(46406003)(36756003)(97736003)(46102003)(122386002)(42186005)(229853001)(40100003)(110136001); DIR:OUT; SFP:1102; SCL:1; SRVR:HKXPR06MB165; H:remon.renesas.com; FPR:; SPF:None; MLV:sfv; PTR:InfoNoRecords; MX:1; A:1; LANG:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:;SRVR:HKXPR06MB165; X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2015 08:08:34.1519 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HKXPR06MB165 Cc: Linux-ALSA , Simon , Liam Girdwood Subject: [alsa-devel] [PATCH 12/16] ASoC: rsnd: save priv in struct rsnd_dai X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org X-Virus-Scanned: ClamAV using ClamSMTP From: Kuninori Morimoto Current rsnd driver has rsnd_mod_to_priv() macro, and struct rsnd_mod has struct rsnd_priv pointer. But, it is waste of memory from data structure point of view. Today we can link mod <-> io <-> rdai each other, so saving priv in rdai is very reasonable. Signed-off-by: Kuninori Morimoto --- sound/soc/sh/rcar/core.c | 5 ++--- sound/soc/sh/rcar/dvc.c | 2 +- sound/soc/sh/rcar/rsnd.h | 9 +++++---- sound/soc/sh/rcar/src.c | 2 +- sound/soc/sh/rcar/ssi.c | 6 +++--- 5 files changed, 12 insertions(+), 12 deletions(-) diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 6fa8709..f0bb137 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c @@ -149,14 +149,12 @@ char *rsnd_mod_dma_name(struct rsnd_mod *mod) return mod->ops->dma_name(mod); } -void rsnd_mod_init(struct rsnd_priv *priv, - struct rsnd_mod *mod, +void rsnd_mod_init(struct rsnd_mod *mod, struct rsnd_mod_ops *ops, struct clk *clk, enum rsnd_mod_type type, int id) { - mod->priv = priv; mod->id = id; mod->ops = ops; mod->type = type; @@ -868,6 +866,7 @@ static int rsnd_dai_probe(struct platform_device *pdev, * init rsnd_dai */ snprintf(rdai[i].name, RSND_DAI_NAME_SIZE, "rsnd-dai.%d", i); + rdai[i].priv = priv; /* * init snd_soc_dai_driver diff --git a/sound/soc/sh/rcar/dvc.c b/sound/soc/sh/rcar/dvc.c index 4ddca4f..38a5f33 100644 --- a/sound/soc/sh/rcar/dvc.c +++ b/sound/soc/sh/rcar/dvc.c @@ -351,7 +351,7 @@ int rsnd_dvc_probe(struct platform_device *pdev, dvc->info = &info->dvc_info[i]; - rsnd_mod_init(priv, &dvc->mod, &rsnd_dvc_ops, + rsnd_mod_init(&dvc->mod, &rsnd_dvc_ops, clk, RSND_MOD_DVC, i); dev_dbg(dev, "CMD%d probed\n", i); diff --git a/sound/soc/sh/rcar/rsnd.h b/sound/soc/sh/rcar/rsnd.h index 6154535..11a1c41 100644 --- a/sound/soc/sh/rcar/rsnd.h +++ b/sound/soc/sh/rcar/rsnd.h @@ -221,7 +221,6 @@ struct rsnd_dai_stream; struct rsnd_mod { int id; enum rsnd_mod_type type; - struct rsnd_priv *priv; struct rsnd_mod_ops *ops; struct rsnd_dma dma; struct rsnd_dai_stream *io; @@ -256,7 +255,7 @@ struct rsnd_mod { #define __rsnd_mod_call_pcm_new 0 #define __rsnd_mod_call_fallback 0 -#define rsnd_mod_to_priv(mod) ((mod)->priv) +#define rsnd_mod_to_priv(mod) (rsnd_io_to_priv(rsnd_mod_to_io(mod))) #define rsnd_mod_to_dma(mod) (&(mod)->dma) #define rsnd_dma_to_mod(_dma) container_of((_dma), struct rsnd_mod, dma) #define rsnd_mod_to_io(mod) ((mod)->io) @@ -264,8 +263,7 @@ struct rsnd_mod { #define rsnd_mod_hw_start(mod) clk_prepare_enable((mod)->clk) #define rsnd_mod_hw_stop(mod) clk_disable_unprepare((mod)->clk) -void rsnd_mod_init(struct rsnd_priv *priv, - struct rsnd_mod *mod, +void rsnd_mod_init(struct rsnd_mod *mod, struct rsnd_mod_ops *ops, struct clk *clk, enum rsnd_mod_type type, @@ -291,6 +289,7 @@ struct rsnd_dai_stream { #define rsnd_io_to_mod_src(io) ((io)->mod[RSND_MOD_SRC]) #define rsnd_io_to_mod_dvc(io) ((io)->mod[RSND_MOD_DVC]) #define rsnd_io_to_rdai(io) ((io)->rdai) +#define rsnd_io_to_priv(io) (rsnd_rdai_to_priv(rsnd_io_to_rdai(io))) #define rsnd_io_is_play(io) (&rsnd_io_to_rdai(io)->playback == io) #define rsnd_io_to_runtime(io) ((io)->substream ? \ (io)->substream->runtime : NULL) @@ -300,6 +299,7 @@ struct rsnd_dai { char name[RSND_DAI_NAME_SIZE]; struct rsnd_dai_stream playback; struct rsnd_dai_stream capture; + struct rsnd_priv *priv; unsigned int clk_master:1; unsigned int bit_clk_inv:1; @@ -310,6 +310,7 @@ struct rsnd_dai { #define rsnd_rdai_nr(priv) ((priv)->rdai_nr) #define rsnd_rdai_is_clk_master(rdai) ((rdai)->clk_master) +#define rsnd_rdai_to_priv(rdai) ((rdai)->priv) #define for_each_rsnd_dai(rdai, priv, i) \ for (i = 0; \ (i < rsnd_rdai_nr(priv)) && \ diff --git a/sound/soc/sh/rcar/src.c b/sound/soc/sh/rcar/src.c index 0d136cd..8c22d21 100644 --- a/sound/soc/sh/rcar/src.c +++ b/sound/soc/sh/rcar/src.c @@ -889,7 +889,7 @@ int rsnd_src_probe(struct platform_device *pdev, src->info = &info->src_info[i]; - rsnd_mod_init(priv, &src->mod, ops, clk, RSND_MOD_SRC, i); + rsnd_mod_init(&src->mod, ops, clk, RSND_MOD_SRC, i); dev_dbg(dev, "SRC%d probed\n", i); } diff --git a/sound/soc/sh/rcar/ssi.c b/sound/soc/sh/rcar/ssi.c index b5a2fd6..9b89f6c 100644 --- a/sound/soc/sh/rcar/ssi.c +++ b/sound/soc/sh/rcar/ssi.c @@ -125,7 +125,7 @@ static void rsnd_ssi_status_check(struct rsnd_mod *mod, static int rsnd_ssi_master_clk_start(struct rsnd_ssi *ssi, struct rsnd_dai_stream *io) { - struct rsnd_priv *priv = rsnd_mod_to_priv(&ssi->mod); + struct rsnd_priv *priv = rsnd_io_to_priv(io); struct snd_pcm_runtime *runtime = rsnd_io_to_runtime(io); struct device *dev = rsnd_priv_to_dev(priv); int i, j, ret; @@ -179,7 +179,7 @@ static void rsnd_ssi_master_clk_stop(struct rsnd_ssi *ssi) static void rsnd_ssi_hw_start(struct rsnd_ssi *ssi, struct rsnd_dai_stream *io) { - struct rsnd_priv *priv = rsnd_mod_to_priv(&ssi->mod); + struct rsnd_priv *priv = rsnd_io_to_priv(io); struct rsnd_dai *rdai = rsnd_io_to_rdai(io); struct device *dev = rsnd_priv_to_dev(priv); u32 cr_mode; @@ -730,7 +730,7 @@ int rsnd_ssi_probe(struct platform_device *pdev, else if (rsnd_ssi_pio_available(ssi)) ops = &rsnd_ssi_pio_ops; - rsnd_mod_init(priv, &ssi->mod, ops, clk, RSND_MOD_SSI, i); + rsnd_mod_init(&ssi->mod, ops, clk, RSND_MOD_SSI, i); rsnd_ssi_parent_clk_setup(priv, ssi); }