[v2,RESEND,08/10] ocfs2: convert to kobject_del_and_put()

Message ID 20230319092641.41917-8-frank.li@vivo.com
State New
Headers
Series [v2,RESEND,01/10] kobject: introduce kobject_del_and_put() |

Commit Message

李扬韬 March 19, 2023, 9:26 a.m. UTC
  Use kobject_del_and_put() to simplify code.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>
Signed-off-by: Yangtao Li <frank.li@vivo.com>
---
 fs/ocfs2/filecheck.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Joseph Qi March 20, 2023, 3:35 a.m. UTC | #1
On 3/19/23 5:26 PM, Yangtao Li wrote:
> Use kobject_del_and_put() to simplify code.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Cc: "Rafael J. Wysocki" <rafael@kernel.org>
> Signed-off-by: Yangtao Li <frank.li@vivo.com>
> ---
>  fs/ocfs2/filecheck.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/ocfs2/filecheck.c b/fs/ocfs2/filecheck.c
> index 1ad7106741f8..fb9cf601245b 100644
> --- a/fs/ocfs2/filecheck.c
> +++ b/fs/ocfs2/filecheck.c
> @@ -198,8 +198,7 @@ void ocfs2_filecheck_remove_sysfs(struct ocfs2_super *osb)
>  	if (!osb->osb_fc_ent.fs_fcheck)
>  		return;
>  
> -	kobject_del(&osb->osb_fc_ent.fs_kobj);
> -	kobject_put(&osb->osb_fc_ent.fs_kobj);
> +	kobject_del_and_put(&osb->osb_fc_ent.fs_kobj);
>  	wait_for_completion(&osb->osb_fc_ent.fs_kobj_unregister);
>  	ocfs2_filecheck_sysfs_free(&osb->osb_fc_ent);
>  }

Can't find any implementation of kobject_del_and_put() in mainline.
So I guess you've introduced it at the beginning of this series? Since I
can only see this one:(
So it depends on kobject lib. If kobject lib accepts this helper, it's
fine to me.

Thanks,
Joseph
  

Patch

diff --git a/fs/ocfs2/filecheck.c b/fs/ocfs2/filecheck.c
index 1ad7106741f8..fb9cf601245b 100644
--- a/fs/ocfs2/filecheck.c
+++ b/fs/ocfs2/filecheck.c
@@ -198,8 +198,7 @@  void ocfs2_filecheck_remove_sysfs(struct ocfs2_super *osb)
 	if (!osb->osb_fc_ent.fs_fcheck)
 		return;
 
-	kobject_del(&osb->osb_fc_ent.fs_kobj);
-	kobject_put(&osb->osb_fc_ent.fs_kobj);
+	kobject_del_and_put(&osb->osb_fc_ent.fs_kobj);
 	wait_for_completion(&osb->osb_fc_ent.fs_kobj_unregister);
 	ocfs2_filecheck_sysfs_free(&osb->osb_fc_ent);
 }