From patchwork Fri Jul 14 19:58:02 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Zimmerman via tpmdd-devel X-Patchwork-Id: 788759 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.sourceforge.net (lists.sourceforge.net [216.34.181.88]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 3x8Nmd0qlfz9sNd for ; Sat, 15 Jul 2017 05:58:57 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; unprotected) header.d=lists.sourceforge.net header.i=@lists.sourceforge.net header.b="TkN5IeR1"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sourceforge.net header.i=@sourceforge.net header.b="ZDMgyvx1"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sf.net header.i=@sf.net header.b="DyhJu6/M"; dkim=neutral (0-bit key) header.d=google.com header.i=@google.com header.b="RK8rxZ6A"; dkim-atps=neutral DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.sourceforge.net; s=beta; h=Content-Transfer-Encoding:Content-Type:MIME-Version:Reply-To:From:List-Subscribe:List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:Subject:References:In-Reply-To:Message-Id:Date:To; bh=FASrsEEd/LnV9AO1M//ix5rUMsBCtRPu0nsg0ihTJh0=; b=TkN5IeR1ZbS3hLaGoI/MUD7j2w6qVaW+aJyCp1/2Pd+LM4iegghusMctNxSyZfESJ6sqGt9P+HEG+IRNRg6bTLtBle3hjUzsB+tXo209H4iOIdlVgg5TMqJ3QS+dXptvH2JILIveKkMHTeQDar866695bb+9/vmQmfHiuHCoMfM=; Received: from localhost ([127.0.0.1] helo=sfs-ml-4.v29.ch3.sourceforge.com) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1dW6jj-0004EK-4Y; Fri, 14 Jul 2017 19:58:51 +0000 Received: from sog-mx-2.v43.ch3.sourceforge.com ([172.29.43.192] helo=mx.sourceforge.net) by sfs-ml-4.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1dW6ji-0004EB-66 for tpmdd-devel@lists.sourceforge.net; Fri, 14 Jul 2017 19:58:50 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=2gM3TzTcSb8sfkPeAXF65Oe9IERhm1t32961rgCwo4s=; b=ZDMgyvx1nVWxPPt8/66clvsnr6Iysy2GVlLxSbCAKWqfCy60TkuVQD0Lxi9zACEU1I5ywY82szrYdnKKgZJjVmsga19NJ9jvNNzBiV0jcCv6Na+XeewFMJ7AgYTYplCh6nCgFJl421dxpOHLyNOHpvB2Glfqei1W7rtPaZvPp0M=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From; bh=2gM3TzTcSb8sfkPeAXF65Oe9IERhm1t32961rgCwo4s=; b=DyhJu6/MTIzfVTt9iFBw94vMw+YdzeapSCTRG5h4N/LjAQtfwYuw6+rISxDTeExXKQzM6ncicCZHLTYDgCuYa9BRCkZvGuS+PdGpBnjM5SqTaNvsQy5yX3TTfaPWgm/otiJZSDyu+CfUxHmMfZ67vV1mZ4MmlsQDh0yH0efEtEE=; Received-SPF: pass (sog-mx-2.v43.ch3.sourceforge.com: domain of google.com designates 74.125.83.49 as permitted sender) client-ip=74.125.83.49; envelope-from=joshz@google.com; helo=mail-pg0-f49.google.com; Received: from mail-pg0-f49.google.com ([74.125.83.49]) by sog-mx-2.v43.ch3.sourceforge.com with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) id 1dW6jh-00070d-Da for tpmdd-devel@lists.sourceforge.net; Fri, 14 Jul 2017 19:58:50 +0000 Received: by mail-pg0-f49.google.com with SMTP id t186so50432816pgb.1 for ; Fri, 14 Jul 2017 12:58:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=2gM3TzTcSb8sfkPeAXF65Oe9IERhm1t32961rgCwo4s=; b=RK8rxZ6AVfNP3hHLVjRGLv6UULejYE94bDQZ3iq1Bz7txuv7PfKw0Y4IlTQJzJL8EU V6qeZSabMHGzEGTxKYCeTz75X6vHhpdg7nz13vOqQHiuxcm89b4NT/Z0LlePl84wmvUT ZNlcgXKvy3qliAa53EyybJIZWoN7W6up4Imttl7ZABDOxm5i3Nxwq+OA6xJIuUeRi8I0 0G9IXcV3Yot87u17pfLhuSU1zUciaRaRJ62PpgPff0USh6SGbweeLs62/+GURFTN66R3 mazOGxHYpPjwjzi1eIbYWSPdvwk0pSuOfxLuvkUcJDs9sioJ43CcqX/B2bIk2EMxytt2 BjIA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=2gM3TzTcSb8sfkPeAXF65Oe9IERhm1t32961rgCwo4s=; b=UhCIkPrMZDw8WKQ8/pZ2dnHm+urq8OyKB8D2slK2unN63qB7f2FNfRmUN9HIGQK5Qg huhAty483kR+cnFeDPn/hYTInZy9mg9uJ8WH9aIyyse7B2rdyqMqoIp0fx/zKwrUO984 eQ+1ZIk3j+2Jy3jXnYTiUrE88uijFz8Aq2r34y8c1Z76S8f4KwHkyPjx62bZXw53luaw CPDH71cBlomSVus17xB8x0tNsacHERMqftCW3n3LqtT/d5MIml/5wVhzQTbhnkNe7/kG UJ8OTROUfI5Mguw1BCdZCOdIqMWFXjFUcKe0kakhuEj1V+2ZdiAeWbSHsIoxCS2Hx0Po 26OQ== X-Gm-Message-State: AIVw111MqK6gytRoIeF/nxZT8Ej90FyV8cshB2zapV/ginsF73hy2Xeg JNget7VpbVGvKh2w X-Received: by 10.84.233.139 with SMTP id l11mr4487210plk.298.1500062323459; Fri, 14 Jul 2017 12:58:43 -0700 (PDT) Received: from angband.kir.corp.google.com ([100.66.174.26]) by smtp.googlemail.com with ESMTPSA id t26sm22043500pfe.88.2017.07.14.12.58.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 14 Jul 2017 12:58:42 -0700 (PDT) To: Jarkko Sakkinen , Jason Gunthorpe , tpmdd-devel@lists.sourceforge.net, gregkh@linuxfoundation.org, stable@vger.kernel.org Date: Fri, 14 Jul 2017 12:58:02 -0700 Message-Id: <20170714195803.7035-4-joshz@google.com> X-Mailer: git-send-email 2.13.2.932.g7449e964c-goog In-Reply-To: <20170714195803.7035-1-joshz@google.com> References: <20170714195803.7035-1-joshz@google.com> X-Spam-Score: -1.5 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [74.125.83.49 listed in list.dnswl.org] -0.0 SPF_PASS SPF: sender matches SPF record -0.0 RP_MATCHES_RCVD Envelope sender domain matches handover relay domain -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature 0.1 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1dW6jh-00070d-Da Subject: [tpmdd-devel] [PATCH v1 3/4] Add "shutdown" to "struct class".' X-BeenThere: tpmdd-devel@lists.sourceforge.net X-Mailman-Version: 2.1.21 Precedence: list List-Id: Tpm Device Driver maintainance List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Josh Zimmerman via tpmdd-devel From: Josh Zimmerman via tpmdd-devel Reply-To: Josh Zimmerman MIME-Version: 1.0 Errors-To: tpmdd-devel-bounces@lists.sourceforge.net 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. --- 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 f18856f5954b..afe045792796 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -2094,7 +2094,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 b8f411b57dcb..3656df6cf638 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -368,6 +368,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. @@ -396,6 +397,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);