+static const struct attribute_group sdw_master_node_group = {
+ .attrs = master_node_attrs,
+};
+
+static const struct attribute_group *sdw_master_node_groups[] = {
+ &sdw_master_node_group,
+ NULL
+};
Minor nit, you can use the ATTRIBUTE_GROUPS() macro here to save you a
few lines.
+
+static void sdw_device_release(struct device *dev)
+{
+ struct sdw_master_sysfs *master = to_sdw_device(dev);
+
+ kfree(master);
+}
+
+static struct device_type sdw_device_type = {
+ .name = "sdw_device",
+ .release = sdw_device_release,
+};
+
+int sdw_sysfs_bus_init(struct sdw_bus *bus)
+{
+ struct sdw_master_sysfs *master;
+ int err;
+
+ if (bus->sysfs) {
+ dev_err(bus->dev, "SDW sysfs is already initialized\n");
+ return -EIO;
+ }
+
+ master = kzalloc(sizeof(*master), GFP_KERNEL);
+ if (!master)
+ return -ENOMEM;
Why are you creating a whole new device to put all of this under? Is
this needed? What will the sysfs tree look like when you do this? Why
can't the "bus" device just get all of these attributes and no second
device be created?