[v2,RESEND,04/10] zonefs: convert to kobject_del_and_put()

Message ID 20230319092641.41917-4-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/zonefs/sysfs.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
  

Comments

Damien Le Moal March 19, 2023, 9:42 p.m. UTC | #1
On 3/19/23 18:26, 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/zonefs/sysfs.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/fs/zonefs/sysfs.c b/fs/zonefs/sysfs.c
> index 8ccb65c2b419..5e117188fbb5 100644
> --- a/fs/zonefs/sysfs.c
> +++ b/fs/zonefs/sysfs.c
> @@ -113,8 +113,7 @@ void zonefs_sysfs_unregister(struct super_block *sb)
>  	if (!sbi || !sbi->s_sysfs_registered)
>  		return;
>  
> -	kobject_del(&sbi->s_kobj);
> -	kobject_put(&sbi->s_kobj);
> +	kobject_del_and_put(&sbi->s_kobj);
>  	wait_for_completion(&sbi->s_kobj_unregister);

There is no function kobject_del_and_put() in rc3. I guess it is introduced by
this series but since you did not send everything, it is impossible to review.
Please always send the full patch series so that reviewers have all the context
that is needed to review/ack.

>  }
>
  

Patch

diff --git a/fs/zonefs/sysfs.c b/fs/zonefs/sysfs.c
index 8ccb65c2b419..5e117188fbb5 100644
--- a/fs/zonefs/sysfs.c
+++ b/fs/zonefs/sysfs.c
@@ -113,8 +113,7 @@  void zonefs_sysfs_unregister(struct super_block *sb)
 	if (!sbi || !sbi->s_sysfs_registered)
 		return;
 
-	kobject_del(&sbi->s_kobj);
-	kobject_put(&sbi->s_kobj);
+	kobject_del_and_put(&sbi->s_kobj);
 	wait_for_completion(&sbi->s_kobj_unregister);
 }