EDAC, sb_edac: Bump driver version and do some cleanups
authorQiuxu Zhuo <qiuxu.zhuo@intel.com>
Tue, 23 May 2017 00:09:34 +0000 (08:09 +0800)
committerBorislav Petkov <bp@suse.de>
Thu, 25 May 2017 13:00:36 +0000 (15:00 +0200)
Collapse 'case:' in *_mci_bind_devs() and update driver version from
1.1.1 to 1.1.2.

Signed-off-by: Qiuxu Zhuo <qiuxu.zhuo@intel.com>
Cc: linux-edac <linux-edac@vger.kernel.org>
Link: http://lkml.kernel.org/r/20170523000934.87971-1-qiuxu.zhuo@intel.com
Signed-off-by: Borislav Petkov <bp@suse.de>
drivers/edac/sb_edac.c

index 30eb910..89fd6bd 100644 (file)
@@ -35,7 +35,7 @@ static LIST_HEAD(sbridge_edac_list);
 /*
  * Alter this version for the module when modifications are made
  */
-#define SBRIDGE_REVISION    " Ver: 1.1.1 "
+#define SBRIDGE_REVISION    " Ver: 1.1.2 "
 #define EDAC_MOD_STR      "sbridge_edac"
 
 /*
@@ -2353,6 +2353,13 @@ static int sbridge_get_all_devices(u8 *num_mc,
        return 0;
 }
 
+/*
+ * Device IDs for {SBRIDGE,IBRIDGE,HASWELL,BROADWELL}_IMC_HA0_TAD0 are in
+ * the format: XXXa. So we can convert from a device to the corresponding
+ * channel like this
+ */
+#define TAD_DEV_TO_CHAN(dev) (((dev) & 0xf) - 0xa)
+
 static int sbridge_mci_bind_devs(struct mem_ctl_info *mci,
                                 struct sbridge_dev *sbridge_dev)
 {
@@ -2390,7 +2397,7 @@ static int sbridge_mci_bind_devs(struct mem_ctl_info *mci,
                case PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD2:
                case PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD3:
                {
-                       int id = pdev->device - PCI_DEVICE_ID_INTEL_SBRIDGE_IMC_TAD0;
+                       int id = TAD_DEV_TO_CHAN(pdev->device);
                        pvt->pci_tad[id] = pdev;
                        saw_chan_mask |= 1 << id;
                }
@@ -2442,6 +2449,7 @@ static int ibridge_mci_bind_devs(struct mem_ctl_info *mci,
 
                switch (pdev->device) {
                case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0:
+               case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1:
                        pvt->pci_ha = pdev;
                        break;
                case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_TA:
@@ -2455,8 +2463,12 @@ static int ibridge_mci_bind_devs(struct mem_ctl_info *mci,
                case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_TAD1:
                case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_TAD2:
                case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_TAD3:
+               case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_TAD0:
+               case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_TAD1:
+               case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_TAD2:
+               case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_TAD3:
                {
-                       int id = pdev->device - PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA0_TAD0;
+                       int id = TAD_DEV_TO_CHAN(pdev->device);
                        pvt->pci_tad[id] = pdev;
                        saw_chan_mask |= 1 << id;
                }
@@ -2476,19 +2488,6 @@ static int ibridge_mci_bind_devs(struct mem_ctl_info *mci,
                case PCI_DEVICE_ID_INTEL_IBRIDGE_BR1:
                        pvt->pci_br1 = pdev;
                        break;
-               case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1:
-                       pvt->pci_ha = pdev;
-                       break;
-               case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_TAD0:
-               case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_TAD1:
-               case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_TAD2:
-               case PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_TAD3:
-               {
-                       int id = pdev->device - PCI_DEVICE_ID_INTEL_IBRIDGE_IMC_HA1_TAD0;
-                       pvt->pci_tad[id] = pdev;
-                       saw_chan_mask |= 1 << id;
-               }
-                       break;
                default:
                        goto error;
                }
@@ -2548,9 +2547,11 @@ static int haswell_mci_bind_devs(struct mem_ctl_info *mci,
                        pvt->pci_sad1 = pdev;
                        break;
                case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA0:
+               case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA1:
                        pvt->pci_ha = pdev;
                        break;
                case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA0_TA:
+               case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA1_TA:
                        pvt->pci_ta = pdev;
                        break;
                case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA0_TM:
@@ -2561,20 +2562,12 @@ static int haswell_mci_bind_devs(struct mem_ctl_info *mci,
                case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA0_TAD1:
                case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA0_TAD2:
                case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA0_TAD3:
-               {
-                       int id = pdev->device - PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA0_TAD0;
-
-                       pvt->pci_tad[id] = pdev;
-                       saw_chan_mask |= 1 << id;
-               }
-                       break;
                case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA1_TAD0:
                case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA1_TAD1:
                case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA1_TAD2:
                case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA1_TAD3:
                {
-                       int id = pdev->device - PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA1_TAD0;
-
+                       int id = TAD_DEV_TO_CHAN(pdev->device);
                        pvt->pci_tad[id] = pdev;
                        saw_chan_mask |= 1 << id;
                }
@@ -2586,12 +2579,6 @@ static int haswell_mci_bind_devs(struct mem_ctl_info *mci,
                        if (!pvt->pci_ddrio)
                                pvt->pci_ddrio = pdev;
                        break;
-               case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA1:
-                       pvt->pci_ha = pdev;
-                       break;
-               case PCI_DEVICE_ID_INTEL_HASWELL_IMC_HA1_TA:
-                       pvt->pci_ta = pdev;
-                       break;
                default:
                        break;
                }
@@ -2645,9 +2632,11 @@ static int broadwell_mci_bind_devs(struct mem_ctl_info *mci,
                        pvt->pci_sad1 = pdev;
                        break;
                case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA0:
+               case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA1:
                        pvt->pci_ha = pdev;
                        break;
                case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA0_TA:
+               case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA1_TA:
                        pvt->pci_ta = pdev;
                        break;
                case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA0_TM:
@@ -2658,18 +2647,12 @@ static int broadwell_mci_bind_devs(struct mem_ctl_info *mci,
                case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA0_TAD1:
                case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA0_TAD2:
                case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA0_TAD3:
-               {
-                       int id = pdev->device - PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA0_TAD0;
-                       pvt->pci_tad[id] = pdev;
-                       saw_chan_mask |= 1 << id;
-               }
-                       break;
                case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA1_TAD0:
                case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA1_TAD1:
                case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA1_TAD2:
                case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA1_TAD3:
                {
-                       int id = pdev->device - PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA1_TAD0;
+                       int id = TAD_DEV_TO_CHAN(pdev->device);
                        pvt->pci_tad[id] = pdev;
                        saw_chan_mask |= 1 << id;
                }
@@ -2677,12 +2660,6 @@ static int broadwell_mci_bind_devs(struct mem_ctl_info *mci,
                case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_DDRIO0:
                        pvt->pci_ddrio = pdev;
                        break;
-               case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA1:
-                       pvt->pci_ha = pdev;
-                       break;
-               case PCI_DEVICE_ID_INTEL_BROADWELL_IMC_HA1_TA:
-                       pvt->pci_ta = pdev;
-                       break;
                default:
                        break;
                }