From patchwork Fri Oct 6 20:09:11 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 149390 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp570260vqo; Fri, 6 Oct 2023 13:10:27 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFlo7xKp06BW52g1+KhdI4fKHxFT2SIwbF0U6FrLnySTag3mOeeU6gfeLE4zNB5gulFSgD5 X-Received: by 2002:a17:90b:46c7:b0:277:4b68:b93c with SMTP id jx7-20020a17090b46c700b002774b68b93cmr9096538pjb.4.1696623027009; Fri, 06 Oct 2023 13:10:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696623026; cv=none; d=google.com; s=arc-20160816; b=nAoZhA0kdE5HjhVQ9VL4sia0yQt5aeoj1nQpH+YizGEnvhLxwHtpsV++n2zuP/paHX bqbnIggVuA3MKoFMKsX82lNVAdUuW3FUMKn4gjzGsWdEmp3ELVEcsixADBwibPE6mRqQ 9YHvL6KkHV7oMQYsvCYVwIC9YnvHMVMAoH3EFb9gE8IESuxbEZDoUp0MJeCLPXERgw92 xz4cxGQFmBeEz/PB/KiJWKS/iCS7cjL8NV5D+L7hHhfjV51+CW/zx2HFkw5ehOPss+sc 7x3tAOUuWZq4fhhhDohjaVU/EzqSEiCairiTecBIP8nWZk+kNUPBUz1lkEOg5NHJiCOV ezJA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:in-reply-to:references:message-id :content-transfer-encoding:mime-version:subject:date:from; bh=ZZOch+WDqofN+3QITjE4l0oM3GunXyt8y2cN5QknfSQ=; fh=WS2zAkXwa/jMVS9GpKyo4Oby25TrfObQF36eIgdo4ro=; b=ahkwELkIcJe5Nengd+v5RiUAIAD3HimgYZHJoXVI3Eqa768e8/OZGnQGRxmalSgqvY 5KY8h62rKDZyxchKtgCS03gBA34wIt8CP4iOOnbL7zKOSOH5NBH6yJT7ATZYa6biHVjM szjfDAIJ75pga0/9+YFgtWWwsckoRlSNzB6F17LGfq9fM/7jfehJhYxdnwVBg71lJjTB jIyZ1fwb+YoMpGQXMNbDaU8WFyocwPsosizmWIPWpCxW1MCe/lHTPrFsDUviSvNcGzqt VrP7SIKMxTllufuiS6BPVGH2tD75IRXZ3s6LtFvNOxSl2fdkkO6DoeQ22JcugIW9pjew wiGg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from groat.vger.email (groat.vger.email. [2620:137:e000::3:5]) by mx.google.com with ESMTPS id w20-20020a17090aea1400b00274cd766a42si2788385pjy.171.2023.10.06.13.10.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 13:10:26 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) client-ip=2620:137:e000::3:5; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:5 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by groat.vger.email (Postfix) with ESMTP id 2C1BD834767E; Fri, 6 Oct 2023 13:10:15 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at groat.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233429AbjJFUJt (ORCPT + 18 others); Fri, 6 Oct 2023 16:09:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60998 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233421AbjJFUJl (ORCPT ); Fri, 6 Oct 2023 16:09:41 -0400 Received: from mail-ot1-f54.google.com (mail-ot1-f54.google.com [209.85.210.54]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D9594CA for ; Fri, 6 Oct 2023 13:09:39 -0700 (PDT) Received: by mail-ot1-f54.google.com with SMTP id 46e09a7af769-6c4e7951dddso1615912a34.1 for ; Fri, 06 Oct 2023 13:09:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696622979; x=1697227779; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ZZOch+WDqofN+3QITjE4l0oM3GunXyt8y2cN5QknfSQ=; b=gcffyZZdGLaqLIiXqFloqhJfX4cOggdIW1DOWlq6k2p0rBErXmu4cNFmAoXM4c1d2A b3Pal3moSH8FS5N8idU7AsAtnl6aFyCDSP52eSaomriNbcAz6ptqoXKhiGGFQyrsVaAY 54EJIlvEOHgZ1nPfIQekuFiowsCtgq5ZPa2owIifWBWJf1Ydr/3MPobYgdaLFHth4NgO lkkmSfMkMKHa3t/nC8CZZeJJRLeG4FHLMvbxJgeOZcjdKN1KLWnjsNo0w44Aj9wQcRNT Xin123G2NAFoCf36o2bYQ3wyooN62gCHdS9fkfKPJI8gVEpqonCJMHAIpONBNlvD/Cbs wnAQ== X-Gm-Message-State: AOJu0YziFyvnPiQgP3zE0fZbbCTzsv8XsS4JW3FOL35z555JTsIrR1Cu 5+FwVcmWtlbzBM0QGqqm+g== X-Received: by 2002:a9d:6210:0:b0:6b9:b0f6:eab8 with SMTP id g16-20020a9d6210000000b006b9b0f6eab8mr9353110otj.5.1696622979060; Fri, 06 Oct 2023 13:09:39 -0700 (PDT) Received: from robh_at_kernel.org (66-90-144-107.dyn.grandenetworks.net. [66.90.144.107]) by smtp.gmail.com with ESMTPSA id r12-20020a9d750c000000b006c61c098d38sm680849otk.21.2023.10.06.13.09.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 13:09:38 -0700 (PDT) Received: (nullmailer pid 229127 invoked by uid 1000); Fri, 06 Oct 2023 20:09:30 -0000 From: Rob Herring Date: Fri, 06 Oct 2023 15:09:11 -0500 Subject: [PATCH v3 2/5] ASoC: Drop unnecessary of_match_device() calls MIME-Version: 1.0 Message-Id: <20231006-dt-asoc-header-cleanups-v3-2-13a4f0f7fee6@kernel.org> References: <20231006-dt-asoc-header-cleanups-v3-0-13a4f0f7fee6@kernel.org> In-Reply-To: <20231006-dt-asoc-header-cleanups-v3-0-13a4f0f7fee6@kernel.org> To: Mark Brown , Claudiu Beznea , Jaroslav Kysela , Takashi Iwai , Peter Rosin , Lars-Peter Clausen , nuno.sa@analog.com, James Schulman , David Rhodes , Richard Fitzgerald , AngeloGioacchino Del Regno , Shenghao Ding , Kevin Lu , Baojun Xu , Oder Chiou , Fabio Estevam , Kiseok Jo , Kevin Cernekee , Shengjiu Wang , Xiubo Li , Nicolin Chen , Srinivas Kandagatla , Banajit Goswami , Nicolas Frattaroli , Sylwester Nawrocki , Ban Tao , Peter Ujfalusi , Jarkko Nikula , Cezary Rojewski , Pierre-Louis Bossart , Peter Ujfalusi , Bard Liao , Ranjani Sridharan , Kai Vehmanen , Olivier Moysan , Arnaud Pouliquen , Maxime Coquelin , Alexandre Torgue Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, Charles Keepax X-Mailer: b4 0.13-dev X-Spam-Status: No, score=2.6 required=5.0 tests=MAILING_LIST_MULTI, RCVD_IN_SBL_CSS,SPF_HELO_NONE,SPF_PASS autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on groat.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (groat.vger.email [0.0.0.0]); Fri, 06 Oct 2023 13:10:15 -0700 (PDT) X-Spam-Level: ** X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779038187317582671 X-GMAIL-MSGID: 1779038187317582671 If probe is reached, we've already matched the device and in the case of DT matching, the struct device_node pointer will be set. Therefore, there is no need to call of_match_device() in probe. Acked-by: Charles Keepax Signed-off-by: Rob Herring --- sound/soc/codecs/ak5386.c | 7 ++----- sound/soc/codecs/cs4271.c | 22 ++++++---------------- sound/soc/codecs/tas5086.c | 6 +----- 3 files changed, 9 insertions(+), 26 deletions(-) diff --git a/sound/soc/codecs/ak5386.c b/sound/soc/codecs/ak5386.c index 0c5e00679c7d..21a44476f48d 100644 --- a/sound/soc/codecs/ak5386.c +++ b/sound/soc/codecs/ak5386.c @@ -10,7 +10,6 @@ #include #include #include -#include #include #include #include @@ -168,7 +167,6 @@ static int ak5386_probe(struct platform_device *pdev) if (!priv) return -ENOMEM; - priv->reset_gpio = -EINVAL; dev_set_drvdata(dev, priv); for (i = 0; i < ARRAY_SIZE(supply_names); i++) @@ -179,9 +177,8 @@ static int ak5386_probe(struct platform_device *pdev) if (ret < 0) return ret; - if (of_match_device(of_match_ptr(ak5386_dt_ids), dev)) - priv->reset_gpio = of_get_named_gpio(dev->of_node, - "reset-gpio", 0); + priv->reset_gpio = of_get_named_gpio(dev->of_node, + "reset-gpio", 0); if (gpio_is_valid(priv->reset_gpio)) if (devm_gpio_request_one(dev, priv->reset_gpio, diff --git a/sound/soc/codecs/cs4271.c b/sound/soc/codecs/cs4271.c index 188b8b43c524..9e6f8a048dd5 100644 --- a/sound/soc/codecs/cs4271.c +++ b/sound/soc/codecs/cs4271.c @@ -15,7 +15,6 @@ #include #include #include -#include #include #include #include @@ -563,19 +562,12 @@ static int cs4271_component_probe(struct snd_soc_component *component) struct cs4271_private *cs4271 = snd_soc_component_get_drvdata(component); struct cs4271_platform_data *cs4271plat = component->dev->platform_data; int ret; - bool amutec_eq_bmutec = false; + bool amutec_eq_bmutec; -#ifdef CONFIG_OF - if (of_match_device(cs4271_dt_ids, component->dev)) { - if (of_get_property(component->dev->of_node, - "cirrus,amutec-eq-bmutec", NULL)) - amutec_eq_bmutec = true; - - if (of_get_property(component->dev->of_node, - "cirrus,enable-soft-reset", NULL)) - cs4271->enable_soft_reset = true; - } -#endif + amutec_eq_bmutec = of_property_read_bool(component->dev->of_node, + "cirrus,amutec-eq-bmutec"); + cs4271->enable_soft_reset = of_property_read_bool(component->dev->of_node, + "cirrus,enable-soft-reset"); ret = regulator_bulk_enable(ARRAY_SIZE(cs4271->supplies), cs4271->supplies); @@ -655,9 +647,7 @@ static int cs4271_common_probe(struct device *dev, if (!cs4271) return -ENOMEM; - if (of_match_device(cs4271_dt_ids, dev)) - cs4271->gpio_nreset = - of_get_named_gpio(dev->of_node, "reset-gpio", 0); + cs4271->gpio_nreset = of_get_named_gpio(dev->of_node, "reset-gpio", 0); if (cs4271plat) cs4271->gpio_nreset = cs4271plat->gpio_nreset; diff --git a/sound/soc/codecs/tas5086.c b/sound/soc/codecs/tas5086.c index 60e59e993ba6..f52c14b43f28 100644 --- a/sound/soc/codecs/tas5086.c +++ b/sound/soc/codecs/tas5086.c @@ -940,11 +940,7 @@ static int tas5086_i2c_probe(struct i2c_client *i2c) i2c_set_clientdata(i2c, priv); - if (of_match_device(of_match_ptr(tas5086_dt_ids), dev)) { - struct device_node *of_node = dev->of_node; - gpio_nreset = of_get_named_gpio(of_node, "reset-gpio", 0); - } - + gpio_nreset = of_get_named_gpio(dev->of_node, "reset-gpio", 0); if (gpio_is_valid(gpio_nreset)) if (devm_gpio_request(dev, gpio_nreset, "TAS5086 Reset")) gpio_nreset = -EINVAL;