Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp2093642rwb; Thu, 17 Nov 2022 06:30:39 -0800 (PST) X-Google-Smtp-Source: AA0mqf4lB3McpyGUatbm+kTh21lpXhCiwKGvmuF6trh0C3z4D0G+WGk5+mth8OBTiQHoCVT7YzOI X-Received: by 2002:a17:902:ab19:b0:186:b91b:17ec with SMTP id ik25-20020a170902ab1900b00186b91b17ecmr3070044plb.10.1668695439467; Thu, 17 Nov 2022 06:30:39 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668695439; cv=none; d=google.com; s=arc-20160816; b=sRn9Pj2XoUfx8Q3cVBBYiusDZbZaJLOuFtkNm09G/+0LnrblBezpBi7MW8iqrMWrru U8oj8P9SuQLcIyaRjuCdktgxvvSI1FM8d9JFtJY5JQ8C/kRKb7Emk419NWtv8/Fg2rLR IaR7tTpJZ6jUlA2Y/z6O/03jfuKjnKnQqdoNWRW+IHqG9Qz2G0bbrUaFxrxLGelATK3p RfyOwbLlcnlyZ7GyNQLv6ZKA7dYkwlFv61Pc7HV4D+7K1HodzXdXCTcKWFopUbq/XWxP Mkwipu3LUplHXKcOovSvjMOIclZdTBAbGRgMPof7atOHcnaSAwHurWDleZ2ocLgZm5AO 6qtg== 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=pP6wCC1D3dPgTnwLAkiyGtXDogheormoOvmiKB907/o=; b=KdI0sIkTcItbM+MI7vei5Thl19q2abQey/U+7CgYO+xSv7E6Tnaveeptfq3uwlo0A/ 8WmjGJLWldaH96Pn8XopjslnKDBqUmK5bOtuDRijahLi/pz7PAMTB0G7kXpDOtGP9GXc kw61yHYq/IwjqaKrU1/k8UHN93U8OAEYcJ7tWNmQrQE1gDScSCNcbY/51irYxteu2Qfd U2wgH/ieWo7UPAu2+lhogMCnn13+11c1gjOkzHbbGtEA8VcpoaVle/gkLWCnNQMhPVO0 9w2MynGhbV9q/6m4vdi/TcsrbvIKDkRujsUSwFFvnc+H2xa8rP9M6Oa50SuThmzLZrEN nobA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=Y0XtxTj0; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id n6-20020a170902d2c600b0017f5bacd4d8si1162428plc.571.2022.11.17.06.30.27; Thu, 17 Nov 2022 06:30:39 -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=Y0XtxTj0; 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 S240310AbiKQORs (ORCPT + 92 others); Thu, 17 Nov 2022 09:17:48 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47804 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234751AbiKQORq (ORCPT ); Thu, 17 Nov 2022 09:17:46 -0500 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E66D7324 for ; Thu, 17 Nov 2022 06:17:45 -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 2AHEHLJY006137; Thu, 17 Nov 2022 08:17:30 -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=pP6wCC1D3dPgTnwLAkiyGtXDogheormoOvmiKB907/o=; b=Y0XtxTj0SKU0gH/sQreUOy/OesrY3vtNK7YTwzfro16EaQUuY5Icz1KDLde1wns8WrM9 /x9jncJdbEeK5bDT3U/a/f3QlpAzIv1sRFKCcwZGvtCVz+MLbxh8qgKujZLbomaFwBXc /NxXVG/5HIhOKK2RY7KSo86CZbFvdNnAQzlJiIsKjRpJ06yjrhvp3qp+wBw++Uaw34l0 p1CW3zGReggUKavakkVlHa2ncKBRYLJH7Bpb12eHnW4GdMCoh8Arn4R67zfr5lCtc439 RhnxPg45gBg4xXSy2hpr3qYiw/QSHRcorB0cdpuFmHcDuAnAexixb+HyRQ/7o11rSpSk fg== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3kv73yk9j9-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 17 Nov 2022 08:17:30 -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.20; Thu, 17 Nov 2022 08:17:28 -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.20 via Frontend Transport; Thu, 17 Nov 2022 08:17:28 -0600 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id E963EB38; Thu, 17 Nov 2022 14:17:27 +0000 (UTC) From: Charles Keepax To: CC: , , , , , Subject: [PATCH v2 3/4] soundwire: debugfs: Switch to sdw_read_no_pm Date: Thu, 17 Nov 2022 14:17:26 +0000 Message-ID: <20221117141727.3031503-4-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221117141727.3031503-1-ckeepax@opensource.cirrus.com> References: <20221117141727.3031503-1-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: 90XPt4ZgU0_lq0NS129dKCUUaPjTRiok X-Proofpoint-GUID: 90XPt4ZgU0_lq0NS129dKCUUaPjTRiok 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: X-Mailing-List: linux-kernel@vger.kernel.org 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 --- 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; -- 2.30.2