[S390] cio: Introduce ccw_bus_type.shutdown.
authorCornelia Huck <cornelia.huck@de.ibm.com>
Fri, 12 Oct 2007 14:11:21 +0000 (16:11 +0200)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Fri, 12 Oct 2007 14:13:01 +0000 (16:13 +0200)
Introduce a shutdown method for the ccw bus that calls the driver
specific shutdown method in struct ccw_driver.
Switch zfcp to the new ccw_driver shutdown method.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/cio/device.c
drivers/s390/scsi/zfcp_ccw.c
include/asm-s390/ccwdev.h

index 3943a4fde22ad0ccc2566d9178050c81f29c095c..7fb271c60c272c69bb45877bcc07184e451b3221 100644 (file)
@@ -1433,12 +1433,22 @@ ccw_device_remove (struct device *dev)
        return 0;
 }
 
+static void ccw_device_shutdown(struct device *dev)
+{
+       struct ccw_device *cdev;
+
+       cdev = to_ccwdev(dev);
+       if (cdev->drv && cdev->drv->shutdown)
+               cdev->drv->shutdown(cdev);
+}
+
 struct bus_type ccw_bus_type = {
        .name   = "ccw",
        .match  = ccw_bus_match,
        .uevent = ccw_uevent,
        .probe  = ccw_device_probe,
        .remove = ccw_device_remove,
+       .shutdown = ccw_device_shutdown,
 };
 
 /**
index 1c8f71a59855b26b2123e611b3ce3978ee6d5dd2..c0d1c0eb32099f225a8d972cc164d1a19d3ae25b 100644 (file)
@@ -28,7 +28,7 @@ static void zfcp_ccw_remove(struct ccw_device *);
 static int zfcp_ccw_set_online(struct ccw_device *);
 static int zfcp_ccw_set_offline(struct ccw_device *);
 static int zfcp_ccw_notify(struct ccw_device *, int);
-static void zfcp_ccw_shutdown(struct device *);
+static void zfcp_ccw_shutdown(struct ccw_device *);
 
 static struct ccw_device_id zfcp_ccw_device_id[] = {
        {CCW_DEVICE_DEVTYPE(ZFCP_CONTROL_UNIT_TYPE,
@@ -51,9 +51,7 @@ static struct ccw_driver zfcp_ccw_driver = {
        .set_online  = zfcp_ccw_set_online,
        .set_offline = zfcp_ccw_set_offline,
        .notify      = zfcp_ccw_notify,
-       .driver      = {
-               .shutdown = zfcp_ccw_shutdown,
-       },
+       .shutdown    = zfcp_ccw_shutdown,
 };
 
 MODULE_DEVICE_TABLE(ccw, zfcp_ccw_device_id);
@@ -277,12 +275,12 @@ zfcp_ccw_register(void)
  * Makes sure that QDIO queues are down when the system gets stopped.
  */
 static void
-zfcp_ccw_shutdown(struct device *dev)
+zfcp_ccw_shutdown(struct ccw_device *cdev)
 {
        struct zfcp_adapter *adapter;
 
        down(&zfcp_data.config_sema);
-       adapter = dev_get_drvdata(dev);
+       adapter = dev_get_drvdata(&cdev->dev);
        zfcp_erp_adapter_shutdown(adapter, 0);
        zfcp_erp_wait(adapter);
        up(&zfcp_data.config_sema);
index 8e961aa4b39484e3e108b22f3b9d0c910185dd24..066aa70518ce0b0c94e4d0380abd9940c520c02f 100644 (file)
@@ -102,6 +102,7 @@ struct ccw_device {
  * @set_online: called when setting device online
  * @set_offline: called when setting device offline
  * @notify: notify driver of device state changes
+ * @shutdown: called at device shutdown
  * @driver: embedded device driver structure
  * @name: device driver name
  */
@@ -113,6 +114,7 @@ struct ccw_driver {
        int (*set_online) (struct ccw_device *);
        int (*set_offline) (struct ccw_device *);
        int (*notify) (struct ccw_device *, int);
+       void (*shutdown) (struct ccw_device *);
        struct device_driver driver;
        char *name;
 };