Commit 7543f344 authored by Antonio Ospite's avatar Antonio Ospite Committed by Mauro Carvalho Chehab

[media] m920x: factor out a m920x_write_seq() function

This is in preparation for the vp7049 frontend attach function which is
going to set a sequence of registers as well.
Signed-off-by: default avatarAntonio Ospite <ospite@studenti.unina.it>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 90849834
...@@ -63,6 +63,21 @@ static inline int m920x_write(struct usb_device *udev, u8 request, ...@@ -63,6 +63,21 @@ static inline int m920x_write(struct usb_device *udev, u8 request,
return ret; return ret;
} }
static inline int m920x_write_seq(struct usb_device *udev, u8 request,
struct m920x_inits *seq)
{
int ret;
while (seq->address) {
ret = m920x_write(udev, request, seq->data, seq->address);
if (ret != 0)
return ret;
seq++;
}
return ret;
}
static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq) static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq)
{ {
int ret = 0, i, epi, flags = 0; int ret = 0, i, epi, flags = 0;
...@@ -71,15 +86,10 @@ static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq) ...@@ -71,15 +86,10 @@ static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq)
/* Remote controller init. */ /* Remote controller init. */
if (d->props.rc.legacy.rc_query) { if (d->props.rc.legacy.rc_query) {
deb("Initialising remote control\n"); deb("Initialising remote control\n");
while (rc_seq->address) { ret = m920x_write_seq(d->udev, M9206_CORE, rc_seq);
if ((ret = m920x_write(d->udev, M9206_CORE, if (ret != 0) {
rc_seq->data, deb("Initialising remote control failed\n");
rc_seq->address)) != 0) { return ret;
deb("Initialising remote control failed\n");
return ret;
}
rc_seq++;
} }
deb("Initialising remote control success\n"); deb("Initialising remote control success\n");
......
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