rapidio: add shutdown notification for RapidIO devices
authorAlexandre Bounine <alexandre.bounine@idt.com>
Tue, 22 Mar 2016 21:26:05 +0000 (14:26 -0700)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 22 Mar 2016 22:36:02 +0000 (15:36 -0700)
Add bus-specific callback to stop RapidIO devices during a system
shutdown.

Signed-off-by: Alexandre Bounine <alexandre.bounine@idt.com>
Cc: Matt Porter <mporter@kernel.crashing.org>
Cc: Aurelien Jacquiot <a-jacquiot@ti.com>
Cc: Andre van Herk <andre.van.herk@prodrive-technologies.com>
Signed-off-by: Andrew Morton <akpm@linux-foundation.org>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
drivers/rapidio/rio-driver.c
include/linux/rio.h

index f301f059bb85c1b18820ee45cfe4f08427ae8ec9..128350f4d17a45f9787ab43b828d90d5f52a396b 100644 (file)
@@ -131,6 +131,17 @@ static int rio_device_remove(struct device *dev)
        return 0;
 }
 
+static void rio_device_shutdown(struct device *dev)
+{
+       struct rio_dev *rdev = to_rio_dev(dev);
+       struct rio_driver *rdrv = rdev->driver;
+
+       dev_dbg(dev, "RIO: %s\n", __func__);
+
+       if (rdrv && rdrv->shutdown)
+               rdrv->shutdown(rdev);
+}
+
 /**
  *  rio_register_driver - register a new RIO driver
  *  @rdrv: the RIO driver structure to register
@@ -229,6 +240,7 @@ struct bus_type rio_bus_type = {
        .bus_groups = rio_bus_groups,
        .probe = rio_device_probe,
        .remove = rio_device_remove,
+       .shutdown = rio_device_shutdown,
        .uevent = rio_uevent,
 };
 
index 8996a629a32189df2c5852dc204b36986a878cbe..c64a0baf37c89483adbf87d272e3b04c185c5e6b 100644 (file)
@@ -423,6 +423,7 @@ struct rio_ops {
  * @id_table: RIO device ids to be associated with this driver
  * @probe: RIO device inserted
  * @remove: RIO device removed
+ * @shutdown: shutdown notification callback
  * @suspend: RIO device suspended
  * @resume: RIO device awakened
  * @enable_wake: RIO device enable wake event
@@ -437,6 +438,7 @@ struct rio_driver {
        const struct rio_device_id *id_table;
        int (*probe) (struct rio_dev * dev, const struct rio_device_id * id);
        void (*remove) (struct rio_dev * dev);
+       void (*shutdown)(struct rio_dev *dev);
        int (*suspend) (struct rio_dev * dev, u32 state);
        int (*resume) (struct rio_dev * dev);
        int (*enable_wake) (struct rio_dev * dev, u32 state, int enable);