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

net/qla3xxx: Remove useless DMA-32 fallback configuration

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

So, if dma_set_mask_and_coherent() succeeds, 'pci_using_dac' 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/3011689e8c77d49d7e44509d5a8241320ec408c5.1641754134.git.christophe.jaillet@wanadoo.fr
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

authored by

Christophe JAILLET and committed by
Jakub Kicinski
0959a82a 7ac2d77c

+3 -8
+3 -8
drivers/net/ethernet/qlogic/qla3xxx.c
··· 3750 3750 struct net_device *ndev = NULL; 3751 3751 struct ql3_adapter *qdev = NULL; 3752 3752 static int cards_found; 3753 - int pci_using_dac, err; 3753 + int err; 3754 3754 3755 3755 err = pci_enable_device(pdev); 3756 3756 if (err) { ··· 3766 3766 3767 3767 pci_set_master(pdev); 3768 3768 3769 - if (!dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64))) 3770 - pci_using_dac = 1; 3771 - else if (!(err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(32)))) 3772 - pci_using_dac = 0; 3773 - 3769 + err = dma_set_mask_and_coherent(&pdev->dev, DMA_BIT_MASK(64)); 3774 3770 if (err) { 3775 3771 pr_err("%s no usable DMA configuration\n", pci_name(pdev)); 3776 3772 goto err_out_free_regions; ··· 3793 3797 3794 3798 qdev->msg_enable = netif_msg_init(debug, default_msg); 3795 3799 3796 - if (pci_using_dac) 3797 - ndev->features |= NETIF_F_HIGHDMA; 3800 + ndev->features |= NETIF_F_HIGHDMA; 3798 3801 if (qdev->device_id == QL3032_DEVICE_ID) 3799 3802 ndev->features |= NETIF_F_IP_CSUM | NETIF_F_SG; 3800 3803