Commit b642ed06 authored by Robert P. J. Day's avatar Robert P. J. Day Committed by Dave Airlie

drm: "kobject_init/kobject_add" -> "kobject_init_and_add".

Replace sequential calls to kobject_init() and kobject_add() with the
combo wrapper kobject_init_and_add(), which provides the same
semantics.
Signed-off-by: default avatarRobert P. J. Day <rpjday@crashcourse.ca>
Signed-off-by: default avatarDave Airlie <airlied@redhat.com>
parent 72e942dd
...@@ -1425,8 +1425,8 @@ int ttm_bo_global_init(struct ttm_global_reference *ref) ...@@ -1425,8 +1425,8 @@ int ttm_bo_global_init(struct ttm_global_reference *ref)
atomic_set(&glob->bo_count, 0); atomic_set(&glob->bo_count, 0);
kobject_init(&glob->kobj, &ttm_bo_glob_kobj_type); ret = kobject_init_and_add(
ret = kobject_add(&glob->kobj, ttm_get_kobj(), "buffer_objects"); &glob->kobj, &ttm_bo_glob_kobj_type, ttm_get_kobj(), "buffer_objects");
if (unlikely(ret != 0)) if (unlikely(ret != 0))
kobject_put(&glob->kobj); kobject_put(&glob->kobj);
return ret; return ret;
......
...@@ -260,8 +260,8 @@ static int ttm_mem_init_kernel_zone(struct ttm_mem_global *glob, ...@@ -260,8 +260,8 @@ static int ttm_mem_init_kernel_zone(struct ttm_mem_global *glob,
zone->used_mem = 0; zone->used_mem = 0;
zone->glob = glob; zone->glob = glob;
glob->zone_kernel = zone; glob->zone_kernel = zone;
kobject_init(&zone->kobj, &ttm_mem_zone_kobj_type); ret = kobject_init_and_add(
ret = kobject_add(&zone->kobj, &glob->kobj, zone->name); &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
kobject_put(&zone->kobj); kobject_put(&zone->kobj);
return ret; return ret;
...@@ -296,8 +296,8 @@ static int ttm_mem_init_highmem_zone(struct ttm_mem_global *glob, ...@@ -296,8 +296,8 @@ static int ttm_mem_init_highmem_zone(struct ttm_mem_global *glob,
zone->used_mem = 0; zone->used_mem = 0;
zone->glob = glob; zone->glob = glob;
glob->zone_highmem = zone; glob->zone_highmem = zone;
kobject_init(&zone->kobj, &ttm_mem_zone_kobj_type); ret = kobject_init_and_add(
ret = kobject_add(&zone->kobj, &glob->kobj, zone->name); &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
kobject_put(&zone->kobj); kobject_put(&zone->kobj);
return ret; return ret;
...@@ -343,8 +343,8 @@ static int ttm_mem_init_dma32_zone(struct ttm_mem_global *glob, ...@@ -343,8 +343,8 @@ static int ttm_mem_init_dma32_zone(struct ttm_mem_global *glob,
zone->used_mem = 0; zone->used_mem = 0;
zone->glob = glob; zone->glob = glob;
glob->zone_dma32 = zone; glob->zone_dma32 = zone;
kobject_init(&zone->kobj, &ttm_mem_zone_kobj_type); ret = kobject_init_and_add(
ret = kobject_add(&zone->kobj, &glob->kobj, zone->name); &zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name);
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
kobject_put(&zone->kobj); kobject_put(&zone->kobj);
return ret; return ret;
...@@ -365,10 +365,8 @@ int ttm_mem_global_init(struct ttm_mem_global *glob) ...@@ -365,10 +365,8 @@ int ttm_mem_global_init(struct ttm_mem_global *glob)
glob->swap_queue = create_singlethread_workqueue("ttm_swap"); glob->swap_queue = create_singlethread_workqueue("ttm_swap");
INIT_WORK(&glob->work, ttm_shrink_work); INIT_WORK(&glob->work, ttm_shrink_work);
init_waitqueue_head(&glob->queue); init_waitqueue_head(&glob->queue);
kobject_init(&glob->kobj, &ttm_mem_glob_kobj_type); ret = kobject_init_and_add(
ret = kobject_add(&glob->kobj, &glob->kobj, &ttm_mem_glob_kobj_type, ttm_get_kobj(), "memory_accounting");
ttm_get_kobj(),
"memory_accounting");
if (unlikely(ret != 0)) { if (unlikely(ret != 0)) {
kobject_put(&glob->kobj); kobject_put(&glob->kobj);
return ret; return ret;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment