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

Configure Feed

Select the types of activity you want to include in your feed.

Revert "net: mvpp2: Improve data types and use min()"

This reverts commit f7023b3d697c6a7dfe2d9c70e0d8c2c580ccbd76.

Russell indicates that assuming 32bits are sufficient isn't
necessarily safe.

Link: https://lore.kernel.org/20240711154741.174745-1-thorsten.blum@toblux.com/
Signed-off-by: Jakub Kicinski <kuba@kernel.org>

+6 -6
+6 -6
drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c
··· 2766 2766 } 2767 2767 } 2768 2768 2769 - static u32 mvpp2_usec_to_cycles(u32 usec, u32 clk_hz) 2769 + static u32 mvpp2_usec_to_cycles(u32 usec, unsigned long clk_hz) 2770 2770 { 2771 2771 u64 tmp = (u64)clk_hz * usec; 2772 2772 2773 2773 do_div(tmp, USEC_PER_SEC); 2774 2774 2775 - return min(tmp, U32_MAX); 2775 + return tmp > U32_MAX ? U32_MAX : tmp; 2776 2776 } 2777 2777 2778 - static u32 mvpp2_cycles_to_usec(u32 cycles, u32 clk_hz) 2778 + static u32 mvpp2_cycles_to_usec(u32 cycles, unsigned long clk_hz) 2779 2779 { 2780 2780 u64 tmp = (u64)cycles * USEC_PER_SEC; 2781 2781 2782 2782 do_div(tmp, clk_hz); 2783 2783 2784 - return min(tmp, U32_MAX); 2784 + return tmp > U32_MAX ? U32_MAX : tmp; 2785 2785 } 2786 2786 2787 2787 /* Set the time delay in usec before Rx interrupt */ 2788 2788 static void mvpp2_rx_time_coal_set(struct mvpp2_port *port, 2789 2789 struct mvpp2_rx_queue *rxq) 2790 2790 { 2791 - u32 freq = port->priv->tclk; 2791 + unsigned long freq = port->priv->tclk; 2792 2792 u32 val = mvpp2_usec_to_cycles(rxq->time_coal, freq); 2793 2793 2794 2794 if (val > MVPP2_MAX_ISR_RX_THRESHOLD) { ··· 2804 2804 2805 2805 static void mvpp2_tx_time_coal_set(struct mvpp2_port *port) 2806 2806 { 2807 - u32 freq = port->priv->tclk; 2807 + unsigned long freq = port->priv->tclk; 2808 2808 u32 val = mvpp2_usec_to_cycles(port->tx_time_coal, freq); 2809 2809 2810 2810 if (val > MVPP2_MAX_ISR_TX_THRESHOLD) {