Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1707980
| From | Michal Suchanek <msuchanek@suse.de> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | [PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set. |
| Date | 2017-08-09 23:40 +0200 |
| Message-ID | <ucGRP-4rq-9@gated-at.bofh.it> (permalink) |
| Organization | linux.* mail to news gateway |
Disabling the driver hook by setting class hook is totally sound design
not prone to error as evidenced by the single implementation of the
class hook.
Fixes: d1bd4a792d39 ("tpm: Issue a TPM2_Shutdown for TPM2 devices.")
Fixes: f77af1516584 ("Add "shutdown" to "struct class".")
Signed-off-by: Michal Suchanek <msuchanek@suse.de>
---
drivers/base/core.c | 3 ++-
drivers/char/tpm/tpm-chip.c | 9 +--------
2 files changed, 3 insertions(+), 9 deletions(-)
diff --git a/drivers/base/core.c b/drivers/base/core.c
index 755451f684bc..2cf752dc1421 100644
--- a/drivers/base/core.c
+++ b/drivers/base/core.c
@@ -2668,7 +2668,8 @@ void device_shutdown(void)
if (initcall_debug)
dev_info(dev, "shutdown\n");
dev->class->shutdown(dev);
- } else if (dev->bus && dev->bus->shutdown) {
+ }
+ if (dev->bus && dev->bus->shutdown) {
if (initcall_debug)
dev_info(dev, "shutdown\n");
dev->bus->shutdown(dev);
diff --git a/drivers/char/tpm/tpm-chip.c b/drivers/char/tpm/tpm-chip.c
index 67ec9d3d04f5..edf8fa553f5f 100644
--- a/drivers/char/tpm/tpm-chip.c
+++ b/drivers/char/tpm/tpm-chip.c
@@ -164,14 +164,7 @@ static int tpm_class_shutdown(struct device *dev)
chip->ops = NULL;
up_write(&chip->ops_sem);
}
- /* Allow bus- and device-specific code to run. Note: since chip->ops
- * is NULL, more-specific shutdown code will not be able to issue TPM
- * commands.
- */
- if (dev->bus && dev->bus->shutdown)
- dev->bus->shutdown(dev);
- else if (dev->driver && dev->driver->shutdown)
- dev->driver->shutdown(dev);
+
return 0;
}
--
2.10.2
Back to linux.kernel | Previous | Next — Next in thread | Find similar | Unroll thread
[PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set. Michal Suchanek <msuchanek@suse.de> - 2017-08-09 23:40 +0200
Re: [PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set. Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-08-10 00:00 +0200
Re: [PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set. Michal Suchánek <msuchanek@suse.de> - 2017-08-10 12:20 +0200
Re: [PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set. Jason Gunthorpe <jgunthorpe@obsidianresearch.com> - 2017-08-10 18:40 +0200
Re: [PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set. Michal Suchánek <msuchanek@suse.de> - 2017-08-11 07:10 +0200
Re: [PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set. Henrique de Moraes Holschuh <hmh@hmh.eng.br> - 2017-08-11 17:30 +0200
Re: [PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set. Michal Suchánek <msuchanek@suse.de> - 2017-08-11 19:10 +0200
Re: [PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set. Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com> - 2017-08-11 14:00 +0200
csiph-web