tpmdd-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>
To: Josh Zimmerman <joshz@google.com>
Cc: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>,
	tpmdd-devel@lists.sourceforge.net, gregkh@linuxfoundation.org,
	stable@vger.kernel.org
Subject: Re: [PATCH v1 1/2] Add "shutdown" to "struct class".'
Date: Sun, 16 Jul 2017 13:42:04 +0300	[thread overview]
Message-ID: <20170716104204.p4leji2vpi22xk6u@linux.intel.com> (raw)
In-Reply-To: <20170713004121.21750-2-joshz@google.com>

On Wed, Jul 12, 2017 at 05:41:20PM -0700, Josh Zimmerman wrote:
> Backport of commit f77af15165847406b15d8f70c382c4cb15846b2a upstream.
> 
> The TPM class has some common shutdown code that must be executed for
> all drivers. This adds some needed functionality for that.
> 
> Signed-off-by: Josh Zimmerman <joshz@google.com>

Reviewed-by: Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>

/Jarkko

> ---
>  drivers/base/core.c    | 6 +++++-
>  include/linux/device.h | 2 ++
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/base/core.c b/drivers/base/core.c
> index ce057a568673..03a82d017cf1 100644
> --- a/drivers/base/core.c
> +++ b/drivers/base/core.c
> @@ -2095,7 +2095,11 @@ void device_shutdown(void)
>  		pm_runtime_get_noresume(dev);
>  		pm_runtime_barrier(dev);
>  
> -		if (dev->bus && dev->bus->shutdown) {
> +		if (dev->class && dev->class->shutdown) {
> +			if (initcall_debug)
> +				dev_info(dev, "shutdown\n");
> +			dev->class->shutdown(dev);
> +		} else if (dev->bus && dev->bus->shutdown) {
>  			if (initcall_debug)
>  				dev_info(dev, "shutdown\n");
>  			dev->bus->shutdown(dev);
> diff --git a/include/linux/device.h b/include/linux/device.h
> index bc41e87a969b..df850f723264 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -373,6 +373,7 @@ int subsys_virtual_register(struct bus_type *subsys,
>   * @suspend:	Used to put the device to sleep mode, usually to a low power
>   *		state.
>   * @resume:	Used to bring the device from the sleep mode.
> + * @shutdown:  Called at shut-down time to quiesce the device.
>   * @ns_type:	Callbacks so sysfs can detemine namespaces.
>   * @namespace:	Namespace of the device belongs to this class.
>   * @pm:		The default device power management operations of this class.
> @@ -401,6 +402,7 @@ struct class {
>  
>  	int (*suspend)(struct device *dev, pm_message_t state);
>  	int (*resume)(struct device *dev);
> +	int (*shutdown)(struct device *dev);
>  
>  	const struct kobj_ns_type_operations *ns_type;
>  	const void *(*namespace)(struct device *dev);
> -- 
> 2.13.2.932.g7449e964c-goog
> 

  reply	other threads:[~2017-07-16 10:42 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-07-13  0:41 [PATCH v1 0/2] Run TPM2_Shutdown on system shutdown Josh Zimmerman
2017-07-13  0:41 ` [PATCH v1 1/2] Add "shutdown" to "struct class".' Josh Zimmerman
2017-07-16 10:42   ` Jarkko Sakkinen [this message]
2017-07-13  0:41 ` [PATCH v1 2/2] tpm: Issue a TPM2_Shutdown for TPM2 devices Josh Zimmerman
2017-07-16 10:42   ` Jarkko Sakkinen
2017-07-13  2:13 ` [PATCH v1 0/2] Run TPM2_Shutdown on system shutdown Josh Zimmerman
2017-07-13 12:23   ` Greg Kroah-Hartman

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170716104204.p4leji2vpi22xk6u@linux.intel.com \
    --to=jarkko.sakkinen@linux.intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jgunthorpe@obsidianresearch.com \
    --cc=joshz@google.com \
    --cc=stable@vger.kernel.org \
    --cc=tpmdd-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).