From patchwork Tue May 28 05:05:24 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kuninori Morimoto X-Patchwork-Id: 799545 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from alsa0.perex.cz (alsa0.perex.cz [77.48.224.243]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 421C6C25B78 for ; Tue, 28 May 2024 05:06:49 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 312D3DFA; Tue, 28 May 2024 07:06:37 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 312D3DFA DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1716872807; bh=RAj+toQ4SADLBgedd/PKIfprcwUVfMEMfxpH2eBRK94=; h=From:Subject:To:Cc:In-Reply-To:References:Date:List-Id: List-Archive:List-Help:List-Owner:List-Post:List-Subscribe: List-Unsubscribe:From; b=jnXjjwYvOyFBd0f3xoGOVQpHkc0xvp/HTvg+/YWZslmlKC1ZSdakKnMdoJv8+Tfne 7qxPNS5d+p4MKsyRUfr0juRuxOctwz50ENF6YjieKrN4BF716fvRk1vcGbv6FVfXp0 QaadZtOGryeeS6k+a/ggPF/9tTf7vrUeiupFy9OM= Received: by alsa1.perex.cz (Postfix, from userid 50401) id 4E5CBF8061A; Tue, 28 May 2024 07:05:39 +0200 (CEST) Received: from mailman-core.alsa-project.org (mailman-core.alsa-project.org [10.254.200.10]) by alsa1.perex.cz (Postfix) with ESMTP id CA02CF80610; Tue, 28 May 2024 07:05:38 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 8A21EF805F7; Tue, 28 May 2024 07:05:34 +0200 (CEST) Received: from TY3P286CU002.outbound.protection.outlook.com (mail-japaneastazlp170110002.outbound.protection.outlook.com [IPv6:2a01:111:f403:c405::2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by alsa1.perex.cz (Postfix) with ESMTPS id C985DF800E9 for ; Tue, 28 May 2024 07:05:29 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz C985DF800E9 Authentication-Results: alsa1.perex.cz; dkim=pass (1024-bit key, unprotected) header.d=renesas.com header.i=@renesas.com header.a=rsa-sha256 header.s=selector1 header.b=IB1uZ2Ao ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=c46nvD76dI7ssn0dsGeThKeqnyHU5Ug127FnCVyJasR0wmLrjMuRHRrG79PEeW3/8qbt4aAyz7VSe3mk0vXnVs9egWk19CBILj01oseLR/Ddv7iUmalww+mjfPRDHJbiQZzBmwx1O3iiYnF7BTY2zlEjeewxvtMdjWHFLSQpaNPl9QsClB0tlNUrltwlDTiPMDbIZGOZjwnZvS876OmyyvSIta2MJG+J0ZG3F9Ljv29xUMdZ3+t+RzmZD8GG+s76oljCU1xypIrWVxgwC9M4YrPv/LlYfF5fiLhUTkr40RNV1M+A1gAfO3+xS8//N/lzfJ2CWuNuRp8oEPQZgvK5BQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=eYDPWN70id/pqSZTV4B1QGwYc76mIj8P3Zxk5otIMjY=; b=WfVeziMdaeuwkBgrkSn1qTN/w+I4aI0s4SI7lBtbY6CW5UohKoO6vkNwRmvHTkeiNk8cR780bylWKw9kqtvwC9aproEyVvGbIGRTjIMVF+e3j1I3ajNqQm9KDXJkkdv9EqJjcT+CtW/AgN0Rqqv2YMbBGQH5GtExgyg5xFru01wPKuB6JXNYtkmuU64JjwXBUgggFOeJxMiPN0kznS94QIW3D6vH5z8MI8/stNj2nn8q7kwUL5pC5IPxwopdenqP0sjJYxA8Jgnig0fdNwJ4q/Bd1LeF3pa5vYcvuBDI1TOpQ9Lj052G61+1UyPgoUm8tfNQNHBrdAFGwoLfCoaxFQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=renesas.com; dmarc=pass action=none header.from=renesas.com; dkim=pass header.d=renesas.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=renesas.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=eYDPWN70id/pqSZTV4B1QGwYc76mIj8P3Zxk5otIMjY=; b=IB1uZ2AoZArReyVBifcrMQU2FbgzWh0woq/WhWwypuqTAkiOV5jbJjME0SvPtwa7o+yIfxpzGBVG3qOjqSzqeeg5vXCgvrCpT/3OyIfNSeFhZYwDJb5l5Gw4hJL4Ou61V8s/ZRXtYWhyMhDKOnKUgRLxh5T20tfobVw3bunw3PY= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=renesas.com; Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) by TYCPR01MB7090.jpnprd01.prod.outlook.com (2603:1096:400:c1::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7611.30; Tue, 28 May 2024 05:05:24 +0000 Received: from TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11]) by TYCPR01MB10914.jpnprd01.prod.outlook.com ([fe80::c568:1028:2fd1:6e11%4]) with mapi id 15.20.7611.030; Tue, 28 May 2024 05:05:24 +0000 Message-ID: <877cfeh6gb.wl-kuninori.morimoto.gx@renesas.com> From: Kuninori Morimoto Subject: [PATCH 03/11] ASoC: audio-graph-card2: remove ports node name check User-Agent: Wanderlust/2.15.9 Emacs/29.3 Mule/6.0 To: Mark Brown Cc: Linux-ALSA In-Reply-To: <87bk4qh6h8.wl-kuninori.morimoto.gx@renesas.com> References: <87bk4qh6h8.wl-kuninori.morimoto.gx@renesas.com> Date: Tue, 28 May 2024 05:05:24 +0000 X-ClientProxiedBy: TYWPR01CA0049.jpnprd01.prod.outlook.com (2603:1096:400:17f::20) To TYCPR01MB10914.jpnprd01.prod.outlook.com (2603:1096:400:3a9::11) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: TYCPR01MB10914:EE_|TYCPR01MB7090:EE_ X-MS-Office365-Filtering-Correlation-Id: ae2d678c-cd60-40d0-7e81-08dc7ed3c849 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; ARA:13230031|376005|1800799015|52116005|366007|38350700005; X-Microsoft-Antispam-Message-Info: hX8mj8EIX3IlRb9bdTdQsqqGhUnFcGVlqVww8mA1s6WhPCTuKplClYrclTJZe/q64aipjJYJHewISpn/yOHHEsJeWK1ZqMm07XS4KmM4CV1H2AkEgzh5Im6uRATmHYQ6dVGYE4lKqh02aaNAlQwgb0ijy908oXefUuXxdX0Ssofgd8Kjt+ymX++jkYoQpswkdUSGu9g5V11z5NoDEEsBC34Wp+evE8gBpZIlVQ09sqxBwY6544zeCKxHlNMTrAeEzMdbHF/0Cgc5cXlZhuihHn9kb+kaCz+2Qy/UN6NNZCMZrv6QLG34NTQa9QfIUT3lUhbJfsZJInEQFHHKZ3/umhPemazwUyoXfDO2cnZTGKVv4TmMxDokKMZWotWoZr88kJAekDxX3no3d774CIQRt2i/H8GZKCTNcKZoLVbarthJhoIXubZUpeArs3/C8YpX2pj7Ljb1/3W9xvdDicNPvDh13M6A58hFCprAtY2pO4V4sxG3xvtN3WpwJ9IbEuGROhlk3RGq1hc1nr6wpth+CqHNSvlPR/aTRg4tdGJTM1wCvE0G/+hRKxeEylojGrHzU3ZbmTBTFoOJpZNbKQVXlhNnxzygikuSZhACtkzqLMCTqTjZuVwmu669kFDdroC5A8hkWUHrUpWsTb005KVfS9OCuUQyROxzufdfXVKmYB9+duq5eRr1U9HcMeCO98MRZxLbX2lzZuN1LQuaq4TaEJ6wzoSXs8Bn+GFdJmpxoj19aTjVW1o7pbyHUZSm3Ev7CMRw31U0/DYYoiGEJO4lqs8eHHc6dW8A4MUTbPrLVMlaOEyC0gKtL4VFoTUnf+MXBHNhDvIcB4B+ZzQPcl3N6ABYtFBqaf0aOMdaQEuHle7w2UFqadP1u5kvuqS9WFZTTGpMlC8SF5TwrsRXDewOISScj36+3Jk39baPmMKjJlCQDupmmUgXlSgf4ZBeDOnjSYAcKv5hJcrxBOB//3icfdVq1524R6xbSj3twD0H6aQMp/P8Oc8jlnwuBftaFFdGTXIh3wD9t4d3kYEDP7CnVFKgafhjP4L2F+6hKIf7xzX44j59Yr51R7eonDeVKeeIWtDia3f3MaY8A0sZbw5k6LqSjh6G742ts+zpndMXUOA8Ndn8TCtYszHRw1l1MOMiWHOihHi9vty2B7xTB8Ze+S7dYuPQkdQ1ZMVlRKXPDoHeW/1vPTb5Jpyk558zxZcUhUxUdfRpfWLGH8ebO+fX8VpNDCMQvVyhL6JQAP79cuk3hmlUXa/yPFU6NuaWp5RWBhBPMYE9qRk/gWj2GsPkomq8Py53PB4oLpVYZhG2/83uGOw3zJFxweSzzx1k8Obg+nl3zBGE4OsPA5QxFYjyMA== X-Forefront-Antispam-Report: CIP:255.255.255.255; CTRY:; LANG:en; SCL:1; SRV:; IPV:NLI; SFV:NSPM; H:TYCPR01MB10914.jpnprd01.prod.outlook.com; PTR:; CAT:NONE; SFS:(13230031)(376005)(1800799015)(52116005)(366007)(38350700005); DIR:OUT; SFP:1101; X-MS-Exch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N7D33t9qXxRwPvsNxZPqYgz1On2IlcV5PtZq2X9AdI119aPShCpPywrxsMRcczNoNyPrUaDc7TfAwTyZHWeG/zBlXUzicLarNUfqMCJbXWLOg/U/QA2sIZQowi83CWSEO31y54ib8aCgFoW3jdE9p926khTqg6582B7RdK4C10I85p+aeBkw9jPKXnfIh+VRP1jA85PVqfXcr4OcVUso5WRfuyZTMAAek1FcB/gTZy7Qj95Rh1q+KV8sdxOJpe/t+6KnW5EwCPjONUyZDttfrEA91swsyh43bUgsVl3lqx5zCIhxQmMfWk6mLqbb9FTaGwYEFhkM4tEYTEhWZQPmcSZgpn8XgNfjTuecFi9u+uktVJo2tjMNO6lIhoBJZwbPkCsIJVoiLlpGo6C7+dSVHTbgk/HVHvFXDCs2TYdKf+YQ4yHLt+mJ/AcRGgCUh1TYGUkJcUY0KhMbGIuIrh/eXs6XItTjNQKZV078iAgvyee8ylxnGxphxPzHj/zHSntVPAcWCxxExg0eerGuFRaH+dmWnTHABi9ZdwHz6hhb5C/BVsAsq8BRuFh6A3tlx5r3PZ+LThIi8Wxje8OB7bKHW8GncfOBjbl1vFb+iw= X-OriginatorOrg: renesas.com X-MS-Exchange-CrossTenant-Network-Message-Id: ae2d678c-cd60-40d0-7e81-08dc7ed3c849 X-MS-Exchange-CrossTenant-AuthSource: TYCPR01MB10914.jpnprd01.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2024 05:05:24.4091 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 53d82571-da19-47e4-9cb4-625a166a4a2a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: Cl6Tyxu2U8ERpWuIuj5t9RIbMd+RyZi9S8tmWIkeiLtAS6TdfQizLSO/6PrDwAX5CxTO8l6SdR54BhVcYp0Dn6evaYpeyB1//tuSPbCsrutdFw0vvjTpoC+OKaiMPouR X-MS-Exchange-Transport-CrossTenantHeadersStamped: TYCPR01MB7090 Message-ID-Hash: JL27J4YSR26GVDMB6FIDHERQ6ANV7AUH X-Message-ID-Hash: JL27J4YSR26GVDMB6FIDHERQ6ANV7AUH X-MailFrom: kuninori.morimoto.gx@renesas.com X-Mailman-Rule-Misses: dmarc-mitigation; no-senders; approved; emergency; loop; banned-address; member-moderation; header-match-alsa-devel.alsa-project.org-0; header-match-alsa-devel.alsa-project.org-1; nonmember-moderation; administrivia; implicit-dest; max-recipients; max-size; news-moderation; no-subject; digests; suspicious-header X-Mailman-Version: 3.3.9 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" Archived-At: List-Archive: List-Help: List-Owner: List-Post: List-Subscribe: List-Unsubscribe: Current audio-graph-card2 is checking if the node name was "ports" or not when parsing the property. if (of_node_name_eq(ports, "ports")) of_xxx(ports, ...); Now, it is using new port_to_ports() which will be NULL if the node doesn't have "ports", and each of_xxx functions will do nothing if node was NULL. Now we don't need to check ports node name. Let's remove and cleanup it. Signed-off-by: Kuninori Morimoto --- sound/soc/generic/audio-graph-card2.c | 15 +++++++-------- sound/soc/generic/simple-card-utils.c | 3 +++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/sound/soc/generic/audio-graph-card2.c b/sound/soc/generic/audio-graph-card2.c index 58123fbc29046..3029e8ebfa222 100644 --- a/sound/soc/generic/audio-graph-card2.c +++ b/sound/soc/generic/audio-graph-card2.c @@ -381,8 +381,7 @@ static void graph_parse_convert(struct device_node *ep, struct device_node *ports = port_to_ports(port); struct simple_util_data *adata = &props->adata; - if (of_node_name_eq(ports, "ports")) - simple_util_parse_convert(ports, NULL, adata); + simple_util_parse_convert(ports, NULL, adata); simple_util_parse_convert(port, NULL, adata); simple_util_parse_convert(ep, NULL, adata); @@ -396,8 +395,7 @@ static void graph_parse_mclk_fs(struct device_node *ep, struct device_node *port = ep_to_port(ep); struct device_node *ports = port_to_ports(port); - if (of_node_name_eq(ports, "ports")) - of_property_read_u32(ports, "mclk-fs", &props->mclk_fs); + of_property_read_u32(ports, "mclk-fs", &props->mclk_fs); of_property_read_u32(port, "mclk-fs", &props->mclk_fs); of_property_read_u32(ep, "mclk-fs", &props->mclk_fs); @@ -496,8 +494,7 @@ static int __graph_parse_node(struct simple_util_priv *priv, struct device_node *rport = ep_to_port(ep); struct device_node *rports = port_to_ports(rport); - if (of_node_name_eq(rports, "ports")) - snd_soc_of_parse_node_prefix(rports, cconf, codecs->of_node, "prefix"); + snd_soc_of_parse_node_prefix(rports, cconf, codecs->of_node, "prefix"); snd_soc_of_parse_node_prefix(rport, cconf, codecs->of_node, "prefix"); of_node_put(rport); @@ -717,6 +714,9 @@ static void graph_parse_daifmt(struct device_node *node, { unsigned int fmt; + if (!node) + return; + /* * see also above "daifmt" explanation * and samples. @@ -798,8 +798,7 @@ static void graph_link_init(struct simple_util_priv *priv, */ graph_parse_daifmt(ep, &daifmt, &bit_frame); /* (C) */ graph_parse_daifmt(port, &daifmt, &bit_frame); /* (B) */ - if (of_node_name_eq(ports, "ports")) - graph_parse_daifmt(ports, &daifmt, &bit_frame); /* (A) */ + graph_parse_daifmt(ports, &daifmt, &bit_frame); /* (A) */ /* * convert bit_frame diff --git a/sound/soc/generic/simple-card-utils.c b/sound/soc/generic/simple-card-utils.c index 17718c58793d2..7ebf59a03e698 100644 --- a/sound/soc/generic/simple-card-utils.c +++ b/sound/soc/generic/simple-card-utils.c @@ -46,6 +46,9 @@ void simple_util_parse_convert(struct device_node *np, { char prop[128]; + if (!np) + return; + if (!prefix) prefix = "";