pci: rename device->linux_dev We have dev_id, which is Linux's device. We had device, which was Linux's dev. We also have 'dev', which is encoded in Linux's devfn. This was a mess, especially since when we spatched dev to device, that collided with other uses of device (meaning dev_id) in Linux. Anyway, we aren't even using linux_dev nee device, it was just a source of confusion for me. Signed-off-by: Barret Rhoden <brho@cs.berkeley.edu>
diff --git a/kern/arch/x86/pci.h b/kern/arch/x86/pci.h index 42a64f8..2de8b49 100644 --- a/kern/arch/x86/pci.h +++ b/kern/arch/x86/pci.h
@@ -174,7 +174,7 @@ uintptr_t mmio_cfg; void *dev_data; /* device private pointer */ struct iommu *iommu; /* ptr to controlling iommu */ - struct device device; + struct device linux_dev; bool in_use; /* prevent double discovery */ int domain; /* legacy size was 16-bits */ uint8_t bus;
diff --git a/kern/drivers/net/bnx2x/bnx2x.h b/kern/drivers/net/bnx2x/bnx2x.h index 1690b1a..dbf9c17 100644 --- a/kern/drivers/net/bnx2x/bnx2x.h +++ b/kern/drivers/net/bnx2x/bnx2x.h
@@ -2201,12 +2201,12 @@ bool is_pf); #define BNX2X_ILT_ZALLOC(x, y, size) \ - x = dma_zalloc_coherent(&bp->pdev->dev, size, y, MEM_WAIT) + x = dma_zalloc_coherent(&bp->pdev->linux_dev, size, y, MEM_WAIT) #define BNX2X_ILT_FREE(x, y, size) \ do { \ if (x) { \ - dma_free_coherent(&bp->pdev->dev, size, x, y); \ + dma_free_coherent(&bp->pdev->linux_dev, size, x, y); \ x = NULL; \ y = 0; \ } \
diff --git a/kern/drivers/net/bnx2x/bnx2x_cmn.h b/kern/drivers/net/bnx2x/bnx2x_cmn.h index 4d68fd9..88e1c6d 100644 --- a/kern/drivers/net/bnx2x/bnx2x_cmn.h +++ b/kern/drivers/net/bnx2x/bnx2x_cmn.h
@@ -29,7 +29,7 @@ #define BNX2X_PCI_FREE(x, y, size) \ do { \ if (x) { \ - dma_free_coherent(&bp->pdev->dev, size, (void *)x, y); \ + dma_free_coherent(&bp->pdev->linux_dev, size, (void *)x, y); \ x = NULL; \ y = 0; \ } \ @@ -45,7 +45,7 @@ #define BNX2X_PCI_ALLOC(y, size) \ ({ \ - void *x = dma_zalloc_coherent(&bp->pdev->dev, size, y, MEM_WAIT); \ + void *x = dma_zalloc_coherent(&bp->pdev->linux_dev, size, y, MEM_WAIT); \ if (x) \ DP(NETIF_MSG_HW, \ "BNX2X_PCI_ALLOC: Physical %p Virtual %p\n", \ @@ -54,7 +54,7 @@ }) #define BNX2X_PCI_FALLOC(y, size) \ ({ \ - void *x = dma_alloc_coherent(&bp->pdev->dev, size, y, MEM_WAIT); \ + void *x = dma_alloc_coherent(&bp->pdev->linux_dev, size, y, MEM_WAIT); \ if (x) { \ memset(x, 0xff, size); \ DP(NETIF_MSG_HW, \
diff --git a/kern/drivers/net/bnx2x/bnx2x_main.c b/kern/drivers/net/bnx2x/bnx2x_main.c index f48b53b..c277901 100644 --- a/kern/drivers/net/bnx2x/bnx2x_main.c +++ b/kern/drivers/net/bnx2x/bnx2x_main.c
@@ -6519,7 +6519,7 @@ /* gzip service functions */ static int bnx2x_gunzip_init(struct bnx2x *bp) { - bp->gunzip_buf = dma_alloc_coherent(&bp->pdev->dev, FW_BUF_SIZE, + bp->gunzip_buf = dma_alloc_coherent(&bp->pdev->linux_dev, FW_BUF_SIZE, &bp->gunzip_mapping, MEM_WAIT); if (bp->gunzip_buf == NULL) goto gunzip_nomem1; @@ -6539,7 +6539,7 @@ bp->strm = NULL; gunzip_nomem2: - dma_free_coherent(&bp->pdev->dev, FW_BUF_SIZE, bp->gunzip_buf, + dma_free_coherent(&bp->pdev->linux_dev, FW_BUF_SIZE, bp->gunzip_buf, bp->gunzip_mapping); bp->gunzip_buf = NULL; @@ -6557,8 +6557,8 @@ } if (bp->gunzip_buf) { - dma_free_coherent(&bp->pdev->dev, FW_BUF_SIZE, bp->gunzip_buf, - bp->gunzip_mapping); + dma_free_coherent(&bp->pdev->linux_dev, FW_BUF_SIZE, + bp->gunzip_buf, bp->gunzip_mapping); bp->gunzip_buf = NULL; } } @@ -12736,7 +12736,7 @@ { return 0; #if 0 // AKAROS_PORT - struct device *dev = &bp->pdev->dev; + struct device *dev = &bp->pdev->linux_dev; if (dma_set_mask_and_coherent(dev, DMA_BIT_MASK(64)) != 0 && dma_set_mask_and_coherent(dev, DMA_BIT_MASK(32)) != 0) { @@ -12768,7 +12768,7 @@ board_type == BCM57711 || board_type == BCM57711E); - SET_NETDEV_DEV(dev, &pdev->dev); + SET_NETDEV_DEV(dev, &pdev->linux_dev); bp->dev = dev; bp->pdev = pdev; @@ -13120,7 +13120,8 @@ } BNX2X_DEV_INFO("Loading %s\n", fw_file_name); - rc = request_firmware(&bp->firmware, fw_file_name, &bp->pdev->device); + rc = request_firmware(&bp->firmware, fw_file_name, + &bp->pdev->linux_dev); if (rc) { BNX2X_ERR("Can't load firmware file %s\n", fw_file_name); @@ -13252,7 +13253,7 @@ * one fast path queue: one FP queue + SB for CNIC */ if (pci_find_cap(pdev, PCI_CAP_ID_MSIX, &msix_cap)) { - dev_info(&pdev->dev, "no msix capability found\n"); + dev_info(&pdev->linux_dev, "no msix capability found\n"); return 1 + cnic_cnt; } @@ -13492,7 +13493,7 @@ */ rc = bnx2x_set_int_mode(bp); if (rc) { - dev_err(&pdev->dev, "Cannot set interrupts\n"); + dev_err(&pdev->linux_dev, "Cannot set interrupts\n"); goto init_one_exit; } BNX2X_DEV_INFO("set interrupts successfully\n");
diff --git a/kern/drivers/net/mlx4/alloc.c b/kern/drivers/net/mlx4/alloc.c index e5fdc74..dd8053b 100644 --- a/kern/drivers/net/mlx4/alloc.c +++ b/kern/drivers/net/mlx4/alloc.c
@@ -601,8 +601,9 @@ buf->nbufs = 1; buf->npages = 1; buf->page_shift = get_order(size) + PAGE_SHIFT; - buf->direct.buf = dma_alloc_coherent(&dev->persist->pdev->dev, - size, &t, gfp); + buf->direct.buf = + dma_alloc_coherent(&dev->persist->pdev->linux_dev, size, + &t, gfp); if (!buf->direct.buf) return -ENOMEM; @@ -630,7 +631,7 @@ for (i = 0; i < buf->nbufs; ++i) { buf->page_list[i].buf = - dma_alloc_coherent(&dev->persist->pdev->dev, + dma_alloc_coherent(&dev->persist->pdev->linux_dev, PAGE_SIZE, &t, gfp); if (!buf->page_list[i].buf) @@ -670,7 +671,7 @@ int i; if (buf->nbufs == 1) - dma_free_coherent(&dev->persist->pdev->dev, size, + dma_free_coherent(&dev->persist->pdev->linux_dev, size, buf->direct.buf, buf->direct.map); else { @@ -681,7 +682,7 @@ for (i = 0; i < buf->nbufs; ++i) if (buf->page_list[i].buf) - dma_free_coherent(&dev->persist->pdev->dev, + dma_free_coherent(&dev->persist->pdev->linux_dev, PAGE_SIZE, buf->page_list[i].buf, buf->page_list[i].map); @@ -797,7 +798,7 @@ set_bit(i, db->u.pgdir->bits[o]); if (bitmap_full(db->u.pgdir->order1, MLX4_DB_PER_PAGE / 2)) { - dma_free_coherent(&dev->persist->pdev->dev, PAGE_SIZE, + dma_free_coherent(&dev->persist->pdev->linux_dev, PAGE_SIZE, db->u.pgdir->db_page, db->u.pgdir->db_dma); list_del(&db->u.pgdir->list); kfree(db->u.pgdir);
diff --git a/kern/drivers/net/mlx4/cmd.c b/kern/drivers/net/mlx4/cmd.c index 7f406e7..309f019 100644 --- a/kern/drivers/net/mlx4/cmd.c +++ b/kern/drivers/net/mlx4/cmd.c
@@ -2469,7 +2469,7 @@ err_comm: iounmap(priv->mfunc.comm); err_vhcr: - dma_free_coherent(&dev->persist->pdev->dev, PAGE_SIZE, + dma_free_coherent(&dev->persist->pdev->linux_dev, PAGE_SIZE, priv->mfunc.vhcr, priv->mfunc.vhcr_dma); priv->mfunc.vhcr = NULL; @@ -2501,10 +2501,10 @@ } if (mlx4_is_mfunc(dev) && !priv->mfunc.vhcr) { - priv->mfunc.vhcr = dma_alloc_coherent(&dev->persist->pdev->dev, - PAGE_SIZE, - &priv->mfunc.vhcr_dma, - MEM_WAIT); + priv->mfunc.vhcr = + dma_alloc_coherent(&dev->persist->pdev->linux_dev, + PAGE_SIZE, &priv->mfunc.vhcr_dma, + MEM_WAIT); if (!priv->mfunc.vhcr) goto err; @@ -2587,7 +2587,7 @@ } if (mlx4_is_mfunc(dev) && priv->mfunc.vhcr && (cleanup_mask & MLX4_CMD_CLEANUP_VHCR)) { - dma_free_coherent(&dev->persist->pdev->dev, PAGE_SIZE, + dma_free_coherent(&dev->persist->pdev->linux_dev, PAGE_SIZE, priv->mfunc.vhcr, priv->mfunc.vhcr_dma); priv->mfunc.vhcr = NULL; }
diff --git a/kern/drivers/net/mlx4/en_clock.c b/kern/drivers/net/mlx4/en_clock.c index 12872bc..923b23b 100644 --- a/kern/drivers/net/mlx4/en_clock.c +++ b/kern/drivers/net/mlx4/en_clock.c
@@ -291,7 +291,7 @@ snprintf(mdev->ptp_clock_info.name, 16, "mlx4 ptp"); mdev->ptp_clock = ptp_clock_register(&mdev->ptp_clock_info, - &mdev->pdev->dev); + &mdev->pdev->linux_dev); if (IS_ERR(mdev->ptp_clock)) { mdev->ptp_clock = NULL; mlx4_err(mdev, "ptp_clock_register failed\n");
diff --git a/kern/drivers/net/mlx4/en_cq.c b/kern/drivers/net/mlx4/en_cq.c index b63375e..2a3b533 100644 --- a/kern/drivers/net/mlx4/en_cq.c +++ b/kern/drivers/net/mlx4/en_cq.c
@@ -70,10 +70,10 @@ /* Allocate HW buffers on provided NUMA node. * dev->numa_node is used in mtt range allocation flow. */ - set_dev_node(&mdev->dev->persist->pdev->dev, node); + set_dev_node(&mdev->dev->persist->pdev->linux_dev, node); err = mlx4_alloc_hwq_res(mdev->dev, &cq->wqres, cq->buf_size, 2 * PAGE_SIZE); - set_dev_node(&mdev->dev->persist->pdev->dev, mdev->dev->numa_node); + set_dev_node(&mdev->dev->persist->pdev->linux_dev, mdev->dev->numa_node); if (err) goto err_cq;
diff --git a/kern/drivers/net/mlx4/en_main.c b/kern/drivers/net/mlx4/en_main.c index f8667c0..0e1cab0 100644 --- a/kern/drivers/net/mlx4/en_main.c +++ b/kern/drivers/net/mlx4/en_main.c
@@ -89,7 +89,7 @@ level, DRV_NAME, priv->dev->name, &vaf); else printk("%s%s: %s: Port %d: %pV", - level, DRV_NAME, dev_name(&priv->mdev->pdev->dev), + level, DRV_NAME, dev_name(&priv->mdev->pdev->linux_dev), priv->port, &vaf); va_end(args); #else @@ -101,7 +101,7 @@ printk("%s%s: %s: ", level, DRV_NAME, priv->dev->name); else printk("%s%s: %s: Port %d: ", level, DRV_NAME, - dev_name(&priv->mdev->pdev->dev), priv->port); + dev_name(&priv->mdev->pdev->linux_dev), priv->port); vcprintf(format, args); va_end(args); print_unlock();
diff --git a/kern/drivers/net/mlx4/en_netdev.c b/kern/drivers/net/mlx4/en_netdev.c index c4e3e36..d9f0968 100644 --- a/kern/drivers/net/mlx4/en_netdev.c +++ b/kern/drivers/net/mlx4/en_netdev.c
@@ -2845,7 +2845,7 @@ netif_set_real_num_tx_queues(dev, prof->tx_ring_num); netif_set_real_num_rx_queues(dev, prof->rx_ring_num); - SET_NETDEV_DEV(dev, &mdev->dev->persist->pdev->dev); + SET_NETDEV_DEV(dev, &mdev->dev->persist->pdev->linux_dev); #else dev->ctlr = kzmalloc(sizeof(struct mlx4_en_priv), MEM_WAIT); #endif
diff --git a/kern/drivers/net/mlx4/en_rx.c b/kern/drivers/net/mlx4/en_rx.c index 2ee592a..bb3649d 100644 --- a/kern/drivers/net/mlx4/en_rx.c +++ b/kern/drivers/net/mlx4/en_rx.c
@@ -384,10 +384,10 @@ ring->rx_info, tmp); /* Allocate HW buffers on provided NUMA node */ - set_dev_node(&mdev->dev->persist->pdev->dev, node); + set_dev_node(&mdev->dev->persist->pdev->linux_dev, node); err = mlx4_alloc_hwq_res(mdev->dev, &ring->wqres, ring->buf_size, 2 * PAGE_SIZE); - set_dev_node(&mdev->dev->persist->pdev->dev, mdev->dev->numa_node); + set_dev_node(&mdev->dev->persist->pdev->linux_dev, mdev->dev->numa_node); if (err) goto err_info;
diff --git a/kern/drivers/net/mlx4/en_tx.c b/kern/drivers/net/mlx4/en_tx.c index 148fb6d..95731da 100644 --- a/kern/drivers/net/mlx4/en_tx.c +++ b/kern/drivers/net/mlx4/en_tx.c
@@ -82,10 +82,10 @@ ring->buf_size = ALIGN(size * ring->stride, MLX4_EN_PAGE_SIZE); /* Allocate HW buffers on provided NUMA node */ - set_dev_node(&mdev->dev->persist->pdev->dev, node); + set_dev_node(&mdev->dev->persist->pdev->linux_dev, node); err = mlx4_alloc_hwq_res(mdev->dev, &ring->wqres, ring->buf_size, 2 * PAGE_SIZE); - set_dev_node(&mdev->dev->persist->pdev->dev, mdev->dev->numa_node); + set_dev_node(&mdev->dev->persist->pdev->linux_dev, mdev->dev->numa_node); if (err) { en_err(priv, "Failed allocating hwq resources\n"); goto err_bounce;
diff --git a/kern/drivers/net/mlx4/eq.c b/kern/drivers/net/mlx4/eq.c index e478afd..4589b08 100644 --- a/kern/drivers/net/mlx4/eq.c +++ b/kern/drivers/net/mlx4/eq.c
@@ -972,10 +972,9 @@ eq_context = mailbox->buf; for (i = 0; i < npages; ++i) { - eq->page_list[i].buf = dma_alloc_coherent(&dev->persist-> - pdev->dev, - PAGE_SIZE, &t, - MEM_WAIT); + eq->page_list[i].buf = + dma_alloc_coherent(&dev->persist->pdev->linux_dev, + PAGE_SIZE, &t, MEM_WAIT); if (!eq->page_list[i].buf) goto err_out_free_pages; @@ -1041,8 +1040,8 @@ err_out_free_pages: for (i = 0; i < npages; ++i) if (eq->page_list[i].buf) - dma_free_coherent(&dev->persist->pdev->dev, PAGE_SIZE, - eq->page_list[i].buf, + dma_free_coherent(&dev->persist->pdev->linux_dev, + PAGE_SIZE, eq->page_list[i].buf, eq->page_list[i].map); mlx4_free_cmd_mailbox(dev, mailbox); @@ -1075,7 +1074,7 @@ mlx4_mtt_cleanup(dev, &eq->mtt); for (i = 0; i < npages; ++i) - dma_free_coherent(&dev->persist->pdev->dev, PAGE_SIZE, + dma_free_coherent(&dev->persist->pdev->linux_dev, PAGE_SIZE, eq->page_list[i].buf, eq->page_list[i].map);
diff --git a/kern/drivers/net/mlx4/icm.c b/kern/drivers/net/mlx4/icm.c index 25dcbcd..d3446d4 100644 --- a/kern/drivers/net/mlx4/icm.c +++ b/kern/drivers/net/mlx4/icm.c
@@ -65,7 +65,7 @@ int i; for (i = 0; i < chunk->npages; ++i) - dma_free_coherent(&dev->persist->pdev->dev, + dma_free_coherent(&dev->persist->pdev->linux_dev, chunk->mem[i].length, lowmem_page_address(sg_page(&chunk->mem[i])), sg_dma_address(&chunk->mem[i]));
diff --git a/kern/drivers/net/mlx4/main.c b/kern/drivers/net/mlx4/main.c index 2309a21..1c83d18 100644 --- a/kern/drivers/net/mlx4/main.c +++ b/kern/drivers/net/mlx4/main.c
@@ -2586,7 +2586,8 @@ info->port_attr.show = show_port_type; sysfs_attr_init(&info->port_attr.attr); - err = device_create_file(&dev->persist->pdev->dev, &info->port_attr); + err = device_create_file(&dev->persist->pdev->linux_dev, + &info->port_attr); if (err) { mlx4_err(dev, "Failed to create file for port %d\n", port); info->port = -1; @@ -2605,11 +2606,11 @@ info->port_mtu_attr.show = show_port_ib_mtu; sysfs_attr_init(&info->port_mtu_attr.attr); - err = device_create_file(&dev->persist->pdev->dev, + err = device_create_file(&dev->persist->pdev->linux_dev, &info->port_mtu_attr); if (err) { mlx4_err(dev, "Failed to create mtu file for port %d\n", port); - device_remove_file(&info->dev->persist->pdev->dev, + device_remove_file(&info->dev->persist->pdev->linux_dev, &info->port_attr); info->port = -1; } @@ -2625,8 +2626,9 @@ if (info->port < 0) return; - device_remove_file(&info->dev->persist->pdev->dev, &info->port_attr); - device_remove_file(&info->dev->persist->pdev->dev, + device_remove_file(&info->dev->persist->pdev->linux_dev, + &info->port_attr); + device_remove_file(&info->dev->persist->pdev->linux_dev, &info->port_mtu_attr); #endif } @@ -2843,7 +2845,7 @@ #if 0 // AKAROS_PORT dev->rev_id = pdev->revision; #endif - dev->numa_node = dev_to_node(&pdev->dev); + dev->numa_node = dev_to_node(&pdev->linux_dev); /* Detect if this device is a virtual function */ if (pci_dev_data & MLX4_PCI_DEV_IS_VF) { @@ -3249,7 +3251,8 @@ err = pci_enable_device(pdev); if (err) { - dev_err(&pdev->dev, "Cannot enable PCI device, aborting\n"); + dev_err(&pdev->linux_dev, + "Cannot enable PCI device, aborting\n"); return err; } @@ -3261,7 +3264,8 @@ total_vfs += nvfs[param_map[num_vfs_argc - 1][i]], i++) { nvfs[param_map[num_vfs_argc - 1][i]] = num_vfs[i]; if (nvfs[i] < 0) { - dev_err(&pdev->dev, "num_vfs module parameter cannot be negative\n"); + dev_err(&pdev->linux_dev, + "num_vfs module parameter cannot be negative\n"); err = -EINVAL; goto err_disable_pdev; } @@ -3270,13 +3274,14 @@ i++) { prb_vf[param_map[probe_vfs_argc - 1][i]] = probe_vf[i]; if (prb_vf[i] < 0 || prb_vf[i] > nvfs[i]) { - dev_err(&pdev->dev, "probe_vf module parameter cannot be negative or greater than num_vfs\n"); + dev_err(&pdev->linux_dev, + "probe_vf module parameter cannot be negative or greater than num_vfs\n"); err = -EINVAL; goto err_disable_pdev; } } if (total_vfs >= MLX4_MAX_NUM_VF) { - dev_err(&pdev->dev, + dev_err(&pdev->linux_dev, "Requested more VF's (%d) than allowed (%d)\n", total_vfs, MLX4_MAX_NUM_VF - 1); err = -EINVAL; @@ -3285,7 +3290,7 @@ for (i = 0; i < MLX4_MAX_PORTS; i++) { if (nvfs[i] + nvfs[2] >= MLX4_MAX_NUM_VF_P_PORT) { - dev_err(&pdev->dev, + dev_err(&pdev->linux_dev, "Requested more VF's (%d) for port (%d) than allowed (%d)\n", nvfs[i] + nvfs[2], i + 1, MLX4_MAX_NUM_VF_P_PORT - 1); @@ -3301,7 +3306,7 @@ #else !pci_get_membar(pdev, 0)) { #endif - dev_err(&pdev->dev, "Missing DCS, aborting (driver_data: 0x%x, pci_resource_flags(pdev, 0):0x%lx)\n", + dev_err(&pdev->linux_dev, "Missing DCS, aborting (driver_data: 0x%x, pci_resource_flags(pdev, 0):0x%lx)\n", #if 0 // AKAROS_PORT pci_dev_data, pci_resource_flags(pdev, 0)); #else @@ -3315,14 +3320,15 @@ #else if (!pci_get_membar(pdev, 2)) { #endif - dev_err(&pdev->dev, "Missing UAR, aborting\n"); + dev_err(&pdev->linux_dev, "Missing UAR, aborting\n"); err = -ENODEV; goto err_disable_pdev; } err = pci_request_regions(pdev, DRV_NAME); if (err) { - dev_err(&pdev->dev, "Couldn't get PCI resources, aborting\n"); + dev_err(&pdev->linux_dev, + "Couldn't get PCI resources, aborting\n"); goto err_disable_pdev; } @@ -3330,25 +3336,29 @@ err = pci_set_dma_mask(pdev, DMA_BIT_MASK(64)); if (err) { - dev_warn(&pdev->dev, "Warning: couldn't set 64-bit PCI DMA mask\n"); + dev_warn(&pdev->linux_dev, + "Warning: couldn't set 64-bit PCI DMA mask\n"); err = pci_set_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { - dev_err(&pdev->dev, "Can't set PCI DMA mask, aborting\n"); + dev_err(&pdev->linux_dev, + "Can't set PCI DMA mask, aborting\n"); goto err_release_regions; } } err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(64)); if (err) { - dev_warn(&pdev->dev, "Warning: couldn't set 64-bit consistent PCI DMA mask\n"); + dev_warn(&pdev->linux_dev, + "Warning: couldn't set 64-bit consistent PCI DMA mask\n"); err = pci_set_consistent_dma_mask(pdev, DMA_BIT_MASK(32)); if (err) { - dev_err(&pdev->dev, "Can't set consistent PCI DMA mask, aborting\n"); + dev_err(&pdev->linux_dev, + "Can't set consistent PCI DMA mask, aborting\n"); goto err_release_regions; } } /* Allow large DMA segments, up to the firmware limit of 1 GB */ - dma_set_max_seg_size(&pdev->dev, 1024 * 1024 * 1024); + dma_set_max_seg_size(&pdev->linux_dev, 1024 * 1024 * 1024); #if 0 // AKAROS_PORT /* Detect if this device is a virtual function */ if (pci_dev_data & MLX4_PCI_DEV_IS_VF) { @@ -3368,7 +3378,7 @@ } if ((extended_func_num(pdev) - vfs_offset) > prb_vf[i]) { - dev_warn(&pdev->dev, "Skipping virtual function:%d\n", + dev_warn(&pdev->linux_dev, "Skipping virtual function:%d\n", extended_func_num(pdev)); err = -ENODEV; goto err_release_regions;
diff --git a/kern/drivers/net/mlx4/mlx4.h b/kern/drivers/net/mlx4/mlx4.h index 624b1ca..c8985d7 100644 --- a/kern/drivers/net/mlx4/mlx4.h +++ b/kern/drivers/net/mlx4/mlx4.h
@@ -209,16 +209,16 @@ do { \ if (mlx4_debug_level) \ dev_printk(KERN_DEBUG, \ - &(mdev)->persist->pdev->dev, format, \ + &(mdev)->persist->pdev->linux_dev, format, \ ##__VA_ARGS__); \ } while (0) #define mlx4_err(mdev, format, ...) \ - dev_err(&(mdev)->persist->pdev->dev, format, ##__VA_ARGS__) + dev_err(&(mdev)->persist->pdev->linux_dev, format, ##__VA_ARGS__) #define mlx4_info(mdev, format, ...) \ - dev_info(&(mdev)->persist->pdev->dev, format, ##__VA_ARGS__) + dev_info(&(mdev)->persist->pdev->linux_dev, format, ##__VA_ARGS__) #define mlx4_warn(mdev, format, ...) \ - dev_warn(&(mdev)->persist->pdev->dev, format, ##__VA_ARGS__) + dev_warn(&(mdev)->persist->pdev->linux_dev, format, ##__VA_ARGS__) extern int mlx4_log_num_mgm_entry_size; extern int log_mtts_per_seg;
diff --git a/kern/drivers/net/mlx4/mlx4_en.h b/kern/drivers/net/mlx4/mlx4_en.h index 2d279b1..7ab2e81 100644 --- a/kern/drivers/net/mlx4/mlx4_en.h +++ b/kern/drivers/net/mlx4/mlx4_en.h
@@ -899,10 +899,10 @@ #define mlx4_err(mdev, format, ...) \ pr_err(DRV_NAME " %s: " format, \ - dev_name(&(mdev)->pdev->dev), ##__VA_ARGS__) + dev_name(&(mdev)->pdev->linux_dev), ##__VA_ARGS__) #define mlx4_info(mdev, format, ...) \ pr_info(DRV_NAME " %s: " format, \ - dev_name(&(mdev)->pdev->dev), ##__VA_ARGS__) + dev_name(&(mdev)->pdev->linux_dev), ##__VA_ARGS__) #define mlx4_warn(mdev, format, ...) \ pr_warn(DRV_NAME " %s: " format, \ - dev_name(&(mdev)->pdev->dev), ##__VA_ARGS__) + dev_name(&(mdev)->pdev->linux_dev), ##__VA_ARGS__)
diff --git a/kern/drivers/net/mlx4/mr.c b/kern/drivers/net/mlx4/mr.c index f197114..e0b6548 100644 --- a/kern/drivers/net/mlx4/mr.c +++ b/kern/drivers/net/mlx4/mr.c
@@ -718,13 +718,13 @@ if (!mtts) return -ENOMEM; - dma_sync_single_for_cpu(&dev->persist->pdev->dev, dma_handle, + dma_sync_single_for_cpu(&dev->persist->pdev->linux_dev, dma_handle, npages * sizeof (uint64_t), DMA_TO_DEVICE); for (i = 0; i < npages; ++i) mtts[i] = cpu_to_be64(page_list[i] | MLX4_MTT_FLAG_PRESENT); - dma_sync_single_for_device(&dev->persist->pdev->dev, dma_handle, + dma_sync_single_for_device(&dev->persist->pdev->linux_dev, dma_handle, npages * sizeof (uint64_t), DMA_TO_DEVICE); return 0; @@ -1032,13 +1032,14 @@ /* Make sure MPT status is visible before writing MTT entries */ wmb(); - dma_sync_single_for_cpu(&dev->persist->pdev->dev, fmr->dma_handle, + dma_sync_single_for_cpu(&dev->persist->pdev->linux_dev, fmr->dma_handle, npages * sizeof(uint64_t), DMA_TO_DEVICE); for (i = 0; i < npages; ++i) fmr->mtts[i] = cpu_to_be64(page_list[i] | MLX4_MTT_FLAG_PRESENT); - dma_sync_single_for_device(&dev->persist->pdev->dev, fmr->dma_handle, + dma_sync_single_for_device(&dev->persist->pdev->linux_dev, + fmr->dma_handle, npages * sizeof(uint64_t), DMA_TO_DEVICE); fmr->mpt->key = cpu_to_be32(key);
diff --git a/kern/drivers/net/mlx4u/mr.c b/kern/drivers/net/mlx4u/mr.c index 4f2114e..142e2e1 100644 --- a/kern/drivers/net/mlx4u/mr.c +++ b/kern/drivers/net/mlx4u/mr.c
@@ -401,10 +401,9 @@ if (!mfrpl->ibfrpl.page_list) goto err_free; - mfrpl->mapped_page_list = dma_alloc_coherent(&dev->dev->persist-> - pdev->dev, - size, &mfrpl->map, - GFP_KERNEL); + mfrpl->mapped_page_list = + dma_alloc_coherent(&dev->dev->persist->pdev->linux_dev, size, + &mfrpl->map, GFP_KERNEL); if (!mfrpl->mapped_page_list) goto err_free; @@ -424,7 +423,7 @@ struct mlx4_ib_fast_reg_page_list *mfrpl = to_mfrpl(page_list); int size = page_list->max_page_list_len * sizeof (u64); - dma_free_coherent(&dev->dev->persist->pdev->dev, size, + dma_free_coherent(&dev->dev->persist->pdev->linux_dev, size, mfrpl->mapped_page_list, mfrpl->map); kfree(mfrpl->ibfrpl.page_list);
diff --git a/kern/drivers/net/r8169.c b/kern/drivers/net/r8169.c index 4f57342..e2372b8 100644 --- a/kern/drivers/net/r8169.c +++ b/kern/drivers/net/r8169.c
@@ -1677,7 +1677,7 @@ rtl_link_chg_patch(tp); /* This is to cancel a scheduled suspend if there's one. */ if (pm) - pm_request_resume(&tp->pci_dev->device); + pm_request_resume(&tp->pci_dev->linux_dev); netif_carrier_on(dev); if (net_ratelimit()) netif_info(tp, ifup, dev, "link up\n"); @@ -1685,7 +1685,7 @@ netif_carrier_off(dev); netif_info(tp, ifdown, dev, "link down\n"); if (pm) - pm_schedule_suspend(&tp->pci_dev->device, 5000); + pm_schedule_suspend(&tp->pci_dev->linux_dev, 5000); } } @@ -1753,7 +1753,7 @@ static void rtl8169_get_wol(struct ether *dev, struct ethtool_wolinfo *wol) { struct rtl8169_private *tp = netdev_priv(dev); - struct device *d = &tp->pci_dev->device; + struct device *d = &tp->pci_dev->linux_dev; pm_runtime_get_noresume(d); @@ -1859,7 +1859,7 @@ static int rtl8169_set_wol(struct ether *dev, struct ethtool_wolinfo *wol) { struct rtl8169_private *tp = netdev_priv(dev); - struct device *d = &tp->pci_dev->device; + struct device *d = &tp->pci_dev->linux_dev; pm_runtime_get_noresume(d); @@ -1876,7 +1876,7 @@ rtl_unlock_work(tp); - device_set_wakeup_enable(&tp->pci_dev->device, wol->wolopts); + device_set_wakeup_enable(&tp->pci_dev->linux_dev, wol->wolopts); pm_runtime_put_noidle(d); @@ -2345,7 +2345,7 @@ uint64_t *data) { struct rtl8169_private *tp = netdev_priv(dev); - struct device *d = &tp->pci_dev->device; + struct device *d = &tp->pci_dev->linux_dev; struct rtl8169_counters *counters = tp->counters; ASSERT_RTNL(); @@ -4530,7 +4530,7 @@ static int rtl_set_mac_address(struct ether *dev, void *p) { struct rtl8169_private *tp = netdev_priv(dev); - struct device *d = &tp->pci_dev->device; + struct device *d = &tp->pci_dev->linux_dev; struct sockaddr *addr = p; if (!is_valid_ether_addr(addr->sa_data)) @@ -5234,7 +5234,7 @@ if (!rtl_fw) goto err_warn; - rc = request_firmware(&rtl_fw->fw, name, &tp->pci_dev->device); + rc = request_firmware(&rtl_fw->fw, name, &tp->pci_dev->linux_dev); if (rc < 0) goto err_free; @@ -6756,8 +6756,8 @@ static void rtl8169_free_rx_databuff(struct rtl8169_private *tp, void **data_buff, struct RxDesc *desc) { - dma_unmap_single(&tp->pci_dev->device, le64_to_cpu(desc->addr), rx_buf_sz, - DMA_FROM_DEVICE); + dma_unmap_single(&tp->pci_dev->linux_dev, le64_to_cpu(desc->addr), + rx_buf_sz, DMA_FROM_DEVICE); kfree(*data_buff); *data_buff = NULL; @@ -6793,7 +6793,7 @@ { void *data; dma_addr_t mapping; - struct device *d = &tp->pci_dev->device; + struct device *d = &tp->pci_dev->linux_dev; struct ether *dev = tp->dev; #if 0 // AKAROS_PORT int node = dev->dev.parent ? dev_to_node(dev->dev.parent) : -1; @@ -6909,7 +6909,7 @@ if (len) { struct block *bp = tx_skb->block; - rtl8169_unmap_tx_skb(&tp->pci_dev->device, tx_skb, + rtl8169_unmap_tx_skb(&tp->pci_dev->linux_dev, tx_skb, tp->TxDescArray + entry); if (bp) { freeb(bp); @@ -6962,7 +6962,7 @@ { unsigned int cur_frag, entry; struct TxDesc *uninitialized_var(txd); - struct device *d = &tp->pci_dev->device; + struct device *d = &tp->pci_dev->linux_dev; entry = tp->cur_tx; /* Don't use cur_frag for the loop. ebd may have holes, but we only @@ -7217,7 +7217,7 @@ unsigned int entry = tp->cur_tx % NUM_TX_DESC; struct TxDesc *txd = tp->TxDescArray + entry; void __iomem *ioaddr = tp->mmio_addr; - struct device *d = &tp->pci_dev->device; + struct device *d = &tp->pci_dev->linux_dev; dma_addr_t mapping; uint32_t status, len; uint32_t opts[2]; @@ -7379,7 +7379,7 @@ */ bus_rmb(); - rtl8169_unmap_tx_skb(&tp->pci_dev->device, tx_skb, + rtl8169_unmap_tx_skb(&tp->pci_dev->linux_dev, tx_skb, tp->TxDescArray + entry); if (status & LastFrag) { u64_stats_update_begin(&tp->tx_stats.syncp); @@ -7444,7 +7444,7 @@ int pkt_size, dma_addr_t addr) { struct block *bp; - struct device *d = &tp->pci_dev->device; + struct device *d = &tp->pci_dev->linux_dev; data = rtl8169_align(data); dma_sync_single_for_cpu(d, addr, pkt_size, DMA_FROM_DEVICE); @@ -7742,7 +7742,7 @@ struct rtl8169_private *tp = netdev_priv(dev); struct pci_device *pdev = tp->pci_dev; - pm_runtime_get_sync(&pdev->device); + pm_runtime_get_sync(&pdev->linux_dev); /* Update counters before going down */ rtl8169_update_counters(dev); @@ -7757,14 +7757,14 @@ free_irq(pdev->irqline, dev); - dma_free_coherent(&pdev->device, R8169_RX_RING_BYTES, tp->RxDescArray, + dma_free_coherent(&pdev->linux_dev, R8169_RX_RING_BYTES, tp->RxDescArray, tp->RxPhyAddr); - dma_free_coherent(&pdev->device, R8169_TX_RING_BYTES, tp->TxDescArray, + dma_free_coherent(&pdev->linux_dev, R8169_TX_RING_BYTES, tp->TxDescArray, tp->TxPhyAddr); tp->TxDescArray = NULL; tp->RxDescArray = NULL; - pm_runtime_put_sync(&pdev->device); + pm_runtime_put_sync(&pdev->linux_dev); return 0; } @@ -7785,19 +7785,19 @@ struct pci_device *pdev = tp->pci_dev; int retval = -ENOMEM; - pm_runtime_get_sync(&pdev->device); + pm_runtime_get_sync(&pdev->linux_dev); /* * Rx and Tx descriptors needs 256 bytes alignment. * dma_alloc_coherent provides more. */ - tp->TxDescArray = dma_zalloc_coherent(&pdev->device, + tp->TxDescArray = dma_zalloc_coherent(&pdev->linux_dev, R8169_TX_RING_BYTES, &tp->TxPhyAddr, MEM_WAIT); if (!tp->TxDescArray) goto err_pm_runtime_put; - tp->RxDescArray = dma_zalloc_coherent(&pdev->device, + tp->RxDescArray = dma_zalloc_coherent(&pdev->linux_dev, R8169_RX_RING_BYTES, &tp->RxPhyAddr, MEM_WAIT); if (!tp->RxDescArray) @@ -7841,7 +7841,7 @@ rtl_unlock_work(tp); tp->saved_wolopts = 0; - pm_runtime_put_noidle(&pdev->device); + pm_runtime_put_noidle(&pdev->linux_dev); rtl8169_check_link_status(dev, tp, ioaddr); out: @@ -7851,15 +7851,15 @@ rtl_release_firmware(tp); rtl8169_rx_clear(tp); err_free_rx_1: - dma_free_coherent(&pdev->device, R8169_RX_RING_BYTES, tp->RxDescArray, + dma_free_coherent(&pdev->linux_dev, R8169_RX_RING_BYTES, tp->RxDescArray, tp->RxPhyAddr); tp->RxDescArray = NULL; err_free_tx_0: - dma_free_coherent(&pdev->device, R8169_TX_RING_BYTES, tp->TxDescArray, + dma_free_coherent(&pdev->linux_dev, R8169_TX_RING_BYTES, tp->TxDescArray, tp->TxPhyAddr); tp->TxDescArray = NULL; err_pm_runtime_put: - pm_runtime_put_noidle(&pdev->device); + pm_runtime_put_noidle(&pdev->linux_dev); goto out; } @@ -7872,9 +7872,9 @@ struct rtl8169_counters *counters = tp->counters; unsigned int start; - pm_runtime_get_noresume(&pdev->device); + pm_runtime_get_noresume(&pdev->linux_dev); - if (netif_running(dev) && pm_runtime_active(&pdev->device)) + if (netif_running(dev) && pm_runtime_active(&pdev->linux_dev)) rtl8169_rx_missed(dev, ioaddr); do { @@ -7902,7 +7902,7 @@ * Fetch additonal counter values missing in stats collected by driver * from tally counters. */ - if (pm_runtime_active(&pdev->device)) + if (pm_runtime_active(&pdev->linux_dev)) rtl8169_update_counters(dev); /* @@ -7916,7 +7916,7 @@ stats->tx_aborted_errors = le16_to_cpu(counters->tx_aborted) - le16_to_cpu(tp->tc_offset.tx_aborted); - pm_runtime_put_noidle(&pdev->device); + pm_runtime_put_noidle(&pdev->linux_dev); } static void rtl8169_net_suspend(struct ether *dev) @@ -8077,7 +8077,7 @@ { struct ether *dev = pci_get_drvdata(pdev); struct rtl8169_private *tp = netdev_priv(dev); - struct device *d = &pdev->device; + struct device *d = &pdev->linux_dev; pm_runtime_get_sync(d); @@ -8124,13 +8124,13 @@ unregister_netdev(dev); - dma_free_coherent(&tp->pci_dev->device, sizeof(*tp->counters), + dma_free_coherent(&tp->pci_dev->linux_dev, sizeof(*tp->counters), tp->counters, tp->counters_phys_addr); rtl_release_firmware(tp); if (pci_dev_run_wake(pdev)) - pm_runtime_get_noresume(&pdev->device); + pm_runtime_get_noresume(&pdev->linux_dev); #if 0 // AKAROS_PORT /* restore original MAC address */ @@ -8321,7 +8321,7 @@ MODULENAME, RTL8169_VERSION); } - SET_NETDEV_DEV(dev, &pdev->device); + SET_NETDEV_DEV(dev, &pdev->linux_dev); tp = netdev_priv(dev); tp->dev = dev; tp->pci_dev = pdev; @@ -8580,7 +8580,7 @@ tp->rtl_fw = RTL_FIRMWARE_UNKNOWN; - tp->counters = dma_zalloc_coherent(&pdev->device, sizeof(*tp->counters), + tp->counters = dma_zalloc_coherent(&pdev->linux_dev, sizeof(*tp->counters), &tp->counters_phys_addr, MEM_WAIT); if (!tp->counters) { rc = -ENOMEM; @@ -8613,11 +8613,11 @@ rtl8168_driver_start(tp); } - device_set_wakeup_enable(&pdev->device, + device_set_wakeup_enable(&pdev->linux_dev, tp->features & RTL_FEATURE_WOL); if (pci_dev_run_wake(pdev)) - pm_runtime_put_noidle(&pdev->device); + pm_runtime_put_noidle(&pdev->linux_dev); netif_carrier_off(dev); @@ -8625,7 +8625,7 @@ return rc; err_out_cnt_6: - dma_free_coherent(&pdev->device, sizeof(*tp->counters), tp->counters, + dma_free_coherent(&pdev->linux_dev, sizeof(*tp->counters), tp->counters, tp->counters_phys_addr); err_out_msi_5: netif_napi_del(&tp->napi);
diff --git a/kern/include/linux/compat_todo.h b/kern/include/linux/compat_todo.h index a1eed08..c69e070 100644 --- a/kern/include/linux/compat_todo.h +++ b/kern/include/linux/compat_todo.h
@@ -680,7 +680,7 @@ #define pci_pool dma_pool #define pci_pool_create(name, pdev, size, align, allocation) \ - dma_pool_create(name, pdev, size, align, allocation) + dma_pool_create(name, &pdev->linux_dev, size, align, allocation) #define pci_pool_destroy(pool) dma_pool_destroy(pool) #define pci_pool_alloc(pool, flags, handle) dma_pool_alloc(pool, flags, handle) #define pci_pool_free(pool, vaddr, addr) dma_pool_free(pool, vaddr, addr)
diff --git a/scripts/spatch/linux/scalar.cocci b/scripts/spatch/linux/scalar.cocci index 58def3d..d8dd3cb 100644 --- a/scripts/spatch/linux/scalar.cocci +++ b/scripts/spatch/linux/scalar.cocci
@@ -147,7 +147,7 @@ struct pci_device *p; @@ -p->dev -+p->device ++p->linux_dev @@ struct ether *p;