Skip to content

Commit 8824e50

Browse files
Malcolm Priestleymchehab
authored andcommitted
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: Malcolm Priestley <tvboxspy@gmail.com> Signed-off-by: Sean Young <sean@mess.org> Signed-off-by: Mauro Carvalho Chehab <mchehab+samsung@kernel.org>
1 parent d95947c commit 8824e50

File tree

1 file changed

+3
-32
lines changed

1 file changed

+3
-32
lines changed

drivers/media/usb/dvb-usb-v2/lmedm04.c

Lines changed: 3 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ struct lme2510_state {
136136
u8 pid_off;
137137
void *buffer;
138138
struct urb *lme_urb;
139-
void *usb_buffer;
139+
u8 usb_buffer[64];
140140
/* Frontend original calls */
141141
int (*fe_read_status)(struct dvb_frontend *, enum fe_status *);
142142
int (*fe_read_signal_strength)(struct dvb_frontend *, u16 *);
@@ -169,18 +169,9 @@ static int lme2510_usb_talk(struct dvb_usb_device *d,
169169
u8 *wbuf, int wlen, u8 *rbuf, int rlen)
170170
{
171171
struct lme2510_state *st = d->priv;
172-
u8 *buff;
172+
u8 *buff = st->usb_buffer;
173173
int ret = 0;
174174

175-
if (st->usb_buffer == NULL) {
176-
st->usb_buffer = kmalloc(64, GFP_KERNEL);
177-
if (st->usb_buffer == NULL) {
178-
info("MEM Error no memory");
179-
return -ENOMEM;
180-
}
181-
}
182-
buff = st->usb_buffer;
183-
184175
ret = mutex_lock_interruptible(&d->usb_mutex);
185176

186177
if (ret < 0)
@@ -1245,41 +1236,21 @@ static int lme2510_get_rc_config(struct dvb_usb_device *d,
12451236
return 0;
12461237
}
12471238

1248-
static void *lme2510_exit_int(struct dvb_usb_device *d)
1239+
static void lme2510_exit(struct dvb_usb_device *d)
12491240
{
12501241
struct lme2510_state *st = d->priv;
12511242
struct dvb_usb_adapter *adap = &d->adapter[0];
1252-
void *buffer = NULL;
12531243

12541244
if (adap != NULL) {
12551245
lme2510_kill_urb(&adap->stream);
12561246
}
12571247

1258-
if (st->usb_buffer != NULL) {
1259-
st->i2c_talk_onoff = 1;
1260-
st->signal_level = 0;
1261-
st->signal_sn = 0;
1262-
buffer = st->usb_buffer;
1263-
}
1264-
12651248
if (st->lme_urb != NULL) {
12661249
usb_kill_urb(st->lme_urb);
12671250
usb_free_coherent(d->udev, 128, st->buffer,
12681251
st->lme_urb->transfer_dma);
12691252
info("Interrupt Service Stopped");
12701253
}
1271-
1272-
return buffer;
1273-
}
1274-
1275-
static void lme2510_exit(struct dvb_usb_device *d)
1276-
{
1277-
void *usb_buffer;
1278-
1279-
if (d != NULL) {
1280-
usb_buffer = lme2510_exit_int(d);
1281-
kfree(usb_buffer);
1282-
}
12831254
}
12841255

12851256
static struct dvb_usb_device_properties lme2510_props = {

0 commit comments

Comments
 (0)