Received: by 2002:a05:6a10:a841:0:0:0:0 with SMTP id d1csp3907685pxy; Mon, 26 Apr 2021 12:42:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxYl1qzGClWFUeso7iPLXXm0xQZzeF3CWV3sgeSeFGeHNC+RdRZySEl/C6zf6zr65UZhZej X-Received: by 2002:a62:5c6:0:b029:24d:e97f:1b1d with SMTP id 189-20020a6205c60000b029024de97f1b1dmr19625698pff.40.1619466125004; Mon, 26 Apr 2021 12:42:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1619466124; cv=none; d=google.com; s=arc-20160816; b=au368p+zmbpqtVDQdCyO6CdvPS+cdEwRYNlp/6OBXyQkqmSxy9R6ysdx0Rd+iUBW7h 4tB6rxfeyonMAW80hKs80SvOm6NFzASKGwjhUCZ16xoCUdy43ty/hSZc0h46KeDephOA zSGjWSMbpB5gFFXupwypXxqWfKmf+IHZDPIOQ7bhbFUMkAxA/ghpIQuIXPH2x64PTFUK HjpXC+rJXZRQqzRaYr+spfaQ1ELBLWLiAibB9J4Obh8rZ3gL8QQUbaGDkAPUAItDikG+ IcqW3bswc9uUEkC9rTXe4HU9g4o/dOPXrA2J9VxfT56c6/I/Xe/g8pLx5+cuU6i8CuuZ a3bQ== 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=CQWUshTzpRmPn2kJI0awd5uuYv8OmvrDOIgcP4epbdo=; b=SwaY1KkdbpnLPf1TtC61/BEhq1O0aNLPwlhx9RH99Osnu5C/JDpUu7aZdgh+fZ60th tfvOWbOEkCbw1SYpdOoJXA4RhbD+BYUp7743ktwEusN9GA08JoyCzM2jA3eCim9FTM8c C9rxA39RVAOcdlVj1XGFwxOFhek9iBoyrqSNiMR+sitmY5jIDcxDkRqgjM9e1+229ky6 9b77FMpaoUXDYX1ZlhaLH2XfnP8OejcgVJlevpJ63LYGAxs+500kmyX3R7DrdXZAfcz0 QHGLYm72+TBNNA1N0yW5/meuadao2azy0zgX8EjlMm1A79tM10B+3npKBasSQPmAU102 BeuQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@baylibre-com.20150623.gappssmtp.com header.s=20150623 header.b=UgEJ4d6l; 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 a6si19298379pgm.17.2021.04.26.12.41.52; Mon, 26 Apr 2021 12:42:04 -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=UgEJ4d6l; 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 S239485AbhDZTgA (ORCPT + 99 others); Mon, 26 Apr 2021 15:36:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59168 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236653AbhDZTf7 (ORCPT ); Mon, 26 Apr 2021 15:35:59 -0400 Received: from mail-ed1-x532.google.com (mail-ed1-x532.google.com [IPv6:2a00:1450:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6DB4CC061574 for ; Mon, 26 Apr 2021 12:35:16 -0700 (PDT) Received: by mail-ed1-x532.google.com with SMTP id i3so41436420edt.1 for ; Mon, 26 Apr 2021 12:35:16 -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=CQWUshTzpRmPn2kJI0awd5uuYv8OmvrDOIgcP4epbdo=; b=UgEJ4d6lj6QZe9Wb9lBm+Sehhc2qr51WrpP8QFbbM9d582S2l/LI9xlU7m3bqnZV+h YWzj9SXTma6HfNiA3yZNNiZHB1fHM64TBQJVV8r0RbJa6ODKehpCdz2Akhg9hNypvUvX UbN3SANLkszu/zz9p4k4rAiA/WO8ht1mTb2l9KGWGavhR+iOOkwURlkfKCr/SFHV+tsG /mhEjnHgjUUfaH4vMywpldGudvXfIzx4JOWXEzl/uLiPO2iAHwL79TSA4GuKIiWspdsy 3FkCTfwkw9zRlOY/TVf5LCzZ1h1ChQgXrxrvWrKCwmpQhZuH7CScSbdoot+QkkBVHZ77 prWA== 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=CQWUshTzpRmPn2kJI0awd5uuYv8OmvrDOIgcP4epbdo=; b=AdPKr+uOXU1SE2jDXogNsBjcDbh5LZ5X6kE70MNCFp1w1M3QkQpOIWeC0Fk727TyIk kcvZllzpo++qzFV7HsyRy7bKGd7GZFZW55NFUPXO/SEIGFVPM8StKCSjzyXjaIT0wPrm jDnwsYS6I1mZjUH6+Pk/Zq1FhLxkxyFWY57a3OleZUPUgn+xokkmL2dpGwQWj45yFo9K S2DMg26yrbbW7RmXQjbaBMVM4XgM1zQMHB/DW+v8P4HFwvT5hw3KgZ5fc+reN3Wv4kK1 snyX1vAK4u/s2uchhyTx/g9sBLA/vKGdSSTLilOa6KDDKOj5Cpp7jG+3X5fpUR4nRzEo S5jQ== X-Gm-Message-State: AOAM530114fI86u1m1GVn2EWUQu+/Uom1FX+FGr7e9OIXr7N1yZZgraV 8wndR144EEBvvzJy2Q0BNhyhNQ== X-Received: by 2002:a50:9e4f:: with SMTP id z73mr294004ede.338.1619465715126; Mon, 26 Apr 2021 12:35:15 -0700 (PDT) Received: from localhost (82-65-169-74.subs.proxad.net. [82.65.169.74]) by smtp.gmail.com with ESMTPSA id d24sm602306edp.31.2021.04.26.12.35.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Apr 2021 12:35:14 -0700 (PDT) References: <20210421120512.413057-1-jbrunet@baylibre.com> <20210421120512.413057-6-jbrunet@baylibre.com> <69eaa840-ed77-fc01-2925-7e5e9998e80f@linux.intel.com> User-agent: mu4e 1.4.15; emacs 27.1 From: Jerome Brunet To: Pierre-Louis Bossart , Mark Brown Cc: Stephen Boyd , alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 5/5] ASoC: da7219: properly get clk from the provider In-reply-to: <69eaa840-ed77-fc01-2925-7e5e9998e80f@linux.intel.com> Message-ID: <1j7dkon8jy.fsf@starbuckisacylon.baylibre.com> Date: Mon, 26 Apr 2021 21:35:13 +0200 MIME-Version: 1.0 Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon 26 Apr 2021 at 20:10, Pierre-Louis Bossart wrote: > On 4/21/21 7:05 AM, Jerome Brunet wrote: >> Instead of using the clk embedded in the clk_hw (which is meant to go >> away), a clock provider which need to interact with its own clock should >> request clk reference through the clock provider API. >> Reviewed-by: Stephen Boyd >> Signed-off-by: Jerome Brunet > > This patch seems to introduce a regression in our modprobe/rmmod tests Really sorry about that :/ > > https://github.com/thesofproject/linux/pull/2870 > > RMMOD snd_soc_da7219 > rmmod: ERROR: Module snd_soc_da7219 is in use > > Reverting this patch restores the ability to remove the module. > > Wondering if devm_ increases a module/device refcount somehow? The driver is the provider and consumer, so it is consuming itself. This was the intent, I think the patch should be correct like this. Maybe I overlooked something on the clock side. I'll check. I'm not sure the problem is devm_ variant, it might be clk_hw_get_clk() simpler variant which also plays with module ref counts. I don't have this particular HW to check but I'll try to replicate the test with a dummy module and report ASAP. Of course, I suppose the same problem applies to PATCH 1 of the series > >> --- >> sound/soc/codecs/da7219.c | 5 ++++- >> 1 file changed, 4 insertions(+), 1 deletion(-) >> diff --git a/sound/soc/codecs/da7219.c b/sound/soc/codecs/da7219.c >> index 13009d08b09a..bd3c523a8617 100644 >> --- a/sound/soc/codecs/da7219.c >> +++ b/sound/soc/codecs/da7219.c >> @@ -2181,7 +2181,10 @@ static int da7219_register_dai_clks(struct snd_soc_component *component) >> ret); >> goto err; >> } >> - da7219->dai_clks[i] = dai_clk_hw->clk; >> + >> + da7219->dai_clks[i] = devm_clk_hw_get_clk(dev, dai_clk_hw, NULL); >> + if (IS_ERR(da7219->dai_clks[i])) >> + return PTR_ERR(da7219->dai_clks[i]); >> /* For DT setup onecell data, otherwise create lookup */ >> if (np) { >>