hc
2024-05-10 748e4f3d702def1a4bff191e0cf93b6a05340f01
kernel/drivers/net/wan/sbni.c
....@@ -260,11 +260,12 @@
260260 return sbni_isa_probe( dev );
261261 /* otherwise we have to perform search our adapter */
262262
263
- if( io[ num ] != -1 )
264
- dev->base_addr = io[ num ],
263
+ if( io[ num ] != -1 ) {
264
+ dev->base_addr = io[ num ];
265265 dev->irq = irq[ num ];
266
- else if( scandone || io[ 0 ] != -1 )
266
+ } else if( scandone || io[ 0 ] != -1 ) {
267267 return -ENODEV;
268
+ }
268269
269270 /* if io[ num ] contains non-zero address, then that is on ISA bus */
270271 if( dev->base_addr )
....@@ -399,12 +400,13 @@
399400 nl->maxframe = DEFAULT_FRAME_LEN;
400401 nl->csr1.rate = baud[ num ];
401402
402
- if( (nl->cur_rxl_index = rxl[ num ]) == -1 )
403
+ if( (nl->cur_rxl_index = rxl[ num ]) == -1 ) {
403404 /* autotune rxl */
404
- nl->cur_rxl_index = DEF_RXL,
405
+ nl->cur_rxl_index = DEF_RXL;
405406 nl->delta_rxl = DEF_RXL_DELTA;
406
- else
407
+ } else {
407408 nl->delta_rxl = 0;
409
+ }
408410 nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index ];
409411 if( inb( ioaddr + CSR0 ) & 0x01 )
410412 nl->state |= FL_SLOW_MODE;
....@@ -512,13 +514,15 @@
512514
513515 do {
514516 repeat = 0;
515
- if( inb( dev->base_addr + CSR0 ) & (RC_RDY | TR_RDY) )
516
- handle_channel( dev ),
517
+ if( inb( dev->base_addr + CSR0 ) & (RC_RDY | TR_RDY) ) {
518
+ handle_channel( dev );
517519 repeat = 1;
520
+ }
518521 if( nl->second && /* second channel present */
519
- (inb( nl->second->base_addr+CSR0 ) & (RC_RDY | TR_RDY)) )
520
- handle_channel( nl->second ),
522
+ (inb( nl->second->base_addr+CSR0 ) & (RC_RDY | TR_RDY)) ) {
523
+ handle_channel( nl->second );
521524 repeat = 1;
525
+ }
522526 } while( repeat );
523527
524528 if( nl->second )
....@@ -610,11 +614,12 @@
610614 nl->state |= FL_PREV_OK;
611615 if( framelen > 4 )
612616 nl->in_stats.all_rx_number++;
613
- } else
614
- nl->state &= ~FL_PREV_OK,
615
- change_level( dev ),
616
- nl->in_stats.all_rx_number++,
617
+ } else {
618
+ nl->state &= ~FL_PREV_OK;
619
+ change_level( dev );
620
+ nl->in_stats.all_rx_number++;
617621 nl->in_stats.bad_rx_number++;
622
+ }
618623
619624 return !frame_ok || framelen > 4;
620625 }
....@@ -689,9 +694,10 @@
689694 *crc_p = calc_crc32( *crc_p, skb->data + nl->outpos, len );
690695
691696 /* if packet too short we should write some more bytes to pad */
692
- for( len = nl->framelen - len; len--; )
693
- outb( 0, dev->base_addr + DAT ),
697
+ for( len = nl->framelen - len; len--; ) {
698
+ outb( 0, dev->base_addr + DAT );
694699 *crc_p = CRC32( 0, *crc_p );
700
+ }
695701 }
696702
697703
....@@ -703,9 +709,10 @@
703709
704710 int frame_ok;
705711
706
- if( is_first )
707
- nl->wait_frameno = frameno,
712
+ if( is_first ) {
713
+ nl->wait_frameno = frameno;
708714 nl->inppos = 0;
715
+ }
709716
710717 if( nl->wait_frameno == frameno ) {
711718
....@@ -717,33 +724,35 @@
717724 * error was occurred... drop entire packet
718725 */
719726 else if( (frame_ok = skip_tail( dev->base_addr, framelen, crc ))
720
- != 0 )
721
- nl->wait_frameno = 0,
722
- nl->inppos = 0,
727
+ != 0 ) {
728
+ nl->wait_frameno = 0;
729
+ nl->inppos = 0;
723730 #ifdef CONFIG_SBNI_MULTILINE
724
- nl->master->stats.rx_errors++,
731
+ nl->master->stats.rx_errors++;
725732 nl->master->stats.rx_missed_errors++;
726733 #else
727
- dev->stats.rx_errors++,
734
+ dev->stats.rx_errors++;
728735 dev->stats.rx_missed_errors++;
729736 #endif
737
+ }
730738 /* now skip all frames until is_first != 0 */
731739 } else
732740 frame_ok = skip_tail( dev->base_addr, framelen, crc );
733741
734
- if( is_first && !frame_ok )
742
+ if( is_first && !frame_ok ) {
735743 /*
736744 * Frame has been broken, but we had already stored
737745 * is_first... Drop entire packet.
738746 */
739
- nl->wait_frameno = 0,
747
+ nl->wait_frameno = 0;
740748 #ifdef CONFIG_SBNI_MULTILINE
741
- nl->master->stats.rx_errors++,
749
+ nl->master->stats.rx_errors++;
742750 nl->master->stats.rx_crc_errors++;
743751 #else
744
- dev->stats.rx_errors++,
752
+ dev->stats.rx_errors++;
745753 dev->stats.rx_crc_errors++;
746754 #endif
755
+ }
747756
748757 return frame_ok;
749758 }
....@@ -761,7 +770,7 @@
761770 dev->stats.tx_packets++;
762771 dev->stats.tx_bytes += nl->tx_buf_p->len;
763772 #endif
764
- dev_kfree_skb_irq( nl->tx_buf_p );
773
+ dev_consume_skb_irq(nl->tx_buf_p);
765774
766775 nl->tx_buf_p = NULL;
767776
....@@ -782,17 +791,18 @@
782791 if( nl->state & FL_WAIT_ACK ) {
783792 nl->outpos += nl->framelen;
784793
785
- if( --nl->tx_frameno )
794
+ if( --nl->tx_frameno ) {
786795 nl->framelen = min_t(unsigned int,
787796 nl->maxframe,
788797 nl->tx_buf_p->len - nl->outpos);
789
- else
790
- send_complete( dev ),
798
+ } else {
799
+ send_complete( dev );
791800 #ifdef CONFIG_SBNI_MULTILINE
792801 netif_wake_queue( nl->master );
793802 #else
794803 netif_wake_queue( dev );
795804 #endif
805
+ }
796806 }
797807 }
798808
....@@ -872,16 +882,17 @@
872882 {
873883 struct net_local *nl = netdev_priv(dev);
874884
875
- if( nl->tx_buf_p )
876
- dev_kfree_skb_any( nl->tx_buf_p ),
877
- nl->tx_buf_p = NULL,
885
+ if( nl->tx_buf_p ) {
886
+ dev_kfree_skb_any( nl->tx_buf_p );
887
+ nl->tx_buf_p = NULL;
878888 #ifdef CONFIG_SBNI_MULTILINE
879
- nl->master->stats.tx_errors++,
889
+ nl->master->stats.tx_errors++;
880890 nl->master->stats.tx_carrier_errors++;
881891 #else
882
- dev->stats.tx_errors++,
892
+ dev->stats.tx_errors++;
883893 dev->stats.tx_carrier_errors++;
884894 #endif
895
+ }
885896
886897 nl->tx_frameno = 0;
887898 nl->framelen = 0;
....@@ -1327,12 +1338,13 @@
13271338
13281339 spin_lock( &nl->lock );
13291340 flags = *(struct sbni_flags*) &ifr->ifr_ifru;
1330
- if( flags.fixed_rxl )
1331
- nl->delta_rxl = 0,
1341
+ if( flags.fixed_rxl ) {
1342
+ nl->delta_rxl = 0;
13321343 nl->cur_rxl_index = flags.rxl;
1333
- else
1334
- nl->delta_rxl = DEF_RXL_DELTA,
1344
+ } else {
1345
+ nl->delta_rxl = DEF_RXL_DELTA;
13351346 nl->cur_rxl_index = DEF_RXL;
1347
+ }
13361348
13371349 nl->csr1.rxl = rxl_tab[ nl->cur_rxl_index ];
13381350 nl->csr1.rate = flags.rate;
....@@ -1526,13 +1538,16 @@
15261538 (*dest[ parm ])[ n ] = simple_strtol( p, &p, 0 );
15271539 if( !*p || *p == ')' )
15281540 return 1;
1529
- if( *p == ';' )
1530
- ++p, ++n, parm = 0;
1531
- else if( *p++ != ',' )
1541
+ if( *p == ';' ) {
1542
+ ++p;
1543
+ ++n;
1544
+ parm = 0;
1545
+ } else if( *p++ != ',' ) {
15321546 break;
1533
- else
1547
+ } else {
15341548 if( ++parm >= 5 )
15351549 break;
1550
+ }
15361551 }
15371552 bad_param:
15381553 pr_err("Error in sbni kernel parameter!\n");