Skip to content

Commit

Permalink
rapidio: add shutdown notification for RapidIO devices
Browse files Browse the repository at this point in the history
Add bus-specific callback to stop RapidIO devices during a system
shutdown.

Signed-off-by: Alexandre Bounine <[email protected]>
Cc: Matt Porter <[email protected]>
Cc: Aurelien Jacquiot <[email protected]>
Cc: Andre van Herk <[email protected]>
Signed-off-by: Andrew Morton <[email protected]>
Signed-off-by: Linus Torvalds <[email protected]>
  • Loading branch information
Alexandre Bounine authored and torvalds committed Mar 22, 2016
1 parent dbe74af commit 83dc2cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
12 changes: 12 additions & 0 deletions drivers/rapidio/rio-driver.c
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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,
};

Expand Down
2 changes: 2 additions & 0 deletions include/linux/rio.h
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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);
Expand Down

0 comments on commit 83dc2cb

Please sign in to comment.