Commit 7b47b27f authored by Guoqing Jiang's avatar Guoqing Jiang Committed by Jason Gunthorpe

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.comSigned-off-by: default avatarGuoqing Jiang <guoqing.jiang@cloud.ionos.com>
Signed-off-by: default avatarJack Wang <jinpu.wang@cloud.ionos.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 424774c9
...@@ -471,15 +471,12 @@ int rtrs_clt_create_sysfs_root_files(struct rtrs_clt *clt) ...@@ -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); 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) { if (clt->kobj_paths) {
kobject_del(clt->kobj_paths); kobject_del(clt->kobj_paths);
kobject_put(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 @@ struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops *ops, ...@@ -2707,8 +2707,7 @@ struct rtrs_clt *rtrs_clt_open(struct rtrs_clt_ops *ops,
rtrs_clt_close_conns(sess, true); rtrs_clt_close_conns(sess, true);
kobject_put(&sess->kobj); kobject_put(&sess->kobj);
} }
rtrs_clt_destroy_sysfs_root_files(clt); rtrs_clt_destroy_sysfs_root(clt);
rtrs_clt_destroy_sysfs_root_folders(clt);
free_clt(clt); free_clt(clt);
out: out:
...@@ -2725,8 +2724,7 @@ void rtrs_clt_close(struct rtrs_clt *clt) ...@@ -2725,8 +2724,7 @@ void rtrs_clt_close(struct rtrs_clt *clt)
struct rtrs_clt_sess *sess, *tmp; struct rtrs_clt_sess *sess, *tmp;
/* Firstly forbid sysfs access */ /* Firstly forbid sysfs access */
rtrs_clt_destroy_sysfs_root_files(clt); rtrs_clt_destroy_sysfs_root(clt);
rtrs_clt_destroy_sysfs_root_folders(clt);
/* Now it is safe to iterate over all paths without locks */ /* Now it is safe to iterate over all paths without locks */
list_for_each_entry_safe(sess, tmp, &clt->paths_list, s.entry) { 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, ...@@ -243,8 +243,7 @@ ssize_t rtrs_clt_reset_all_help(struct rtrs_clt_stats *stats,
/* rtrs-clt-sysfs.c */ /* rtrs-clt-sysfs.c */
int rtrs_clt_create_sysfs_root_files(struct rtrs_clt *clt); 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(struct rtrs_clt *clt);
void rtrs_clt_destroy_sysfs_root_files(struct rtrs_clt *clt);
int rtrs_clt_create_sess_files(struct rtrs_clt_sess *sess); int rtrs_clt_create_sess_files(struct rtrs_clt_sess *sess);
void rtrs_clt_destroy_sess_files(struct rtrs_clt_sess *sess, void rtrs_clt_destroy_sess_files(struct rtrs_clt_sess *sess,
......
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