aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/nvec
diff options
context:
space:
mode:
authorJulian Andres Klode <jak@jak-linux.org>2011-09-27 19:00:58 +0200
committerGreg Kroah-Hartman <gregkh@suse.de>2011-09-29 17:41:36 -0700
commit198dd26714ba4a60ccc5ce70bc4506613b4f0c2d (patch)
tree52c5b0053a6c806d2552a7a7229b22c2a49eacb4 /drivers/staging/nvec
parentstaging: nvec: Move implementation-only macros out of the header (diff)
downloadlinux-dev-198dd26714ba4a60ccc5ce70bc4506613b4f0c2d.tar.xz
linux-dev-198dd26714ba4a60ccc5ce70bc4506613b4f0c2d.zip
staging: nvec: Export nvec_msg_free() to clients
Client code wishing to make use of nvec_write_sync() must have a way to free the returned pointer, otherwise we run out of poool memory fairly soon. Signed-off-by: Julian Andres Klode <jak@jak-linux.org> Acked-by: Marc Dietrich <marvin24@gmx.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/nvec')
-rw-r--r--drivers/staging/nvec/nvec.c6
-rw-r--r--drivers/staging/nvec/nvec.h3
2 files changed, 7 insertions, 2 deletions
diff --git a/drivers/staging/nvec/nvec.c b/drivers/staging/nvec/nvec.c
index 3fa1c75bda8a..488d7dd78a2f 100644
--- a/drivers/staging/nvec/nvec.c
+++ b/drivers/staging/nvec/nvec.c
@@ -159,12 +159,13 @@ static struct nvec_msg *nvec_msg_alloc(struct nvec_chip *nvec)
*
* Free the given message
*/
-static void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg)
+inline void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg)
{
if (msg != &nvec->tx_scratch)
dev_vdbg(nvec->dev, "INFO: Free %ti\n", msg - nvec->msg_pool);
atomic_set(&msg->used, 0);
}
+EXPORT_SYMBOL_GPL(nvec_msg_free);
/**
* nvec_msg_is_event - Return %true if @msg is an event
@@ -259,7 +260,8 @@ EXPORT_SYMBOL(nvec_write_async);
* interrupt handlers.
*
* Returns: A pointer to the response message on success,
- * %NULL on failure.
+ * %NULL on failure. Free with nvec_msg_free() once no longer
+ * used.
*/
struct nvec_msg *nvec_write_sync(struct nvec_chip *nvec,
const unsigned char *data, short size)
diff --git a/drivers/staging/nvec/nvec.h b/drivers/staging/nvec/nvec.h
index 44787535c0ea..f8ffe0002d1f 100644
--- a/drivers/staging/nvec/nvec.h
+++ b/drivers/staging/nvec/nvec.h
@@ -192,4 +192,7 @@ extern int nvec_register_notifier(struct nvec_chip *nvec,
extern int nvec_unregister_notifier(struct device *dev,
struct notifier_block *nb,
unsigned int events);
+
+extern void nvec_msg_free(struct nvec_chip *nvec, struct nvec_msg *msg);
+
#endif