Staging: wlags49_h2: Hoist assign from if
authorJoe Perches <joe@perches.com>
Thu, 25 Mar 2010 05:17:07 +0000 (22:17 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Tue, 11 May 2010 18:35:45 +0000 (11:35 -0700)
Signed-off-by: Joe Perches <joe@perches.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
drivers/staging/wlags49_h2/hcf.c
drivers/staging/wlags49_h2/wl_main.c
drivers/staging/wlags49_h2/wl_netdev.c
drivers/staging/wlags49_h2/wl_priv.c
drivers/staging/wlags49_h2/wl_sysfs.c

index 6e39f50..390628c 100644 (file)
@@ -990,7 +990,8 @@ int rc = HCF_ERR_INCOMP_FW;
                        ifbp->IFB_CntlOpt |= DMA_ENABLED;
                        HCFASSERT( NT_ASSERT, NEVER_TESTED )
                        // make the entire rx descriptor chain DMA-owned, so the DMA engine can (re-)use it.
-                       if ( ( p = ifbp->IFB_FirstDesc[DMA_RX] ) != NULL ) {   //;? Think this over again in the light of the new chaining strategy
+                       p = ifbp->IFB_FirstDesc[DMA_RX];
+                       if (p != NULL) {   //;? Think this over again in the light of the new chaining strategy
                                if ( 1 )        { //begin alternative
                                        HCFASSERT( NT_ASSERT, NEVER_TESTED )
                                        put_frame_lst( ifbp, ifbp->IFB_FirstDesc[DMA_RX], DMA_RX );
@@ -2087,7 +2088,8 @@ wci_bufp  pt;                                     //pointer with the "right" type, just to help ease writing macr
                        OPW( HREG_AUX_OFFSET, (hcf_16)(PLUG_DATA_OFFSET & 0x7E) );
                        io_port = ifbp->IFB_IOBase + HREG_AUX_DATA;             //to prevent side effects of the MSF-defined macro
                        p = ltvp->val;                                  //destination char pointer (in LTV record)
-                       if ( ( i = len - 1 ) > 0 ) {
+                       i = len - 1;
+                       if (i > 0 ) {
                                pt = (wci_bufp)p;       //just to help ease writing macros with embedded assembly
                                IN_PORT_STRING_8_16( io_port, pt, i ); //space used by T: -1
                        }
@@ -2674,7 +2676,8 @@ hcf_16            fid = 0;
 
 #if (HCF_EXT) & HCF_EXT_TX_CONT                                // Continuous transmit test
        if ( tx_cntl == HFS_TX_CNTL_TX_CONT ) {
-               if ( ( fid = get_fid( ifbp ) ) != 0 ) {
+               fid = get_fid(ifbp);
+               if (fid != 0 ) {
                                                                                        //setup BAP to begin of TxFS
                        (void)setup_bap( ifbp, fid, 0, IO_OUT );
                                                                                        //copy all the fragments in a transparent fashion
@@ -2700,7 +2703,8 @@ hcf_16            fid = 0;
 #if (HCF_TYPE) & HCF_TYPE_WPA
        tx_cntl |= ifbp->IFB_MICTxCntl;
 #endif // HCF_TYPE_WPA
-       if ( (fid = ifbp->IFB_TxFID) == 0 && ( fid = get_fid( ifbp ) ) != 0 )           /* 4 */
+       fid = ifbp->IFB_TxFID;
+       if (fid == 0 && ( fid = get_fid( ifbp ) ) != 0 )                /* 4 */
                        /* skip the next compound statement if:
                           - pre-put message or
                           - no fid available (which should never occur if the MSF adheres to the WCI)
@@ -4860,7 +4864,8 @@ PROT_CNT_INI
 int    rc;
 
        HCFTRACE( ifbp, HCF_TRACE_STRIO );
-       if ( ( rc = ifbp->IFB_DefunctStat ) == HCF_SUCCESS ) {                                                                          /*2*/
+       rc = ifbp->IFB_DefunctStat;
+       if (rc == HCF_SUCCESS) {                                                                                /*2*/
                OPW( HREG_SELECT_1, fid );                                                                                                                              /*4*/
                OPW( HREG_OFFSET_1, offset );
                if ( type == IO_IN ) {
index cf0c384..88d0d47 100644 (file)
@@ -3591,7 +3591,8 @@ int scull_read_procmem(char *buf, char **start, off_t offset, int len, int *eof,
 
     len=0;
 
-       if ( ( lp = ((struct net_device *)data)->priv ) == NULL ) {
+       lp = ((struct net_device *)data)->priv;
+       if (lp == NULL) {
         len += sprintf(buf+len,"No wl_private in scull_read_procmem\n" );
        } else if ( lp->wlags49_type == 0 ){
            ifbp = &lp->hcfCtx;
index 1db73eb..1cfaee3 100644 (file)
@@ -930,8 +930,10 @@ int wl_rx(struct net_device *dev)
         port = ( hfs_stat >> 8 ) & 0x0007;
         DBG_RX( DbgInfo, "Rx frame for port %d\n", port );
 
-        if(( pktlen = lp->hcfCtx.IFB_RxLen ) != 0 ) {
-            if(( skb = ALLOC_SKB( pktlen )) != NULL ) {
+        pktlen = lp->hcfCtx.IFB_RxLen;
+        if (pktlen != 0) {
+            skb = ALLOC_SKB(pktlen);
+            if (skb != NULL) {
                 /* Set the netdev based on the port */
                 switch( port ) {
 #ifdef USE_WDS
@@ -1995,8 +1997,10 @@ int wl_rx_dma( struct net_device *dev )
                 port = ( hfs_stat >> 8 ) & 0x0007;
                 DBG_RX( DbgInfo, "Rx frame for port %d\n", port );
 
-                if(( pktlen = GET_BUF_CNT( desc_next )) != 0 ) {
-                    if(( skb = ALLOC_SKB( pktlen )) != NULL ) {
+                pktlen = GET_BUF_CNT(desc_next);
+                if (pktlen != 0) {
+                    skb = ALLOC_SKB(pktlen);
+                    if (skb != NULL) {
                         switch( port ) {
 #ifdef USE_WDS
                         case 1:
index 727ea8a..a67ff52 100644 (file)
@@ -503,7 +503,8 @@ int wvlan_uil_send_diag_msg( struct uilreq *urq, struct wl_private *lp )
                                                return result;
                                        }
 
-                                       if ((data = kmalloc(urq->len, GFP_KERNEL)) != NULL) {
+                                       data = kmalloc(urq->len, GFP_KERNEL);
+                                       if (data != NULL) {
                                                memset( Descp, 0, sizeof( DESC_STRCT ));
                                                memcpy( data, urq->data, urq->len );
 
@@ -617,7 +618,8 @@ int wvlan_uil_put_info( struct uilreq *urq, struct wl_private *lp )
                                   LTV record, try to allocate it from the kernel stack.
                                   Otherwise, we just use our local LTV record. */
                                if( urq->len > sizeof( lp->ltvRecord )) {
-                                       if(( pLtv = (ltv_t *)kmalloc( urq->len, GFP_KERNEL )) != NULL ) {
+                                       pLtv = (ltv_t *)kmalloc( urq->len, GFP_KERNEL );
+                                       if (pLtv != NULL) {
                                                ltvAllocated = TRUE;
                                        } else {
                                                DBG_ERROR( DbgInfo, "Alloc FAILED\n" );
@@ -1296,7 +1298,8 @@ int wvlan_uil_get_info( struct uilreq *urq, struct wl_private *lp )
                                   LTV record, try to allocate it from the kernel stack.
                                   Otherwise, we just use our local LTV record. */
                                if( urq->len > sizeof( lp->ltvRecord )) {
-                                       if(( pLtv = (ltv_t *)kmalloc( urq->len, GFP_KERNEL )) != NULL ) {
+                                       pLtv = (ltv_t *)kmalloc( urq->len, GFP_KERNEL );
+                                       if (pLtv != NULL) {
                                                ltvAllocated = TRUE;
 
                                                /* Copy the command/length information into the new buffer. */
index 864e01a..e4c8804 100644 (file)
@@ -46,7 +46,8 @@ static ssize_t show_tallies(struct device *d, struct device_attribute *attr,
     if (dev_isalive(dev)) {
        wl_lock(lp, &flags);
 
-       if ((ret = wl_get_tallies(lp, &tallies)) == 0) {
+       ret = wl_get_tallies(lp, &tallies);
+       if (ret == 0) {
                wl_unlock(lp, &flags);
                ret = snprintf(buf, PAGE_SIZE,
                    "TxUnicastFrames:           %u\n"