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

myri10ge: fix most sparse warnings

- convert remaining htonl/ntohl +__raw_read/__raw_writel to
swab32 + readl/writel
- add missing __iomem qualifier in myri10ge_open()
- fix dubious: x & !y warning by switching from logical to bitwise not

The swab32 conversion fixes a bug in myri10ge_led() where
big-endian machines would write the wrong pattern.

The only remaining warning (lock context imbalance) is due to
the use of __netif_tx_trylock(), and cannot easily be fixed.

Signed-off-by: Andrew Gallatin <gallatin@myri.com>
Signed-off-by: David S. Miller <davem@davemloft.net>

authored by

Andrew Gallatin and committed by
David S. Miller
59e955ed 50426b59

+5 -5
+5 -5
drivers/net/ethernet/myricom/myri10ge/myri10ge.c
··· 1885 1885 } 1886 1886 if (!on) 1887 1887 pattern = swab32(readl(mgp->sram + pattern_off + 4)); 1888 - writel(htonl(pattern), mgp->sram + pattern_off); 1888 + writel(swab32(pattern), mgp->sram + pattern_off); 1889 1889 return 0; 1890 1890 } 1891 1891 ··· 2294 2294 struct myri10ge_priv *mgp = netdev_priv(dev); 2295 2295 struct myri10ge_cmd cmd; 2296 2296 int i, status, big_pow2, slice; 2297 - u8 *itable; 2297 + u8 __iomem *itable; 2298 2298 2299 2299 if (mgp->running != MYRI10GE_ETH_STOPPED) 2300 2300 return -EBUSY; ··· 2757 2757 flags_next |= next_is_first * 2758 2758 MXGEFW_FLAGS_FIRST; 2759 2759 rdma_count |= -(chop | next_is_first); 2760 - rdma_count += chop & !next_is_first; 2760 + rdma_count += chop & ~next_is_first; 2761 2761 } else if (likely(cum_len_next >= 0)) { /* header ends */ 2762 2762 int small; 2763 2763 ··· 3836 3836 goto abort_with_mtrr; 3837 3837 } 3838 3838 hdr_offset = 3839 - ntohl(__raw_readl(mgp->sram + MCP_HEADER_PTR_OFFSET)) & 0xffffc; 3839 + swab32(readl(mgp->sram + MCP_HEADER_PTR_OFFSET)) & 0xffffc; 3840 3840 ss_offset = hdr_offset + offsetof(struct mcp_gen_header, string_specs); 3841 - mgp->sram_size = ntohl(__raw_readl(mgp->sram + ss_offset)); 3841 + mgp->sram_size = swab32(readl(mgp->sram + ss_offset)); 3842 3842 if (mgp->sram_size > mgp->board_span || 3843 3843 mgp->sram_size <= MYRI10GE_FW_OFFSET) { 3844 3844 dev_err(&pdev->dev,