Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp467722ybl; Fri, 31 Jan 2020 02:14:07 -0800 (PST) X-Google-Smtp-Source: APXvYqzjI1mh2/4o0E+k4fC1DwfLltZd1gTZJGy6xfuUn8o/PS+nNBDm1HIBHQKsUNgdUjDTCWQ0 X-Received: by 2002:aca:56ce:: with SMTP id k197mr6028926oib.99.1580465647894; Fri, 31 Jan 2020 02:14:07 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1580465647; cv=none; d=google.com; s=arc-20160816; b=oSAm8S38NpsquZZjSwmAlb/M6eTcqnYpCFYXtwe3cpnF0cy/zSff0IW0zQ8Dq/09wB 4DMhnekHnmt/gyMAXBhfGb4Nt26f982M/PLNSmBOhPwKLyjiGF/yOlpOtMmhKhlfYGv2 9Z0Xvq1B30qC4syDtj/Mc5NCo81yCF7KekhqeHxUbC67gRHLEhqBYHPVXROG31hJaT5r 5A8jjUsMuUV/APLaVMA6Z/THTTPq6mJF0PToLGs+GO3DrF64M7L/DuB57PxtEzaYCcJV RjusnU7/VsRCXuxgxN8wFVYRtN5TFsjui1JrCGLfimFu/YKNl6i0AoBwpBMRObD+LjHq m2VA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version; bh=raabJwU4zEa7l6nAkAqDBvubVlQSjL6C05vgOXbsY4Y=; b=fewDW6CdHXGTZX9a9aKJoJwBd0rVWiUvC317gyNn+i90ylyJA1+RMNHgvKBKZdCAO+ 20CGIEjASa6lw4vbMcWNZCzv4AahiAgqRJVDbyKikLGKE44ArJsgbnYLr0I9zTkxYXPt BZ7AQ7uYsMunfk+Kfm/FRC5e4aZeFiooNwnUgfeux8NsTGAOgnSd3VwXnGlfVnW7rAZZ LIaIPFqV57vUHaZR26QQQormDXqUXdt13dmkPDf5JTs7ndC5KeKpS6BDgB7xDwPvJX8B LfjcH10B+e72CgGtwhxJ833MsPjpDK2B37VrMhmIr27XOWNCsbPDBjZCUm39Uo9hTcWd 87lA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 194si4165299oii.2.2020.01.31.02.13.55; Fri, 31 Jan 2020 02:14:07 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-crypto-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-crypto-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728289AbgAaKNp (ORCPT + 99 others); Fri, 31 Jan 2020 05:13:45 -0500 Received: from mail-oi1-f194.google.com ([209.85.167.194]:34300 "EHLO mail-oi1-f194.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728160AbgAaKNp (ORCPT ); Fri, 31 Jan 2020 05:13:45 -0500 Received: by mail-oi1-f194.google.com with SMTP id l136so6747661oig.1; Fri, 31 Jan 2020 02:13:44 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=raabJwU4zEa7l6nAkAqDBvubVlQSjL6C05vgOXbsY4Y=; b=qBYoO8hSNd26sXZI9kaAHYcDMa/5/Xn91LZOGK50pqpaiv31ONUX9azCTRz3Mwls2t YOs9s11m7SUKvtCq22bDEY85YzZMrnWKEtIhnn+1S9TIYMCdXmvRQcvbwpxRrFbCtrA0 Kwgrt+oyfh87L4MKFp+bB5cpOgungwqPpxtAwsWhB6zUHPBaiFsTX+Vndbel9prcQgph N9cZoSZa7glDODlM3Xk1z9ZaI1RfA5FcE/YtotrvRpE5uuXSvhmvOJL5Xy+d5iAWfVIC pyJZI4h8yyYgfUcAzFaPUnxTYV/YWeDOyjrX7qGJb2X8KnmZqHRwgW7sncoV4f23+wAA HfLQ== X-Gm-Message-State: APjAAAW9Sxvu+VVEvZY+vfN/FYfYjFJNSuot2WOBpj3OVAidi5yZMCM6 sZOM5fDrPZfaeMM643+BgB1UDqqq9mM9URfp73A= X-Received: by 2002:aca:bfc2:: with SMTP id p185mr5936669oif.57.1580465624588; Fri, 31 Jan 2020 02:13:44 -0800 (PST) MIME-Version: 1.0 References: <20200124132957.15769-1-geert+renesas@glider.be> <20200124132957.15769-2-geert+renesas@glider.be> In-Reply-To: <20200124132957.15769-2-geert+renesas@glider.be> From: "Rafael J. Wysocki" Date: Fri, 31 Jan 2020 11:13:33 +0100 Message-ID: Subject: Re: [PATCH 1/2] debugfs: regset32: Add Runtime PM support To: Geert Uytterhoeven Cc: Greg Kroah-Hartman , Gilad Ben-Yossef , Herbert Xu , "David S . Miller" , "Rafael J . Wysocki" , Rob Clark , Sean Paul , Felipe Balbi , Alan Stern , Thierry Reding , Jonathan Hunter , Mathias Nyman , Matthias Brugger , Chunfeng Yun , Bin Liu , linux-crypto@vger.kernel.org, Linux PM , Linux-Renesas , "open list:ULTRA-WIDEBAND (UWB) SUBSYSTEM:" , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-crypto-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-crypto@vger.kernel.org On Fri, Jan 24, 2020 at 2:30 PM Geert Uytterhoeven wrote: > > Hardware registers of devices under control of power management cannot > be accessed at all times. If such a device is suspended, register > accesses may lead to undefined behavior, like reading bogus values, or > causing exceptions or system locks. > > Extend struct debugfs_regset32 with an optional field to let device > drivers specify the device the registers in the set belong to. This > allows debugfs_show_regset32() to make sure the device is resumed while > its registers are being read. > > Signed-off-by: Geert Uytterhoeven LGTM: Acked-by: Rafael J. Wysocki > --- > fs/debugfs/file.c | 8 ++++++++ > include/linux/debugfs.h | 1 + > 2 files changed, 9 insertions(+) > > diff --git a/fs/debugfs/file.c b/fs/debugfs/file.c > index dede25247b81f72a..5e52d68421c678f2 100644 > --- a/fs/debugfs/file.c > +++ b/fs/debugfs/file.c > @@ -18,6 +18,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -1057,7 +1058,14 @@ static int debugfs_show_regset32(struct seq_file *s, void *data) > { > struct debugfs_regset32 *regset = s->private; > > + if (regset->dev) > + pm_runtime_get_sync(regset->dev); > + > debugfs_print_regs32(s, regset->regs, regset->nregs, regset->base, ""); > + > + if (regset->dev) > + pm_runtime_put(regset->dev); > + > return 0; > } > > diff --git a/include/linux/debugfs.h b/include/linux/debugfs.h > index bf9b6cafa4c26a68..5d0783ae09f365ac 100644 > --- a/include/linux/debugfs.h > +++ b/include/linux/debugfs.h > @@ -35,6 +35,7 @@ struct debugfs_regset32 { > const struct debugfs_reg32 *regs; > int nregs; > void __iomem *base; > + struct device *dev; /* Optional device for Runtime PM */ > }; > > extern struct dentry *arch_debugfs_dir; > -- > 2.17.1 >