Received: by 2002:a05:6358:d09b:b0:dc:cd0c:909e with SMTP id jc27csp10708728rwb; Fri, 25 Nov 2022 07:07:03 -0800 (PST) X-Google-Smtp-Source: AA0mqf4IuNZaEvmi2L4aJzVsS1b4G9BXVMXA7wnHGycD7WIe8+2rFl66h8s4yBkzYEVqnPkEQ4dS X-Received: by 2002:aa7:85c8:0:b0:574:5789:b8a4 with SMTP id z8-20020aa785c8000000b005745789b8a4mr12863370pfn.47.1669388823490; Fri, 25 Nov 2022 07:07:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669388823; cv=none; d=google.com; s=arc-20160816; b=pf/V2z3/Ue6PUZuVkRO7ftSZWOjDIT8whaphqedyRk4Lv/me49aqCsGX7A5sn4BB1z yzsORWEFpsqtMW1pPvNL+ssxTZGoSCOVhLQSsd9QAGvntl8Rm52+hoxmDoP9bk4Nl1mx kjSxQsiCVcOTagFEGRh6tK5b5r1045xKBZ7JA7/Fn1QaVDDYl/yNVgA1onuo51K4QI+X el2hi+z54vcG/JQL1aJzj3L+tRtwUQimUfAWMCbVR643vhAAXNk0t70bCsKBM+XzH+p1 a2d1bt4/um5Yhc0OMB/vzPALC285ocVVeRlcQjBlSgcawudf95cPRcSEgDd5lZPYg3yR j17g== 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=fmtjNKPzLbqjNIqHltuZn0oCtwpbo1qpHKVTmVc8jZc=; b=w1JYVySVHQH/V9/5YwI8/QYWuvyAv1e4UEjmTJ9BhHrHEDQk8RukWVpBQFd3ZRNZ9x 8BiYUyLCboykg6RmMs8wt/0xkiHqzaErEBfQDNfP1ztHc/LzbV13GvYJ8d6YPxMacwrk Fdkpp7hpbTEOo8E4Cw1BOWsHkK1ZK0JtGhDNPT8wRwulLuQfwXS+7Y7sDfqOLdUmjVOb 2qD8W4+T6G+Litf/6CbnLbnImU+pt1g9IzX3bvS05H22jJdwL9lll0x+0C26mQmwdpE8 JoKmJImLngYVxgEBmy3AOqfu1m1XdkTsUflaUIY3jAC2nJAaTnUANLkbNbe6Mrfud7/M CZBg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@cirrus.com header.s=PODMain02222019 header.b=LhZNHUmH; 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 v189-20020a6389c6000000b004622caf9ac6si4332950pgd.781.2022.11.25.07.06.39; Fri, 25 Nov 2022 07:07:03 -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=LhZNHUmH; 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 S229975AbiKYOU4 (ORCPT + 86 others); Fri, 25 Nov 2022 09:20:56 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42596 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229745AbiKYOUs (ORCPT ); Fri, 25 Nov 2022 09:20:48 -0500 Received: from mx0b-001ae601.pphosted.com (mx0b-001ae601.pphosted.com [67.231.152.168]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2352523155 for ; Fri, 25 Nov 2022 06:20:48 -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 2APCp6w8007040; Fri, 25 Nov 2022 08:20:32 -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=fmtjNKPzLbqjNIqHltuZn0oCtwpbo1qpHKVTmVc8jZc=; b=LhZNHUmHWJLT2pQ9s4mQSKQ19X7WWiWy4sncMf3o6LmGyzTZeCKR8gmy91JjLXxkZIRu KpaZK20spzt7id3XxM2Lo2A4044JDGlVVxo3oU4oD3VWaR6P2PkmMhjpsI9dYjZosZpw 8kdZ+4sOi2MKRU5/n9oo0PYCPbYO6+1GVo9MiNtvwRoOxtvZAwtIiyug6KGYBlHuV6lY e7u3rowcl+L4uns42OPO7kic7rr6IPRucSECJSWFWs6QjDEs5mlj5S89a+RY89w/4uzz 9EuUEyDmOwj86Egmskc+MzJIsDE3snGlmdq+Nv0FsaiJ5hPSpH1p5wS6CkXnNUujM7Gb ew== Received: from ediex01.ad.cirrus.com ([84.19.233.68]) by mx0b-001ae601.pphosted.com (PPS) with ESMTPS id 3kxvet7ccn-3 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Fri, 25 Nov 2022 08:20:32 -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; Fri, 25 Nov 2022 08:20:29 -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; Fri, 25 Nov 2022 08:20:29 -0600 Received: from algalon.ad.cirrus.com (algalon.ad.cirrus.com [198.90.251.122]) by ediswmail.ad.cirrus.com (Postfix) with ESMTP id 27DF2B2F; Fri, 25 Nov 2022 14:20:29 +0000 (UTC) From: Charles Keepax To: CC: , , , , , Subject: [PATCH v4 3/4] soundwire: debugfs: Switch to sdw_read_no_pm Date: Fri, 25 Nov 2022 14:20:27 +0000 Message-ID: <20221125142028.1118618-4-ckeepax@opensource.cirrus.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20221125142028.1118618-1-ckeepax@opensource.cirrus.com> References: <20221125142028.1118618-1-ckeepax@opensource.cirrus.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Proofpoint-ORIG-GUID: tbFnoGi_Ad1V39P-G-zMdKzR9s9Ew5e6 X-Proofpoint-GUID: tbFnoGi_Ad1V39P-G-zMdKzR9s9Ew5e6 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. Reviewed-by: Pierre-Louis Bossart Signed-off-by: Charles Keepax --- No change since v3. drivers/soundwire/debugfs.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/soundwire/debugfs.c b/drivers/soundwire/debugfs.c index 49900cd207bc7..dea782e0edc4b 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,12 @@ 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) { + kfree(buf); + return ret; + } + ret = scnprintf(buf, RD_BUF, "Register Value\n"); /* DP0 non-banked registers */ @@ -112,6 +119,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