diff options
author | Antonio Ospite <ospite@studenti.unina.it> | 2012-12-10 21:37:11 +0100 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-12-27 19:28:15 +0100 |
commit | 7543f344e9b06afe86b55a2620f5c11b38bd5642 (patch) | |
tree | 5f563f57e473f050aa0c44ee5a2a94f110d3f3f2 /drivers/media/usb/dvb-usb/m920x.c | |
parent | [media] m920x: fix a typo in a comment (diff) | |
download | linux-7543f344e9b06afe86b55a2620f5c11b38bd5642.tar.xz linux-7543f344e9b06afe86b55a2620f5c11b38bd5642.zip |
[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: Antonio Ospite <ospite@studenti.unina.it>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/usb/dvb-usb/m920x.c')
-rw-r--r-- | drivers/media/usb/dvb-usb/m920x.c | 28 |
1 files changed, 19 insertions, 9 deletions
diff --git a/drivers/media/usb/dvb-usb/m920x.c b/drivers/media/usb/dvb-usb/m920x.c index 433696d14f4b..23416fbb9f8c 100644 --- a/drivers/media/usb/dvb-usb/m920x.c +++ b/drivers/media/usb/dvb-usb/m920x.c @@ -63,6 +63,21 @@ static inline int m920x_write(struct usb_device *udev, u8 request, 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) { 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) /* Remote controller init. */ if (d->props.rc.legacy.rc_query) { deb("Initialising remote control\n"); - while (rc_seq->address) { - if ((ret = m920x_write(d->udev, M9206_CORE, - rc_seq->data, - rc_seq->address)) != 0) { - deb("Initialising remote control failed\n"); - return ret; - } - - rc_seq++; + ret = m920x_write_seq(d->udev, M9206_CORE, rc_seq); + if (ret != 0) { + deb("Initialising remote control failed\n"); + return ret; } deb("Initialising remote control success\n"); |