Skip to content

Commit ba7a0f4

Browse files
committed
Revert "net: mvpp2: Improve data types and use min()"
This reverts commit f7023b3. Russell indicates that assuming 32bits are sufficient isn't necessarily safe. Link: https://lore.kernel.org/[email protected]/ Signed-off-by: Jakub Kicinski <[email protected]>
1 parent 0970bf6 commit ba7a0f4

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

drivers/net/ethernet/marvell/mvpp2/mvpp2_main.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2766,29 +2766,29 @@ static void mvpp2_tx_pkts_coal_set(struct mvpp2_port *port,
27662766
}
27672767
}
27682768

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)
27702770
{
27712771
u64 tmp = (u64)clk_hz * usec;
27722772

27732773
do_div(tmp, USEC_PER_SEC);
27742774

2775-
return min(tmp, U32_MAX);
2775+
return tmp > U32_MAX ? U32_MAX : tmp;
27762776
}
27772777

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)
27792779
{
27802780
u64 tmp = (u64)cycles * USEC_PER_SEC;
27812781

27822782
do_div(tmp, clk_hz);
27832783

2784-
return min(tmp, U32_MAX);
2784+
return tmp > U32_MAX ? U32_MAX : tmp;
27852785
}
27862786

27872787
/* Set the time delay in usec before Rx interrupt */
27882788
static void mvpp2_rx_time_coal_set(struct mvpp2_port *port,
27892789
struct mvpp2_rx_queue *rxq)
27902790
{
2791-
u32 freq = port->priv->tclk;
2791+
unsigned long freq = port->priv->tclk;
27922792
u32 val = mvpp2_usec_to_cycles(rxq->time_coal, freq);
27932793

27942794
if (val > MVPP2_MAX_ISR_RX_THRESHOLD) {
@@ -2804,7 +2804,7 @@ static void mvpp2_rx_time_coal_set(struct mvpp2_port *port,
28042804

28052805
static void mvpp2_tx_time_coal_set(struct mvpp2_port *port)
28062806
{
2807-
u32 freq = port->priv->tclk;
2807+
unsigned long freq = port->priv->tclk;
28082808
u32 val = mvpp2_usec_to_cycles(port->tx_time_coal, freq);
28092809

28102810
if (val > MVPP2_MAX_ISR_TX_THRESHOLD) {

0 commit comments

Comments
 (0)