|
@@ -666,18 +666,11 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,
|
|
stm->dev.parent = parent;
|
|
stm->dev.parent = parent;
|
|
stm->dev.release = stm_device_release;
|
|
stm->dev.release = stm_device_release;
|
|
|
|
|
|
- err = kobject_set_name(&stm->dev.kobj, "%s", stm_data->name);
|
|
|
|
- if (err)
|
|
|
|
- goto err_device;
|
|
|
|
-
|
|
|
|
- err = device_add(&stm->dev);
|
|
|
|
- if (err)
|
|
|
|
- goto err_device;
|
|
|
|
-
|
|
|
|
mutex_init(&stm->link_mutex);
|
|
mutex_init(&stm->link_mutex);
|
|
spin_lock_init(&stm->link_lock);
|
|
spin_lock_init(&stm->link_lock);
|
|
INIT_LIST_HEAD(&stm->link_list);
|
|
INIT_LIST_HEAD(&stm->link_list);
|
|
|
|
|
|
|
|
+ /* initialize the object before it is accessible via sysfs */
|
|
spin_lock_init(&stm->mc_lock);
|
|
spin_lock_init(&stm->mc_lock);
|
|
mutex_init(&stm->policy_mutex);
|
|
mutex_init(&stm->policy_mutex);
|
|
stm->sw_nmasters = nmasters;
|
|
stm->sw_nmasters = nmasters;
|
|
@@ -685,6 +678,14 @@ int stm_register_device(struct device *parent, struct stm_data *stm_data,
|
|
stm->data = stm_data;
|
|
stm->data = stm_data;
|
|
stm_data->stm = stm;
|
|
stm_data->stm = stm;
|
|
|
|
|
|
|
|
+ err = kobject_set_name(&stm->dev.kobj, "%s", stm_data->name);
|
|
|
|
+ if (err)
|
|
|
|
+ goto err_device;
|
|
|
|
+
|
|
|
|
+ err = device_add(&stm->dev);
|
|
|
|
+ if (err)
|
|
|
|
+ goto err_device;
|
|
|
|
+
|
|
return 0;
|
|
return 0;
|
|
|
|
|
|
err_device:
|
|
err_device:
|