[S390] cio: Use helpers instead of container_of().
authorCornelia Huck <cornelia.huck@de.ibm.com>
Sat, 26 Jan 2008 13:10:38 +0000 (14:10 +0100)
committerMartin Schwidefsky <schwidefsky@de.ibm.com>
Sat, 26 Jan 2008 13:10:56 +0000 (14:10 +0100)
- Introduce to_cssdriver.
- Use to_xxx instead of container_of where possible.

Signed-off-by: Cornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com>
drivers/s390/cio/ccwgroup.c
drivers/s390/cio/css.c
drivers/s390/cio/css.h

index 5baa517c3b6625665f98dadada2679ec7da4e641..b3e2c16caa413dec579d4cb202b6c373f5fc50a7 100644 (file)
@@ -35,8 +35,8 @@ ccwgroup_bus_match (struct device * dev, struct device_driver * drv)
        struct ccwgroup_device *gdev;
        struct ccwgroup_driver *gdrv;
 
-       gdev = container_of(dev, struct ccwgroup_device, dev);
-       gdrv = container_of(drv, struct ccwgroup_driver, driver);
+       gdev = to_ccwgroupdev(dev);
+       gdrv = to_ccwgroupdrv(drv);
 
        if (gdev->creator_id == gdrv->driver_id)
                return 1;
index c3df2cd009a4f1b113615e728d3a15e0d2593c4f..bc2f8fa576a3693cbc264f8a0aa0b5cf2abd2e5d 100644 (file)
@@ -787,8 +787,8 @@ int sch_is_pseudo_sch(struct subchannel *sch)
 static int
 css_bus_match (struct device *dev, struct device_driver *drv)
 {
-       struct subchannel *sch = container_of (dev, struct subchannel, dev);
-       struct css_driver *driver = container_of (drv, struct css_driver, drv);
+       struct subchannel *sch = to_subchannel(dev);
+       struct css_driver *driver = to_cssdriver(drv);
 
        if (sch->st == driver->subchannel_type)
                return 1;
@@ -802,7 +802,7 @@ css_probe (struct device *dev)
        struct subchannel *sch;
 
        sch = to_subchannel(dev);
-       sch->driver = container_of (dev->driver, struct css_driver, drv);
+       sch->driver = to_cssdriver(dev->driver);
        return (sch->driver->probe ? sch->driver->probe(sch) : 0);
 }
 
index 81215ef3243575bfa451218c96be4c0506772310..1d8306cc74c41b64c4f738c8d744f369d2fc2a3e 100644 (file)
@@ -134,6 +134,8 @@ struct css_driver {
        void (*shutdown)(struct subchannel *);
 };
 
+#define to_cssdriver(n) container_of(n, struct css_driver, drv)
+
 /*
  * all css_drivers have the css_bus_type
  */