Message ID | 20221114102956.914468-4-ckeepax@opensource.cirrus.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:6687:0:0:0:0:0 with SMTP id l7csp2073479wru; Mon, 14 Nov 2022 02:39:02 -0800 (PST) X-Google-Smtp-Source: AA0mqf42XGKPotjsJPR+jTapqjg9d5OHQ8eIO/a4SvvlJ812oy5EHkkkAGbY+/n9qDy41V8V6VpZ X-Received: by 2002:a05:6a00:3485:b0:571:fa1d:85b7 with SMTP id cp5-20020a056a00348500b00571fa1d85b7mr6392391pfb.39.1668422342065; Mon, 14 Nov 2022 02:39:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668422342; cv=none; d=google.com; s=arc-20160816; b=uzYFqbvn+swzHVb6kKBAafFOf2CW2visfAftOJLeVxjJ1jq0u25CoPoyBT9NH2wGD6 tOYih3gB7JWlOgH+0+tXQRk6vHTBWTGiVYnUcuJelJU1XNW9amTeGRbKNuXh6y2Cbmm2 +XxMr2faNSdJr42xTtT7Fhzhqg59BG2Jtf4Jaon6YeEnm9k+1fSDahjBABYlEXtSi3ic rQMPcPcRkvMYdAMXam8MneaC47D6t/oso6/uRp2oMxEM3CFtRzVUWSp/qWeRGA3bZqS6 FwX0Xo+fru6FSkGXnZMsLrJ+gdZPJtv3h70thgObZqfIUmIXBFoeesIXoontKwaQNG6b tEMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=wR8WznTLjHtXuxSzrfRxj5uzxnQfyrE3rhFbBYPUl9E=; b=e4B4jWk3Ht1wMQwV8G8RT0N6sT7sCVGlrtroMixCnK1dWj06hDDVdLDMYc1vZ8w0KY bBcSWAOj7f65den6bqSw6amb18o0WxJ71z38eGukHb9cmy57v7DrdVzWU+K2piDL6d1S 3k3zubLkhL+uxkQM+tugAGhyyr+mYxdEhFQbdQL5iHJtp4fDDSgsn7tvSRpaNsdyqWif Ss8o7mMiCdIyUaUDquDr0e3sS8Nat6eoQra5XcOAYX+IJNaFdoElVtzhclGMfgyK/n6S WR1eMg0AbyQKXnYzYOZ0WrZ3LxCtZvqVnGr0us7a6p/hFJxv/Lodo9cmEz+ZBeOGjkza yZ5A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=Pz4b01vd; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w14-20020a17090a8a0e00b002135a4d80d7si9029683pjn.188.2022.11.14.02.38.49; Mon, 14 Nov 2022 02:39:02 -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=@cirrus.com header.s=PODMain02222019 header.b=Pz4b01vd; 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=REJECT sp=REJECT dis=NONE) header.from=cirrus.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236484AbiKNKbu (ORCPT <rfc822;winker.wchi@gmail.com> + 99 others); Mon, 14 Nov 2022 05:31:50 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236564AbiKNKbP (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 14 Nov 2022 05:31:15 -0500 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B55714D2C for <linux-kernel@vger.kernel.org>; Mon, 14 Nov 2022 02:31:13 -0800 (PST) Received: from pps.filterd (m0077474.ppops.net [127.0.0.1]) by mx0b-001ae601.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 2AE8Wcie019990; Mon, 14 Nov 2022 04:29:59 -0600 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=cirrus.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding : content-type; s=PODMain02222019; bh=wR8WznTLjHtXuxSzrfRxj5uzxnQfyrE3rhFbBYPUl9E=; b=Pz4b01vd4pkAmDey1/iXQitssuwC7GwX/0K9JnvGvgzq+o8fE3FKSzfVCrzQ8Jc8bLdH hUZSQjs7aVA0wl0SY5u41xvH6fdat2Wubil7qfcEUfs9dZQ3KTbUesGKBmTQyQFnxmGC CaKTjyNWg9bPUOBXfPX6p5I7RVetKAbVq68YEF28OxaYf5e9Qyzy5eI30XtRmrsNR3C0 zEr97UTqDoo65QFwA6CpB4DA0ybLEgHy07ISEsYOJSeJ2ryxUpVICeaRcVYBvHHCjexb 7CQ+/rz5wt7GIMPpJhiwKZUDjCrLGKKpBh2AmtA1srIZGO+B0LUVym/B/Ge74BkQwZdG uA== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3kt8sst0cm-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Mon, 14 Nov 2022 04:29:59 -0600 Received: from ediex01.ad.cirrus.com (198.61.84.80) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.15; Mon, 14 Nov 2022 04:29:56 -0600 Received: from ediswmail.ad.cirrus.com (198.61.86.93) by ediex01.ad.cirrus.com (198.61.84.80) with Microsoft SMTP Server id 15.2.1118.15 via Frontend Transport; Mon, 14 Nov 2022 04:29:56 -0600 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 66CF8B2F; Mon, 14 Nov 2022 10:29:56 +0000 (UTC) From: Charles Keepax <ckeepax@opensource.cirrus.com> To: <vkoul@kernel.org> CC: <yung-chuan.liao@linux.intel.com>, <pierre-louis.bossart@linux.intel.com>, <sanyog.r.kale@intel.com>, <alsa-devel@alsa-project.org>, <linux-kernel@vger.kernel.org>, <patches@opensource.cirrus.com> Subject: [PATCH 3/4] soundwire: debugfs: Switch to sdw_read_no_pm Date: Mon, 14 Nov 2022 10:29:55 +0000 Message-ID: <20221114102956.914468-4-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221114102956.914468-1-ckeepax@opensource.cirrus.com> References: <20221114102956.914468-1-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-GUID: Q3wEA4SA0jb2CYzwI9IxJadDNNpQfAj0 X-Proofpoint-ORIG-GUID: Q3wEA4SA0jb2CYzwI9IxJadDNNpQfAj0 X-Proofpoint-Spam-Reason: safe X-Spam-Status: No, score=-2.7 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE,SPF_PASS 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1749467625568582166?= X-GMAIL-MSGID: =?utf-8?q?1749467625568582166?= |
Series | Minor SoundWire clean ups | |
Commit Message
Charles Keepax
Nov. 14, 2022, 10:29 a.m. UTC
It is rather inefficient to be constantly enabling/disabling the PM
runtime as we print out each individual register, switch to holding a PM
runtime reference across the whole register output.
Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com>
---
drivers/soundwire/debugfs.c | 11 ++++++++++-
1 file changed, 10 insertions(+), 1 deletion(-)
Comments
On 11/14/22 04:29, Charles Keepax wrote: > It is rather inefficient to be constantly enabling/disabling the PM > runtime as we print out each individual register, switch to holding a PM > runtime reference across the whole register output. the change is good, but technically the pm_runtime resume happens for the first read and suspend with a delay if use_autosuspend() is enabled, so presumably we'll see the same number of resume/suspend with the existing code and the suggested change. Maybe update the commit message to mention that we constantly change reference counts, as you did in the next patch? > > Signed-off-by: Charles Keepax <ckeepax@opensource.cirrus.com> > --- > 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 <linux/device.h> > #include <linux/debugfs.h> > #include <linux/mod_devicetable.h> > +#include <linux/pm_runtime.h> > #include <linux/slab.h> > #include <linux/soundwire/sdw.h> > #include <linux/soundwire/sdw_registers.h> > @@ -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;
On Mon, Nov 14, 2022 at 10:14:19AM -0600, Pierre-Louis Bossart wrote: > > > On 11/14/22 04:29, Charles Keepax wrote: > > It is rather inefficient to be constantly enabling/disabling the PM > > runtime as we print out each individual register, switch to holding a PM > > runtime reference across the whole register output. > > the change is good, but technically the pm_runtime resume happens for > the first read and suspend with a delay if use_autosuspend() is enabled, > so presumably we'll see the same number of resume/suspend with the > existing code and the suggested change. > > Maybe update the commit message to mention that we constantly change > reference counts, as you did in the next patch? Yeah agree, I will respin the commit message. Thanks, Charles
Hi Charles, https://git-scm.com/docs/git-format-patch#_base_tree_information] url: https://github.com/intel-lab-lkp/linux/commits/Charles-Keepax/Minor-SoundWire-clean-ups/20221114-183333 patch link: https://lore.kernel.org/r/20221114102956.914468-4-ckeepax%40opensource.cirrus.com patch subject: [PATCH 3/4] soundwire: debugfs: Switch to sdw_read_no_pm config: loongarch-randconfig-m041-20221114 compiler: loongarch64-linux-gcc (GCC) 12.1.0 If you fix the issue, kindly add following tag where applicable | Reported-by: kernel test robot <lkp@intel.com> | Reported-by: Dan Carpenter <error27@gmail.com> smatch warnings: drivers/soundwire/debugfs.c:61 sdw_slave_reg_show() warn: possible memory leak of 'buf' vim +/buf +61 drivers/soundwire/debugfs.c bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 48 static int sdw_slave_reg_show(struct seq_file *s_file, void *data) bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 49 { bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 50 struct sdw_slave *slave = s_file->private; bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 51 char *buf; bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 52 ssize_t ret; bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 53 int i, j; bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 54 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 55 buf = kzalloc(RD_BUF, GFP_KERNEL); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 56 if (!buf) bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 57 return -ENOMEM; bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 58 f3345eda607ecc Charles Keepax 2022-11-14 59 ret = pm_runtime_resume_and_get(&slave->dev); f3345eda607ecc Charles Keepax 2022-11-14 60 if (ret < 0 && ret != -EACCES) f3345eda607ecc Charles Keepax 2022-11-14 @61 return ret; kfree(buf); f3345eda607ecc Charles Keepax 2022-11-14 62 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 63 ret = scnprintf(buf, RD_BUF, "Register Value\n"); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 64 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 65 /* DP0 non-banked registers */ bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 66 ret += scnprintf(buf + ret, RD_BUF - ret, "\nDP0\n"); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 67 for (i = SDW_DP0_INT; i <= SDW_DP0_PREPARECTRL; i++) bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 68 ret += sdw_sprintf(slave, buf, ret, i); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 69 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 70 /* DP0 Bank 0 registers */ bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 71 ret += scnprintf(buf + ret, RD_BUF - ret, "Bank0\n"); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 72 ret += sdw_sprintf(slave, buf, ret, SDW_DP0_CHANNELEN); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 73 for (i = SDW_DP0_SAMPLECTRL1; i <= SDW_DP0_LANECTRL; i++) bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 74 ret += sdw_sprintf(slave, buf, ret, i); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 75 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 76 /* DP0 Bank 1 registers */ bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 77 ret += scnprintf(buf + ret, RD_BUF - ret, "Bank1\n"); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 78 ret += sdw_sprintf(slave, buf, ret, bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 79 SDW_DP0_CHANNELEN + SDW_BANK1_OFFSET); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 80 for (i = SDW_DP0_SAMPLECTRL1 + SDW_BANK1_OFFSET; bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 81 i <= SDW_DP0_LANECTRL + SDW_BANK1_OFFSET; i++) bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 82 ret += sdw_sprintf(slave, buf, ret, i); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 83 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 84 /* SCP registers */ bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 85 ret += scnprintf(buf + ret, RD_BUF - ret, "\nSCP\n"); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 86 for (i = SDW_SCP_INT1; i <= SDW_SCP_BANKDELAY; i++) bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 87 ret += sdw_sprintf(slave, buf, ret, i); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 88 for (i = SDW_SCP_DEVID_0; i <= SDW_SCP_DEVID_5; i++) bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 89 ret += sdw_sprintf(slave, buf, ret, i); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 90 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 91 /* bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 92 * SCP Bank 0/1 registers are read-only and cannot be bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 93 * retrieved from the Slave. The Master typically keeps track bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 94 * of the current frame size so the information can be found bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 95 * in other places bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 96 */ bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 97 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 98 /* DP1..14 registers */ bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 99 for (i = 1; SDW_VALID_PORT_RANGE(i); i++) { bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 100 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 101 /* DPi registers */ bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 102 ret += scnprintf(buf + ret, RD_BUF - ret, "\nDP%d\n", i); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 103 for (j = SDW_DPN_INT(i); j <= SDW_DPN_PREPARECTRL(i); j++) bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 104 ret += sdw_sprintf(slave, buf, ret, j); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 105 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 106 /* DPi Bank0 registers */ bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 107 ret += scnprintf(buf + ret, RD_BUF - ret, "Bank0\n"); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 108 for (j = SDW_DPN_CHANNELEN_B0(i); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 109 j <= SDW_DPN_LANECTRL_B0(i); j++) bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 110 ret += sdw_sprintf(slave, buf, ret, j); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 111 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 112 /* DPi Bank1 registers */ bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 113 ret += scnprintf(buf + ret, RD_BUF - ret, "Bank1\n"); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 114 for (j = SDW_DPN_CHANNELEN_B1(i); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 115 j <= SDW_DPN_LANECTRL_B1(i); j++) bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 116 ret += sdw_sprintf(slave, buf, ret, j); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 117 } bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 118 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 119 seq_printf(s_file, "%s", buf); f3345eda607ecc Charles Keepax 2022-11-14 120 f3345eda607ecc Charles Keepax 2022-11-14 121 pm_runtime_mark_last_busy(&slave->dev); f3345eda607ecc Charles Keepax 2022-11-14 122 pm_runtime_put(&slave->dev); f3345eda607ecc Charles Keepax 2022-11-14 123 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 124 kfree(buf); bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 125 bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 126 return 0; bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 127 } bf03473d5bcc85 Pierre-Louis Bossart 2019-08-21 128 DEFINE_SHOW_ATTRIBUTE(sdw_slave_reg);
On Mon, Nov 21, 2022 at 01:50:55PM +0300, Dan Carpenter wrote: > Hi Charles, > > https://git-scm.com/docs/git-format-patch#_base_tree_information] > > url: https://github.com/intel-lab-lkp/linux/commits/Charles-Keepax/Minor-SoundWire-clean-ups/20221114-183333 > patch link: https://lore.kernel.org/r/20221114102956.914468-4-ckeepax%40opensource.cirrus.com > patch subject: [PATCH 3/4] soundwire: debugfs: Switch to sdw_read_no_pm > config: loongarch-randconfig-m041-20221114 > compiler: loongarch64-linux-gcc (GCC) 12.1.0 > > If you fix the issue, kindly add following tag where applicable > | Reported-by: kernel test robot <lkp@intel.com> > | Reported-by: Dan Carpenter <error27@gmail.com> > Thanks for the spot I will fix this up and do a v3. Thanks, Charles
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 <linux/device.h> #include <linux/debugfs.h> #include <linux/mod_devicetable.h> +#include <linux/pm_runtime.h> #include <linux/slab.h> #include <linux/soundwire/sdw.h> #include <linux/soundwire/sdw_registers.h> @@ -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;