summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/media/rc/ir-lirc-codec.c2
-rw-r--r--drivers/media/rc/lirc_dev.c13
-rw-r--r--include/media/lirc_dev.h9
3 files changed, 18 insertions, 6 deletions
diff --git a/drivers/media/rc/ir-lirc-codec.c b/drivers/media/rc/ir-lirc-codec.c
index 2d591168c991..d5c155a5a547 100644
--- a/drivers/media/rc/ir-lirc-codec.c
+++ b/drivers/media/rc/ir-lirc-codec.c
@@ -347,7 +347,7 @@ static int ir_lirc_register(struct rc_dev *dev)
int rc = -ENOMEM;
unsigned long features = 0;
- ldev = kzalloc(sizeof(*ldev), GFP_KERNEL);
+ ldev = lirc_allocate_device();
if (!ldev)
return rc;
diff --git a/drivers/media/rc/lirc_dev.c b/drivers/media/rc/lirc_dev.c
index e381a1c04bea..a6005f70de5a 100644
--- a/drivers/media/rc/lirc_dev.c
+++ b/drivers/media/rc/lirc_dev.c
@@ -103,6 +103,19 @@ out:
return err;
}
+struct lirc_dev *
+lirc_allocate_device(void)
+{
+ return kzalloc(sizeof(struct lirc_dev), GFP_KERNEL);
+}
+EXPORT_SYMBOL(lirc_allocate_device);
+
+void lirc_free_device(struct lirc_dev *d)
+{
+ kfree(d);
+}
+EXPORT_SYMBOL(lirc_free_device);
+
int lirc_register_device(struct lirc_dev *d)
{
struct irctl *ir;
diff --git a/include/media/lirc_dev.h b/include/media/lirc_dev.h
index d16d6e0ef8da..4b0dc640e142 100644
--- a/include/media/lirc_dev.h
+++ b/include/media/lirc_dev.h
@@ -156,11 +156,10 @@ struct lirc_dev {
struct irctl *irctl;
};
-/* following functions can be called ONLY from user context
- *
- * returns negative value on error or zero
- * contents of the structure pointed by p is copied
- */
+struct lirc_dev *lirc_allocate_device(void);
+
+void lirc_free_device(struct lirc_dev *d);
+
int lirc_register_device(struct lirc_dev *d);
void lirc_unregister_device(struct lirc_dev *d);