Commit 2f528c8b authored by Alex Elder's avatar Alex Elder Committed by Greg Kroah-Hartman

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: default avatarAlex Elder <elder@linaro.org>
Signed-off-by: default avatarGreg Kroah-Hartman <greg@kroah.com>
parent 6e5dd0bb
...@@ -12,7 +12,6 @@ ...@@ -12,7 +12,6 @@
#include <linux/module.h> #include <linux/module.h>
#include <linux/moduleparam.h> #include <linux/moduleparam.h>
#include <linux/kernel.h> #include <linux/kernel.h>
#include <linux/kref.h>
#include <linux/device.h> #include <linux/device.h>
#include <linux/slab.h> #include <linux/slab.h>
...@@ -46,7 +45,6 @@ struct gbuf *greybus_alloc_gbuf(struct greybus_host_device *hd, ...@@ -46,7 +45,6 @@ struct gbuf *greybus_alloc_gbuf(struct greybus_host_device *hd,
if (!gbuf) if (!gbuf)
return NULL; return NULL;
kref_init(&gbuf->kref);
gbuf->hd = hd; gbuf->hd = hd;
gbuf->dest_cport_id = dest_cport_id; gbuf->dest_cport_id = dest_cport_id;
gbuf->status = -EBADR; /* Initial value--means "never set" */ gbuf->status = -EBADR; /* Initial value--means "never set" */
...@@ -62,20 +60,12 @@ struct gbuf *greybus_alloc_gbuf(struct greybus_host_device *hd, ...@@ -62,20 +60,12 @@ struct gbuf *greybus_alloc_gbuf(struct greybus_host_device *hd,
} }
EXPORT_SYMBOL_GPL(greybus_alloc_gbuf); 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); gbuf->hd->driver->free_gbuf_data(gbuf);
kmem_cache_free(gbuf_head_cache, 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); EXPORT_SYMBOL_GPL(greybus_free_gbuf);
int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t gfp_mask) int greybus_submit_gbuf(struct gbuf *gbuf, gfp_t gfp_mask)
......
...@@ -119,8 +119,6 @@ ...@@ -119,8 +119,6 @@
*/ */
struct gbuf { struct gbuf {
struct kref kref;
struct greybus_host_device *hd; struct greybus_host_device *hd;
u16 dest_cport_id; /* Destination CPort id */ u16 dest_cport_id; /* Destination CPort id */
int status; int status;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment