Commit 1d1cb1eeebf1288703ba0b7f0eca8304220839ef

Authored by Craig McQueen
1 parent 777db9ab

Fix indentation to use tabs, according to Linux kernel coding style.

Showing 1 changed file with 124 additions and 124 deletions
module/tty0tty.c
... ... @@ -84,14 +84,14 @@ static struct tty0tty_serial *tty0tty_table[TINY_TTY_MINORS]; /* initially all N
84 84 static int tty0tty_open(struct tty_struct *tty, struct file *file)
85 85 {
86 86 struct tty0tty_serial *tty0tty;
87   - int index;
  87 + int index;
88 88 int msr=0;
89 89 int mcr=0;
90 90  
91 91 #ifdef SCULL_DEBUG
92 92 printk(KERN_DEBUG "%s - \n", __FUNCTION__);
93 93 #endif
94   - /* initialize the pointer in case something fails */
  94 + /* initialize the pointer in case something fails */
95 95 tty->driver_data = NULL;
96 96  
97 97 /* get the serial object associated with this tty pointer */
... ... @@ -111,34 +111,34 @@ static int tty0tty_open(struct tty_struct *tty, struct file *file)
111 111 tty0tty->open_count = 0;
112 112  
113 113 tty0tty_table[index] = tty0tty;
114   -
115   - }
116   -
117   - if( (index % 2) == 0)
118   - {
119   - if(tty0tty_table[index+1] != NULL)
120   - if (tty0tty_table[index+1]->open_count > 0)
121   - mcr=tty0tty_table[index+1]->mcr;
122   - }
123   - else
124   - {
125   - if(tty0tty_table[index-1] != NULL)
126   - if (tty0tty_table[index-1]->open_count > 0)
127   - mcr=tty0tty_table[index-1]->mcr;
128   - }
129   -
  114 +
  115 + }
  116 +
  117 + if( (index % 2) == 0)
  118 + {
  119 + if(tty0tty_table[index+1] != NULL)
  120 + if (tty0tty_table[index+1]->open_count > 0)
  121 + mcr=tty0tty_table[index+1]->mcr;
  122 + }
  123 + else
  124 + {
  125 + if(tty0tty_table[index-1] != NULL)
  126 + if (tty0tty_table[index-1]->open_count > 0)
  127 + mcr=tty0tty_table[index-1]->mcr;
  128 + }
  129 +
130 130 //null modem connection
131 131  
132   - if( (mcr & MCR_RTS) == MCR_RTS )
133   - {
134   - msr |= MSR_CTS;
135   - }
  132 + if( (mcr & MCR_RTS) == MCR_RTS )
  133 + {
  134 + msr |= MSR_CTS;
  135 + }
136 136  
137   - if( (mcr & MCR_DTR) == MCR_DTR )
138   - {
139   - msr |= MSR_DSR;
140   - msr |= MSR_CD;
141   - }
  137 + if( (mcr & MCR_DTR) == MCR_DTR )
  138 + {
  139 + msr |= MSR_DSR;
  140 + msr |= MSR_CD;
  141 + }
142 142  
143 143 tty0tty->msr = msr;
144 144  
... ... @@ -168,8 +168,8 @@ static void do_close(struct tty0tty_serial *tty0tty)
168 168 --tty0tty->open_count;
169 169 exit:
170 170 up(&tty0tty->sem);
171   -
172   - return;
  171 +
  172 + return;
173 173 }
174 174  
175 175 static void tty0tty_close(struct tty_struct *tty, struct file *file)
... ... @@ -177,7 +177,7 @@ static void tty0tty_close(struct tty_struct *tty, struct file *file)
177 177 struct tty0tty_serial *tty0tty = tty->driver_data;
178 178  
179 179 #ifdef SCULL_DEBUG
180   - printk(KERN_DEBUG "%s - \n", __FUNCTION__);
  180 + printk(KERN_DEBUG "%s - \n", __FUNCTION__);
