summaryrefslogtreecommitdiff
path: root/fs
diff options
context:
space:
mode:
authorBart Van Assche <bart.vanassche@sandisk.com>2017-02-09 17:28:50 -0800
committerChristoph Hellwig <hch@lst.de>2017-06-12 13:20:20 +0200
commit19e72d3abb63cb16d021a4066ce1a18880509e99 (patch)
tree4d8228390a3f8b4697552bfa807232f71731bd8f /fs
parentba80aa909c99802c428682c352b0ee0baac0acd3 (diff)
configfs: Introduce config_item_get_unless_zero()
Signed-off-by: Bart Van Assche <bart.vanassche@sandisk.com> [hch: minor style tweak] Signed-off-by: Christoph Hellwig <hch@lst.de>
Diffstat (limited to 'fs')
-rw-r--r--fs/configfs/item.c8
1 files changed, 8 insertions, 0 deletions
diff --git a/fs/configfs/item.c b/fs/configfs/item.c
index 8b2a994042dd..a66f6624d899 100644
--- a/fs/configfs/item.c
+++ b/fs/configfs/item.c
@@ -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;