pci: Add a struct device field
authorBarret Rhoden <brho@cs.berkeley.edu>
Wed, 1 Nov 2017 20:28:28 +0000 (16:28 -0400)
committerBarret Rhoden <brho@cs.berkeley.edu>
Thu, 16 Nov 2017 15:46:56 +0000 (10:46 -0500)
bnx2x has a lot of other places that are still using pcidev->dev, but it's
passing them to dont-care macros.  It's hokey, and spatch doesn't seem to
want to catch them all.  It's also a little hard to spatch after doing the
native conversion; some places have akaros_pcidev->dev, meaning the 'd' of
TBDF.

Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
kern/arch/x86/pci.h
kern/drivers/net/bnx2x/bnx2x_main.c
kern/include/linux/compat_todo.h
kern/include/linux_compat.h

index c772bbe..374ef44 100644 (file)
 
 #define MAX_PCI_BAR                    6
 
+/* Nothing yet, but this helps with Linux drivers. */
+struct device {
+};
 
 struct pci_bar {
        uint32_t                                        raw_bar;
@@ -169,6 +172,7 @@ struct pci_device {
        char                                            name[9];
        spinlock_t                                      lock;
        void                                            *dev_data;      /* device private pointer */
+       struct device                           device;
        bool                                            in_use;         /* prevent double discovery */
        uint8_t                                         bus;
        uint8_t                                         dev;
index 2ed2c12..d9ef320 100644 (file)
@@ -13133,7 +13133,7 @@ static int bnx2x_init_firmware(struct bnx2x *bp)
        }
        BNX2X_DEV_INFO("Loading %s\n", fw_file_name);
 
-       rc = request_firmware(&bp->firmware, fw_file_name, &bp->pdev->dev);
+       rc = request_firmware(&bp->firmware, fw_file_name, &bp->pdev->device);
        if (rc) {
                BNX2X_ERR("Can't load firmware file %s\n",
                          fw_file_name);
index cccfd73..6a625d9 100644 (file)
@@ -370,9 +370,6 @@ struct cpu_rmap {
 
 extern unsigned long saved_max_pfn;
 
-struct device {
-};
-
 struct device_attribute {
 };
 
index aeaf628..3d1f5f8 100644 (file)
@@ -853,10 +853,9 @@ struct firmware {
        size_t size;
 };
 
-/* the ignored param is a &pcidev->dev in linux, which is a struct dev.  our
- * pcidev->dev is the "slot" */
 static inline int request_firmware(const struct firmware **fwp,
-                                   const char *file_name, uint8_t *ignored)
+                                   const char *file_name,
+                                                                  struct device *ignored)
 {
        struct firmware *ret_fw;
        struct file *fw_file;