staging: sb105x: clean up interface type test
authorDan Carpenter <dan.carpenter@oracle.com>
Wed, 9 Jan 2013 07:12:14 +0000 (10:12 +0300)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Fri, 18 Jan 2013 00:43:20 +0000 (16:43 -0800)
IIR_RS232 is zero so "if (IIR_RS232 == (b_ret & IIR_RS232))" is always
true so RS232 was always chosen by default.  The test should be
"if (0 == (b_ret & 0x30)) { ".  The other tests should also be in that
format.

This does change how the code works...  If 0x30 is set then it now
defaults to RS232 instead of RS485.

Signed-off-by: Dan Carpenter <dan.carpenter@oracle.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/sb105x/sb_mp_register.h
drivers/staging/sb105x/sb_pci_mp.c

index 5480ae11368f822c38c637929c6de5b61a83afea..a2087f5b0d1abdfbd03186f899556d50eda61528 100644 (file)
@@ -45,7 +45,7 @@
 #define IIR_RS232              0x00            /* RS232 type */
 #define IIR_RS422              0x10            /* RS422 type */
 #define IIR_RS485              0x20            /* RS485 type */
-#define IIR_UNKNOWN            0x30            /* unknown type */
+#define IIR_TYPE_MASK          0x30
 
 /* Interrrupt Mask Register */
 #define MP_OPTR_IMR0           0x0C    /* port0 ~ port8 */
index c34ebff6bb043f4e032a90091956fa2cd64a7960..3da44dff24bfbea43943d8498c2df6bff5f06e33 100644 (file)
@@ -2851,18 +2851,12 @@ static void __init multi_init_ports(void)
                                printk("IIR_RET = %x\n",b_ret);
                        }
 
-                       if(IIR_RS232 == (b_ret & IIR_RS232))
-                       {
-                               mtpt->interface = RS232;
-                       }
-                       if(IIR_RS422 == (b_ret & IIR_RS422))
-                       {
+                       /* default to RS232 */
+                       mtpt->interface = RS232;
+                       if (IIR_RS422 == (b_ret & IIR_TYPE_MASK))
                                mtpt->interface = RS422PTP;
-                       }
-                       if(IIR_RS485 == (b_ret & IIR_RS485))
-                       {
+                       if (IIR_RS485 == (b_ret & IIR_TYPE_MASK))
                                mtpt->interface = RS485NE;
-                       }
                }
        }
 }