Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 19e72d3a authored by Bart Van Assche's avatar Bart Van Assche Committed by Christoph Hellwig
Browse files

configfs: Introduce config_item_get_unless_zero()



Signed-off-by: default avatarBart Van Assche <bart.vanassche@sandisk.com>
[hch: minor style tweak]
Signed-off-by: default avatarChristoph Hellwig <hch@lst.de>
parent ba80aa90
Loading
Loading
Loading
Loading
+8 −0
Original line number Diff line number Diff line
@@ -138,6 +138,14 @@ struct config_item *config_item_get(struct config_item *item)
}
EXPORT_SYMBOL(config_item_get);

struct config_item *config_item_get_unless_zero(struct config_item *item)
{
	if (item && kref_get_unless_zero(&item->ci_kref))
		return item;
	return NULL;
}
EXPORT_SYMBOL(config_item_get_unless_zero);

static void config_item_cleanup(struct config_item *item)
{
	struct config_item_type *t = item->ci_type;
+2 −1
Original line number Diff line number Diff line
@@ -75,6 +75,7 @@ extern void config_item_init_type_name(struct config_item *item,
				       struct config_item_type *type);

extern struct config_item *config_item_get(struct config_item *);
extern struct config_item *config_item_get_unless_zero(struct config_item *);
extern void config_item_put(struct config_item *);

struct config_item_type {