On Wed, Nov 21, 2018 at 10:44:55AM +0200, Leon Romanovsky wrote: > @@ -1189,7 +1190,7 @@ static int add_port(struct ib_device *device, int port_num, > static ssize_t node_type_show(struct device *device, > struct device_attribute *attr, char *buf) > { > - struct ib_device *dev = container_of(device, struct ib_device, dev); > + struct ib_device *dev = rdma_device_to_ibdev(device); > > switch (dev->node_type) { > case RDMA_NODE_IB_CA: return sprintf(buf, "%d: CA\n", dev->node_type); > @@ -1206,7 +1207,7 @@ static DEVICE_ATTR_RO(node_type); > static ssize_t sys_image_guid_show(struct device *device, > struct device_attribute *dev_attr, char *buf) > { > - struct ib_device *dev = container_of(device, struct ib_device, dev); > + struct ib_device *dev = rdma_device_to_ibdev(device); > > return sprintf(buf, "%04x:%04x:%04x:%04x\n", > be16_to_cpu(((__be16 *) &dev->attrs.sys_image_guid)[0]), > @@ -1219,7 +1220,7 @@ static DEVICE_ATTR_RO(sys_image_guid); > static ssize_t node_guid_show(struct device *device, > struct device_attribute *attr, char *buf) > { > - struct ib_device *dev = container_of(device, struct ib_device, dev); > + struct ib_device *dev = rdma_device_to_ibdev(device); > > return sprintf(buf, "%04x:%04x:%04x:%04x\n", > be16_to_cpu(((__be16 *) &dev->node_guid)[0]), > @@ -1232,7 +1233,7 @@ static DEVICE_ATTR_RO(node_guid); > static ssize_t node_desc_show(struct device *device, > struct device_attribute *attr, char *buf) > { > - struct ib_device *dev = container_of(device, struct ib_device, dev); > + struct ib_device *dev = rdma_device_to_ibdev(device); > > return sprintf(buf, "%.64s\n", dev->node_desc); > } > @@ -1241,7 +1242,7 @@ static ssize_t node_desc_store(struct device *device, > struct device_attribute *attr, > const char *buf, size_t count) > { > - struct ib_device *dev = container_of(device, struct ib_device, dev); > + struct ib_device *dev = rdma_device_to_ibdev(device); > struct ib_device_modify desc = {}; > int ret; > > @@ -1260,7 +1261,7 @@ static DEVICE_ATTR_RW(node_desc); > static ssize_t fw_ver_show(struct device *device, struct device_attribute *attr, > char *buf) > { > - struct ib_device *dev = container_of(device, struct ib_device, dev); > + struct ib_device *dev = rdma_device_to_ibdev(device); > > ib_get_device_fw_str(dev, buf); > strlcat(buf, "\n", IB_FW_VERSION_NAME_MAX); Why not put these in the prior patch? > diff --git a/include/rdma/ib_verbs.h b/include/rdma/ib_verbs.h > index c7055e242792..ccb279cc5d98 100644 > +++ b/include/rdma/ib_verbs.h > @@ -2253,6 +2253,15 @@ struct ib_counters_read_attr { > > struct uverbs_attr_bundle; > > +struct ib_core_device { > + /* device must be the first element in structure until, > + * union of ib_core_device and device exists in ib_device. > + */ > + struct device dev; > + struct kobject *ports_kobj; > + struct list_head port_list; > +}; Bleck, don't do the horizontal white space thing. If you really can't help yourself then at least choose a sane alignment column, this is just ugly. Jason