From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f51.google.com (mail-wm1-f51.google.com [209.85.128.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 34EBD3BF662 for ; Mon, 23 Mar 2026 16:16:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282599; cv=none; b=AX8WAu6xHrJj2ONCxA047gO8J4xnJfZeNuPPvWDkm2KIHpeUlNwh4u62sqPXbpAuPaLxW7CHWJEXeomo1SeFA5AWmh5jMDgbzcZ67UQhlkIuzIL08Tkzeo9tDM3z+ljke/AsaZywzSNom3bvi5kgVmiBgNqh/R9gpq7nfNc3oos= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1774282599; c=relaxed/simple; bh=g8+Hj0Vb1Y/88a17yOow0ZjQc6l0noTQuUGZxhIscS0=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=e8+k4MixeAfGvRfsVr05tqA+jzj+SIm+BxeudHuk9dYeoWU7sIqoSYEaVk78DMTM0M4eyCdLD+dC4Q1ki3/LXfRdXCiQcq+fXlK/v8BBLRmDDloHVA5vf5im14UfjndGGrBAT2yitddybhYfxPSIKN7CAJsPL0nW4XP2rJLm8LQ= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DfL7ZP4L; arc=none smtp.client-ip=209.85.128.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DfL7ZP4L" Received: by mail-wm1-f51.google.com with SMTP id 5b1f17b1804b1-4870206f73bso17110115e9.3 for ; Mon, 23 Mar 2026 09:16:35 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1774282594; x=1774887394; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=8e14EFbUgBOZGsLZ9xhCm0kYrey9UscJoVzYYnSs0h4=; b=DfL7ZP4Llr92HekVW2kyP2b4s9Qyu1vsgQfyaskD9FbZ4dPGD3IdrcpP8MRCRMo8a7 +SmkE5IcF9Kdn06p/ka3nvaVpTn/Gn3E7vMR007RubPNkbHB9BHEiCLL1mBBmqdOHQe4 d9K8k+2jQykdskGS3n7+IIh6en0YoP1Ga932SCTkuwiMBwxvssLNxB9wK5qmpn7wfTf7 gkdv1nlOvMxZDXi69+SPOv6nEQdJE5LVYvvpgtNh7752gDNBR6jerpk7y/mIdgjUzrE0 pIKwOYxI1wimzzfOPyTY6ybPyOySpxcZVKcH0r+NI+Sn/f4sy4bJtgwFU+WTB4e50x1Z vjbA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1774282594; x=1774887394; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-gg:x-gm-message-state:from :to:cc:subject:date:message-id:reply-to; bh=8e14EFbUgBOZGsLZ9xhCm0kYrey9UscJoVzYYnSs0h4=; b=BGOvCtKNQrZilN9KmGaX2x1XFaxalxHPpC6d7yYQKbvxeKdL39Gh5Hgg7Bdl/kxqn8 ovMFB0GSRquC7RUE3XFCicGQkwEYltxzrZeRR0EadJha/hnnLx922sf6EiU4KSMLCchj McowNxuqFSeX9QbSmnSrUjcIWnbhFFaAlGtasAzvncaMolOuZD/yq7F2jisAAUg7GTzI Dnpp+uv+D7RhNNHE+9BY6UtEWj9vP7HuSPEAadNA0Ae+0yMWAEuQ8K55plEPmw8iElrQ H8HzWwLF60/N+iIa5EIfTd+WHUDnmnui/qErTy5lyhsjVJ06AtdOiFLeHGqOjHVoJyOx bQVg== X-Forwarded-Encrypted: i=1; AJvYcCU8FYZLD/E87XGDpt+X+ALSp1qYLWF81BM0TaeYrtLIIPYSTuiKd+t1Qf0QaEn7Wv6r3QkSlpl4d0Y+0gI=@vger.kernel.org X-Gm-Message-State: AOJu0YxBxDPA1ogcM8ldj9CgV62J6fzocUxWXGJaxXuU2Hn2NFdRtv9S 4apQCoJHrFK5XQvgGCTBBthZHCoPM6AIxFC/DsR/KKzUZ8JebgzaOTY= X-Gm-Gg: ATEYQzwFmgNjN4CPHfxt2wZh8FJcdlcY05gK0UJTRa2L8w9gTh9o9vKvWgztuoI9ae2 AG0oewSg5u4SwOyu5k301VumlkZZBPhM2RmE/3WgL4NkqgqJ3GKhcQwKRTVoxzCRYcIqrObh4+0 SauvTyNkkmAyn7ccAHXvfDvk4W51iagda9M8ITIv8X2WWB9PKWqQeNisPAoAm+uC7uZPb0gZ99u MkCRbtIl6nK0jeZJBgpmDlKn77UL5fdTIZ4zcWVc4PC2t9MwIWEnhOgsCvkHgy26ex8bjdQ65B6 N6fWuyGY1Omb7jkQUsHToa9umshjDvggK54l5vJI9ZQeiI4GQVvhYskhLnJ1ux981RoGUQRLHTE b16bp6HeUAduGSPEZ4sgnNUAC5GxRC87oGXe/1CL+OO+qEy7xa4Iqyb/aVt9jcGKWS4xmC13xnK wBUDUZRwA37e0FAvY5ve/vCuIHaoiaU44DFImuOeV5Spcci4+CAwJz X-Received: by 2002:a05:600c:a59b:b0:486:ffa3:593 with SMTP id 5b1f17b1804b1-486ffa30b26mr96817745e9.28.1774282594063; Mon, 23 Mar 2026 09:16:34 -0700 (PDT) Received: from localhost.localdomain ([78.240.51.139]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-486f8aacc73sm331863395e9.0.2026.03.23.09.16.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Mar 2026 09:16:29 -0700 (PDT) From: Jihed Chaibi To: paul@crapouillou.net, linux-mips@vger.kernel.org Cc: lgirdwood@gmail.com, broonie@kernel.org, perex@perex.cz, tiwai@suse.com, linux-sound@vger.kernel.org, linux-kernel@vger.kernel.org, jihed.chaibi.dev@gmail.com Subject: [PATCH 1/3] ASoC: jz4725b: Convert to devm_clk_get_enabled() Date: Mon, 23 Mar 2026 17:15:49 +0100 Message-ID: <20260323161551.47181-2-jihed.chaibi.dev@gmail.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260323161551.47181-1-jihed.chaibi.dev@gmail.com> References: <20260323161551.47181-1-jihed.chaibi.dev@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The clock is obtained with devm_clk_get() in the platform probe, then manually enabled in the component probe and disabled in the component remove without checking the return value of clk_prepare_enable(). Use devm_clk_get_enabled() instead, which combines the get, prepare and enable operations into one call whose lifetime is tied to the device. This removes the need for explicit enable/disable in the component probe/remove callbacks, and ensures that clock enable failures are propagated as errors rather than silently ignored. Remove the now-unused struct clk pointer from struct jz_icdc and drop the empty component remove callback. Signed-off-by: Jihed Chaibi --- sound/soc/codecs/jz4725b.c | 18 ++++-------------- 1 file changed, 4 insertions(+), 14 deletions(-) diff --git a/sound/soc/codecs/jz4725b.c b/sound/soc/codecs/jz4725b.c index 39cebaa167be..8a7d26a08c03 100644 --- a/sound/soc/codecs/jz4725b.c +++ b/sound/soc/codecs/jz4725b.c @@ -160,7 +160,6 @@ enum { struct jz_icdc { struct regmap *regmap; void __iomem *base; - struct clk *clk; }; static const SNDRV_CTL_TLVD_DECLARE_DB_SCALE(jz4725b_adc_tlv, 0, 150, 0); @@ -405,8 +404,6 @@ static int jz4725b_codec_dev_probe(struct snd_soc_component *component) struct jz_icdc *icdc = snd_soc_component_get_drvdata(component); struct regmap *map = icdc->regmap; - clk_prepare_enable(icdc->clk); - /* Write CONFIGn (n=1 to 8) bits. * The value 0x0f is specified in the datasheet as a requirement. */ @@ -418,16 +415,8 @@ static int jz4725b_codec_dev_probe(struct snd_soc_component *component) return 0; } -static void jz4725b_codec_dev_remove(struct snd_soc_component *component) -{ - struct jz_icdc *icdc = snd_soc_component_get_drvdata(component); - - clk_disable_unprepare(icdc->clk); -} - static const struct snd_soc_component_driver jz4725b_codec = { .probe = jz4725b_codec_dev_probe, - .remove = jz4725b_codec_dev_remove, .set_bias_level = jz4725b_codec_set_bias_level, .controls = jz4725b_codec_controls, .num_controls = ARRAY_SIZE(jz4725b_codec_controls), @@ -618,6 +607,7 @@ static int jz4725b_codec_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct jz_icdc *icdc; + struct clk *clk; int ret; icdc = devm_kzalloc(dev, sizeof(*icdc), GFP_KERNEL); @@ -633,9 +623,9 @@ static int jz4725b_codec_probe(struct platform_device *pdev) if (IS_ERR(icdc->regmap)) return PTR_ERR(icdc->regmap); - icdc->clk = devm_clk_get(&pdev->dev, "aic"); - if (IS_ERR(icdc->clk)) - return PTR_ERR(icdc->clk); + clk = devm_clk_get_enabled(dev, "aic"); + if (IS_ERR(clk)) + return PTR_ERR(clk); platform_set_drvdata(pdev, icdc); -- 2.47.3