Skip to content

Commit

Permalink
drm: "kobject_init/kobject_add" -> "kobject_init_and_add".
Browse files Browse the repository at this point in the history
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: Robert P. J. Day <[email protected]>
Signed-off-by: Dave Airlie <[email protected]>
  • Loading branch information
rpjday authored and airlied committed Mar 15, 2010
1 parent 72e942d commit b642ed0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 12 deletions.
4 changes: 2 additions & 2 deletions drivers/gpu/drm/ttm/ttm_bo.c
Original file line number Diff line number Diff line change
Expand Up @@ -1425,8 +1425,8 @@ int ttm_bo_global_init(struct ttm_global_reference *ref)

atomic_set(&glob->bo_count, 0);

kobject_init(&glob->kobj, &ttm_bo_glob_kobj_type);
ret = kobject_add(&glob->kobj, ttm_get_kobj(), "buffer_objects");
ret = kobject_init_and_add(
&glob->kobj, &ttm_bo_glob_kobj_type, ttm_get_kobj(), "buffer_objects");
if (unlikely(ret != 0))
kobject_put(&glob->kobj);
return ret;
Expand Down
18 changes: 8 additions & 10 deletions drivers/gpu/drm/ttm/ttm_memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -260,8 +260,8 @@ static int ttm_mem_init_kernel_zone(struct ttm_mem_global *glob,
zone->used_mem = 0;
zone->glob = glob;
glob->zone_kernel = zone;
kobject_init(&zone->kobj, &ttm_mem_zone_kobj_type);
ret = kobject_add(&zone->kobj, &glob->kobj, zone->name);
ret = kobject_init_and_add(
&zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name);
if (unlikely(ret != 0)) {
kobject_put(&zone->kobj);
return ret;
Expand Down Expand Up @@ -296,8 +296,8 @@ static int ttm_mem_init_highmem_zone(struct ttm_mem_global *glob,
zone->used_mem = 0;
zone->glob = glob;
glob->zone_highmem = zone;
kobject_init(&zone->kobj, &ttm_mem_zone_kobj_type);
ret = kobject_add(&zone->kobj, &glob->kobj, zone->name);
ret = kobject_init_and_add(
&zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name);
if (unlikely(ret != 0)) {
kobject_put(&zone->kobj);
return ret;
Expand Down Expand Up @@ -343,8 +343,8 @@ static int ttm_mem_init_dma32_zone(struct ttm_mem_global *glob,
zone->used_mem = 0;
zone->glob = glob;
glob->zone_dma32 = zone;
kobject_init(&zone->kobj, &ttm_mem_zone_kobj_type);
ret = kobject_add(&zone->kobj, &glob->kobj, zone->name);
ret = kobject_init_and_add(
&zone->kobj, &ttm_mem_zone_kobj_type, &glob->kobj, zone->name);
if (unlikely(ret != 0)) {
kobject_put(&zone->kobj);
return ret;
Expand All @@ -365,10 +365,8 @@ int ttm_mem_global_init(struct ttm_mem_global *glob)
glob->swap_queue = create_singlethread_workqueue("ttm_swap");
INIT_WORK(&glob->work, ttm_shrink_work);
init_waitqueue_head(&glob->queue);
kobject_init(&glob->kobj, &ttm_mem_glob_kobj_type);
ret = kobject_add(&glob->kobj,
ttm_get_kobj(),
"memory_accounting");
ret = kobject_init_and_add(
&glob->kobj, &ttm_mem_glob_kobj_type, ttm_get_kobj(), "memory_accounting");
if (unlikely(ret != 0)) {
kobject_put(&glob->kobj);
return ret;
Expand Down

0 comments on commit b642ed0

Please sign in to comment.