Commit 8824e501 authored by Malcolm Priestley's avatar Malcolm Priestley Committed by Mauro Carvalho Chehab

media: lmedm04: Move usb buffer to lme2510_state.

lme2510_state exists for the entire duration of driver.

Move usb_buffer to lme2510_state removing the need for
lme2510_exit_int for removing the buffer.
Signed-off-by: default avatarMalcolm Priestley <tvboxspy@gmail.com>
Signed-off-by: default avatarSean Young <sean@mess.org>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab+samsung@kernel.org>
parent d95947c0
...@@ -136,7 +136,7 @@ struct lme2510_state { ...@@ -136,7 +136,7 @@ struct lme2510_state {
u8 pid_off; u8 pid_off;
void *buffer; void *buffer;
struct urb *lme_urb; struct urb *lme_urb;
void *usb_buffer; u8 usb_buffer[64];
/* Frontend original calls */ /* Frontend original calls */
int (*fe_read_status)(struct dvb_frontend *, enum fe_status *); int (*fe_read_status)(struct dvb_frontend *, enum fe_status *);
int (*fe_read_signal_strength)(struct dvb_frontend *, u16 *); int (*fe_read_signal_strength)(struct dvb_frontend *, u16 *);
...@@ -169,18 +169,9 @@ static int lme2510_usb_talk(struct dvb_usb_device *d, ...@@ -169,18 +169,9 @@ static int lme2510_usb_talk(struct dvb_usb_device *d,
u8 *wbuf, int wlen, u8 *rbuf, int rlen) u8 *wbuf, int wlen, u8 *rbuf, int rlen)
{ {
struct lme2510_state *st = d->priv; struct lme2510_state *st = d->priv;
u8 *buff; u8 *buff = st->usb_buffer;
int ret = 0; int ret = 0;
if (st->usb_buffer == NULL) {
st->usb_buffer = kmalloc(64, GFP_KERNEL);
if (st->usb_buffer == NULL) {
info("MEM Error no memory");
return -ENOMEM;
}
}
buff = st->usb_buffer;
ret = mutex_lock_interruptible(&d->usb_mutex); ret = mutex_lock_interruptible(&d->usb_mutex);
if (ret < 0) if (ret < 0)
...@@ -1245,41 +1236,21 @@ static int lme2510_get_rc_config(struct dvb_usb_device *d, ...@@ -1245,41 +1236,21 @@ static int lme2510_get_rc_config(struct dvb_usb_device *d,
return 0; return 0;
} }
static void *lme2510_exit_int(struct dvb_usb_device *d) static void lme2510_exit(struct dvb_usb_device *d)
{ {
struct lme2510_state *st = d->priv; struct lme2510_state *st = d->priv;
struct dvb_usb_adapter *adap = &d->adapter[0]; struct dvb_usb_adapter *adap = &d->adapter[0];
void *buffer = NULL;
if (adap != NULL) { if (adap != NULL) {
lme2510_kill_urb(&adap->stream); lme2510_kill_urb(&adap->stream);
} }
if (st->usb_buffer != NULL) {
st->i2c_talk_onoff = 1;
st->signal_level = 0;
st->signal_sn = 0;
buffer = st->usb_buffer;
}
if (st->lme_urb != NULL) { if (st->lme_urb != NULL) {
usb_kill_urb(st->lme_urb); usb_kill_urb(st->lme_urb);
usb_free_coherent(d->udev, 128, st->buffer, usb_free_coherent(d->udev, 128, st->buffer,
st->lme_urb->transfer_dma); st->lme_urb->transfer_dma);
info("Interrupt Service Stopped"); info("Interrupt Service Stopped");
} }
return buffer;
}
static void lme2510_exit(struct dvb_usb_device *d)
{
void *usb_buffer;
if (d != NULL) {
usb_buffer = lme2510_exit_int(d);
kfree(usb_buffer);
}
} }
static struct dvb_usb_device_properties lme2510_props = { static struct dvb_usb_device_properties lme2510_props = {
......
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