From patchwork Mon Sep 19 17:57:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bard Liao X-Patchwork-Id: 12980855 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 830E5ECAAA1 for ; Mon, 19 Sep 2022 17:52:13 +0000 (UTC) Received: from alsa1.perex.cz (alsa1.perex.cz [207.180.221.201]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by alsa0.perex.cz (Postfix) with ESMTPS id 78183E12; Mon, 19 Sep 2022 19:51:21 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa0.perex.cz 78183E12 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=alsa-project.org; s=default; t=1663609931; bh=EviRt9EmxI1oqeLj/2924DDSte2Z0gsI2mryQ9QkDl4=; h=From:To:Subject:Date:In-Reply-To:References:Cc:List-Id: List-Unsubscribe:List-Archive:List-Post:List-Help:List-Subscribe: From; b=DzlKP3pOWimERDx8+46BKkcIswnzY5QwA32mCCTmPOmjz6E2JDF8O4otW9HK2ZMAS CWn7+DXDvfRfRgDK9fSU4C/es8ZVSqPQwhDhVxafT4IZjhYEK6kL3lyvM760mFY5oa WpjgiY/Z6Mr4noN+96Pgz2R5hExaUrXWSrzWo3Hc= Received: from alsa1.perex.cz (localhost.localdomain [127.0.0.1]) by alsa1.perex.cz (Postfix) with ESMTP id 793BEF8053A; Mon, 19 Sep 2022 19:50:58 +0200 (CEST) Received: by alsa1.perex.cz (Postfix, from userid 50401) id 455F3F8053B; Mon, 19 Sep 2022 19:50:57 +0200 (CEST) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) (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 88BCBF8016D for ; Mon, 19 Sep 2022 19:50:50 +0200 (CEST) DKIM-Filter: OpenDKIM Filter v2.11.0 alsa1.perex.cz 88BCBF8016D Authentication-Results: alsa1.perex.cz; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="IhTU19j4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663609851; x=1695145851; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EviRt9EmxI1oqeLj/2924DDSte2Z0gsI2mryQ9QkDl4=; b=IhTU19j4dptk3UK9DLx7lwh0JW/HcyVZqmU5dHjDFcgRJjS5JZ61Jzam pIyOW7EUG4U8sJRBsCUYpmoBSJuOWl9K3Fvdr+7Yup5XLKfKcoZUZrbV1 0sOS5EUL/425e699BzygjKRrYBVpT4BNwZSvd2a6n9CD6SapbT3tae2DN Eq0bgtB9LZ4HB/kkhrcpVAH3wCtrzgLsdn2qdreOTZuz913Ydt9NQzHOi W+dPVoJniSNp/IM/sRt8XFfBWg/5gGfXOMYLB/N1gHWpof4EbFJdKU//b ymQVZHIgDxa6+0nCMMlxwcQ4XCLKyVhCtjr3ykHRwEVTLVvUNnh2Em1h4 A==; X-IronPort-AV: E=McAfee;i="6500,9779,10475"; a="282498668" X-IronPort-AV: E=Sophos;i="5.93,328,1654585200"; d="scan'208";a="282498668" Received: from fmsmga006.fm.intel.com ([10.253.24.20]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2022 10:50:44 -0700 X-IronPort-AV: E=Sophos;i="5.93,328,1654585200"; d="scan'208";a="863658384" Received: from bard-ubuntu.sh.intel.com ([10.239.185.57]) by fmsmga006-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 19 Sep 2022 10:50:43 -0700 From: Bard Liao To: alsa-devel@alsa-project.org, vkoul@kernel.org Subject: [PATCH 02/11] soundwire: intel: simplify flow and use devm_ for DAI registration Date: Tue, 20 Sep 2022 01:57:12 +0800 Message-Id: <20220919175721.354679-3-yung-chuan.liao@linux.intel.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220919175721.354679-1-yung-chuan.liao@linux.intel.com> References: <20220919175721.354679-1-yung-chuan.liao@linux.intel.com> MIME-Version: 1.0 Cc: pierre-louis.bossart@linux.intel.com, vinod.koul@linaro.org, bard.liao@intel.com, linux-kernel@vger.kernel.org X-BeenThere: alsa-devel@alsa-project.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: "Alsa-devel mailing list for ALSA developers - http://www.alsa-project.org" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: "Alsa-devel" From: Pierre-Louis Bossart We already use devm_ for memory allocation but not for component/DAI registration. The resource management can be based on devm_ in all cases. Signed-off-by: Pierre-Louis Bossart Reviewed-by: Rander Wang Signed-off-by: Bard Liao --- drivers/soundwire/intel.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/drivers/soundwire/intel.c b/drivers/soundwire/intel.c index 3bb29bc00d5a..a6fe91f2d964 100644 --- a/drivers/soundwire/intel.c +++ b/drivers/soundwire/intel.c @@ -1203,8 +1203,8 @@ static int intel_register_dai(struct sdw_intel *sdw) if (ret) return ret; - return snd_soc_register_component(cdns->dev, &dai_component, - dais, num_dai); + return devm_snd_soc_register_component(cdns->dev, &dai_component, + dais, num_dai); } static int sdw_master_read_intel_prop(struct sdw_bus *bus) @@ -1489,7 +1489,6 @@ int intel_link_startup(struct auxiliary_device *auxdev) static void intel_link_remove(struct auxiliary_device *auxdev) { - struct device *dev = &auxdev->dev; struct sdw_cdns *cdns = auxiliary_get_drvdata(auxdev); struct sdw_intel *sdw = cdns_to_intel(cdns); struct sdw_bus *bus = &cdns->bus; @@ -1502,7 +1501,6 @@ static void intel_link_remove(struct auxiliary_device *auxdev) if (!bus->prop.hw_disabled) { intel_debugfs_exit(sdw); sdw_cdns_enable_interrupt(cdns, false); - snd_soc_unregister_component(dev); } sdw_bus_master_delete(bus); }