181 181 #endif
182 182 if (tty0tty)
183 183 do_close(tty0tty);
... ... @@ -189,7 +189,7 @@ static int tty0tty_write(struct tty_struct *tty, const unsigned char *buffer, in
189 189 int retval = -EINVAL;
190 190 struct tty_struct *ttyx = NULL;
191 191  
192   - if (!tty0tty)
  192 + if (!tty0tty)
193 193 return -ENODEV;
194 194  
195 195 down(&tty0tty->sem);
... ... @@ -198,27 +198,27 @@ static int tty0tty_write(struct tty_struct *tty, const unsigned char *buffer, in
198 198 /* port was not opened */
199 199 goto exit;
200 200  
201   - if( (tty0tty->tty->index % 2) == 0)
202   - {
203   - if(tty0tty_table[tty0tty->tty->index+1] != NULL)
204   - if (tty0tty_table[tty0tty->tty->index+1]->open_count > 0)
205   - ttyx=tty0tty_table[tty0tty->tty->index+1]->tty;
206   - }
207   - else
208   - {
209   - if(tty0tty_table[tty0tty->tty->index-1] != NULL)
210   - if (tty0tty_table[tty0tty->tty->index-1]->open_count > 0)
211   - ttyx=tty0tty_table[tty0tty->tty->index-1]->tty;
212   - }
213   -
214   -// tty->low_latency=1;
215   -
216   - if(ttyx != NULL)
217   - {
218   - tty_insert_flip_string(ttyx, buffer, count);
219   - tty_flip_buffer_push(ttyx);
220   - retval=count;
221   - }
  201 + if( (tty0tty->tty->index % 2) == 0)
  202 + {
  203 + if(tty0tty_table[tty0tty->tty->index+1] != NULL)
  204 + if (tty0tty_table[tty0tty->tty->index+1]->open_count > 0)
  205 + ttyx=tty0tty_table[tty0tty->tty->index+1]->tty;
  206 + }
  207 + else
  208 + {
  209 + if(tty0tty_table[tty0tty->tty->index-1] != NULL)
  210 + if (tty0tty_table[tty0tty->tty->index-1]->open_count > 0)
  211 + ttyx=tty0tty_table[tty0tty->tty->index-1]->tty;
  212 + }
  213 +
  214 +// tty->low_latency=1;
  215 +
  216 + if(ttyx != NULL)
  217 + {
  218 + tty_insert_flip_string(ttyx, buffer, count);
  219 + tty_flip_buffer_push(ttyx);
  220 + retval=count;
  221 + }
222 222  
223 223 exit:
224 224 up(&tty0tty->sem);
... ... @@ -255,7 +255,7 @@ static void tty0tty_set_termios(struct tty_struct *tty, struct ktermios *old_ter
255 255 unsigned int cflag;
256 256  
257 257 #ifdef SCULL_DEBUG
258   - printk(KERN_DEBUG "%s - \n", __FUNCTION__);
  258 + printk(KERN_DEBUG "%s - \n", __FUNCTION__);
259 259 #endif
260 260 cflag = tty->termios->c_cflag;
261 261  
... ... @@ -347,96 +347,96 @@ static int tty0tty_tiocmget(struct tty_struct *tty, struct file *file)
347 347 unsigned int mcr = tty0tty->mcr;
348 348  
349 349  
350   - result = ((mcr & MCR_DTR) ? TIOCM_DTR : 0) | /* DTR is set */
351   - ((mcr & MCR_RTS) ? TIOCM_RTS : 0) | /* RTS is set */
352   - ((mcr & MCR_LOOP) ? TIOCM_LOOP : 0) | /* LOOP is set */
353   - ((msr & MSR_CTS) ? TIOCM_CTS : 0) | /* CTS is set */
354   - ((msr & MSR_CD) ? TIOCM_CAR : 0) | /* Carrier detect is set*/
355   - ((msr & MSR_RI) ? TIOCM_RI : 0) | /* Ring Indicator is set */
356   - ((msr & MSR_DSR) ? TIOCM_DSR : 0); /* DSR is set */
  350 + result = ((mcr & MCR_DTR) ? TIOCM_DTR : 0) | /* DTR is set */
  351 + ((mcr & MCR_RTS) ? TIOCM_RTS : 0) | /* RTS is set */
  352 + ((mcr & MCR_LOOP) ? TIOCM_LOOP : 0) | /* LOOP is set */
  353 + ((msr & MSR_CTS) ? TIOCM_CTS : 0) | /* CTS is set */
  354 + ((msr & MSR_CD) ? TIOCM_CAR : 0) | /* Carrier detect is set*/
  355 + ((msr & MSR_RI) ? TIOCM_RI : 0) | /* Ring Indicator is set */
  356 + ((msr & MSR_DSR) ? TIOCM_DSR : 0); /* DSR is set */
357 357  
358 358 return result;
359 359 }
360 360  
361 361 static int tty0tty_tiocmset(struct tty_struct *tty, struct file *file,
362   - unsigned int set, unsigned int clear)
  362 + unsigned int set, unsigned int clear)
363 363 {
364 364 struct tty0tty_serial *tty0tty = tty->driver_data;
365 365 unsigned int mcr = tty0tty->mcr;
366 366 unsigned int msr=0;
367   -
  367 +
368 368 #ifdef SCULL_DEBUG
369   - printk(KERN_DEBUG "%s - \n", __FUNCTION__);
  369 + printk(KERN_DEBUG "%s - \n", __FUNCTION__);
370 370 #endif
371 371  
372   - if( (tty0tty->tty->index % 2) == 0)
373   - {
374   - if(tty0tty_table[tty0tty->tty->index+1] != NULL)
375   - if (tty0tty_table[tty0tty->tty->index+1]->open_count > 0)
376   - msr=tty0tty_table[tty0tty->tty->index+1]->msr;
377   - }
378   - else
379   - {
380   - if(tty0tty_table[tty0tty->tty->index-1] != NULL)
381   - if (tty0tty_table[tty0tty->tty->index-1]->open_count > 0)
382   - msr=tty0tty_table[tty0tty->tty->index-1]->msr;
383   - }
  372 + if( (tty0tty->tty->index % 2) == 0)
  373 + {
  374 + if(tty0tty_table[tty0tty->tty->index+1] != NULL)
  375 + if (tty0tty_table[tty0tty->tty->index+1]->open_count > 0)
  376 + msr=tty0tty_table[tty0tty->tty->index+1]->msr;
  377 + }
  378 + else
  379 + {
  380 + if(tty0tty_table[tty0tty->tty->index-1] != NULL)
  381 + if (tty0tty_table[tty0tty->tty->index-1]->open_count > 0)
  382 + msr=tty0tty_table[tty0tty->tty->index-1]->msr;
  383 + }
384 384  
385 385 //null modem connection
386 386  
387 387 if (set & TIOCM_RTS)
388   - {
389   - mcr |= MCR_RTS;
390   - msr |= MSR_CTS;
391   - }
  388 + {
  389 + mcr |= MCR_RTS;
  390 + msr |= MSR_CTS;
  391 + }
392 392  
393 393 if (set & TIOCM_DTR)
394   - {
395   - mcr |= MCR_DTR;
396   - msr |= MSR_DSR;
397   - msr |= MSR_CD;
398   - }
  394 + {
  395 + mcr |= MCR_DTR;
  396 + msr |= MSR_DSR;
  397 + msr |= MSR_CD;
  398 + }
399 399  
400 400 if (clear & TIOCM_RTS)
401   - {
402   - mcr &= ~MCR_RTS;
403   - msr &= ~MSR_CTS;
404   - }
  401 + {
  402 + mcr &= ~MCR_RTS;
  403 + msr &= ~MSR_CTS;
  404 + }
405 405  
406 406 if (clear & TIOCM_DTR)
407   - {
408   - mcr &= ~MCR_DTR;
409   - msr &= ~MSR_DSR;
410   - msr &= ~MSR_CD;
411   - }
412   -
  407 + {
  408 + mcr &= ~MCR_DTR;
  409 + msr &= ~MSR_DSR;
  410 + msr &= ~MSR_CD;
  411 + }
  412 +
413 413  
414 414 /* set the new MCR value in the device */
415 415 tty0tty->mcr = mcr;
416   -
417   - if( (tty0tty->tty->index % 2) == 0)
418   - {
419   - if(tty0tty_table[tty0tty->tty->index+1] != NULL)
420   - if (tty0tty_table[tty0tty->tty->index+1]->open_count > 0)
421   - tty0tty_table[tty0tty->tty->index+1]->msr=msr;
422   - }
423   - else
424   - {
425   - if(tty0tty_table[tty0tty->tty->index-1] != NULL)
426   - if (tty0tty_table[tty0tty->tty->index-1]->open_count > 0)
427   - tty0tty_table[tty0tty->tty->index-1]->msr=msr;
428   - }
  416 +
  417 + if( (tty0tty->tty->index % 2) == 0)
  418 + {
  419 + if(tty0tty_table[tty0tty->tty->index+1] != NULL)
  420 + if (tty0tty_table[tty0tty->tty->index+1]->open_count > 0)
  421 + tty0tty_table[tty0tty->tty->index+1]->msr=msr;
  422 + }
  423 + else
  424 + {
  425 + if(tty0tty_table[tty0tty->tty->index-1] != NULL)
  426 + if (tty0tty_table[tty0tty->tty->index-1]->open_count > 0)
  427 + tty0tty_table[tty0tty->tty->index-1]->msr=msr;
  428 + }
429 429 return 0;
430 430 }
431 431  
432 432  
433 433 static int tty0tty_ioctl_tiocgserial(struct tty_struct *tty, struct file *file,
434   - unsigned int cmd, unsigned long arg)
  434 + unsigned int cmd, unsigned long arg)
