staging/xgifb: Consolidate function almost identical calls in XGINew_GetXG21Sense
authorPeter Huewe <peterhuewe@gmx.de>
Mon, 13 May 2013 21:41:47 +0000 (23:41 +0200)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 16 May 2013 23:02:34 +0000 (16:02 -0700)
Instead of calling xgifb_reg_and_or with almost identical parameters in
a simple if/else scenario, we assign the changing parameter to a temp
variable and call xgifb_reg_and_or only from one location.

-> Easier to read, easier to understand (especially wrt the line breaks)

(For the if condition we don't need the Temp variable, so we can use the
value directly).

Signed-off-by: Peter Huewe <peterhuewe@gmx.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/staging/xgifb/vb_init.c

index ab1706b5e98e6bf6eeba7dbb8d3cf8485f98bf03..ba8796fb66d6fbfb29e7ab11cf6c8ab8f4292e57 100644 (file)
@@ -1115,17 +1115,11 @@ static void XGINew_GetXG21Sense(struct pci_dev *pdev,
                        xgifb_reg_or(pVBInfo->P3d4, 0x32, LCDSense);
                        /* Enable read GPIOF */
                        xgifb_reg_and_or(pVBInfo->P3d4, 0x4A, ~0x20, 0x20);
-                       Temp = xgifb_reg_get(pVBInfo->P3d4, 0x48) & 0x04;
-                       if (!Temp)
-                               xgifb_reg_and_or(pVBInfo->P3d4,
-                                                0x38,
-                                                ~0xE0,
-                                                0x80); /* TMDS on chip */
+                       if (xgifb_reg_get(pVBInfo->P3d4, 0x48) & 0x04)
+                               Temp = 0xA0; /* Only DVO on chip */
                        else
-                               xgifb_reg_and_or(pVBInfo->P3d4,
-                                                0x38,
-                                                ~0xE0,
-                                                0xA0); /* Only DVO on chip */
+                               Temp = 0x80; /* TMDS on chip */
+                       xgifb_reg_and_or(pVBInfo->P3d4, 0x38, ~0xE0, Temp);
                        /* Disable read GPIOF */
                        xgifb_reg_and(pVBInfo->P3d4, 0x4A, ~0x20);
                }