Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

myri10ge: Simplify DMA setting

As stated in [1], dma_set_mask() with a 64-bit mask will never fail if
dev->dma_mask is non-NULL.
So, if it fails, the 32 bits case will also fail for the same reason.

If dma_set_mask_and_coherent() succeeds, 'dac_enabled' is known to be 1.

Simplify code and remove some dead code accordingly.

[1]: https://lkml.org/lkml/2021/6/7/398

Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Link: https://lore.kernel.org/r/e92b0c3a3c1574a97a4e6fd0c30225f10fa59d18.1641651693.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Christophe JAILLET and committed by
Jakub Kicinski
21ef11ea a72dc199

+1 -12
+1 -12
drivers/net/ethernet/myricom/myri10ge/myri10ge.c
··· 3742 3742 struct myri10ge_priv *mgp; 3743 3743 struct device *dev = &pdev->dev; 3744 3744 int status = -ENXIO; 3745 - int dac_enabled; 3746 3745 unsigned hdr_offset, ss_offset; 3747 3746 static int board_number; 3748 3747 ··· 3781 3782 3782 3783 myri10ge_mask_surprise_down(pdev); 3783 3784 pci_set_master(pdev); 3784 - dac_enabled = 1; 3785 3785 status = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 3786 - if (status != 0) { 3787 - dac_enabled = 0; 3788 - dev_err(&pdev->dev, 3789 - "64-bit pci address mask was refused, trying 32-bit\n"); 3790 - status = dma_set_mask(&pdev->dev, DMA_BIT_MASK(32)); 3791 - } 3792 3786 if (status != 0) { 3793 3787 dev_err(&pdev->dev, "Error %d setting DMA mask\n", status); 3794 3788 goto abort_with_enabled; ··· 3866 3874 /* fake NETIF_F_HW_VLAN_CTAG_RX for good GRO performance */ 3867 3875 netdev->hw_features |= NETIF_F_HW_VLAN_CTAG_RX; 3868 3876 3869 - netdev->features = netdev->hw_features; 3870 - 3871 - if (dac_enabled) 3872 - netdev->features |= NETIF_F_HIGHDMA; 3877 + netdev->features = netdev->hw_features | NETIF_F_HIGHDMA; 3873 3878 3874 3879 netdev->vlan_features |= mgp->features; 3875 3880 if (mgp->fw_ver_tiny < 37)