Received: by 2002:a05:6a10:17d3:0:0:0:0 with SMTP id hz19csp2636975pxb; Tue, 13 Apr 2021 06:46:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw2qzhu1uovjQw7a1x9ipD5v4aG8VM9kiE0sk5Y5P1GgUqBLd/2U6zi8oby9AIZvPzIkyX1 X-Received: by 2002:a17:90b:4d0f:: with SMTP id mw15mr134285pjb.92.1618321588831; Tue, 13 Apr 2021 06:46:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1618321588; cv=none; d=google.com; s=arc-20160816; b=vyO85b5nPf4HE7n82hKArsgwKHuB1XIjV4M+auLr5qNSFlEIa3TXobgdAxMPBHqiwc QbcAex2O01qPSahzXAEV5JrjkliLouOskCxqBy7UfndOVvjoO24IJgjchU8cZ5mChO8q 5Tko8ZlKwIuzWin0/wJZed8x5XlVFjh/kmWsMdO7DwMKcKx/i7warpSziRDFY+vYWP8G YdiFvijqJ9lqrwDWFvzGlfuNUE67Sov4+cfyE3mnZo6pBVHQN6qJBPALFmWhM1bO2MbU bcBmuvntqUvqD/f9q+X1d3FyWqq18skWWDtkCqMvXeQEaHsIszmJoaaN8RY5OE0uEVWP BXQQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:date:message-id:in-reply-to:subject :cc:to:from:user-agent:references:dkim-signature; bh=I0tKIcGAnmGzt7gEhrs4pRS1r2Q74lYwZyR49l7q3W4=; b=CuxOqZ/dXROpHDyaFliUndi4q3bTc5a13IDaliOBt6kXUOHyP/5GUGGN1jf+Eb/74p dIVs5IRo9+q0TeybEwY+YIDVqC9BLo4HHx6daaT9bhxqfGk0clnDTpab4xeHZeDL2RmI V2VEJb7g4l423+NGnne3zVwVEW2M4Tv1QPS/JHwMQ3djSlQ223YjyvBudO0uZkyA9Zpv bsS2cE8QodyXPjYc6j3GdbZIaYe5I04VI2dXGzE9wrk/mOLdORyEpyJHfqtURJplI5IH dhbXebbDaHUhmV1NgmEd2aRCcrXqTEss7hrPP81a1aGiBXoNiU9JsnjJYlkCAVUwwj5+ gaNg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=s9WMcgFo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a16si17545140plh.247.2021.04.13.06.46.16; Tue, 13 Apr 2021 06:46:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=s9WMcgFo; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238193AbhDMHcT (ORCPT + 99 others); Tue, 13 Apr 2021 03:32:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51872 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237776AbhDMHcT (ORCPT ); Tue, 13 Apr 2021 03:32:19 -0400 Received: from mail-wm1-x32e.google.com (mail-wm1-x32e.google.com [IPv6:2a00:1450:4864:20::32e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 875C6C061574 for ; Tue, 13 Apr 2021 00:31:59 -0700 (PDT) Received: by mail-wm1-x32e.google.com with SMTP id w186so3617669wmg.3 for ; Tue, 13 Apr 2021 00:31:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=baylibre-com.20150623.gappssmtp.com; s=20150623; h=references:user-agent:from:to:cc:subject:in-reply-to:message-id :date:mime-version; bh=I0tKIcGAnmGzt7gEhrs4pRS1r2Q74lYwZyR49l7q3W4=; b=s9WMcgFohkgE20WsAj9CXlV7WD1zYY9OWiuDjIFtC6KA4jVR76cLXh09qK5IL7ZoG+ Yue22tCXfmjieQ3qMNvUV4GBD0bRFkH6fVyEcqaS5jtOBfUi2+WfQzHRhwrp36hZstv7 ZhudGEdVmABoHwZw5ag0jfU7Is3+wiBpwOq0MPGaemjfShNUaHZJr68vMjgp31dqYDNR Tr2/z1+BZY7d45OCTzmM6Z0CwwmlAkhCaLl9yqzmqvB+YMrCSvevAfLrL5bA7oL7I3dn qt5EEpbJdh9h6ml4uoCl5+GpaeBD2/pOGuNi9oADeL2P2apsVffNnBrcx/8gdM687olG dxew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:references:user-agent:from:to:cc:subject :in-reply-to:message-id:date:mime-version; bh=I0tKIcGAnmGzt7gEhrs4pRS1r2Q74lYwZyR49l7q3W4=; b=e4LuLd8JC/z64x9GoJg1VzkM4GW/jI2I2Ow8DEEfcTiMHKE9E/2ldFXqDsoTLWg0g5 22krq/ugsNkXN/LCbF3BL4WIlmrXSyopcecwVOzgGSieWZ0gCMfM+4j2YxGUA8GKqzMs LPaZdFGojN7n2Aezxa1LWGixyhoKTmJRVrcH+0A2grRg17+CEZNoECBZTV4i20uuEjL3 NAdKPthDrn8gCya3d889NdFiBS4taSttLk58Smkmhak1sOHxj+qOoRIIMZWb4o0MHH1X OQpAgKuykV5r6HYr+eSleTr0AlXASRW7aE6jwN/pxVMDOdMWxtqpwNa6JJRlb7ajcU0W SC1Q== X-Gm-Message-State: AOAM5307IL1RyTX+2eH0yMMitksBQ0g1jQYaQW6XZeEqdBATcaXOokww gGRNEZT82gXoR9tUSKhuUzONlg== X-Received: by 2002:a05:600c:4f14:: with SMTP id l20mr2689930wmq.71.1618299118162; Tue, 13 Apr 2021 00:31:58 -0700 (PDT) Received: from localhost (82-65-169-74.subs.proxad.net. [82.65.169.74]) by smtp.gmail.com with ESMTPSA id z17sm7197599wro.1.2021.04.13.00.31.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 13 Apr 2021 00:31:57 -0700 (PDT) References: <20210410111356.467340-1-jbrunet@baylibre.com> <20210410111356.467340-4-jbrunet@baylibre.com> <161825923642.3764895.16526540466177115640@swboyd.mtv.corp.google.com> User-agent: mu4e 1.4.10; emacs 27.2 From: Jerome Brunet To: Stephen Boyd , Liam Girdwood , Mark Brown Cc: alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 3/5] ASoC: rt5682: clock driver must use the clock provider API In-reply-to: <161825923642.3764895.16526540466177115640@swboyd.mtv.corp.google.com> Message-ID: <1jlf9m63o3.fsf@starbuckisacylon.baylibre.com> Date: Tue, 13 Apr 2021 09:31:56 +0200 MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 12 Apr 2021 at 22:27, Stephen Boyd wrote: > Quoting Jerome Brunet (2021-04-10 04:13:54) >> Clock drivers ops should not the clk API but the clock provider (clk_hw) >> instead. >> >> Signed-off-by: Jerome Brunet >> --- >> sound/soc/codecs/rt5682.c | 6 +++--- >> 1 file changed, 3 insertions(+), 3 deletions(-) >> >> diff --git a/sound/soc/codecs/rt5682.c b/sound/soc/codecs/rt5682.c >> index 0e2a10ed11da..2eee02ac8d49 100644 >> --- a/sound/soc/codecs/rt5682.c >> +++ b/sound/soc/codecs/rt5682.c >> @@ -2634,7 +2634,7 @@ static int rt5682_wclk_set_rate(struct clk_hw *hw, unsigned long rate, >> container_of(hw, struct rt5682_priv, >> dai_clks_hw[RT5682_DAI_WCLK_IDX]); >> struct snd_soc_component *component = rt5682->component; >> - struct clk *parent_clk; >> + struct clk_hw *parent_hw; >> const char * const clk_name = clk_hw_get_name(hw); >> int pre_div; >> unsigned int clk_pll2_out; >> @@ -2649,8 +2649,8 @@ static int rt5682_wclk_set_rate(struct clk_hw *hw, unsigned long rate, >> * >> * It will set the codec anyway by assuming mclk is 48MHz. >> */ >> - parent_clk = clk_get_parent(hw->clk); >> - if (!parent_clk) >> + parent_hw = clk_hw_get_parent(hw); >> + if (!parent_hw) >> dev_warn(component->dev, >> "Parent mclk of wclk not acquired in driver. Please ensure mclk was provided as %d Hz.\n", >> CLK_PLL2_FIN); > > Can this code be removed? I don't know why we care to check if the clk > has a parent or not. I'm focusing on removing "hw->clk" where they are - w/o changing too much what the driver does. I don't have the HW nor the story behind it and there is about 50 more drivers to be fixed ... thankfully, most are in drivers/clk/ ;) Here, at least the clock consummer API is not longer used within a clock ops, which is not great considering the locking scheme (among other things)