diff options
author | Steven Toth <stoth@kernellabs.com> | 2010-07-31 14:44:53 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-10-21 07:54:34 -0200 |
commit | 7615e434aefd95181eae099c4f019e021b024eb6 (patch) | |
tree | 22901c7326d8edfe0b8ac1208cb289fcc55241ad /drivers/media/video/saa7164/saa7164-buffer.c | |
parent | add3f580a4342b8bca7e0fb4737fe9eeaefa4319 (diff) |
[media] saa7164: add various encoder message functions
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/saa7164/saa7164-buffer.c')
-rw-r--r-- | drivers/media/video/saa7164/saa7164-buffer.c | 38 |
1 files changed, 38 insertions, 0 deletions
diff --git a/drivers/media/video/saa7164/saa7164-buffer.c b/drivers/media/video/saa7164/saa7164-buffer.c index 6f58af44d02..5fccecd588c 100644 --- a/drivers/media/video/saa7164/saa7164-buffer.c +++ b/drivers/media/video/saa7164/saa7164-buffer.c @@ -265,3 +265,41 @@ int saa7164_buffer_cfg_port(struct saa7164_port *port) return 0; } +struct saa7164_user_buffer *saa7164_buffer_alloc_user(struct saa7164_dev *dev, u32 len) +{ + struct saa7164_user_buffer *buf; + + buf = kzalloc(sizeof(struct saa7164_user_buffer), GFP_KERNEL); + if (buf == 0) + return 0; + + buf->data = kzalloc(len, GFP_KERNEL); + + if (buf->data == 0) { + kfree(buf); + return 0; + } + + buf->actual_size = len; + buf->pos = 0; + + dprintk(DBGLVL_BUF, "%s() allocated user buffer @ 0x%p\n", + __func__, buf); + + return buf; +} + +void saa7164_buffer_dealloc_user(struct saa7164_user_buffer *buf) +{ + if (!buf) + return; + + if (buf->data) { + kfree(buf->data); + buf->data = 0; + } + + if (buf) + kfree(buf); +} + |