Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 250186
b: refs/heads/master
c: 1c6410f
h: refs/heads/master
v: v3
  • Loading branch information
Florian Mickler authored and Mauro Carvalho Chehab committed May 20, 2011
1 parent 43e6bde commit 8ce6c5d
Show file tree
Hide file tree
Showing 3 changed files with 43 additions and 8 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 36f773e8e3f207136a6b903b71754593e0e1819c
refs/heads/master: 1c6410f317c3e78409f0179283089034c77a6ad5
41 changes: 34 additions & 7 deletions trunk/drivers/media/dvb/dvb-usb/vp702x.c
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
* see Documentation/dvb/README.dvb-usb for more information
*/
#include "vp702x.h"
#include <linux/mutex.h>

/* debug */
int dvb_usb_vp702x_debug;
Expand All @@ -29,10 +30,6 @@ struct vp702x_adapter_state {
u8 pid_filter_state;
};

struct vp702x_device_state {
u8 power_state;
};

/* check for mutex FIXME */
int vp702x_usb_in_op(struct dvb_usb_device *d, u8 req, u16 value, u16 index, u8 *b, int blen)
{
Expand Down Expand Up @@ -241,8 +238,38 @@ static struct dvb_usb_device_properties vp702x_properties;
static int vp702x_usb_probe(struct usb_interface *intf,
const struct usb_device_id *id)
{
return dvb_usb_device_init(intf, &vp702x_properties,
THIS_MODULE, NULL, adapter_nr);
struct dvb_usb_device *d;
struct vp702x_device_state *st;
int ret;

ret = dvb_usb_device_init(intf, &vp702x_properties,
THIS_MODULE, &d, adapter_nr);
if (ret)
goto out;

st = d->priv;
st->buf_len = 16;
st->buf = kmalloc(st->buf_len, GFP_KERNEL);
if (!st->buf) {
ret = -ENOMEM;
dvb_usb_device_exit(intf);
goto out;
}
mutex_init(&st->buf_mutex);

out:
return ret;

}

static void vp702x_usb_disconnect(struct usb_interface *intf)
{
struct dvb_usb_device *d = usb_get_intfdata(intf);
struct vp702x_device_state *st = d->priv;
mutex_lock(&st->buf_mutex);
kfree(st->buf);
mutex_unlock(&st->buf_mutex);
dvb_usb_device_exit(intf);
}

static struct usb_device_id vp702x_usb_table [] = {
Expand Down Expand Up @@ -309,7 +336,7 @@ static struct dvb_usb_device_properties vp702x_properties = {
static struct usb_driver vp702x_usb_driver = {
.name = "dvb_usb_vp702x",
.probe = vp702x_usb_probe,
.disconnect = dvb_usb_device_exit,
.disconnect = vp702x_usb_disconnect,
.id_table = vp702x_usb_table,
};

Expand Down
8 changes: 8 additions & 0 deletions trunk/drivers/media/dvb/dvb-usb/vp702x.h
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,14 @@ extern int dvb_usb_vp702x_debug;
#define RESET_TUNER 0xBE
/* IN i: 0, v: 0, no extra buffer */

struct vp702x_device_state {
u8 power_state;
struct mutex buf_mutex;
int buf_len;
u8 *buf;
};


extern struct dvb_frontend * vp702x_fe_attach(struct dvb_usb_device *d);

extern int vp702x_usb_inout_op(struct dvb_usb_device *d, u8 *o, int olen, u8 *i, int ilen, int msec);
Expand Down

0 comments on commit 8ce6c5d

Please sign in to comment.