]> git.baikalelectronics.ru Git - kernel.git/commitdiff
net/fungible: Fix reference to __udivdi3 on 32b builds
authorDimitris Michailidis <d.michailidis@fungible.com>
Fri, 1 Apr 2022 23:24:11 +0000 (16:24 -0700)
committerJakub Kicinski <kuba@kernel.org>
Sat, 2 Apr 2022 04:32:30 +0000 (21:32 -0700)
32b builds with CONFIG_PHYS_ADDR_T_64BIT=y, such as i386 PAE,
raise a linker error due to a 64b division:

ld: drivers/net/ethernet/fungible/funcore/fun_dev.o: in function
`fun_dev_enable':
(.text+0xe1a): undefined reference to `__udivdi3'

The divisor in the offendinng expression is a power of 2. Change it to
use an explicit right shift.

Fixes: fd84ed31b312 ("net/fungible: Add service module for Fungible drivers")
Reported-by: Randy Dunlap <rdunlap@infradead.org>
Signed-off-by: Dimitris Michailidis <dmichail@fungible.com>
Link: https://lore.kernel.org/r/20220401232411.313881-1-dmichail@fungible.com
Signed-off-by: Jakub Kicinski <kuba@kernel.org>
drivers/net/ethernet/fungible/funcore/fun_dev.c

index 5d7aef73df61004ef7faeb0ebeacc8e8638c30e0..fb5120d90f26ac271c09876d59f6b8a4d87e5662 100644 (file)
@@ -586,8 +586,8 @@ static int fun_get_dev_limits(struct fun_dev *fdev)
        /* Calculate the max QID based on SQ/CQ/doorbell counts.
         * SQ/CQ doorbells alternate.
         */
-       num_dbs = (pci_resource_len(pdev, 0) - NVME_REG_DBS) /
-                 (fdev->db_stride * 4);
+       num_dbs = (pci_resource_len(pdev, 0) - NVME_REG_DBS) >>
+                 (2 + NVME_CAP_STRIDE(fdev->cap_reg));
        fdev->max_qid = min3(cq_count, sq_count, num_dbs / 2) - 1;
        fdev->kern_end_qid = fdev->max_qid + 1;
        return 0;