diff options
author | Antonio Ospite <ospite@studenti.unina.it> | 2012-12-10 15:37:11 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2012-12-27 13:28:15 -0500 |
commit | 7543f344e9b06afe86b55a2620f5c11b38bd5642 (patch) | |
tree | 5f563f57e473f050aa0c44ee5a2a94f110d3f3f2 | |
parent | 908498349562ff6614d570b40e904a20d397dafa (diff) |
[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>
-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, | |||
63 | return ret; | 63 | return ret; |
64 | } | 64 | } |
65 | 65 | ||
66 | static inline int m920x_write_seq(struct usb_device *udev, u8 request, | ||
67 | struct m920x_inits *seq) | ||
68 | { | ||
69 | int ret; | ||
70 | while (seq->address) { | ||
71 | ret = m920x_write(udev, request, seq->data, seq->address); | ||
72 | if (ret != 0) | ||
73 | return ret; | ||
74 | |||
75 | seq++; | ||
76 | } | ||
77 | |||
78 | return ret; | ||
79 | } | ||
80 | |||
66 | static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq) | 81 | static int m920x_init(struct dvb_usb_device *d, struct m920x_inits *rc_seq) |
67 | { | 82 | { |
68 | int ret = 0, i, epi, flags = 0; | 83 | 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 | /* Remote controller init. */ | 86 | /* Remote controller init. */ |
72 | if (d->props.rc.legacy.rc_query) { | 87 | if (d->props.rc.legacy.rc_query) { |
73 | deb("Initialising remote control\n"); | 88 | deb("Initialising remote control\n"); |
74 | while (rc_seq->address) { | 89 | ret = m920x_write_seq(d->udev, M9206_CORE, rc_seq); |
75 | if ((ret = m920x_write(d->udev, M9206_CORE, | 90 | if (ret != 0) { |
76 | rc_seq->data, | 91 | deb("Initialising remote control failed\n"); |
77 | rc_seq->address)) != 0) { | 92 | return ret; |
78 | deb("Initialising remote control failed\n"); | ||
79 | return ret; | ||
80 | } | ||
81 | |||
82 | rc_seq++; | ||
83 | } | 93 | } |
84 | 94 | ||
85 | deb("Initialising remote control success\n"); | 95 | deb("Initialising remote control success\n"); |