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

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.com


Signed-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
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -1573,7 +1573,7 @@ static enum i40iw_status_code i40iw_setup_init_state(struct i40iw_handler *hdl,
	status = i40iw_save_msix_info(iwdev, ldev);
	if (status)
		return status;
	iwdev->hw.dev_context = (void *)ldev->pcidev;
	iwdev->hw.pcidev = ldev->pcidev;
	iwdev->hw.hw_addr = ldev->hw_addr;
	status = i40iw_allocate_dma_mem(&iwdev->hw,
					&iwdev->obj_mem, 8192, 4096);
+2 −2
Original line number Diff line number Diff line
@@ -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)
{
	struct pci_dev *pcidev = (struct pci_dev *)hw->dev_context;
	struct pci_dev *pcidev = hw->pcidev;
	int i;

	if (!chunk->pg_cnt)
@@ -193,7 +193,7 @@ static enum i40iw_status_code i40iw_get_vmalloc_mem(struct i40iw_hw *hw,
						    struct i40iw_chunk *chunk,
						    int pg_cnt)
{
	struct pci_dev *pcidev = (struct pci_dev *)hw->dev_context;
	struct pci_dev *pcidev = hw->pcidev;
	struct page *page;
	u8 *addr;
	u32 size;
+2 −1
Original line number Diff line number Diff line
@@ -73,6 +73,7 @@ struct i40iw_pd_ops;
struct i40iw_priv_qp_ops;
struct i40iw_priv_cq_ops;
struct i40iw_hmc_ops;
struct pci_dev;

enum i40iw_page_size {
	I40IW_PAGE_SIZE_4K,
@@ -261,7 +262,7 @@ struct i40iw_vsi_pestat {

struct i40iw_hw {
	u8 __iomem *hw_addr;
	void *dev_context;
	struct pci_dev *pcidev;
	struct i40iw_hmc_info hmc;
};

+2 −2
Original line number Diff line number Diff line
@@ -751,7 +751,7 @@ enum i40iw_status_code i40iw_allocate_dma_mem(struct i40iw_hw *hw,
					      u64 size,
					      u32 alignment)
{
	struct pci_dev *pcidev = (struct pci_dev *)hw->dev_context;
	struct pci_dev *pcidev = hw->pcidev;

	if (!mem)
		return I40IW_ERR_PARAM;
@@ -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)
{
	struct pci_dev *pcidev = (struct pci_dev *)hw->dev_context;
	struct pci_dev *pcidev = hw->pcidev;

	if (!mem || !mem->va)
		return;
+1 −1
Original line number Diff line number Diff line
@@ -2661,7 +2661,7 @@ static struct i40iw_ib_device *i40iw_init_rdma_device(struct i40iw_device *iwdev
{
	struct i40iw_ib_device *iwibdev;
	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);
	if (!iwibdev) {