Skip to content

Commit

Permalink
powerpc: Remove redundant sysfs_remove_file calls for cache info
Browse files Browse the repository at this point in the history
When removing a directory, the sysfs core takes care of removing files
in the directory (see sysfs_remove_dir()).  So when we are about to
delete a kobject (and thus cause its sysfs directory to be removed),
we don't have to explicitly remove the files attached to it, although
it's harmless to do so.

Signed-off-by: Nathan Lynch <ntl@pobox.com>
Signed-off-by: Paul Mackerras <paulus@samba.org>
  • Loading branch information
Nathan Lynch authored and Paul Mackerras committed Aug 20, 2008
1 parent 8f6ba49 commit f3d3d30
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions arch/powerpc/kernel/sysfs.c
Original file line number Diff line number Diff line change
Expand Up @@ -641,16 +641,9 @@ static void remove_cache_info(struct sys_device *sysdev)
int cpu = sysdev->id;

cache_desc = per_cpu(cache_desc, cpu);
if (cache_desc != NULL) {
sysfs_remove_file(&cache_desc->kobj, &cache_size_attr.attr);
sysfs_remove_file(&cache_desc->kobj, &cache_line_size_attr.attr);
sysfs_remove_file(&cache_desc->kobj, &cache_type_attr.attr);
sysfs_remove_file(&cache_desc->kobj, &cache_level_attr.attr);
sysfs_remove_file(&cache_desc->kobj, &cache_nr_sets_attr.attr);
sysfs_remove_file(&cache_desc->kobj, &cache_assoc_attr.attr);

if (cache_desc != NULL)
kobject_put(&cache_desc->kobj);
}

cache_toplevel = per_cpu(cache_toplevel, cpu);
if (cache_toplevel != NULL)
kobject_put(cache_toplevel);
Expand Down

0 comments on commit f3d3d30

Please sign in to comment.