Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2149453rwb; Thu, 17 Nov 2022 07:10:38 -0800 (PST) X-Google-Smtp-Source: AA0mqf5PMJ+bLwPGt4b09JWzhoOlbVwj+QiPiLQYp8jOV3v7QCnW61BHaJt6TqllShu9ptTGBWg4 X-Received: by 2002:a05:6402:550b:b0:45f:9526:e35a with SMTP id fi11-20020a056402550b00b0045f9526e35amr2566300edb.256.1668697838636; Thu, 17 Nov 2022 07:10:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668697838; cv=none; d=google.com; s=arc-20160816; b=ELDczSrvnDG2BjG2Kbw/RJEGBuQHViF69pgcL9UUbXjreJVbWvbOPPdiXEpLqtLRl5 jK7mH43J/Uj6/S4IX1bA/WDY6gfVJMShtomj3obIHyuuFgQrl7pqmsEDCsS2QBBusTeP 5ua4Z5M0uV6QHuuwlmboVcn+z7QG+gB3rtPfeL7uerf2JBik5KQqz+vsgj8LAQ5hlBXh UzNlR+v9XzF/6a5Ewk8Gtwqw6Mj34ZHKADIFgv/96IzQyNlcGnzvNG7e9sVdNvXidWpl rhYRVnU9C8L9OgGsal9W/jTjo29XIhQwFijGP9NlzzWs/YoRgTpSGTkSyj9cb+C2nrOH /X6Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=w0bhSSuJXWUnEIFb3BQ4/iYeI1971BnMr6JOAWprUS8=; b=JWnLjqqy9cfPw9R9BJ1DlPEApB13SL8vv6pcGwBB0bBVK00BER3OSuqkNXOmxArVjd NOeMV9pmXD1P1c8gBJ6hdJbFO8T95GP/VOfJW1smSv6FwhA7kubqfq4HloaRRA7Wj/8H ty8hd7Uf4WppZawlmT49my3nyPt6vurG58RpoOhOjwLgrqYhBe6w2dCtV26toMUOrpFM G34c8RPAqHyWSHYgxIObK/iJhjzGYh2KXzswzzwdY4Ek6q/Ju2XhgiRBvARNyoFpdL1N bdZ0jFcfBImJn8VxCy7/SxMfezNt+rhm5TFkTtuucWQZNcCTSxaDrvETQa9/jTG96ssK 5BBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="dR/HNK+b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id wy4-20020a170906fe0400b007a31138203asi713243ejb.669.2022.11.17.07.10.08; Thu, 17 Nov 2022 07:10:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b="dR/HNK+b"; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240053AbiKQPA2 (ORCPT + 93 others); Thu, 17 Nov 2022 10:00:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49816 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240198AbiKQPAJ (ORCPT ); Thu, 17 Nov 2022 10:00:09 -0500 Received: from mga09.intel.com (mga09.intel.com [134.134.136.24]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 20D2E240AC for ; Thu, 17 Nov 2022 07:00:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1668697208; x=1700233208; h=message-id:date:mime-version:subject:to:cc:references: from:in-reply-to:content-transfer-encoding; bh=pym+nN5dyyoSuoPqt65bfQahyNJPS85MeiSSlQoBJ/8=; b=dR/HNK+bZ/fdYYqwWKswB9Gfj2Gg/jrRJ4dvSgoaznN8U/YGj/ilh1vK lNkq9kakDl9hToboTMl4m2QEU+fCpe5t0OKCWxmpfFd0KDDfDFgJwpiHT XVhxuKj5giJZjFfx//udnsDS9PpGqXolISg15zNbAQlUDZSQXyqeYr7zE d9dtS7933pGowbBmaWe+wIdi9QC7UPskpF/PX15YV6ijgsOmy12H/tZbd 5lwGSoJiQWQ6WD2yS6QM4Vcy+4e+UcUXWbk0yx1c7R33c1vMmtwAHxt3/ j5yHDg1ToU7QjSDUGsjkZLLhzcmozW5vmBNlTZdt/naEQYmYCqxvPScjy A==; X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="314018188" X-IronPort-AV: E=Sophos;i="5.96,171,1665471600"; d="scan'208";a="314018188" Received: from orsmga006.jf.intel.com ([10.7.209.51]) by orsmga102.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2022 07:00:07 -0800 X-IronPort-AV: E=McAfee;i="6500,9779,10534"; a="617636533" X-IronPort-AV: E=Sophos;i="5.96,171,1665471600"; d="scan'208";a="617636533" Received: from kristi4x-mobl1.amr.corp.intel.com (HELO [10.213.177.122]) ([10.213.177.122]) by orsmga006-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 17 Nov 2022 07:00:07 -0800 Message-ID: Date: Thu, 17 Nov 2022 08:44:25 -0600 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Firefox/102.0 Thunderbird/102.4.2 Subject: Re: [PATCH v2 3/4] soundwire: debugfs: Switch to sdw_read_no_pm Content-Language: en-US To: Charles Keepax , vkoul@kernel.org Cc: yung-chuan.liao@linux.intel.com, sanyog.r.kale@intel.com, alsa-devel@alsa-project.org, linux-kernel@vger.kernel.org, patches@opensource.cirrus.com References: <20221117141727.3031503-1-ckeepax@opensource.cirrus.com> <20221117141727.3031503-4-ckeepax@opensource.cirrus.com> From: Pierre-Louis Bossart In-Reply-To: <20221117141727.3031503-4-ckeepax@opensource.cirrus.com> Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.3 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_MED, RCVD_IN_MSPIKE_H3,RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/17/22 08:17, Charles Keepax wrote: > It is rather inefficient to be constantly playing with the runtime > PM reference for each individual register, switch to holding a PM > runtime reference across the whole register output. > > Signed-off-by: Charles Keepax Reviewed-by: Pierre-Louis Bossart > --- > > Changes since v1: > - Reworded commit message > > drivers/soundwire/debugfs.c | 11 ++++++++++- > 1 file changed, 10 insertions(+), 1 deletion(-) > > diff --git a/drivers/soundwire/debugfs.c b/drivers/soundwire/debugfs.c > index 49900cd207bc7..0718e9cda138a 100644 > --- a/drivers/soundwire/debugfs.c > +++ b/drivers/soundwire/debugfs.c > @@ -4,6 +4,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -35,7 +36,7 @@ static ssize_t sdw_sprintf(struct sdw_slave *slave, > { > int value; > > - value = sdw_read(slave, reg); > + value = sdw_read_no_pm(slave, reg); > > if (value < 0) > return scnprintf(buf + pos, RD_BUF - pos, "%3x\tXX\n", reg); > @@ -55,6 +56,10 @@ static int sdw_slave_reg_show(struct seq_file *s_file, void *data) > if (!buf) > return -ENOMEM; > > + ret = pm_runtime_resume_and_get(&slave->dev); > + if (ret < 0 && ret != -EACCES) > + return ret; > + > ret = scnprintf(buf, RD_BUF, "Register Value\n"); > > /* DP0 non-banked registers */ > @@ -112,6 +117,10 @@ static int sdw_slave_reg_show(struct seq_file *s_file, void *data) > } > > seq_printf(s_file, "%s", buf); > + > + pm_runtime_mark_last_busy(&slave->dev); > + pm_runtime_put(&slave->dev); > + > kfree(buf); > > return 0;