Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758520AbcJQIcO (ORCPT ); Mon, 17 Oct 2016 04:32:14 -0400 Received: from relmlor3.renesas.com ([210.160.252.173]:58001 "EHLO relmlie2.idc.renesas.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1757526AbcJQIcJ (ORCPT ); Mon, 17 Oct 2016 04:32:09 -0400 X-IronPort-AV: E=Sophos;i="5.22,559,1449500400"; d="scan'";a="223078435" Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=kuninori.morimoto.gx@renesas.com; Message-ID: <87r37f4c6v.wl%kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 01/23] ASoC: simple-scu-card: code sync: follow to simple family style User-Agent: Wanderlust/2.15.9 Emacs/24.3 Mule/6.0 To: Rob Herring , Mark Brown CC: Linux-ALSA , Liam Girdwood , Simon , Laurent , Guennadi , Grant Likely , Frank Rowand , Linux-DT , Linux-Kernel In-Reply-To: <87shrv4c8x.wl%kuninori.morimoto.gx@renesas.com> References: <87shrv4c8x.wl%kuninori.morimoto.gx@renesas.com> MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="US-ASCII" Date: Mon, 17 Oct 2016 08:32:03 +0000 X-Originating-IP: [211.11.155.144] X-ClientProxiedBy: OS2PR01CA0062.jpnprd01.prod.outlook.com (10.165.51.150) To HK2PR0601MB1443.apcprd06.prod.outlook.com (10.165.182.149) X-MS-Office365-Filtering-Correlation-Id: bb044ae4-babc-499e-800e-08d3f66812d1 X-Microsoft-Exchange-Diagnostics: 1;HK2PR0601MB1443;2:9Lt7KsVnA1rERFaFZWHpGpygojfymzO8PUhx7s+vZoh1G/A6CiA/g9OGY3wH/ghoqpDt3v0CznFVhCGyo7i6kSRTQ0Jx/ZGXEdQnrosS355jvu6bL1G/x9/ZiMMVEtl3ZBetwlFRQH3GqtMFN8U39Ne4pwpAHFfOlHN36uhZ+EmB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FPXIqJfQD9hJVdzaKeuu0fhjMB2/mSWM7yvtEwYcchmdAj8JzqI8y8PGLLZ0Exfc0wIyntnhMOX/7hpAoO7Fcn3eiKVDdD4bRh9HKWILpVP2ENcbc9DabaE+btezuUsQywOtd291bF+BzT/G+itXR7ggiKDyM6o1WMa9JnBfBJpRBHKDNddoaRiwunvP86Xo6WaOyuC5aeQur4gUs0EY9jgwo692ZMMxgYWQyTNO8THRCOE/pDIdD4uUMJfCCCRBm8DGtUvwqwf9nEeUF0OdQ4pI/tXsYwKZLhjz+r/tROySQ2axoGcu4xR0yLuMIphV24DTpOmDpxUpxBezFLa+HcWG/jqnWUUFwlgLh21JlLv5UeGpapsiENbon/2+QoDiEvGRcv2c1EMr7RM9/tMHTjkPmJzR1W/PvM5Woc6RCrkyJnHWA4doihBJGm X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040176)(601004)(2401047)(5005006)(8121501046)(10201501046)(3002001)(6055026);SRVR:HK2PR0601MB1443;BCL:0;PCL:0;RULEID:;SRVR:HK2PR0601MB1443; X-Microsoft-Exchange-Diagnostics: 1;HK2PR0601MB1443;4:UVBsqF/41fHEwHhegchq/VbkH9AtZDxF4Jv+WJ6tRds1gz0CPk37fP2B0Xcf79mPmwEhZ8NymrNi2CkdwJvQuH+BvwjLo4olS5y1865snShZxz9NmPzRtbRnL2Mpo4vtmztrnKTVK64mk2XtFZCBiR5EPYc7JD/MNQq0WFJ/JIjQE5oUa1MLIZh/cvjQFevheNOv3JhDHALF8X09NLX82HdXIMIXW7xDR6UXrNEnRpEQps7cxLsmomhmo1cMfJAvdM/r3DVwAJN3xd7hmAQ9C1PI5dDHrlvd/C62GvGluQx/AcPPpM0A3O+LXXcYiBdb+1mJ8yDm3d8lP+jtvrOoeNDdUC5VLQ4xdBzKeywao03qpfg1npu7w6w9vCOvJbjT5L4USELWfFnHBr+zVLA7UDB4RNQ47hAUSjiAjOEVGoM= X-Forefront-PRVS: 0098BA6C6C X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10019020)(4630300001)(6009001)(7916002)(199003)(189002)(7416002)(53416004)(4001350100001)(46406003)(305945005)(6116002)(101416001)(3846002)(23726003)(586003)(83506001)(36756003)(2906002)(4326007)(92566002)(86362001)(81156014)(8666005)(50466002)(7846002)(81166006)(230783001)(33646002)(8676002)(7736002)(68736007)(229853001)(47776003)(69596002)(66066001)(50986999)(19580405001)(19580395003)(76176999)(5001770100001)(5660300001)(54356999)(106356001)(97736004)(105586002)(77096005)(189998001)(2950100002)(42186005)(7059030)(16060500001);DIR:OUT;SFP:1102;SCL:1;SRVR:HK2PR0601MB1443;H:morimoto-PC.renesas.com;FPR:;SPF:None;PTR:InfoNoRecords;A:1;MX:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;HK2PR0601MB1443;23:wNWIRSuXdYdBwbcKAqWiv3rURWX67E2MXMTfh/k?= =?us-ascii?Q?BNaXZfBEJU3n/44/e5T/M+HVbxQZepgJ84QydheVyqU96HKwjGsOzdhtEGbY?= =?us-ascii?Q?77u8ga9P08ECAzMuDOAEv6xDQZMtZBHsu/PeAWlv+Mjcc+A3uZOaoH+FYyew?= =?us-ascii?Q?Zdn7EYY5WZ6yU3Fhr3M1d5BEcvtgj0zy1oRxUm84iAKfB6R8cul1XEIRq8Hx?= =?us-ascii?Q?MMrGORlh0UolcItuA22pdsOajb68P8FDTWchzfdwTJs5WExfFDjaD0FvoB/F?= =?us-ascii?Q?kWRp0jLSgKf8RzUfDcsPbnPc2IllS1gIL+ojFmSOIhdY8yzX9Abu6gWLh7Sy?= =?us-ascii?Q?knHYwANU33auwbN+yaQLcUcQyumYvvJ9ozrs/8prjlH1v8KKLdG17UHW3NL7?= =?us-ascii?Q?sNRrFzaHGUCnc05tnyVGA15D7hBT1u37U7j0jk8HSPJejR1LfBPtUuDBEpsZ?= =?us-ascii?Q?Op0xJX37rFHBuyAb9B+Z37/Lwb561ckHk9+HhrpAhHzcTwVg34Dlp0G0tFZs?= =?us-ascii?Q?4qLHsqG1ynyCQn/IgkR2xLLV+T2soR46mzucyTCDGNOocnySu7+Klj09rT6g?= =?us-ascii?Q?pN8HCGEEBtxdOs8D/kkDO9eLox9xyqptmS4Yrrj8o4lHlbZBuh2wdILY79tJ?= =?us-ascii?Q?+5mo+A7wTU1U/4JIOKSZqhooCmMaEIQkRumx7zzDebM6GYQZd2auk00yeVZV?= =?us-ascii?Q?DcELeeu3csG/xC8HTHnvXCnnKtxogk2uT3gNPNKp1S0p+wP+GkC78BcjTGlE?= =?us-ascii?Q?b/xA1k40ihgvwcj3W+HiiQ5djQYuWuPO82dAHX+Jp6pgLtuLraqD0UipGIuA?= =?us-ascii?Q?SB00rC6OmYM9POE06CK2qSog9n1RfIGPvHoH5uujPCquCoQ3WNwVHv745YGm?= =?us-ascii?Q?64tYb30XMnSaKbYdqSRZS4POBReEqoWgXV8o1RtKszCzW8aDhaEW1+w161yg?= =?us-ascii?Q?k19cV5pli5Q7PAI/CCMEPo20WDFnzVQhnswzJkgrKxZCaNZv/V5vnexJvndV?= =?us-ascii?Q?F8c8yhdVmkNBJIRtYgWNpwrek2vaLggQTP5G3fruMZhj/wvKFGNXuyqwNEFt?= =?us-ascii?Q?5WIYK/nZ9hv1v/YuBiysla94EXLqlphwXIs0orGIL0BPlrREj1CkzdBNcPbg?= =?us-ascii?Q?FaY7tfo08YeT2KSXbQZ3KRGEv+aC5Hl1JWCwXMkgVSJlsf1CMvnPuidocrR+?= =?us-ascii?Q?G1PMjhVutg1H7FMT9SXI04AwIXN6Swr5uA6Q3tgH43Q2epeSaknnWi6dCE4b?= =?us-ascii?Q?tJw7aZkN6g4SDKwL0VCBvJlg4jbv63B8wxmam9pDY?= X-Microsoft-Exchange-Diagnostics: 1;HK2PR0601MB1443;6:Zumxb913vWIKgOaDbGMazT9AP4Rt7LS0x0uCq2557pQYsf6/qq5qtQEoVpyjfk2rkXAVd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3+mzjHoF3962UTQiJ15r8hxp+mO7fen4T1YV2kfcp+rasHbicPWTqTBfpRqbqKPbgWkIPOR9FAIBtgXme+88cQMDh6qJTr3LoW5Uy5oEkouc7HsSXSgu6MmGDCno= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Oct 2016 08:32:03.1804 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: HK2PR0601MB1443 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5303 Lines: 172 From: Kuninori Morimoto simple sound card family are using very similar style, but because of its historical reason, there are small differences. For example pointer style, function name, caller postion etc... This patch synchronized simple card style to other simple card family Current simple-scu-card function naming is different from other simple card family. And related to it, the necessary operation position is also different. This patch synchronize these to other simple card family. Signed-off-by: Kuninori Morimoto --- sound/soc/generic/simple-scu-card.c | 99 ++++++++++++++++--------------------- 1 file changed, 43 insertions(+), 56 deletions(-) diff --git a/sound/soc/generic/simple-scu-card.c b/sound/soc/generic/simple-scu-card.c index b9973a5..b8d8437 100644 --- a/sound/soc/generic/simple-scu-card.c +++ b/sound/soc/generic/simple-scu-card.c @@ -101,7 +101,7 @@ static int asoc_simple_card_be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd, return 0; } -static int asoc_simple_card_parse_links(struct device_node *np, +static int asoc_simple_card_dai_link_of(struct device_node *np, struct asoc_simple_card_priv *priv, unsigned int daifmt, int idx, bool is_fe) @@ -195,22 +195,35 @@ static int asoc_simple_card_parse_links(struct device_node *np, return 0; } -static int asoc_simple_card_dai_link_of(struct device_node *node, - struct asoc_simple_card_priv *priv) +static int asoc_simple_card_parse_of(struct device_node *node, + struct asoc_simple_card_priv *priv) + { struct device *dev = simple_priv_to_dev(priv); struct device_node *np; unsigned int daifmt = 0; - int ret, i; bool is_fe; + int ret, i; + + if (!node) + return -EINVAL; + + ret = snd_soc_of_parse_audio_routing(&priv->snd_card, PREFIX "routing"); + if (ret < 0) + return ret; + + /* sampling rate convert */ + of_property_read_u32(node, PREFIX "convert-rate", &priv->convert_rate); + + /* channels transfer */ + of_property_read_u32(node, PREFIX "convert-channels", &priv->convert_channels); /* find 1st codec */ np = of_get_child_by_name(node, PREFIX "codec"); if (!np) return -ENODEV; - ret = asoc_simple_card_parse_daifmt(dev, node, np, - PREFIX, &daifmt); + ret = asoc_simple_card_parse_daifmt(dev, node, np, PREFIX, &daifmt); if (ret < 0) return ret; @@ -220,58 +233,12 @@ static int asoc_simple_card_dai_link_of(struct device_node *node, if (strcmp(np->name, PREFIX "cpu") == 0) is_fe = true; - ret = asoc_simple_card_parse_links(np, priv, daifmt, i, is_fe); + ret = asoc_simple_card_dai_link_of(np, priv, daifmt, i, is_fe); if (ret < 0) return ret; i++; } - return 0; -} - -static int asoc_simple_card_parse_of(struct device_node *node, - struct asoc_simple_card_priv *priv, - struct device *dev) -{ - struct asoc_simple_dai *props; - struct snd_soc_dai_link *links; - int ret; - int num; - - if (!node) - return -EINVAL; - - num = of_get_child_count(node); - props = devm_kzalloc(dev, sizeof(*props) * num, GFP_KERNEL); - links = devm_kzalloc(dev, sizeof(*links) * num, GFP_KERNEL); - if (!props || !links) - return -ENOMEM; - - priv->dai_props = props; - priv->dai_link = links; - - /* Init snd_soc_card */ - priv->snd_card.owner = THIS_MODULE; - priv->snd_card.dev = dev; - priv->snd_card.dai_link = priv->dai_link; - priv->snd_card.num_links = num; - priv->snd_card.codec_conf = &priv->codec_conf; - priv->snd_card.num_configs = 1; - - ret = snd_soc_of_parse_audio_routing(&priv->snd_card, PREFIX "routing"); - if (ret < 0) - return ret; - - /* sampling rate convert */ - of_property_read_u32(node, PREFIX "convert-rate", &priv->convert_rate); - - /* channels transfer */ - of_property_read_u32(node, PREFIX "convert-channels", &priv->convert_channels); - - ret = asoc_simple_card_dai_link_of(node, priv); - if (ret < 0) - return ret; - ret = asoc_simple_card_parse_card_name(&priv->snd_card, PREFIX); if (ret < 0) return ret; @@ -287,16 +254,36 @@ static int asoc_simple_card_parse_of(struct device_node *node, static int asoc_simple_card_probe(struct platform_device *pdev) { struct asoc_simple_card_priv *priv; - struct device_node *np = pdev->dev.of_node; + struct snd_soc_dai_link *links; + struct asoc_simple_dai *props; struct device *dev = &pdev->dev; - int ret; + struct device_node *np = pdev->dev.of_node; + int num, ret; /* Allocate the private data */ priv = devm_kzalloc(dev, sizeof(*priv), GFP_KERNEL); if (!priv) return -ENOMEM; - ret = asoc_simple_card_parse_of(np, priv, dev); + num = of_get_child_count(np); + + props = devm_kzalloc(dev, sizeof(*props) * num, GFP_KERNEL); + links = devm_kzalloc(dev, sizeof(*links) * num, GFP_KERNEL); + if (!props || !links) + return -ENOMEM; + + priv->dai_props = props; + priv->dai_link = links; + + /* Init snd_soc_card */ + priv->snd_card.owner = THIS_MODULE; + priv->snd_card.dev = dev; + priv->snd_card.dai_link = priv->dai_link; + priv->snd_card.num_links = num; + priv->snd_card.codec_conf = &priv->codec_conf; + priv->snd_card.num_configs = 1; + + ret = asoc_simple_card_parse_of(np, priv); if (ret < 0) { if (ret != -EPROBE_DEFER) dev_err(dev, "parse error %d\n", ret); -- 1.9.1