435 435 {
436 436 struct tty0tty_serial *tty0tty = tty->driver_data;
437 437  
438 438 #ifdef SCULL_DEBUG
439   - printk(KERN_DEBUG "%s - \n", __FUNCTION__);
  439 + printk(KERN_DEBUG "%s - \n", __FUNCTION__);
440 440 #endif
441 441 if (cmd == TIOCGSERIAL) {
442 442 struct serial_struct tmp;
... ... @@ -467,12 +467,12 @@ static int tty0tty_ioctl_tiocgserial(struct tty_struct *tty, struct file *file,
467 467 }
468 468  
469 469 static int tty0tty_ioctl_tiocmiwait(struct tty_struct *tty, struct file *file,
470   - unsigned int cmd, unsigned long arg)
  470 + unsigned int cmd, unsigned long arg)
471 471 {
472 472 struct tty0tty_serial *tty0tty = tty->driver_data;
473 473  
474 474 #ifdef SCULL_DEBUG
475   - printk(KERN_DEBUG "%s - \n", __FUNCTION__);
  475 + printk(KERN_DEBUG "%s - \n", __FUNCTION__);
476 476 #endif
477 477 if (cmd == TIOCMIWAIT) {
478 478 DECLARE_WAITQUEUE(wait, current);
... ... @@ -508,12 +508,12 @@ static int tty0tty_ioctl_tiocmiwait(struct tty_struct *tty, struct file *file,
508 508 }
509 509  
510 510 static int tty0tty_ioctl_tiocgicount(struct tty_struct *tty, struct file *file,
511   - unsigned int cmd, unsigned long arg)
  511 + unsigned int cmd, unsigned long arg)
512 512 {
513 513 struct tty0tty_serial *tty0tty = tty->driver_data;
514 514  
515 515 #ifdef SCULL_DEBUG
516   - printk(KERN_DEBUG "%s - \n", __FUNCTION__);
  516 + printk(KERN_DEBUG "%s - \n", __FUNCTION__);
517 517 #endif
518 518 if (cmd == TIOCGICOUNT) {
519 519 struct async_icount cnow = tty0tty->icount;
... ... @@ -539,7 +539,7 @@ static int tty0tty_ioctl_tiocgicount(struct tty_struct *tty, struct file *file,
539 539 }
540 540  
541 541 static int tty0tty_ioctl(struct tty_struct *tty, struct file *file,
542   - unsigned int cmd, unsigned long arg)
  542 + unsigned int cmd, unsigned long arg)
543 543 {
544 544 #ifdef SCULL_DEBUG
545 545 printk(KERN_DEBUG "%s - %04X \n", __FUNCTION__,cmd);
... ... @@ -585,19 +585,19 @@ static int __init tty0tty_init(void)
585 585 tty0tty_tty_driver->owner = THIS_MODULE;
586 586 tty0tty_tty_driver->driver_name = "tty0tty";
587 587 tty0tty_tty_driver->name = "tnt";
588   - /* no more devfs subsystem */
  588 + /* no more devfs subsystem */
589 589 tty0tty_tty_driver->major = TINY_TTY_MAJOR;
590 590 tty0tty_tty_driver->type = TTY_DRIVER_TYPE_SERIAL;
591 591 tty0tty_tty_driver->subtype = SERIAL_TYPE_NORMAL;
592   - tty0tty_tty_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW ;
593   - /* no more devfs subsystem */
  592 + tty0tty_tty_driver->flags = TTY_DRIVER_RESET_TERMIOS | TTY_DRIVER_REAL_RAW ;
  593 + /* no more devfs subsystem */
594 594 tty0tty_tty_driver->init_termios = tty_std_termios;
595   - tty0tty_tty_driver->init_termios.c_iflag = 0;
596   - tty0tty_tty_driver->init_termios.c_oflag = 0;
597   - tty0tty_tty_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
598   - tty0tty_tty_driver->init_termios.c_lflag = 0;
599   - tty0tty_tty_driver->init_termios.c_ispeed = 38400;
600   - tty0tty_tty_driver->init_termios.c_ospeed = 38400;
  595 + tty0tty_tty_driver->init_termios.c_iflag = 0;
  596 + tty0tty_tty_driver->init_termios.c_oflag = 0;
  597 + tty0tty_tty_driver->init_termios.c_cflag = B38400 | CS8 | CREAD;
  598 + tty0tty_tty_driver->init_termios.c_lflag = 0;
  599 + tty0tty_tty_driver->init_termios.c_ispeed = 38400;
  600 + tty0tty_tty_driver->init_termios.c_ospeed = 38400;
601 601  
602 602  
603 603 tty_set_operations(tty0tty_tty_driver, &serial_ops);
... ... @@ -621,7 +621,7 @@ static void __exit tty0tty_exit(void)
621 621 int i;
622 622  
623 623 #ifdef SCULL_DEBUG
624   - printk(KERN_DEBUG "%s - \n", __FUNCTION__);
  624 + printk(KERN_DEBUG "%s - \n", __FUNCTION__);
625 625 #endif
626 626 for (i = 0; i < TINY_TTY_MINORS; ++i)
627 627 tty_unregister_device(tty0tty_tty_driver, i);
... ...