Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1707993

Re: [PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set.

From Jason Gunthorpe <jgunthorpe@obsidianresearch.com>
Newsgroups linux.kernel
Subject Re: [PATCH] Do not disable driver and bus shutdown hook when class shutdown hook is set.
Date 2017-08-10 00:00 +0200
Message-ID <ucHbc-4yf-29@gated-at.bofh.it> (permalink)
References <ucGRP-4rq-9@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


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

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


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