aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/easycap
diff options
context:
space:
mode:
authorTomas Winkler <tomas.winkler@intel.com>2011-03-30 06:15:30 -0400
committerGreg Kroah-Hartman <gregkh@suse.de>2011-04-20 16:48:25 -0400
commitfd1b821c31f8a4588cc874721e3d17a47b460380 (patch)
tree4281dd227207bbde7f9c78bd464cd00546a45af8 /drivers/staging/easycap
parent19cb28483a164595405a18758d1a66e189355402 (diff)
staging/easycap: revamp reset function
fix indentation and drop success statements printouts that just causes code be less readable Signed-off-by: Tomas Winkler <tomas.winkler@intel.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/easycap')
-rw-r--r--drivers/staging/easycap/easycap_main.c59
1 files changed, 24 insertions, 35 deletions
diff --git a/drivers/staging/easycap/easycap_main.c b/drivers/staging/easycap/easycap_main.c
index cee3252ea2d..06df88b6cd5 100644
--- a/drivers/staging/easycap/easycap_main.c
+++ b/drivers/staging/easycap/easycap_main.c
@@ -201,9 +201,9 @@ static int easycap_open(struct inode *inode, struct file *file)
201static int reset(struct easycap *peasycap) 201static int reset(struct easycap *peasycap)
202{ 202{
203 struct easycap_standard const *peasycap_standard; 203 struct easycap_standard const *peasycap_standard;
204 int i, rc, input, rate; 204 int fmtidx, input, rate;
205 bool ntsc, other; 205 bool ntsc, other;
206 int fmtidx; 206 int rc;
207 207
208 if (!peasycap) { 208 if (!peasycap) {
209 SAY("ERROR: peasycap is NULL\n"); 209 SAY("ERROR: peasycap is NULL\n");
@@ -226,33 +226,27 @@ static int reset(struct easycap *peasycap)
226 JOM(8, "peasycap->ntsc=%d\n", peasycap->ntsc); 226 JOM(8, "peasycap->ntsc=%d\n", peasycap->ntsc);
227 227
228 rate = ready_saa(peasycap->pusb_device); 228 rate = ready_saa(peasycap->pusb_device);
229 if (0 > rate) { 229 if (rate < 0) {
230 JOM(8, "not ready to capture after %i ms ...\n", PATIENCE); 230 JOM(8, "not ready to capture after %i ms ...\n", PATIENCE);
231 if (peasycap->ntsc) { 231 ntsc = !peasycap->ntsc;
232 JOM(8, "... trying PAL ...\n"); ntsc = false; 232 JOM(8, "... trying %s ..\n", ntsc ? "NTSC" : "PAL");
233 } else { 233 rc = setup_stk(peasycap->pusb_device, ntsc);
234 JOM(8, "... trying NTSC ...\n"); ntsc = true; 234 if (rc) {
235 } 235 SAM("ERROR: setup_stk() rc = %i\n", rc);
236 rc = setup_stk(peasycap->pusb_device, ntsc); 236 return -EFAULT;
237 if (0 == rc) 237 }
238 JOM(4, "setup_stk() OK\n"); 238 rc = setup_saa(peasycap->pusb_device, ntsc);
239 else { 239 if (rc) {
240 SAM("ERROR: setup_stk() rc = %i\n", rc); 240 SAM("ERROR: setup_saa() rc = %i\n", rc);
241 return -EFAULT; 241 return -EFAULT;
242 } 242 }
243 rc = setup_saa(peasycap->pusb_device, ntsc); 243
244 if (0 == rc) 244 rate = ready_saa(peasycap->pusb_device);
245 JOM(4, "setup_saa() OK\n"); 245 if (rate < 0) {
246 else { 246 JOM(8, "not ready to capture after %i ms\n", PATIENCE);
247 SAM("ERROR: setup_saa() rc = %i\n", rc); 247 JOM(8, "... saa register 0x1F has 0x%02X\n",
248 return -EFAULT;
249 }
250 rate = ready_saa(peasycap->pusb_device);
251 if (0 > rate) {
252 JOM(8, "not ready to capture after %i ms ...\n", PATIENCE);
253 JOM(8, "... saa register 0x1F has 0x%02X\n",
254 read_saa(peasycap->pusb_device, 0x1F)); 248 read_saa(peasycap->pusb_device, 0x1F));
255 ntsc = peasycap->ntsc; 249 ntsc = peasycap->ntsc;
256 } else { 250 } else {
257 JOM(8, "... success at second try: %i=rate\n", rate); 251 JOM(8, "... success at second try: %i=rate\n", rate);
258 ntsc = (0 < (rate/2)) ? true : false ; 252 ntsc = (0 < (rate/2)) ? true : false ;
@@ -266,22 +260,17 @@ static int reset(struct easycap *peasycap)
266/*---------------------------------------------------------------------------*/ 260/*---------------------------------------------------------------------------*/
267 261
268 rc = setup_stk(peasycap->pusb_device, ntsc); 262 rc = setup_stk(peasycap->pusb_device, ntsc);
269 if (0 == rc) 263 if (rc) {
270 JOM(4, "setup_stk() OK\n");
271 else {
272 SAM("ERROR: setup_stk() rc = %i\n", rc); 264 SAM("ERROR: setup_stk() rc = %i\n", rc);
273 return -EFAULT; 265 return -EFAULT;
274 } 266 }
275 rc = setup_saa(peasycap->pusb_device, ntsc); 267 rc = setup_saa(peasycap->pusb_device, ntsc);
276 if (0 == rc) 268 if (rc) {
277 JOM(4, "setup_saa() OK\n");
278 else {
279 SAM("ERROR: setup_saa() rc = %i\n", rc); 269 SAM("ERROR: setup_saa() rc = %i\n", rc);
280 return -EFAULT; 270 return -EFAULT;
281 } 271 }
282 272
283 for (i = 0; i < 180; i++) 273 memset(peasycap->merit, 0, sizeof(peasycap->merit));
284 peasycap->merit[i] = 0;
285 274
286 peasycap->video_eof = 0; 275 peasycap->video_eof = 0;
287 peasycap->audio_eof = 0; 276 peasycap->audio_eof = 0;