From 2f528c8bf7199c5eba93ea344a502910dc3a2806 Mon Sep 17 00:00:00 2001 From: Alex Elder Date: Mon, 17 Nov 2014 18:08:29 -0600 Subject: [PATCH] greybus: kill gbuf->kref Since there is only ever one reference to a gbuf, we don't need a kref to figure out when it can be freed. Get rid of the kref and its supporting code. Signed-off-by: Alex Elder Signed-off-by: Greg Kroah-Hartman --- drivers/staging/greybus/gbuf.c | 12 +----------- drivers/staging/greybus/greybus.h | 2 -- 2 files changed, 1 insertion(+), 13 deletions(-) diff --git a/drivers/staging/greybus/gbuf.c b/drivers/staging/greybus/gbuf.c index 92da63257526..1d0dd4acfa2a 100644 --- a/drivers/staging/greybus/gbuf.c +++ b/drivers/staging/greybus/gbuf.c @@ -12,7 +12,6 @@ #include #include #include -#include #include #include @@ -46,7 +45,6 @@ struct gbuf *greybus_alloc_gbuf(struct greybus_host_device *hd, if (!gbuf) return NULL; - kref_init(&gbuf->kref); gbuf->hd = hd; gbuf->dest_cport_id = dest_cport_id; gbuf->status = -EBADR; /* Initial value--means "never set" */ @@ -62,20 +60,12 @@ struct gbuf *greybus_alloc_gbuf(struct greybus_host_device *hd, } EXPORT_SYMBOL_GPL(greybus_alloc_gbuf); -static void free_gbuf(struct kref *kref) +void greybus_free_gbuf(struct gbuf *gbuf) { - struct gbuf *gbuf = container_of(kref, struct gbuf, kref); - gbuf->hd->driver->free_gbuf_data(gbuf); kmem_cache_free(gbuf_head_cache, gbuf); } - -void greybus_free_gbuf(struct gbuf *gbuf) -{ - /* drop the reference count and get out of here */ - kref_put(&gbuf->kref, free_gbuf); -} EXPORT_SYMBOL_GPL(greybus_free_gbuf); int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t gfp_mask) diff --git a/drivers/staging/greybus/greybus.h b/drivers/staging/greybus/greybus.h index 3af338223609..173170065261 100644 --- a/drivers/staging/greybus/greybus.h +++ b/drivers/staging/greybus/greybus.h @@ -119,8 +119,6 @@ */ struct gbuf { - struct kref kref; - struct greybus_host_device *hd; u16 dest_cport_id; /* Destination CPort id */ int status; -- 2.20.1