2017-11-25 06:39:47

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 0/4] Remove a attribute group from a kobject

Arvind Yadav (4):
[PATCH 1/4] staging: ccree: Remove a attribute group from a kobject
[PATCH 2/4] staging: lustre: ldlm: Remove a attribute group from a kobject
[PATCH 3/4] staging: lustre: obdclass: Remove a attribute group from a kobject
[PATCH 4/4] staging: most: Remove a attribute group from a kobject

drivers/staging/ccree/ssi_sysfs.c | 5 ++++-
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 4 +++-
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 3 +++
drivers/staging/most/hdm-dim2/dim2_sysfs.c | 1 +
4 files changed, 11 insertions(+), 2 deletions(-)

--
2.7.4


2017-11-25 06:39:30

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 3/4] staging: lustre: obdclass: Remove a attribute group from a kobject

All attribute group created during class_procfs_init() should be
removed.
if class_procfs_init() will fail and also in class_procfs_clean().

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/staging/lustre/lustre/obdclass/linux/linux-module.c | 3 +++
1 file changed, 3 insertions(+)

diff --git a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
index fc59f29..5795123 100644
--- a/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
+++ b/drivers/staging/lustre/lustre/obdclass/linux/linux-module.c
@@ -501,6 +501,7 @@ int class_procfs_init(void)
rc = debugfs_lustre_root ? PTR_ERR(debugfs_lustre_root)
: -ENOMEM;
debugfs_lustre_root = NULL;
+ sysfs_remove_group(lustre_kobj, &lustre_attr_group);
kobject_put(lustre_kobj);
goto out;
}
@@ -509,6 +510,7 @@ int class_procfs_init(void)
&obd_device_list_fops);
if (IS_ERR_OR_NULL(file)) {
rc = file ? PTR_ERR(file) : -ENOMEM;
+ sysfs_remove_group(lustre_kobj, &lustre_attr_group);
kobject_put(lustre_kobj);
goto out;
}
@@ -522,6 +524,7 @@ int class_procfs_clean(void)

debugfs_lustre_root = NULL;

+ sysfs_remove_group(lustre_kobj, &lustre_attr_group);
kobject_put(lustre_kobj);

return 0;
--
2.7.4

2017-11-25 06:39:29

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 2/4] staging: lustre: ldlm: Remove a attribute group from a kobject

All attribute group created during ldlm_setup() should be removed
in ldlm_cleanup().

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
index 2d5a2c9..ada50b6 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lockd.c
@@ -1093,8 +1093,10 @@ static int ldlm_cleanup(void)
kset_unregister(ldlm_ns_kset);
if (ldlm_svc_kset)
kset_unregister(ldlm_svc_kset);
- if (ldlm_kobj)
+ if (ldlm_kobj) {
+ sysfs_remove_group(ldlm_kobj, &ldlm_attr_group);
kobject_put(ldlm_kobj);
+ }

ldlm_debugfs_cleanup();

--
2.7.4

2017-11-25 06:39:31

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 4/4] staging: most: Remove a attribute group from a kobject

All attribute group created during dim2_sysfs_probe() should be removed
in dim2_sysfs_destroy().

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/staging/most/hdm-dim2/dim2_sysfs.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/drivers/staging/most/hdm-dim2/dim2_sysfs.c b/drivers/staging/most/hdm-dim2/dim2_sysfs.c
index d8b22f9..c038ff5 100644
--- a/drivers/staging/most/hdm-dim2/dim2_sysfs.c
+++ b/drivers/staging/most/hdm-dim2/dim2_sysfs.c
@@ -111,5 +111,6 @@ int dim2_sysfs_probe(struct medialb_bus *bus, struct kobject *parent_kobj)

void dim2_sysfs_destroy(struct medialb_bus *bus)
{
+ sysfs_remove_group(&bus->kobj_group, &bus_attr_group);
kobject_put(&bus->kobj_group);
}
--
2.7.4

2017-11-25 06:39:28

by Arvind Yadav

[permalink] [raw]
Subject: [PATCH 1/4] staging: ccree: Remove a attribute group from a kobject

All attribute group created during sys_init_dir() should be removed
in sys_free_dir()

Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/staging/ccree/ssi_sysfs.c | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/ccree/ssi_sysfs.c b/drivers/staging/ccree/ssi_sysfs.c
index 5d39f15..14a3f32 100644
--- a/drivers/staging/ccree/ssi_sysfs.c
+++ b/drivers/staging/ccree/ssi_sysfs.c
@@ -145,8 +145,11 @@ static void sys_free_dir(struct sys_dir *sys_dir)

kfree(sys_dir->sys_dir_attr_list);

- if (sys_dir->sys_dir_kobj)
+ if (sys_dir->sys_dir_kobj) {
+ sysfs_remove_group(sys_dir->sys_dir_kobj,
+ &sys_dir->sys_dir_attr_group);
kobject_put(sys_dir->sys_dir_kobj);
+ }
}

int ssi_sysfs_init(struct kobject *sys_dev_obj, struct ssi_drvdata *drvdata)
--
2.7.4

2017-11-28 13:21:48

by Greg KH

[permalink] [raw]
Subject: Re: [PATCH 4/4] staging: most: Remove a attribute group from a kobject

On Sat, Nov 25, 2017 at 12:09:31PM +0530, Arvind Yadav wrote:
> All attribute group created during dim2_sysfs_probe() should be removed
> in dim2_sysfs_destroy().
>
> Signed-off-by: Arvind Yadav <[email protected]>
> ---
> drivers/staging/most/hdm-dim2/dim2_sysfs.c | 1 +

This file is not in the tree anymore.