From patchwork Fri Oct 6 20:09:14 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Herring X-Patchwork-Id: 149387 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:a888:0:b0:403:3b70:6f57 with SMTP id x8csp570079vqo; Fri, 6 Oct 2023 13:10:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEAux72UTgarp6vHsf7/Dj7zYnnXElHW//FTn6BAswZSZFoMqJu9Nfn2ZH09t2M0eqvvUy2 X-Received: by 2002:a05:6358:98a8:b0:139:b4c0:94d with SMTP id q40-20020a05635898a800b00139b4c0094dmr10893883rwa.12.1696623007623; Fri, 06 Oct 2023 13:10:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1696623007; cv=none; d=google.com; s=arc-20160816; b=X1RqhGp4cP59ihYZ7A2N9EINZh9An0YIjRMmmF0/bmrKTADaWNx10s/1K1qO7FedO3 UnrZCM0LczF4BaGw3m7RTJd8ju2OX87U8DouOBkZTXpNLOiKMfVskqBOkiJMxN6S3kwD teu+TdbFwbbW9Lp2iaHlUC8ns0Yvc+FH7hL+txUseEc/nyJj37yk9xgxdt2iCjey65ao 7q2YSXMaxkoFv0yLhO4pe7V+/KAHNpPDTqII3B6c55gpoE2v91TywOXJb3tX9NpBsf1X 4fzJnK06om9B0sviprph+bzB6o1yUhx7pZc35JLni3N3iQULfhzpSICGtrLK1FGyB4TY kt8Q== 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=JVsnx99XaF2BlRuypV2LU30baSB/YEHayThwv4pWeUs=; fh=IJ32rODLot8WzKyM5hJwYaHKfXI1FHqM5tEDV9+u21c=; b=UuAi/RNLv4m9P9sJpwXxi2MfSFpgFVO04o74JYN59HswPECt41N78ensgZoz59plMp u5e8HI+jjjFMz1MzIsJBZKUd1gd1L2XbXVrFy72mtNoxmVvqwb9q3riRqhSgQyy1zJsc kOIJJYJxUV3XtAV2sEgHOYQpAPKGSJWweLPKl9P8FYTdWDMfR4LIQwdaOcYT1rd1clGr cvzN/4lNcA6sMABplnv3FHPf4yqvMkB+rupPg7lUYhAd2XPWYKA7HHuwvpR1IiVBto9q 9KBqQyprV5C0tj19v8Qv3P6m2XhOlZhyYuNs07gOxC9IU3HFMCjb305ZpM7PQltjLTbU jrKw== 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:7 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 snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id o3-20020a655bc3000000b00584d3c4a775si4392371pgr.626.2023.10.06.13.10.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 13:10:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 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 snail.vger.email (Postfix) with ESMTP id 016EA837B2CD; Fri, 6 Oct 2023 13:10:07 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233448AbjJFUJy (ORCPT + 18 others); Fri, 6 Oct 2023 16:09:54 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53888 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233428AbjJFUJt (ORCPT ); Fri, 6 Oct 2023 16:09:49 -0400 Received: from mail-oa1-f50.google.com (mail-oa1-f50.google.com [209.85.160.50]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DDD1F107 for ; Fri, 6 Oct 2023 13:09:45 -0700 (PDT) Received: by mail-oa1-f50.google.com with SMTP id 586e51a60fabf-1dcead29b3eso1565676fac.3 for ; Fri, 06 Oct 2023 13:09:45 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1696622982; x=1697227782; 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=JVsnx99XaF2BlRuypV2LU30baSB/YEHayThwv4pWeUs=; b=f6NKebdhF7zS2D2S04HqnfiSfx+sNxrFVdf5LEMDmhuKohYawIIuPErI7a2RZ/OFXq 7Y38WiRnDpcCCqRs/T/HfeIBrYm5ZI6feHZuDd5Z2yxnPZRTN9RVIdpiIZKc0t3b6LAF ChOB+FDXoXAnm8n0gbubPQhVvUQZqOKKDx69kvXHeWIn1NTI2r0a75TSZoyHIoEuMPG8 tQKRa0uknZ6crEATJRUZ3GwaOKsmvw04Oe3l6S/aVTovr8tyh11clASUeTgmzi7jttZD Z9CoZ99ZOVsr2sgqnvPgg5/xD5FTc8QMd1t8+KsXLsG5J/zTiRj2xrCpNpsdG+w/jDSW 4NbQ== X-Gm-Message-State: AOJu0YzL2oc5cTUu4GHS0PaEFglrCWpYmpCfq9Yu5qhv4wUFGfjlDCCE vXlVpYBNOFicIqDbfHIfug== X-Received: by 2002:a05:6871:5cc:b0:1bb:6ee1:114e with SMTP id v12-20020a05687105cc00b001bb6ee1114emr10232512oan.28.1696622982349; Fri, 06 Oct 2023 13:09:42 -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 g2-20020a056870a24200b001dcba6381dcsm879814oai.39.2023.10.06.13.09.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 06 Oct 2023 13:09:41 -0700 (PDT) Received: (nullmailer pid 229133 invoked by uid 1000); Fri, 06 Oct 2023 20:09:30 -0000 From: Rob Herring Date: Fri, 06 Oct 2023 15:09:14 -0500 Subject: [PATCH v3 5/5] ASoC: Use device_get_match_data() MIME-Version: 1.0 Message-Id: <20231006-dt-asoc-header-cleanups-v3-5-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 X-Mailer: b4 0.13-dev X-Spam-Status: No, score=-1.1 required=5.0 tests=BAYES_00, FREEMAIL_ENVFROM_END_DIGIT,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,RCVD_IN_DNSWL_BLOCKED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,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 lindbergh.monkeyblade.net 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 (snail.vger.email [0.0.0.0]); Fri, 06 Oct 2023 13:10:07 -0700 (PDT) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1779038166474642213 X-GMAIL-MSGID: 1779038166474642213 Use preferred device_get_match_data() instead of of_match_device() to get the driver match data. With this, adjust the includes to explicitly include the correct headers. Signed-off-by: Rob Herring --- v3: - Move some header changes from patch 1 to here for rockchip_i2s_tdm.c, rockchip_pdm.c, smdk_wm8994.c, and tegra210_amx.c. --- sound/soc/intel/keembay/kmb_platform.c | 13 +------------ sound/soc/qcom/lpass-cpu.c | 15 +++++---------- sound/soc/rockchip/rockchip_i2s.c | 8 +++----- sound/soc/rockchip/rockchip_i2s_tdm.c | 24 ++++++++---------------- sound/soc/rockchip/rockchip_pdm.c | 7 +------ sound/soc/samsung/smdk_wm8994.c | 28 +++------------------------- sound/soc/stm/stm32_i2s.c | 7 ++----- sound/soc/stm/stm32_sai.c | 8 ++++---- sound/soc/stm/stm32_sai_sub.c | 6 +----- sound/soc/stm/stm32_spdifrx.c | 8 ++------ sound/soc/tegra/tegra210_amx.c | 10 ++-------- sound/soc/ti/davinci-evm.c | 7 ++----- sound/soc/ti/davinci-mcasp.c | 9 ++++----- sound/soc/ti/omap-mcbsp.c | 10 ++++------ 14 files changed, 42 insertions(+), 118 deletions(-) diff --git a/sound/soc/intel/keembay/kmb_platform.c b/sound/soc/intel/keembay/kmb_platform.c index e929497a5eb5..37ea2e1d2e92 100644 --- a/sound/soc/intel/keembay/kmb_platform.c +++ b/sound/soc/intel/keembay/kmb_platform.c @@ -11,7 +11,6 @@ #include #include #include -#include #include #include #include @@ -820,7 +819,6 @@ static int kmb_plat_dai_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; struct snd_soc_dai_driver *kmb_i2s_dai; - const struct of_device_id *match; struct device *dev = &pdev->dev; struct kmb_i2s_info *kmb_i2s; struct resource *res; @@ -831,16 +829,7 @@ static int kmb_plat_dai_probe(struct platform_device *pdev) if (!kmb_i2s) return -ENOMEM; - kmb_i2s_dai = devm_kzalloc(dev, sizeof(*kmb_i2s_dai), GFP_KERNEL); - if (!kmb_i2s_dai) - return -ENOMEM; - - match = of_match_device(kmb_plat_of_match, &pdev->dev); - if (!match) { - dev_err(&pdev->dev, "Error: No device match found\n"); - return -ENODEV; - } - kmb_i2s_dai = (struct snd_soc_dai_driver *) match->data; + kmb_i2s_dai = (struct snd_soc_dai_driver *)device_get_match_data(&pdev->dev); /* Prepare the related clocks */ kmb_i2s->clk_apb = devm_clk_get(dev, "apb_clk"); diff --git a/sound/soc/qcom/lpass-cpu.c b/sound/soc/qcom/lpass-cpu.c index 18aff2654f89..ac0feb89b458 100644 --- a/sound/soc/qcom/lpass-cpu.c +++ b/sound/soc/qcom/lpass-cpu.c @@ -9,7 +9,6 @@ #include #include #include -#include #include #include #include @@ -1106,7 +1105,6 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) struct resource *res; const struct lpass_variant *variant; struct device *dev = &pdev->dev; - const struct of_device_id *match; int ret, i, dai_id; dsp_of_node = of_parse_phandle(pdev->dev.of_node, "qcom,adsp", 0); @@ -1121,17 +1119,14 @@ int asoc_qcom_lpass_cpu_platform_probe(struct platform_device *pdev) return -ENOMEM; platform_set_drvdata(pdev, drvdata); - match = of_match_device(dev->driver->of_match_table, dev); - if (!match || !match->data) + variant = device_get_match_data(dev); + if (!variant) return -EINVAL; - if (of_device_is_compatible(dev->of_node, "qcom,lpass-cpu-apq8016")) { - dev_warn(dev, "%s compatible is deprecated\n", - match->compatible); - } + if (of_device_is_compatible(dev->of_node, "qcom,lpass-cpu-apq8016")) + dev_warn(dev, "qcom,lpass-cpu-apq8016 compatible is deprecated\n"); - drvdata->variant = (struct lpass_variant *)match->data; - variant = drvdata->variant; + drvdata->variant = variant; of_lpass_cpu_parse_dai_data(dev, drvdata); diff --git a/sound/soc/rockchip/rockchip_i2s.c b/sound/soc/rockchip/rockchip_i2s.c index 74e7d6ee0f28..b0c3ef030e06 100644 --- a/sound/soc/rockchip/rockchip_i2s.c +++ b/sound/soc/rockchip/rockchip_i2s.c @@ -10,8 +10,8 @@ #include #include #include +#include #include -#include #include #include #include @@ -736,7 +736,6 @@ static int rockchip_i2s_init_dai(struct rk_i2s_dev *i2s, struct resource *res, static int rockchip_i2s_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; - const struct of_device_id *of_id; struct rk_i2s_dev *i2s; struct snd_soc_dai_driver *dai; struct resource *res; @@ -752,11 +751,10 @@ static int rockchip_i2s_probe(struct platform_device *pdev) i2s->grf = syscon_regmap_lookup_by_phandle(node, "rockchip,grf"); if (!IS_ERR(i2s->grf)) { - of_id = of_match_device(rockchip_i2s_match, &pdev->dev); - if (!of_id || !of_id->data) + i2s->pins = device_get_match_data(&pdev->dev); + if (!i2s->pins) return -EINVAL; - i2s->pins = of_id->data; } /* try to prepare related clocks */ diff --git a/sound/soc/rockchip/rockchip_i2s_tdm.c b/sound/soc/rockchip/rockchip_i2s_tdm.c index d3700f3c98e6..7e996550d1df 100644 --- a/sound/soc/rockchip/rockchip_i2s_tdm.c +++ b/sound/soc/rockchip/rockchip_i2s_tdm.c @@ -10,9 +10,7 @@ #include #include #include -#include -#include -#include +#include #include #include #include @@ -75,7 +73,7 @@ struct rk_i2s_tdm_dev { struct snd_dmaengine_dai_dma_data playback_dma_data; struct reset_control *tx_reset; struct reset_control *rx_reset; - struct rk_i2s_soc_data *soc_data; + const struct rk_i2s_soc_data *soc_data; bool is_master_mode; bool io_multiplex; bool mclk_calibrate; @@ -1277,21 +1275,21 @@ static const struct txrx_config rv1126_txrx_config[] = { { 0xff800000, 0x10260, RV1126_I2S0_CLK_TXONLY, RV1126_I2S0_CLK_RXONLY }, }; -static struct rk_i2s_soc_data px30_i2s_soc_data = { +static const struct rk_i2s_soc_data px30_i2s_soc_data = { .softrst_offset = 0x0300, .configs = px30_txrx_config, .config_count = ARRAY_SIZE(px30_txrx_config), .init = common_soc_init, }; -static struct rk_i2s_soc_data rk1808_i2s_soc_data = { +static const struct rk_i2s_soc_data rk1808_i2s_soc_data = { .softrst_offset = 0x0300, .configs = rk1808_txrx_config, .config_count = ARRAY_SIZE(rk1808_txrx_config), .init = common_soc_init, }; -static struct rk_i2s_soc_data rk3308_i2s_soc_data = { +static const struct rk_i2s_soc_data rk3308_i2s_soc_data = { .softrst_offset = 0x0400, .grf_reg_offset = 0x0308, .grf_shift = 5, @@ -1300,14 +1298,14 @@ static struct rk_i2s_soc_data rk3308_i2s_soc_data = { .init = common_soc_init, }; -static struct rk_i2s_soc_data rk3568_i2s_soc_data = { +static const struct rk_i2s_soc_data rk3568_i2s_soc_data = { .softrst_offset = 0x0400, .configs = rk3568_txrx_config, .config_count = ARRAY_SIZE(rk3568_txrx_config), .init = common_soc_init, }; -static struct rk_i2s_soc_data rv1126_i2s_soc_data = { +static const struct rk_i2s_soc_data rv1126_i2s_soc_data = { .softrst_offset = 0x0300, .configs = rv1126_txrx_config, .config_count = ARRAY_SIZE(rv1126_txrx_config), @@ -1544,7 +1542,6 @@ static int rockchip_i2s_tdm_rx_path_prepare(struct rk_i2s_tdm_dev *i2s_tdm, static int rockchip_i2s_tdm_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; - const struct of_device_id *of_id; struct rk_i2s_tdm_dev *i2s_tdm; struct resource *res; void __iomem *regs; @@ -1556,13 +1553,8 @@ static int rockchip_i2s_tdm_probe(struct platform_device *pdev) i2s_tdm->dev = &pdev->dev; - of_id = of_match_device(rockchip_i2s_tdm_match, &pdev->dev); - if (!of_id) - return -EINVAL; - spin_lock_init(&i2s_tdm->lock); - i2s_tdm->soc_data = (struct rk_i2s_soc_data *)of_id->data; - + i2s_tdm->soc_data = device_get_match_data(&pdev->dev); i2s_tdm->frame_width = 64; i2s_tdm->clk_trcm = TRCM_TXRX; diff --git a/sound/soc/rockchip/rockchip_pdm.c b/sound/soc/rockchip/rockchip_pdm.c index 4756cfc23218..d16a4a67a6a2 100644 --- a/sound/soc/rockchip/rockchip_pdm.c +++ b/sound/soc/rockchip/rockchip_pdm.c @@ -8,7 +8,6 @@ #include #include #include -#include #include #include #include @@ -572,7 +571,6 @@ static int rockchip_pdm_path_parse(struct rk_pdm_dev *pdm, struct device_node *n static int rockchip_pdm_probe(struct platform_device *pdev) { struct device_node *node = pdev->dev.of_node; - const struct of_device_id *match; struct rk_pdm_dev *pdm; struct resource *res; void __iomem *regs; @@ -582,10 +580,7 @@ static int rockchip_pdm_probe(struct platform_device *pdev) if (!pdm) return -ENOMEM; - match = of_match_device(rockchip_pdm_match, &pdev->dev); - if (match) - pdm->version = (uintptr_t)match->data; - + pdm->version = (enum rk_pdm_version)device_get_match_data(&pdev->dev); if (pdm->version == RK_PDM_RK3308) { pdm->reset = devm_reset_control_get(&pdev->dev, "pdm-m"); if (IS_ERR(pdm->reset)) diff --git a/sound/soc/samsung/smdk_wm8994.c b/sound/soc/samsung/smdk_wm8994.c index 13fb1bd7f4c9..def92cc09f9c 100644 --- a/sound/soc/samsung/smdk_wm8994.c +++ b/sound/soc/samsung/smdk_wm8994.c @@ -5,7 +5,6 @@ #include #include #include -#include /* * Default CFG switch settings to use this driver: @@ -32,15 +31,6 @@ /* SMDK has a 16.934MHZ crystal attached to WM8994 */ #define SMDK_WM8994_FREQ 16934000 -struct smdk_wm8994_data { - int mclk1_rate; -}; - -/* Default SMDKs */ -static struct smdk_wm8994_data smdk_board_data = { - .mclk1_rate = SMDK_WM8994_FREQ, -}; - static int smdk_hw_params(struct snd_pcm_substream *substream, struct snd_pcm_hw_params *params) { @@ -136,8 +126,8 @@ static struct snd_soc_card smdk = { .num_links = ARRAY_SIZE(smdk_dai), }; -static const struct of_device_id samsung_wm8994_of_match[] __maybe_unused = { - { .compatible = "samsung,smdk-wm8994", .data = &smdk_board_data }, +static const struct of_device_id samsung_wm8994_of_match[] = { + { .compatible = "samsung,smdk-wm8994" }, {}, }; MODULE_DEVICE_TABLE(of, samsung_wm8994_of_match); @@ -147,15 +137,9 @@ static int smdk_audio_probe(struct platform_device *pdev) int ret; struct device_node *np = pdev->dev.of_node; struct snd_soc_card *card = &smdk; - struct smdk_wm8994_data *board; - const struct of_device_id *id; card->dev = &pdev->dev; - board = devm_kzalloc(&pdev->dev, sizeof(*board), GFP_KERNEL); - if (!board) - return -ENOMEM; - if (np) { smdk_dai[0].cpus->dai_name = NULL; smdk_dai[0].cpus->of_node = of_parse_phandle(np, @@ -171,12 +155,6 @@ static int smdk_audio_probe(struct platform_device *pdev) smdk_dai[0].platforms->of_node = smdk_dai[0].cpus->of_node; } - id = of_match_device(samsung_wm8994_of_match, &pdev->dev); - if (id) - *board = *((struct smdk_wm8994_data *)id->data); - - platform_set_drvdata(pdev, board); - ret = devm_snd_soc_register_card(&pdev->dev, card); if (ret) @@ -188,7 +166,7 @@ static int smdk_audio_probe(struct platform_device *pdev) static struct platform_driver smdk_audio_driver = { .driver = { .name = "smdk-audio-wm8994", - .of_match_table = of_match_ptr(samsung_wm8994_of_match), + .of_match_table = samsung_wm8994_of_match, .pm = &snd_soc_pm_ops, }, .probe = smdk_audio_probe, diff --git a/sound/soc/stm/stm32_i2s.c b/sound/soc/stm/stm32_i2s.c index 06a42130f5e4..46098e111142 100644 --- a/sound/soc/stm/stm32_i2s.c +++ b/sound/soc/stm/stm32_i2s.c @@ -1024,7 +1024,6 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev, struct stm32_i2s_data *i2s) { struct device_node *np = pdev->dev.of_node; - const struct of_device_id *of_id; struct reset_control *rst; struct resource *res; int irq, ret; @@ -1032,10 +1031,8 @@ static int stm32_i2s_parse_dt(struct platform_device *pdev, if (!np) return -ENODEV; - of_id = of_match_device(stm32_i2s_ids, &pdev->dev); - if (of_id) - i2s->regmap_conf = (const struct regmap_config *)of_id->data; - else + i2s->regmap_conf = device_get_match_data(&pdev->dev); + if (!i2s->regmap_conf) return -EINVAL; i2s->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); diff --git a/sound/soc/stm/stm32_sai.c b/sound/soc/stm/stm32_sai.c index 8e21e6f886fc..b45ee7e24f22 100644 --- a/sound/soc/stm/stm32_sai.c +++ b/sound/soc/stm/stm32_sai.c @@ -151,8 +151,8 @@ static int stm32_sai_set_sync(struct stm32_sai_data *sai_client, static int stm32_sai_probe(struct platform_device *pdev) { struct stm32_sai_data *sai; + const struct stm32_sai_conf *conf; struct reset_control *rst; - const struct of_device_id *of_id; u32 val; int ret; @@ -164,9 +164,9 @@ static int stm32_sai_probe(struct platform_device *pdev) if (IS_ERR(sai->base)) return PTR_ERR(sai->base); - of_id = of_match_device(stm32_sai_ids, &pdev->dev); - if (of_id) - memcpy(&sai->conf, (const struct stm32_sai_conf *)of_id->data, + conf = device_get_match_data(&pdev->dev); + if (conf) + memcpy(&sai->conf, (const struct stm32_sai_conf *)conf, sizeof(struct stm32_sai_conf)); else return -EINVAL; diff --git a/sound/soc/stm/stm32_sai_sub.c b/sound/soc/stm/stm32_sai_sub.c index 8bcb98d9b64e..ad2492efb1cd 100644 --- a/sound/soc/stm/stm32_sai_sub.c +++ b/sound/soc/stm/stm32_sai_sub.c @@ -1506,7 +1506,6 @@ static int stm32_sai_sub_parse_of(struct platform_device *pdev, static int stm32_sai_sub_probe(struct platform_device *pdev) { struct stm32_sai_sub_data *sai; - const struct of_device_id *of_id; const struct snd_dmaengine_pcm_config *conf = &stm32_sai_pcm_config; int ret; @@ -1514,10 +1513,7 @@ static int stm32_sai_sub_probe(struct platform_device *pdev) if (!sai) return -ENOMEM; - of_id = of_match_device(stm32_sai_sub_ids, &pdev->dev); - if (!of_id) - return -EINVAL; - sai->id = (uintptr_t)of_id->data; + sai->id = (uintptr_t)device_get_match_data(&pdev->dev); sai->pdev = pdev; mutex_init(&sai->ctrl_lock); diff --git a/sound/soc/stm/stm32_spdifrx.c b/sound/soc/stm/stm32_spdifrx.c index a359b528b26b..9eed3c57e3f1 100644 --- a/sound/soc/stm/stm32_spdifrx.c +++ b/sound/soc/stm/stm32_spdifrx.c @@ -908,17 +908,13 @@ static int stm32_spdifrx_parse_of(struct platform_device *pdev, struct stm32_spdifrx_data *spdifrx) { struct device_node *np = pdev->dev.of_node; - const struct of_device_id *of_id; struct resource *res; if (!np) return -ENODEV; - of_id = of_match_device(stm32_spdifrx_ids, &pdev->dev); - if (of_id) - spdifrx->regmap_conf = - (const struct regmap_config *)of_id->data; - else + spdifrx->regmap_conf = device_get_match_data(&pdev->dev); + if (!spdifrx->regmap_conf) return -EINVAL; spdifrx->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); diff --git a/sound/soc/tegra/tegra210_amx.c b/sound/soc/tegra/tegra210_amx.c index 179876949b30..dd1a2c77c6ea 100644 --- a/sound/soc/tegra/tegra210_amx.c +++ b/sound/soc/tegra/tegra210_amx.c @@ -7,9 +7,8 @@ #include #include #include +#include #include -#include -#include #include #include #include @@ -536,18 +535,13 @@ static int tegra210_amx_platform_probe(struct platform_device *pdev) struct tegra210_amx *amx; void __iomem *regs; int err; - const struct of_device_id *match; struct tegra210_amx_soc_data *soc_data; - match = of_match_device(tegra210_amx_of_match, dev); - - soc_data = (struct tegra210_amx_soc_data *)match->data; - amx = devm_kzalloc(dev, sizeof(*amx), GFP_KERNEL); if (!amx) return -ENOMEM; - amx->soc_data = soc_data; + amx->soc_data = device_get_match_data(dev); dev_set_drvdata(dev, amx); diff --git a/sound/soc/ti/davinci-evm.c b/sound/soc/ti/davinci-evm.c index ae7fdd761a7a..1bf333d2740d 100644 --- a/sound/soc/ti/davinci-evm.c +++ b/sound/soc/ti/davinci-evm.c @@ -175,20 +175,17 @@ static struct snd_soc_card evm_soc_card = { static int davinci_evm_probe(struct platform_device *pdev) { struct device_node *np = pdev->dev.of_node; - const struct of_device_id *match; struct snd_soc_dai_link *dai; struct snd_soc_card_drvdata_davinci *drvdata = NULL; struct clk *mclk; int ret = 0; - match = of_match_device(of_match_ptr(davinci_evm_dt_ids), &pdev->dev); - if (!match) { + dai = (struct snd_soc_dai_link *) device_get_match_data(&pdev->dev); + if (!dai) { dev_err(&pdev->dev, "Error: No device match found\n"); return -ENODEV; } - dai = (struct snd_soc_dai_link *) match->data; - evm_soc_card.dai_link = dai; dai->codecs->of_node = of_parse_phandle(np, "ti,audio-codec", 0); diff --git a/sound/soc/ti/davinci-mcasp.c b/sound/soc/ti/davinci-mcasp.c index 7e7d665a5504..b892d66f7847 100644 --- a/sound/soc/ti/davinci-mcasp.c +++ b/sound/soc/ti/davinci-mcasp.c @@ -21,8 +21,6 @@ #include #include #include -#include -#include #include #include #include @@ -1882,9 +1880,10 @@ static bool davinci_mcasp_have_gpiochip(struct davinci_mcasp *mcasp) static int davinci_mcasp_get_config(struct davinci_mcasp *mcasp, struct platform_device *pdev) { - const struct of_device_id *match = of_match_device(mcasp_dt_ids, &pdev->dev); struct device_node *np = pdev->dev.of_node; struct davinci_mcasp_pdata *pdata = NULL; + const struct davinci_mcasp_pdata *match_pdata = + device_get_match_data(&pdev->dev); const u32 *of_serial_dir32; u32 val; int i; @@ -1893,8 +1892,8 @@ static int davinci_mcasp_get_config(struct davinci_mcasp *mcasp, pdata = pdev->dev.platform_data; pdata->dismod = DISMOD_LOW; goto out; - } else if (match) { - pdata = devm_kmemdup(&pdev->dev, match->data, sizeof(*pdata), + } else if (match_pdata) { + pdata = devm_kmemdup(&pdev->dev, match_pdata, sizeof(*pdata), GFP_KERNEL); if (!pdata) return -ENOMEM; diff --git a/sound/soc/ti/omap-mcbsp.c b/sound/soc/ti/omap-mcbsp.c index bfe51221f541..7643a54592f5 100644 --- a/sound/soc/ti/omap-mcbsp.c +++ b/sound/soc/ti/omap-mcbsp.c @@ -13,7 +13,6 @@ #include #include #include -#include #include #include #include @@ -1360,23 +1359,22 @@ MODULE_DEVICE_TABLE(of, omap_mcbsp_of_match); static int asoc_mcbsp_probe(struct platform_device *pdev) { struct omap_mcbsp_platform_data *pdata = dev_get_platdata(&pdev->dev); + const struct omap_mcbsp_platform_data *match_pdata = + device_get_match_data(&pdev->dev); struct omap_mcbsp *mcbsp; - const struct of_device_id *match; int ret; - match = of_match_device(omap_mcbsp_of_match, &pdev->dev); - if (match) { + if (match_pdata) { struct device_node *node = pdev->dev.of_node; struct omap_mcbsp_platform_data *pdata_quirk = pdata; int buffer_size; - pdata = devm_kzalloc(&pdev->dev, + pdata = devm_kmemdup(&pdev->dev, match_pdata, sizeof(struct omap_mcbsp_platform_data), GFP_KERNEL); if (!pdata) return -ENOMEM; - memcpy(pdata, match->data, sizeof(*pdata)); if (!of_property_read_u32(node, "ti,buffer-size", &buffer_size)) pdata->buffer_size = buffer_size; if (pdata_quirk)