RDMA/rtrs-clt: Consolidate rtrs_clt_destroy_sysfs_root_{folder,files}
Since the two functions are called together, let's consolidate them in a new function rtrs_clt_destroy_sysfs_root. Link: https://lore.kernel.org/r/20201217141915.56989-9-jinpu.wang@cloud.ionos.com Signed-off-by: Guoqing Jiang <guoqing.jiang@cloud.ionos.com> Signed-off-by: Jack Wang <jinpu.wang@cloud.ionos.com> Signed-off-by: Jason Gunthorpe <jgg@nvidia.com>
This commit is contained in:
Родитель
424774c9f3
Коммит
7b47b27fcb
|
@ -471,15 +471,12 @@ int rtrs_clt_create_sysfs_root_files(struct rtrs_clt *clt)
|
|||
return sysfs_create_group(&clt->dev.kobj, &rtrs_clt_attr_group);
|
||||
}
|
||||
|
||||
void rtrs_clt_destroy_sysfs_root_folders(struct rtrs_clt *clt)
|
||||
void rtrs_clt_destroy_sysfs_root(struct rtrs_clt *clt)
|
||||
{
|
||||
sysfs_remove_group(&clt->dev.kobj, &rtrs_clt_attr_group);
|
||||
|
||||
if (clt->kobj_paths) {
|
||||
kobject_del(clt->kobj_paths);
|
||||
kobject_put(clt->kobj_paths);
|
||||
}
|
||||
}
|
||||
|
||||
void rtrs_clt_destroy_sysfs_root_files(struct rtrs_clt *clt)
|
||||
{
|
||||
sysfs_remove_group(&clt->dev.kobj, &rtrs_clt_attr_group);
|
||||
}
|
||||
|
|
|
@ -2707,8 +2707,7 @@ close_all_sess:
|
|||
rtrs_clt_close_conns(sess, true);
|
||||
kobject_put(&sess->kobj);
|
||||
}
|
||||
rtrs_clt_destroy_sysfs_root_files(clt);
|
||||
rtrs_clt_destroy_sysfs_root_folders(clt);
|
||||
rtrs_clt_destroy_sysfs_root(clt);
|
||||
free_clt(clt);
|
||||
|
||||
out:
|
||||
|
@ -2725,8 +2724,7 @@ void rtrs_clt_close(struct rtrs_clt *clt)
|
|||
struct rtrs_clt_sess *sess, *tmp;
|
||||
|
||||
/* Firstly forbid sysfs access */
|
||||
rtrs_clt_destroy_sysfs_root_files(clt);
|
||||
rtrs_clt_destroy_sysfs_root_folders(clt);
|
||||
rtrs_clt_destroy_sysfs_root(clt);
|
||||
|
||||
/* Now it is safe to iterate over all paths without locks */
|
||||
list_for_each_entry_safe(sess, tmp, &clt->paths_list, s.entry) {
|
||||
|
|
|
@ -243,8 +243,7 @@ ssize_t rtrs_clt_reset_all_help(struct rtrs_clt_stats *stats,
|
|||
/* rtrs-clt-sysfs.c */
|
||||
|
||||
int rtrs_clt_create_sysfs_root_files(struct rtrs_clt *clt);
|
||||
void rtrs_clt_destroy_sysfs_root_folders(struct rtrs_clt *clt);
|
||||
void rtrs_clt_destroy_sysfs_root_files(struct rtrs_clt *clt);
|
||||
void rtrs_clt_destroy_sysfs_root(struct rtrs_clt *clt);
|
||||
|
||||
int rtrs_clt_create_sess_files(struct rtrs_clt_sess *sess);
|
||||
void rtrs_clt_destroy_sess_files(struct rtrs_clt_sess *sess,
|
||||
|
|
Загрузка…
Ссылка в новой задаче