tpmdd-devel.lists.sourceforge.net archive mirror
 help / color / mirror / Atom feed
From: Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
To: Michal Suchanek <msuchanek@suse.de>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Peter Huewe <peterhuewe@gmx.de>,
	Marcel Selhorst <tpmdd@selhorst.net>,
	Jarkko Sakkinen <jarkko.sakkinen@linux.intel.com>,
	linux-kernel@vger.kernel.org, tpmdd-devel@lists.sourceforge.net
Subject: Re: [PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set.
Date: Wed, 9 Aug 2017 15:52:02 -0600	[thread overview]
Message-ID: <20170809215202.GA21867@obsidianresearch.com> (raw)
In-Reply-To: <20170809213420.2391-1-msuchanek@suse.de>

On Wed, Aug 09, 2017 at 11:34:20PM +0200, Michal Suchanek wrote:
> 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.

It was done this was for consistency, if you look at the full code:

                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);
                } else if (dev->driver && dev->driver->shutdown) {
                        if (initcall_debug)
                                dev_info(dev, "shutdown\n");
                        dev->driver->shutdown(dev);
                }

The bus disables the driver callback, on the expectation that the bus
implementation will do it.

Existing bus implementations do properly chain to driver shutdown (eg
look at mmc_bus_shutdown) and it appears to have been written like
this so that the bus can insert code before and after calling the
driver shutdown.

Making class act differently from bus seems very confusing, IHMO,
which why the TPM patch was written to follow the existing pattern.

Jason

  reply	other threads:[~2017-08-09 21:52 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-09 21:34 Michal Suchanek
2017-08-09 21:52 ` Jason Gunthorpe [this message]
2017-08-10 10:18   ` Michal Suchánek
2017-08-10 16:30     ` Jason Gunthorpe
2017-08-11  5:04       ` Michal Suchánek
2017-08-11 15:28         ` Henrique de Moraes Holschuh
2017-08-11 17:01           ` Michal Suchánek
2017-08-11 11:50   ` Jarkko Sakkinen

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=20170809215202.GA21867@obsidianresearch.com \
    --to=jgunthorpe@obsidianresearch.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=jarkko.sakkinen@linux.intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=msuchanek@suse.de \
    --cc=peterhuewe@gmx.de \
    --cc=tpmdd-devel@lists.sourceforge.net \
    --cc=tpmdd@selhorst.net \
    --subject='Re: [PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set.' \
    /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

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).