Commit 1d7c9958 authored by Parav Pandit's avatar Parav Pandit Committed by Jason Gunthorpe

RDMA/i40iw: Avoid typecast from void to pci_dev

hw_context stores a pci_device pointer. Use the correct type instead of
void * and avoid typecasts.

Link: https://lore.kernel.org/r/20200914123528.270382-1-parav@mellanox.comSigned-off-by: default avatarParav Pandit <parav@nvidia.com>
Acked-by: default avatarShiraz Saleem <shiraz.saleem@intel.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent 06e8d1df
...@@ -1573,7 +1573,7 @@ static enum i40iw_status_code i40iw_setup_init_state(struct i40iw_handler *hdl, ...@@ -1573,7 +1573,7 @@ static enum i40iw_status_code i40iw_setup_init_state(struct i40iw_handler *hdl,
status = i40iw_save_msix_info(iwdev, ldev); status = i40iw_save_msix_info(iwdev, ldev);
if (status) if (status)
return status; return status;
iwdev->hw.dev_context = (void *)ldev->pcidev; iwdev->hw.pcidev = ldev->pcidev;
iwdev->hw.hw_addr = ldev->hw_addr; iwdev->hw.hw_addr = ldev->hw_addr;
status = i40iw_allocate_dma_mem(&iwdev->hw, status = i40iw_allocate_dma_mem(&iwdev->hw,
&iwdev->obj_mem, 8192, 4096); &iwdev->obj_mem, 8192, 4096);
......
...@@ -167,7 +167,7 @@ static enum i40iw_status_code add_sd_direct(struct i40iw_sc_dev *dev, ...@@ -167,7 +167,7 @@ static enum i40iw_status_code add_sd_direct(struct i40iw_sc_dev *dev,
*/ */
static void i40iw_free_vmalloc_mem(struct i40iw_hw *hw, struct i40iw_chunk *chunk) static void i40iw_free_vmalloc_mem(struct i40iw_hw *hw, struct i40iw_chunk *chunk)
{ {
struct pci_dev *pcidev = (struct pci_dev *)hw->dev_context; struct pci_dev *pcidev = hw->pcidev;
int i; int i;
if (!chunk->pg_cnt) if (!chunk->pg_cnt)
...@@ -193,7 +193,7 @@ static enum i40iw_status_code i40iw_get_vmalloc_mem(struct i40iw_hw *hw, ...@@ -193,7 +193,7 @@ static enum i40iw_status_code i40iw_get_vmalloc_mem(struct i40iw_hw *hw,
struct i40iw_chunk *chunk, struct i40iw_chunk *chunk,
int pg_cnt) int pg_cnt)
{ {
struct pci_dev *pcidev = (struct pci_dev *)hw->dev_context; struct pci_dev *pcidev = hw->pcidev;
struct page *page; struct page *page;
u8 *addr; u8 *addr;
u32 size; u32 size;
......
...@@ -73,6 +73,7 @@ struct i40iw_pd_ops; ...@@ -73,6 +73,7 @@ struct i40iw_pd_ops;
struct i40iw_priv_qp_ops; struct i40iw_priv_qp_ops;
struct i40iw_priv_cq_ops; struct i40iw_priv_cq_ops;
struct i40iw_hmc_ops; struct i40iw_hmc_ops;
struct pci_dev;
enum i40iw_page_size { enum i40iw_page_size {
I40IW_PAGE_SIZE_4K, I40IW_PAGE_SIZE_4K,
...@@ -261,7 +262,7 @@ struct i40iw_vsi_pestat { ...@@ -261,7 +262,7 @@ struct i40iw_vsi_pestat {
struct i40iw_hw { struct i40iw_hw {
u8 __iomem *hw_addr; u8 __iomem *hw_addr;
void *dev_context; struct pci_dev *pcidev;
struct i40iw_hmc_info hmc; struct i40iw_hmc_info hmc;
}; };
......
...@@ -751,7 +751,7 @@ enum i40iw_status_code i40iw_allocate_dma_mem(struct i40iw_hw *hw, ...@@ -751,7 +751,7 @@ enum i40iw_status_code i40iw_allocate_dma_mem(struct i40iw_hw *hw,
u64 size, u64 size,
u32 alignment) u32 alignment)
{ {
struct pci_dev *pcidev = (struct pci_dev *)hw->dev_context; struct pci_dev *pcidev = hw->pcidev;
if (!mem) if (!mem)
return I40IW_ERR_PARAM; return I40IW_ERR_PARAM;
...@@ -770,7 +770,7 @@ enum i40iw_status_code i40iw_allocate_dma_mem(struct i40iw_hw *hw, ...@@ -770,7 +770,7 @@ enum i40iw_status_code i40iw_allocate_dma_mem(struct i40iw_hw *hw,
*/ */
void i40iw_free_dma_mem(struct i40iw_hw *hw, struct i40iw_dma_mem *mem) void i40iw_free_dma_mem(struct i40iw_hw *hw, struct i40iw_dma_mem *mem)
{ {
struct pci_dev *pcidev = (struct pci_dev *)hw->dev_context; struct pci_dev *pcidev = hw->pcidev;
if (!mem || !mem->va) if (!mem || !mem->va)
return; return;
......
...@@ -2661,7 +2661,7 @@ static struct i40iw_ib_device *i40iw_init_rdma_device(struct i40iw_device *iwdev ...@@ -2661,7 +2661,7 @@ static struct i40iw_ib_device *i40iw_init_rdma_device(struct i40iw_device *iwdev
{ {
struct i40iw_ib_device *iwibdev; struct i40iw_ib_device *iwibdev;
struct net_device *netdev = iwdev->netdev; struct net_device *netdev = iwdev->netdev;
struct pci_dev *pcidev = (struct pci_dev *)iwdev->hw.dev_context; struct pci_dev *pcidev = iwdev->hw.pcidev;
iwibdev = ib_alloc_device(i40iw_ib_device, ibdev); iwibdev = ib_alloc_device(i40iw_ib_device, ibdev);
if (!iwibdev) { if (!iwibdev) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment