master/slave.c
changeset 419 cf724fc82a00
parent 418 7a43437bc48b
child 421 2b3ce4f51bd6
--- a/master/slave.c	Thu Oct 19 14:05:56 2006 +0000
+++ b/master/slave.c	Thu Oct 19 14:23:24 2006 +0000
@@ -83,6 +83,8 @@
     .default_attrs = def_attrs
 };
 
+static struct kobj_type ktype_ec_slave_sdos = {};
+
 /** \endcond */
 
 /*****************************************************************************/
@@ -114,6 +116,18 @@
         return -1;
     }
 
+    // init SDO kobject and add it to the hierarchy
+    memset(&slave->sdo_kobj, 0x00, sizeof(struct kobject));
+    kobject_init(&slave->sdo_kobj);
+    slave->sdo_kobj.ktype = &ktype_ec_slave_sdos;
+    slave->sdo_kobj.parent = &slave->kobj;
+    if (kobject_set_name(&slave->sdo_kobj, "sdos")) {
+        EC_ERR("Failed to set kobject name.\n");
+        kobject_put(&slave->sdo_kobj);
+        kobject_put(&slave->kobj);
+        return -1;
+    }
+
     slave->master = master;
 
     slave->requested_state = EC_SLAVE_STATE_UNKNOWN;
@@ -158,6 +172,9 @@
     INIT_LIST_HEAD(&slave->sdo_dictionary);
     INIT_LIST_HEAD(&slave->sdo_confs);
 
+    slave->sdo_dictionary_fetched = 0;
+    slave->jiffies_preop = 0;
+
     for (i = 0; i < 4; i++) {
         slave->dl_link[i] = 0;
         slave->dl_loop[i] = 0;
@@ -225,6 +242,10 @@
         kobject_put(&sdo->kobj);
     }
 
+    // free SDO kobject
+    if (slave->sdo_dictionary_fetched) kobject_del(&slave->sdo_kobj);
+    kobject_put(&slave->sdo_kobj);
+
     // free all SDO configurations
     list_for_each_entry_safe(sdodata, next_sdodata, &slave->sdo_confs, list) {
         list_del(&sdodata->list);