Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Tomas Winkler and committed by
Greg Kroah-Hartman
fd1b821c 19cb2848

+24 -35
+24 -35
drivers/staging/easycap/easycap_main.c
··· 201 201 static int reset(struct easycap *peasycap) 202 202 { 203 203 struct easycap_standard const *peasycap_standard; 204 - int i, rc, input, rate; 204 + int fmtidx, input, rate; 205 205 bool ntsc, other; 206 - int fmtidx; 206 + int rc; 207 207 208 208 if (!peasycap) { 209 209 SAY("ERROR: peasycap is NULL\n"); ··· 226 226 JOM(8, "peasycap->ntsc=%d\n", peasycap->ntsc); 227 227 228 228 rate = ready_saa(peasycap->pusb_device); 229 - if (0 > rate) { 229 + if (rate < 0) { 230 230 JOM(8, "not ready to capture after %i ms ...\n", PATIENCE); 231 - if (peasycap->ntsc) { 232 - JOM(8, "... trying PAL ...\n"); ntsc = false; 233 - } else { 234 - JOM(8, "... trying NTSC ...\n"); ntsc = true; 235 - } 236 - rc = setup_stk(peasycap->pusb_device, ntsc); 237 - if (0 == rc) 238 - JOM(4, "setup_stk() OK\n"); 239 - else { 240 - SAM("ERROR: setup_stk() rc = %i\n", rc); 241 - return -EFAULT; 242 - } 243 - rc = setup_saa(peasycap->pusb_device, ntsc); 244 - if (0 == rc) 245 - JOM(4, "setup_saa() OK\n"); 246 - else { 247 - SAM("ERROR: setup_saa() rc = %i\n", rc); 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", 231 + ntsc = !peasycap->ntsc; 232 + JOM(8, "... trying %s ..\n", ntsc ? "NTSC" : "PAL"); 233 + rc = setup_stk(peasycap->pusb_device, ntsc); 234 + if (rc) { 235 + SAM("ERROR: setup_stk() rc = %i\n", rc); 236 + return -EFAULT; 237 + } 238 + rc = setup_saa(peasycap->pusb_device, ntsc); 239 + if (rc) { 240 + SAM("ERROR: setup_saa() rc = %i\n", rc); 241 + return -EFAULT; 242 + } 243 + 244 + rate = ready_saa(peasycap->pusb_device); 245 + if (rate < 0) { 246 + JOM(8, "not ready to capture after %i ms\n", PATIENCE); 247 + JOM(8, "... saa register 0x1F has 0x%02X\n", 254 248 read_saa(peasycap->pusb_device, 0x1F)); 255 - ntsc = peasycap->ntsc; 249 + ntsc = peasycap->ntsc; 256 250 } else { 257 251 JOM(8, "... success at second try: %i=rate\n", rate); 258 252 ntsc = (0 < (rate/2)) ? true : false ; ··· 260 266 /*---------------------------------------------------------------------------*/ 261 267 262 268 rc = setup_stk(peasycap->pusb_device, ntsc); 263 - if (0 == rc) 264 - JOM(4, "setup_stk() OK\n"); 265 - else { 269 + if (rc) { 266 270 SAM("ERROR: setup_stk() rc = %i\n", rc); 267 271 return -EFAULT; 268 272 } 269 273 rc = setup_saa(peasycap->pusb_device, ntsc); 270 - if (0 == rc) 271 - JOM(4, "setup_saa() OK\n"); 272 - else { 274 + if (rc) { 273 275 SAM("ERROR: setup_saa() rc = %i\n", rc); 274 276 return -EFAULT; 275 277 } 276 278 277 - for (i = 0; i < 180; i++) 278 - peasycap->merit[i] = 0; 279 + memset(peasycap->merit, 0, sizeof(peasycap->merit)); 279 280 280 281 peasycap->video_eof = 0; 281 282 peasycap->audio_eof = 0;