public inbox for linux-block@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] block: rnbd: add .release to rnbd_dev_ktype
@ 2025-04-27 15:48 Salah Triki
  2025-04-27 22:03 ` Jens Axboe
  2025-04-28  9:58 ` Jinpu Wang
  0 siblings, 2 replies; 5+ messages in thread
From: Salah Triki @ 2025-04-27 15:48 UTC (permalink / raw)
  To: Md. Haris Iqbal, Jack Wang, Jens Axboe, linux-block, linux-kernel
  Cc: salah.triki

Every ktype must provides a .release function that will be called after
the last kobject_put.

Signed-off-by: Salah Triki <salah.triki@gmail.com>
---
 drivers/block/rnbd/rnbd-clt-sysfs.c | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/drivers/block/rnbd/rnbd-clt-sysfs.c b/drivers/block/rnbd/rnbd-clt-sysfs.c
index 6ea7c12e3a87..144aea1466a4 100644
--- a/drivers/block/rnbd/rnbd-clt-sysfs.c
+++ b/drivers/block/rnbd/rnbd-clt-sysfs.c
@@ -475,9 +475,17 @@ void rnbd_clt_remove_dev_symlink(struct rnbd_clt_dev *dev)
 	}
 }
 
+static void rnbd_dev_release(struct kobject *kobj)
+{
+	struct rnbd_clt_dev *dev = container_of(kobj, struct rnbd_clt_dev, kobj);
+
+	kfree(dev);
+}
+
 static const struct kobj_type rnbd_dev_ktype = {
 	.sysfs_ops      = &kobj_sysfs_ops,
 	.default_groups = rnbd_dev_groups,
+	.release	= rnbd_dev_release,
 };
 
 static int rnbd_clt_add_dev_kobj(struct rnbd_clt_dev *dev)
-- 
2.43.0


^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2025-05-04 17:20 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-04-27 15:48 [PATCH] block: rnbd: add .release to rnbd_dev_ktype Salah Triki
2025-04-27 22:03 ` Jens Axboe
2025-04-28  8:24   ` John Garry
2025-04-28  9:58 ` Jinpu Wang
2025-05-04 17:20   ` Bart Van Assche

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox