Commit 084325d8 authored by Cornelia Huck's avatar Cornelia Huck Committed by Martin Schwidefsky
Browse files

[S390] cio: Use helpers instead of container_of().



- Introduce to_cssdriver.
- Use to_xxx instead of container_of where possible.
Signed-off-by: default avatarCornelia Huck <cornelia.huck@de.ibm.com>
Signed-off-by: default avatarMartin Schwidefsky <schwidefsky@de.ibm.com>
parent 14ff56bb
...@@ -35,8 +35,8 @@ ccwgroup_bus_match (struct device * dev, struct device_driver * drv) ...@@ -35,8 +35,8 @@ ccwgroup_bus_match (struct device * dev, struct device_driver * drv)
struct ccwgroup_device *gdev; struct ccwgroup_device *gdev;
struct ccwgroup_driver *gdrv; struct ccwgroup_driver *gdrv;
gdev = container_of(dev, struct ccwgroup_device, dev); gdev = to_ccwgroupdev(dev);
gdrv = container_of(drv, struct ccwgroup_driver, driver); gdrv = to_ccwgroupdrv(drv);
if (gdev->creator_id == gdrv->driver_id) if (gdev->creator_id == gdrv->driver_id)
return 1; return 1;
......
...@@ -787,8 +787,8 @@ int sch_is_pseudo_sch(struct subchannel *sch) ...@@ -787,8 +787,8 @@ int sch_is_pseudo_sch(struct subchannel *sch)
static int static int
css_bus_match (struct device *dev, struct device_driver *drv) css_bus_match (struct device *dev, struct device_driver *drv)
{ {
struct subchannel *sch = container_of (dev, struct subchannel, dev); struct subchannel *sch = to_subchannel(dev);
struct css_driver *driver = container_of (drv, struct css_driver, drv); struct css_driver *driver = to_cssdriver(drv);
if (sch->st == driver->subchannel_type) if (sch->st == driver->subchannel_type)
return 1; return 1;
...@@ -802,7 +802,7 @@ css_probe (struct device *dev) ...@@ -802,7 +802,7 @@ css_probe (struct device *dev)
struct subchannel *sch; struct subchannel *sch;
sch = to_subchannel(dev); 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); return (sch->driver->probe ? sch->driver->probe(sch) : 0);
} }
......
...@@ -134,6 +134,8 @@ struct css_driver { ...@@ -134,6 +134,8 @@ struct css_driver {
void (*shutdown)(struct subchannel *); void (*shutdown)(struct subchannel *);
}; };
#define to_cssdriver(n) container_of(n, struct css_driver, drv)
/* /*
* all css_drivers have the css_bus_type * all css_drivers have the css_bus_type
*/ */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment