diff options
author | Marton Nemeth <nm127@freemail.hu> | 2009-11-02 06:05:51 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-12-05 15:41:15 -0500 |
commit | a6b69e409a41144c24dcbecdc174a5c847631de2 (patch) | |
tree | e92a3b7fdef8fe4e453645ce84ff9753194c4951 /drivers/media/video/gspca | |
parent | c86c82b74f800486ede57fdd5a4fa77d86368861 (diff) |
V4L/DVB (13298): gspca - pac207/pac7311/mr97310a: Simplify pac_find_sof.
Remove struct sd dependency from pac_find_sof() function implementation.
This step prepares separation of pac7302 and pac7311 specific parts of
struct sd.
Signed-off-by: Marton Nemeth <nm127@freemail.hu>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca')
-rw-r--r-- | drivers/media/video/gspca/mr97310a.c | 3 | ||||
-rw-r--r-- | drivers/media/video/gspca/pac207.c | 2 | ||||
-rw-r--r-- | drivers/media/video/gspca/pac7311.c | 2 | ||||
-rw-r--r-- | drivers/media/video/gspca/pac_common.h | 27 |
4 files changed, 17 insertions, 17 deletions
diff --git a/drivers/media/video/gspca/mr97310a.c b/drivers/media/video/gspca/mr97310a.c index 442bf1ec5eda..ffb5e6d62c0b 100644 --- a/drivers/media/video/gspca/mr97310a.c +++ b/drivers/media/video/gspca/mr97310a.c | |||
@@ -1034,9 +1034,10 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
1034 | __u8 *data, /* isoc packet */ | 1034 | __u8 *data, /* isoc packet */ |
1035 | int len) /* iso packet length */ | 1035 | int len) /* iso packet length */ |
1036 | { | 1036 | { |
1037 | struct sd *sd = (struct sd *) gspca_dev; | ||
1037 | unsigned char *sof; | 1038 | unsigned char *sof; |
1038 | 1039 | ||
1039 | sof = pac_find_sof(gspca_dev, data, len); | 1040 | sof = pac_find_sof(&sd->sof_read, data, len); |
1040 | if (sof) { | 1041 | if (sof) { |
1041 | int n; | 1042 | int n; |
1042 | 1043 | ||
diff --git a/drivers/media/video/gspca/pac207.c b/drivers/media/video/gspca/pac207.c index 96659433d248..57e13e2d550c 100644 --- a/drivers/media/video/gspca/pac207.c +++ b/drivers/media/video/gspca/pac207.c | |||
@@ -344,7 +344,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
344 | struct sd *sd = (struct sd *) gspca_dev; | 344 | struct sd *sd = (struct sd *) gspca_dev; |
345 | unsigned char *sof; | 345 | unsigned char *sof; |
346 | 346 | ||
347 | sof = pac_find_sof(gspca_dev, data, len); | 347 | sof = pac_find_sof(&sd->sof_read, data, len); |
348 | if (sof) { | 348 | if (sof) { |
349 | int n; | 349 | int n; |
350 | 350 | ||
diff --git a/drivers/media/video/gspca/pac7311.c b/drivers/media/video/gspca/pac7311.c index a3fbd307bb76..329f867612d4 100644 --- a/drivers/media/video/gspca/pac7311.c +++ b/drivers/media/video/gspca/pac7311.c | |||
@@ -838,7 +838,7 @@ static void sd_pkt_scan(struct gspca_dev *gspca_dev, | |||
838 | struct sd *sd = (struct sd *) gspca_dev; | 838 | struct sd *sd = (struct sd *) gspca_dev; |
839 | unsigned char *sof; | 839 | unsigned char *sof; |
840 | 840 | ||
841 | sof = pac_find_sof(gspca_dev, data, len); | 841 | sof = pac_find_sof(&sd->sof_read, data, len); |
842 | if (sof) { | 842 | if (sof) { |
843 | unsigned char tmpbuf[4]; | 843 | unsigned char tmpbuf[4]; |
844 | int n, lum_offset, footer_length; | 844 | int n, lum_offset, footer_length; |
diff --git a/drivers/media/video/gspca/pac_common.h b/drivers/media/video/gspca/pac_common.h index d3006539fb82..20f67d9b8c06 100644 --- a/drivers/media/video/gspca/pac_common.h +++ b/drivers/media/video/gspca/pac_common.h | |||
@@ -72,42 +72,41 @@ static const unsigned char pac_sof_marker[5] = | |||
72 | +----------+ | 72 | +----------+ |
73 | */ | 73 | */ |
74 | 74 | ||
75 | static unsigned char *pac_find_sof(struct gspca_dev *gspca_dev, | 75 | static unsigned char *pac_find_sof(u8 *sof_read, |
76 | unsigned char *m, int len) | 76 | unsigned char *m, int len) |
77 | { | 77 | { |
78 | struct sd *sd = (struct sd *) gspca_dev; | ||
79 | int i; | 78 | int i; |
80 | 79 | ||
81 | /* Search for the SOF marker (fixed part) in the header */ | 80 | /* Search for the SOF marker (fixed part) in the header */ |
82 | for (i = 0; i < len; i++) { | 81 | for (i = 0; i < len; i++) { |
83 | switch (sd->sof_read) { | 82 | switch (*sof_read) { |
84 | case 0: | 83 | case 0: |
85 | if (m[i] == 0xff) | 84 | if (m[i] == 0xff) |
86 | sd->sof_read = 1; | 85 | *sof_read = 1; |
87 | break; | 86 | break; |
88 | case 1: | 87 | case 1: |
89 | if (m[i] == 0xff) | 88 | if (m[i] == 0xff) |
90 | sd->sof_read = 2; | 89 | *sof_read = 2; |
91 | else | 90 | else |
92 | sd->sof_read = 0; | 91 | *sof_read = 0; |
93 | break; | 92 | break; |
94 | case 2: | 93 | case 2: |
95 | switch (m[i]) { | 94 | switch (m[i]) { |
96 | case 0x00: | 95 | case 0x00: |
97 | sd->sof_read = 3; | 96 | *sof_read = 3; |
98 | break; | 97 | break; |
99 | case 0xff: | 98 | case 0xff: |
100 | /* stay in this state */ | 99 | /* stay in this state */ |
101 | break; | 100 | break; |
102 | default: | 101 | default: |
103 | sd->sof_read = 0; | 102 | *sof_read = 0; |
104 | } | 103 | } |
105 | break; | 104 | break; |
106 | case 3: | 105 | case 3: |
107 | if (m[i] == 0xff) | 106 | if (m[i] == 0xff) |
108 | sd->sof_read = 4; | 107 | *sof_read = 4; |
109 | else | 108 | else |
110 | sd->sof_read = 0; | 109 | *sof_read = 0; |
111 | break; | 110 | break; |
112 | case 4: | 111 | case 4: |
113 | switch (m[i]) { | 112 | switch (m[i]) { |
@@ -117,18 +116,18 @@ static unsigned char *pac_find_sof(struct gspca_dev *gspca_dev, | |||
117 | "SOF found, bytes to analyze: %u." | 116 | "SOF found, bytes to analyze: %u." |
118 | " Frame starts at byte #%u", | 117 | " Frame starts at byte #%u", |
119 | len, i + 1); | 118 | len, i + 1); |
120 | sd->sof_read = 0; | 119 | *sof_read = 0; |
121 | return m + i + 1; | 120 | return m + i + 1; |
122 | break; | 121 | break; |
123 | case 0xff: | 122 | case 0xff: |
124 | sd->sof_read = 2; | 123 | *sof_read = 2; |
125 | break; | 124 | break; |
126 | default: | 125 | default: |
127 | sd->sof_read = 0; | 126 | *sof_read = 0; |
128 | } | 127 | } |
129 | break; | 128 | break; |
130 | default: | 129 | default: |
131 | sd->sof_read = 0; | 130 | *sof_read = 0; |
132 | } | 131 | } |
133 | } | 132 | } |
134 | 133 | ||