Micha Nelissen wrote: > > Alexandre Bounine wrote: > > - if (!rdev->rswitch) > > - goto out; > > - > > Is it safe? All devices have a switch?
Yes. Because end-points should not have the "routes" attribute at all (corrected by this patch). > > > @@ -63,10 +59,11 @@ struct device_attribute rio_dev_attrs[] = { > > __ATTR_RO(asm_did), > > __ATTR_RO(asm_vid), > > __ATTR_RO(asm_rev), > > - __ATTR_RO(routes), > > __ATTR_NULL, > > }; > > > > +static DEVICE_ATTR(routes, S_IRUGO, routes_show, NULL); > > + > > This seems a separate change from the sw_sysfs? Why make it separate? I assume that your question was "Why do not make it separate?" Both changes are specific to switches, both address sysfs and both are not big enough to justify a separate patch. I agree that make separate patches would give more clarity, so would do better description. Because there are changes that should be made to other patches in this set, I will regenerate this patch with better description. > > > */ > > struct rio_switch { > > @@ -256,6 +257,7 @@ struct rio_switch { > > u8 *sw_domain); > > int (*em_init) (struct rio_dev *dev); > > int (*em_handle) (struct rio_dev *dev, u8 swport); > > + int (*sw_sysfs) (struct rio_dev *dev, int create); > > struct rio_dev *nextdev[0]; > > }; > > Why not make a sw_sysfs_create and sw_sysfs_remove? Is better for > readability. Now you call 'sw_sysfs(dev, 0)' or 'sw_sysfs(dev, 1)'; I just do not want to have an extra member here. Not every switch will require own sysfs attributes, but every switch will be presented by a data structure. Based on its intended use I do not see any problem here. _______________________________________________ Linuxppc-dev mailing list Linuxppc-dev@lists.ozlabs.org https://lists.ozlabs.org/listinfo/linuxppc-dev