From patchwork Sat Dec 4 14:37:12 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12657995 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 gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 DA792C433F5 for ; Mon, 6 Dec 2021 10:22:28 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 773B973F6A; Mon, 6 Dec 2021 10:19:55 +0000 (UTC) Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by gabe.freedesktop.org (Postfix) with ESMTPS id 64FA86E9C7 for ; Sat, 4 Dec 2021 14:37:40 +0000 (UTC) Received: by mail-lf1-x134.google.com with SMTP id n12so13843954lfe.1 for ; Sat, 04 Dec 2021 06:37:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=yiWw98T7doYf6/KdnKDQ+eJuYvZvxnbIRrcyi8dmlBQ=; b=CvIzdumJO57P7zWKTttzFuuWukezUtQ7SVqlCIDYJOCL+DDGJxa5NRlTzP5ufVTyJ3 WdBnoPEWjyt/yA9/2yfp5uKl97UlOmh+2/vbgRGtRKHmGAzisdMgBlLyKdImPkUtofUz q9BHiVvU3wDb+5i1gQYwAeev/0armeUk1a/euDZjUbwA+gB18AP7AOuRBLxcIZpWo4yY gdrBt4VM0+pFbydfe7BjRCAckyhxJp2/NNOMC77qDxxxrT2nUvwqnd7zOcVAdIFgFErp YiV3VT6GsX1JEh9CqKnVF0BwtNheR9RH33TRbulARC2YxWbmmzy2zZ36Urf0WDOLiKAr r+rg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=yiWw98T7doYf6/KdnKDQ+eJuYvZvxnbIRrcyi8dmlBQ=; b=3F0XT3+16xY0RyORXogpkR1iaVpgxd+b2f8OcEXh3Z0Qlu2oubvz9ov+l1ZdOGb9gR x/lv6WeOSn0PF3TLixSAWSGzQeetDtC0nIbc4UOuTrIK61qw2/nPMW7LxQfUgSiyqgXm 1f9EzhhKuvCLiPR2t8luBga1hP6dPRlcV4CozMyA67Mnpe0k+NmVTb5/T9I9Pxcc/5Er G8qIXDuj6SPS4ixsj3Vih9yuIaN6WW4UhOjSvgzLHwyDJGeC+4mgDPE4Nir4qEFqdoZY tyaAtctFSbb+7h6dg4rROW05HCiN4CpvTH6auUTshyPd0DuGtz6cXg2hCB7yTlC3UHZ9 fSKQ== X-Gm-Message-State: AOAM533HWusPqANEbFuGxeK0cc+8jS9Ynr+YGC9rspPRvTKs0WZrS9Qn kuTdfBmNK9b+PNPx+4rY56I= X-Google-Smtp-Source: ABdhPJwGxqR5dlehJ7vaPbP5WBGS9cfxwU4MhdypIIFth3sVfScXSDCGAKQzEHWJmayVj6NGoxgE2w== X-Received: by 2002:a05:6512:1090:: with SMTP id j16mr23911147lfg.568.1638628658719; Sat, 04 Dec 2021 06:37:38 -0800 (PST) Received: from localhost.localdomain (94-29-46-111.dynamic.spd-mgts.ru. [94.29.46.111]) by smtp.gmail.com with ESMTPSA id g36sm782934lfv.16.2021.12.04.06.37.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 04 Dec 2021 06:37:38 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli Subject: [PATCH v4 09/22] ASoC: tegra20: spdif: Use more resource-managed helpers Date: Sat, 4 Dec 2021 17:37:12 +0300 Message-Id: <20211204143725.31646-10-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211204143725.31646-1-digetx@gmail.com> References: <20211204143725.31646-1-digetx@gmail.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: devicetree@vger.kernel.org, alsa-devel@alsa-project.org, Arnd Bergmann , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Rob Herring , linux-tegra@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use resource-managed helpers to make code cleaner. Driver's remove callback isn't needed anymore since driver is completely resource-managed now. Signed-off-by: Dmitry Osipenko Acked-by: Thierry Reding --- sound/soc/tegra/tegra20_spdif.c | 33 +++++++++------------------------ sound/soc/tegra/tegra_pcm.c | 6 ++++++ sound/soc/tegra/tegra_pcm.h | 1 + 3 files changed, 16 insertions(+), 24 deletions(-) diff --git a/sound/soc/tegra/tegra20_spdif.c b/sound/soc/tegra/tegra20_spdif.c index d5c618611dbb..7dd263721c2c 100644 --- a/sound/soc/tegra/tegra20_spdif.c +++ b/sound/soc/tegra/tegra20_spdif.c @@ -289,38 +289,24 @@ static int tegra20_spdif_platform_probe(struct platform_device *pdev) spdif->playback_dma_data.addr_width = DMA_SLAVE_BUSWIDTH_4_BYTES; spdif->playback_dma_data.maxburst = 4; - pm_runtime_enable(&pdev->dev); + ret = devm_pm_runtime_enable(&pdev->dev); + if (ret) + return ret; - ret = snd_soc_register_component(&pdev->dev, &tegra20_spdif_component, - &tegra20_spdif_dai, 1); + ret = devm_snd_soc_register_component(&pdev->dev, + &tegra20_spdif_component, + &tegra20_spdif_dai, 1); if (ret) { dev_err(&pdev->dev, "Could not register DAI: %d\n", ret); - goto err_pm_disable; + return ret; } - ret = tegra_pcm_platform_register(&pdev->dev); + ret = devm_tegra_pcm_platform_register(&pdev->dev); if (ret) { dev_err(&pdev->dev, "Could not register PCM: %d\n", ret); - goto err_unregister_component; + return ret; } - return 0; - -err_unregister_component: - snd_soc_unregister_component(&pdev->dev); -err_pm_disable: - pm_runtime_disable(&pdev->dev); - - return ret; -} - -static int tegra20_spdif_platform_remove(struct platform_device *pdev) -{ - tegra_pcm_platform_unregister(&pdev->dev); - snd_soc_unregister_component(&pdev->dev); - - pm_runtime_disable(&pdev->dev); - return 0; } @@ -342,7 +328,6 @@ static struct platform_driver tegra20_spdif_driver = { .of_match_table = tegra20_spdif_of_match, }, .probe = tegra20_spdif_platform_probe, - .remove = tegra20_spdif_platform_remove, }; module_platform_driver(tegra20_spdif_driver); diff --git a/sound/soc/tegra/tegra_pcm.c b/sound/soc/tegra/tegra_pcm.c index ef1e74d95236..468c8e77de21 100644 --- a/sound/soc/tegra/tegra_pcm.c +++ b/sound/soc/tegra/tegra_pcm.c @@ -48,6 +48,12 @@ int tegra_pcm_platform_register(struct device *dev) } EXPORT_SYMBOL_GPL(tegra_pcm_platform_register); +int devm_tegra_pcm_platform_register(struct device *dev) +{ + return devm_snd_dmaengine_pcm_register(dev, &tegra_dmaengine_pcm_config, 0); +} +EXPORT_SYMBOL_GPL(devm_tegra_pcm_platform_register); + int tegra_pcm_platform_register_with_chan_names(struct device *dev, struct snd_dmaengine_pcm_config *config, char *txdmachan, char *rxdmachan) diff --git a/sound/soc/tegra/tegra_pcm.h b/sound/soc/tegra/tegra_pcm.h index d602126c65b7..2a36eea1740d 100644 --- a/sound/soc/tegra/tegra_pcm.h +++ b/sound/soc/tegra/tegra_pcm.h @@ -32,6 +32,7 @@ int tegra_pcm_hw_params(struct snd_soc_component *component, snd_pcm_uframes_t tegra_pcm_pointer(struct snd_soc_component *component, struct snd_pcm_substream *substream); int tegra_pcm_platform_register(struct device *dev); +int devm_tegra_pcm_platform_register(struct device *dev); int tegra_pcm_platform_register_with_chan_names(struct device *dev, struct snd_dmaengine_pcm_config *config, char *txdmachan, char *rxdmachan);