From patchwork Thu May 25 23:20:30 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josh Zimmerman X-Patchwork-Id: 767175 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 3wYlcv41xMz9s8H for ; Fri, 26 May 2017 09:21:03 +1000 (AEST) Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sourceforge.net header.i=@sourceforge.net header.b="RXIiPMik"; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=sf.net header.i=@sf.net header.b="ckQc1Kxs"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=google.com header.i=@google.com header.b="AVQlQ/PS"; dkim-atps=neutral Received: from localhost ([127.0.0.1] helo=sfs-ml-3.v29.ch3.sourceforge.com) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1dE23t-0002Yf-QF; Thu, 25 May 2017 23:20:57 +0000 Received: from sog-mx-4.v43.ch3.sourceforge.com ([172.29.43.194] helo=mx.sourceforge.net) by sfs-ml-3.v29.ch3.sourceforge.com with esmtp (Exim 4.76) (envelope-from ) id 1dE23t-0002Ya-Bb for tpmdd-devel@lists.sourceforge.net; Thu, 25 May 2017 23:20:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sourceforge.net; s=x; h=Content-Type:To:Subject:Message-ID:Date:From:MIME-Version; bh=5YgXNh35qS7r8EOZ4w4FtY3uQZu4PHOEjeDuTsQMNMc=; b=RXIiPMikcnw9RGQp4f8kqE2VTTHmrNrnP//K0vtP12VqxZm2aCA3CnbQ0eh95QwtuHxMYwn/vXoOv1apBUH/I34p0oII/n4NMDkjAcAOf5J9t4ISWInApwsGtDFSIFKpucIeTyeEctZsrU/jMWb3n88+nlPiULv4IZXuwZt/Cs4=; DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=sf.net; s=x; h=Content-Type:To:Subject:Message-ID:Date:From:MIME-Version; bh=5YgXNh35qS7r8EOZ4w4FtY3uQZu4PHOEjeDuTsQMNMc=; b=ckQc1KxsgIsydDZcuCK5P6737VFgIbI2/Y86NVyJorti20n4uWQzagU41MSEjxmsUsBvYOiWldcB5hS2XUlbFPi30qMCR69Mge1S/OxWBq6sFhYzL41J3OgOZEjVnqf9EQQ08YrzOnkqx7iaJ9qOlFq9fMKL5k76OFeH8oy1ilw=; Received-SPF: pass (sog-mx-4.v43.ch3.sourceforge.com: domain of google.com designates 209.85.220.182 as permitted sender) client-ip=209.85.220.182; envelope-from=joshz@google.com; helo=mail-qk0-f182.google.com; Received: from mail-qk0-f182.google.com ([209.85.220.182]) by sog-mx-4.v43.ch3.sourceforge.com with esmtps (TLSv1:AES128-SHA:128) (Exim 4.76) id 1dE23s-0006FG-It for tpmdd-devel@lists.sourceforge.net; Thu, 25 May 2017 23:20:57 +0000 Received: by mail-qk0-f182.google.com with SMTP id a72so188154212qkj.2 for ; Thu, 25 May 2017 16:20:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=mime-version:from:date:message-id:subject:to; bh=5YgXNh35qS7r8EOZ4w4FtY3uQZu4PHOEjeDuTsQMNMc=; b=AVQlQ/PSOowibrY4PbnM3TGtFsSeeWXBq53SmMQ/5X2DoLiOh4q9qDEbvPrv/6ubcq Mz+PWLvaKWtRDDmBPURvrEf2mam77uCvowLOD+Y31a48DK0K9T9p2rKuRkX2mPrzVDYv aug7rfwHP00S2eg2+FHEt6jCCpl8YcHp5JA2g9CUBpiXCtspg4UEGGfcEgW8UP6e72dq PRjHZhfwIxGXokujoeS+XRde94S1vmZerUVeLY1H7HJMcuHIwdixIN6l0ab8Shy1heOu XRJHEF/AyEZ1j6kJsCMTDjT+dqd0YqhgpamNBxWXUjhdN7RoNd4fmiPCO89+wzDlt3OZ k3BA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:from:date:message-id:subject:to; bh=5YgXNh35qS7r8EOZ4w4FtY3uQZu4PHOEjeDuTsQMNMc=; b=Nfc36998lp/XD1uceA2G319DY9qsTU9eNrrZhLklFyCg5KGjaKdNmqXrazdSLnTCAw a3swW67fzGdqWeZ0unIP1qBciVVqp2UAuO47zsvGkuHk+HwVHKpfXwz8T5MROjeDpEKo 0uEJjeL3WaGC9Y2i2VJQeRlrWmdh1u+UR9oqCr1r7Ssh5vEQwwiw+nmXuAiojf8LnjSb Spe3AN82MvYrbiTcFVMLEBl9PzNz3LMJeRzkyPWq1d5e95R5wVlzKD4KIXeMC6dEMcme 3SPXyeQ4/4RJlo8J2jFJanXuXE2sMlLeRLciltfJTD6pF04qUHFkFaX8KzpW6lZDG5ra KY/Q== X-Gm-Message-State: AODbwcA5SrWF/j/u6PB2+rQHEQXaL3D3U71c+hHze9EiXctC2ZstCm+u OvGIk/GQV1TBtEhA35mWLAe1yicNqxVX X-Received: by 10.55.166.137 with SMTP id p131mr40749539qke.132.1495754450872; Thu, 25 May 2017 16:20:50 -0700 (PDT) MIME-Version: 1.0 Received: by 10.140.82.180 with HTTP; Thu, 25 May 2017 16:20:30 -0700 (PDT) From: Josh Zimmerman Date: Thu, 25 May 2017 16:20:30 -0700 Message-ID: To: Peter Huewe , Marcel Selhorst , Jarkko Sakkinen , Jason Gunthorpe , tpmdd-devel@lists.sourceforge.net, jmorris@namei.org X-Spam-Score: -1.1 (-) X-Spam-Report: Spam Filtering performed by mx.sourceforge.net. See http://spamassassin.org/tag/ for more details. -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at http://www.dnswl.org/, no trust [209.85.220.182 listed in list.dnswl.org] 0.5 RCVD_IN_SORBS_SPAM RBL: SORBS: sender is a spam source [209.85.220.182 listed in dnsbl.sorbs.net] -1.5 SPF_CHECK_PASS SPF reports sender host as permitted sender for sender-domain -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.0 AWL AWL: Adjusted score from AWL reputation of From: address X-Headers-End: 1dE23s-0006FG-It Subject: [tpmdd-devel] [PATCH v4 2/2] 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: , Errors-To: tpmdd-devel-bounces@lists.sourceforge.net 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 Acked-by: Greg Kroah-Hartman Cc: stable@vger.kernel.org ----- v2: Add Signed-off-by. v3: Remove logically separate change. v4: Add "acked-by" and "cc". Reviewed-by: Jarkko Sakkinen --- drivers/base/core.c | 5 +++++ include/linux/device.h | 2 ++ 2 files changed, 7 insertions(+) of this class. @@ -407,6 +408,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); diff --git a/drivers/base/core.c b/drivers/base/core.c index 6bb60fb6a30b..687668d9afbe 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -2667,6 +2667,11 @@ void device_shutdown(void) pm_runtime_get_noresume(dev); pm_runtime_barrier(dev); + if (dev->class && dev->class->shutdown) { + if (initcall_debug) + dev_info(dev, "shutdown\n"); + dev->class->shutdown(dev); + } if (dev->bus && dev->bus->shutdown) { if (initcall_debug) dev_info(dev, "shutdown\n"); diff --git a/include/linux/device.h b/include/linux/device.h index 9ef518af5515..f240baac2001 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -378,6 +378,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