From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9870DC433EF for ; Fri, 17 Dec 2021 17:58:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240069AbhLQR6m (ORCPT ); Fri, 17 Dec 2021 12:58:42 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36534 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240038AbhLQR6L (ORCPT ); Fri, 17 Dec 2021 12:58:11 -0500 Received: from mail-lf1-x134.google.com (mail-lf1-x134.google.com [IPv6:2a00:1450:4864:20::134]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F809C061748; Fri, 17 Dec 2021 09:58:10 -0800 (PST) Received: by mail-lf1-x134.google.com with SMTP id g11so6302397lfu.2; Fri, 17 Dec 2021 09:58:10 -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=Oq9KsYKOEQtYmLXJzVbR0p77Vqj89Yz0SNqCzPk9aww=; b=Be/hYpcFj7O+BPdmVmMrW4x/MfLWPoe6iIwwWKNvyfa5dQwvXFB2G/9uhWcEGiAXfz oQpv7a5SJq6ulmLSmVnEAc1KoTzBl0Wo4fMnIWiM8WM+ZAfEZNzw74TeIVWuiB97MHzO 6plY5TktsNKnQZQ9DO7dgZHldeOrSuMTjIDEaN6Yp4DZ9DWLzkSAD7zLhp+dkPbupKl+ cM7edbO8EXZSj6M5VAWfkaEVhHhCdGUNkm3X8cinU6KW7CBCSw1R0N/H2emmlWWvVy8u eIwHYsGoEM12gJ0U+4mPOn/2V8aWSdxGV3iytCGAQoEuSMjP+6vKG7yQAsla8DNqTDK1 LJxQ== 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=Oq9KsYKOEQtYmLXJzVbR0p77Vqj89Yz0SNqCzPk9aww=; b=OUytjpltWmQ/uKQWea5KfCzkRA1PHAUZXUTezpHY92oxHa3lWzWfw21Gv5gmqkp4QL H34YZfHFg3gTGbkmUhEk6MR9PmHWzm/al8gMKlVpUMLpl5kBocIZjPwsMJuXq5gOPbMx 2yEtVTrT+BnouP7cgq32Dqqrzs8CIOEMUvKcuyXm3b2tmV8+uUywG4j6YfaT6IRO9qOO obtxkbif/5LhErDAPypa2qS9OCy0PaPYQ9WOzYP/561G/MCHUT0V42CO1TwpVaJvDEgA 1cRcgYEXZrG5Ycruqaf/nxoUo16YVgeR2DzZ0bR7LVV2NovyrpBZmW/Pp3yRjQSodT6d fYxQ== X-Gm-Message-State: AOAM530oU6/aZYhaaDJhyTMSRYSG7AaQLKvZ8A62Sf3YLtiwybMtiBqw b4yHUcyQFx2S85z/gGgKDCk= X-Google-Smtp-Source: ABdhPJwURLrbEX96YqiOUtKnN+QvMqzk8Y4fn+is18eeyV6EuYmQSj830j+HQQ71wIzrKJhtD/lMzQ== X-Received: by 2002:a05:6512:23a4:: with SMTP id c36mr3822041lfv.125.1639763888877; Fri, 17 Dec 2021 09:58:08 -0800 (PST) Received: from localhost.localdomain (94-29-63-156.dynamic.spd-mgts.ru. [94.29.63.156]) by smtp.gmail.com with ESMTPSA id w23sm1479244lfa.191.2021.12.17.09.58.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 17 Dec 2021 09:58:08 -0800 (PST) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Mark Brown , Takashi Iwai , Jaroslav Kysela , Liam Girdwood , Agneli Cc: linux-tegra@vger.kernel.org, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH v5 07/11] ASoC: tegra20: spdif: Use more resource-managed helpers Date: Fri, 17 Dec 2021 20:56:02 +0300 Message-Id: <20211217175606.22645-8-digetx@gmail.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: <20211217175606.22645-1-digetx@gmail.com> References: <20211217175606.22645-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use resource-managed helpers to make code cleaner. Driver's remove callback isn't needed anymore since driver is completely resource-managed now. Acked-by: Thierry Reding Signed-off-by: Dmitry Osipenko --- 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); -- 2.33.1