PCI: pcie, aer: flags to bits
authorHidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Mon, 7 Sep 2009 08:16:20 +0000 (17:16 +0900)
committerJesse Barnes <jbarnes@virtuousgeek.org>
Wed, 9 Sep 2009 20:49:56 +0000 (13:49 -0700)
Compact struct and codes.

Signed-off-by: Hidetoshi Seto <seto.hidetoshi@jp.fujitsu.com>
Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
drivers/pci/pcie/aer/aerdrv.h
drivers/pci/pcie/aer/aerdrv_core.c
drivers/pci/pcie/aer/aerdrv_errprint.c

index c44d9e1..78c977c 100644 (file)
                                        PCI_ERR_UNC_UNX_COMP|           \
                                        PCI_ERR_UNC_MALF_TLP)
 
-/* AER Error Info Flags */
-#define AER_TLP_HEADER_VALID_FLAG      0x00000001
-#define AER_MULTI_ERROR_VALID_FLAG     0x00000002
-
 struct header_log_regs {
        unsigned int dw0;
        unsigned int dw1;
@@ -55,10 +51,17 @@ struct header_log_regs {
 struct aer_err_info {
        struct pci_dev *dev[AER_MAX_MULTI_ERR_DEVICES];
        int error_dev_num;
-       u16 id;
-       int severity;                   /* 0:NONFATAL | 1:FATAL | 2:COR */
-       int flags;
-       int first;
+
+       unsigned int id:16;
+
+       unsigned int severity:2;        /* 0:NONFATAL | 1:FATAL | 2:COR */
+       unsigned int __pad1:5;
+       unsigned int multi_error_valid:1;
+
+       unsigned int first_error:5;
+       unsigned int __pad2:2;
+       unsigned int tlp_header_valid:1;
+
        unsigned int status;            /* COR/UNCOR Error Status */
        unsigned int mask;              /* COR/UNCOR Error Mask */
        struct header_log_regs tlp;     /* TLP Header */
index 9ba1602..9626469 100644 (file)
@@ -196,7 +196,7 @@ static int find_device_iter(struct pci_dev *dev, void *data)
                 * If there is no multiple error, we stop
                 * or continue based on the id comparing.
                 */
-               if (!(e_info->flags & AER_MULTI_ERROR_VALID_FLAG))
+               if (!e_info->multi_error_valid)
                        return result;
 
                /*
@@ -254,7 +254,7 @@ static int find_device_iter(struct pci_dev *dev, void *data)
        return 0;
 
 added:
-       if (e_info->flags & AER_MULTI_ERROR_VALID_FLAG)
+       if (e_info->multi_error_valid)
                return 0;
        else
                return 1;
@@ -701,7 +701,7 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
        int pos, temp;
 
        info->status = 0;
-       info->flags &= ~AER_TLP_HEADER_VALID_FLAG;
+       info->tlp_header_valid = 0;
 
        pos = pci_find_ext_capability(dev, PCI_EXT_CAP_ID_ERR);
 
@@ -729,10 +729,10 @@ static int get_device_error_info(struct pci_dev *dev, struct aer_err_info *info)
 
                /* Get First Error Pointer */
                pci_read_config_dword(dev, pos + PCI_ERR_CAP, &temp);
-               info->first = PCI_ERR_CAP_FEP(temp);
+               info->first_error = PCI_ERR_CAP_FEP(temp);
 
                if (info->status & AER_LOG_TLP_MASKS) {
-                       info->flags |= AER_TLP_HEADER_VALID_FLAG;
+                       info->tlp_header_valid = 1;
                        pci_read_config_dword(dev,
                                pos + PCI_ERR_HEADER_LOG, &info->tlp.dw0);
                        pci_read_config_dword(dev,
@@ -811,7 +811,7 @@ static void aer_isr_one_error(struct pcie_device *p_device,
                if (e_src->status &
                        (PCI_ERR_ROOT_MULTI_COR_RCV |
                         PCI_ERR_ROOT_MULTI_UNCOR_RCV))
-                       e_info->flags |= AER_MULTI_ERROR_VALID_FLAG;
+                       e_info->multi_error_valid = 1;
 
                find_source_device(p_device->port, e_info);
                aer_process_err_devices(p_device, e_info);
index 0bb91e2..f0bdf0f 100644 (file)
@@ -170,10 +170,10 @@ static void aer_print_error_source(struct aer_err_info *info)
 
                if (errmsg)
                        AER_PR(info, "%s\t: %s\n", errmsg,
-                               info->first == i ? "First" : "");
+                               info->first_error == i ? "First" : "");
                else
                        AER_PR(info, "Unknown Error Bit %2d  \t: %s\n",
-                               i, info->first == i ? "First" : "");
+                               i, info->first_error == i ? "First" : "");
        }
 }
 
@@ -207,7 +207,7 @@ void aer_print_error(struct pci_dev *dev, struct aer_err_info *info)
                        PCI_SLOT(dev->devfn),
                        PCI_FUNC(dev->devfn));
 
-               if (info->flags & AER_TLP_HEADER_VALID_FLAG) {
+               if (info->tlp_header_valid) {
                        unsigned char *tlp = (unsigned char *) &info->tlp;
                        AER_PR(info, "TLP Header:\n");
                        AER_PR(info, "%02x%02x%02x%02x %02x%02x%02x%02x"