diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-25 23:30:04 +0100 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2016-12-25 23:30:04 +0100 |
commit | 3ddc76dfc786cc6f87852693227fb0b1f124f807 (patch) | |
tree | 8192b4721e05cf6823087f9696db8c0c8f144b02 /drivers/net | |
parent | Merge branch 'smp-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/ker... (diff) | |
parent | ktime: Get rid of ktime_equal() (diff) | |
download | linux-3ddc76dfc786cc6f87852693227fb0b1f124f807.tar.xz linux-3ddc76dfc786cc6f87852693227fb0b1f124f807.zip |
Merge branch 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
Pull timer type cleanups from Thomas Gleixner:
"This series does a tree wide cleanup of types related to
timers/timekeeping.
- Get rid of cycles_t and use a plain u64. The type is not really
helpful and caused more confusion than clarity
- Get rid of the ktime union. The union has become useless as we use
the scalar nanoseconds storage unconditionally now. The 32bit
timespec alike storage got removed due to the Y2038 limitations
some time ago.
That leaves the odd union access around for no reason. Clean it up.
Both changes have been done with coccinelle and a small amount of
manual mopping up"
* 'timers-urgent-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip:
ktime: Get rid of ktime_equal()
ktime: Cleanup ktime_set() usage
ktime: Get rid of the union
clocksource: Use a plain u64 instead of cycle_t
Diffstat (limited to 'drivers/net')
21 files changed, 41 insertions, 43 deletions
diff --git a/drivers/net/can/softing/softing_fw.c b/drivers/net/can/softing/softing_fw.c index 52fe50725d74..4063215c9b54 100644 --- a/drivers/net/can/softing/softing_fw.c +++ b/drivers/net/can/softing/softing_fw.c @@ -390,7 +390,7 @@ static void softing_initialize_timestamp(struct softing *card) ovf = 0x100000000ULL * 16; do_div(ovf, card->pdat->freq ?: 16); - card->ts_overflow = ktime_add_us(ktime_set(0, 0), ovf); + card->ts_overflow = ktime_add_us(0, ovf); } ktime_t softing_raw2ktime(struct softing *card, u32 raw) @@ -647,7 +647,7 @@ int softing_startstop(struct net_device *dev, int up) open_candev(netdev); if (dev != netdev) { /* notify other busses on the restart */ - softing_netdev_rx(netdev, &msg, ktime_set(0, 0)); + softing_netdev_rx(netdev, &msg, 0); ++priv->can.can_stats.restarts; } netif_wake_queue(netdev); diff --git a/drivers/net/can/softing/softing_main.c b/drivers/net/can/softing/softing_main.c index 7621f91a8a20..5f64deec9f6c 100644 --- a/drivers/net/can/softing/softing_main.c +++ b/drivers/net/can/softing/softing_main.c @@ -192,7 +192,7 @@ static int softing_handle_1(struct softing *card) /* a dead bus has no overflows */ continue; ++netdev->stats.rx_over_errors; - softing_netdev_rx(netdev, &msg, ktime_set(0, 0)); + softing_netdev_rx(netdev, &msg, 0); } /* prepare for other use */ memset(&msg, 0, sizeof(msg)); diff --git a/drivers/net/ethernet/amd/xgbe/xgbe-ptp.c b/drivers/net/ethernet/amd/xgbe/xgbe-ptp.c index b03e4f58d02e..a533a6cc2d53 100644 --- a/drivers/net/ethernet/amd/xgbe/xgbe-ptp.c +++ b/drivers/net/ethernet/amd/xgbe/xgbe-ptp.c @@ -122,7 +122,7 @@ #include "xgbe.h" #include "xgbe-common.h" -static cycle_t xgbe_cc_read(const struct cyclecounter *cc) +static u64 xgbe_cc_read(const struct cyclecounter *cc) { struct xgbe_prv_data *pdata = container_of(cc, struct xgbe_prv_data, diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c index 688617ac8c29..d8d06fdfc42b 100644 --- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c +++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c @@ -15223,7 +15223,7 @@ void bnx2x_set_rx_ts(struct bnx2x *bp, struct sk_buff *skb) } /* Read the PHC */ -static cycle_t bnx2x_cyclecounter_read(const struct cyclecounter *cc) +static u64 bnx2x_cyclecounter_read(const struct cyclecounter *cc) { struct bnx2x *bp = container_of(cc, struct bnx2x, cyclecounter); int port = BP_PORT(bp); diff --git a/drivers/net/ethernet/ec_bhf.c b/drivers/net/ethernet/ec_bhf.c index 57650953ff83..7bf78a0d322c 100644 --- a/drivers/net/ethernet/ec_bhf.c +++ b/drivers/net/ethernet/ec_bhf.c @@ -253,7 +253,7 @@ static enum hrtimer_restart ec_bhf_timer_fun(struct hrtimer *timer) if (!netif_running(priv->net_dev)) return HRTIMER_NORESTART; - hrtimer_forward_now(timer, ktime_set(0, polling_frequency)); + hrtimer_forward_now(timer, polling_frequency); return HRTIMER_RESTART; } @@ -427,8 +427,7 @@ static int ec_bhf_open(struct net_device *net_dev) hrtimer_init(&priv->hrtimer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); priv->hrtimer.function = ec_bhf_timer_fun; - hrtimer_start(&priv->hrtimer, ktime_set(0, polling_frequency), - HRTIMER_MODE_REL); + hrtimer_start(&priv->hrtimer, polling_frequency, HRTIMER_MODE_REL); return 0; diff --git a/drivers/net/ethernet/freescale/fec_ptp.c b/drivers/net/ethernet/freescale/fec_ptp.c index f9e74461bdc0..6ebad3fac81d 100644 --- a/drivers/net/ethernet/freescale/fec_ptp.c +++ b/drivers/net/ethernet/freescale/fec_ptp.c @@ -230,7 +230,7 @@ static int fec_ptp_enable_pps(struct fec_enet_private *fep, uint enable) * cyclecounter structure used to construct a ns counter from the * arbitrary fixed point registers */ -static cycle_t fec_ptp_read(const struct cyclecounter *cc) +static u64 fec_ptp_read(const struct cyclecounter *cc) { struct fec_enet_private *fep = container_of(cc, struct fec_enet_private, cc); diff --git a/drivers/net/ethernet/intel/e1000e/netdev.c b/drivers/net/ethernet/intel/e1000e/netdev.c index ffcf35af4881..eccf1da9356b 100644 --- a/drivers/net/ethernet/intel/e1000e/netdev.c +++ b/drivers/net/ethernet/intel/e1000e/netdev.c @@ -4305,24 +4305,24 @@ void e1000e_reinit_locked(struct e1000_adapter *adapter) /** * e1000e_sanitize_systim - sanitize raw cycle counter reads * @hw: pointer to the HW structure - * @systim: cycle_t value read, sanitized and returned + * @systim: time value read, sanitized and returned * * Errata for 82574/82583 possible bad bits read from SYSTIMH/L: * check to see that the time is incrementing at a reasonable * rate and is a multiple of incvalue. **/ -static cycle_t e1000e_sanitize_systim(struct e1000_hw *hw, cycle_t systim) +static u64 e1000e_sanitize_systim(struct e1000_hw *hw, u64 systim) { u64 time_delta, rem, temp; - cycle_t systim_next; + u64 systim_next; u32 incvalue; int i; incvalue = er32(TIMINCA) & E1000_TIMINCA_INCVALUE_MASK; for (i = 0; i < E1000_MAX_82574_SYSTIM_REREADS; i++) { /* latch SYSTIMH on read of SYSTIML */ - systim_next = (cycle_t)er32(SYSTIML); - systim_next |= (cycle_t)er32(SYSTIMH) << 32; + systim_next = (u64)er32(SYSTIML); + systim_next |= (u64)er32(SYSTIMH) << 32; time_delta = systim_next - systim; temp = time_delta; @@ -4342,13 +4342,13 @@ static cycle_t e1000e_sanitize_systim(struct e1000_hw *hw, cycle_t systim) * e1000e_cyclecounter_read - read raw cycle counter (used by time counter) * @cc: cyclecounter structure **/ -static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc) +static u64 e1000e_cyclecounter_read(const struct cyclecounter *cc) { struct e1000_adapter *adapter = container_of(cc, struct e1000_adapter, cc); struct e1000_hw *hw = &adapter->hw; u32 systimel, systimeh; - cycle_t systim; + u64 systim; /* SYSTIMH latching upon SYSTIML read does not work well. * This means that if SYSTIML overflows after we read it but before * we read SYSTIMH, the value of SYSTIMH has been incremented and we @@ -4368,8 +4368,8 @@ static cycle_t e1000e_cyclecounter_read(const struct cyclecounter *cc) systimel = systimel_2; } } - systim = (cycle_t)systimel; - systim |= (cycle_t)systimeh << 32; + systim = (u64)systimel; + systim |= (u64)systimeh << 32; if (adapter->flags2 & FLAG2_CHECK_SYSTIM_OVERFLOW) systim = e1000e_sanitize_systim(hw, systim); diff --git a/drivers/net/ethernet/intel/e1000e/ptp.c b/drivers/net/ethernet/intel/e1000e/ptp.c index ad03763e009a..34cc3be0df8e 100644 --- a/drivers/net/ethernet/intel/e1000e/ptp.c +++ b/drivers/net/ethernet/intel/e1000e/ptp.c @@ -127,8 +127,8 @@ static int e1000e_phc_get_syncdevicetime(ktime_t *device, unsigned long flags; int i; u32 tsync_ctrl; - cycle_t dev_cycles; - cycle_t sys_cycles; + u64 dev_cycles; + u64 sys_cycles; tsync_ctrl = er32(TSYNCTXCTL); tsync_ctrl |= E1000_TSYNCTXCTL_START_SYNC | diff --git a/drivers/net/ethernet/intel/igb/igb_ptp.c b/drivers/net/ethernet/intel/igb/igb_ptp.c index c30eea8399a7..c4477552ce9e 100644 --- a/drivers/net/ethernet/intel/igb/igb_ptp.c +++ b/drivers/net/ethernet/intel/igb/igb_ptp.c @@ -77,7 +77,7 @@ static void igb_ptp_tx_hwtstamp(struct igb_adapter *adapter); /* SYSTIM read access for the 82576 */ -static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc) +static u64 igb_ptp_read_82576(const struct cyclecounter *cc) { struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc); struct e1000_hw *hw = &igb->hw; @@ -94,7 +94,7 @@ static cycle_t igb_ptp_read_82576(const struct cyclecounter *cc) } /* SYSTIM read access for the 82580 */ -static cycle_t igb_ptp_read_82580(const struct cyclecounter *cc) +static u64 igb_ptp_read_82580(const struct cyclecounter *cc) { struct igb_adapter *igb = container_of(cc, struct igb_adapter, cc); struct e1000_hw *hw = &igb->hw; diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c index a92277683a64..1efb404431e9 100644 --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_ptp.c @@ -245,7 +245,7 @@ static void ixgbe_ptp_setup_sdp_x540(struct ixgbe_adapter *adapter) * result of SYSTIME is 32bits of "billions of cycles" and 32 bits of * "cycles", rather than seconds and nanoseconds. */ -static cycle_t ixgbe_ptp_read_X550(const struct cyclecounter *hw_cc) +static u64 ixgbe_ptp_read_X550(const struct cyclecounter *hw_cc) { struct ixgbe_adapter *adapter = container_of(hw_cc, struct ixgbe_adapter, hw_cc); @@ -282,7 +282,7 @@ static cycle_t ixgbe_ptp_read_X550(const struct cyclecounter *hw_cc) * cyclecounter structure used to construct a ns counter from the * arbitrary fixed point registers */ -static cycle_t ixgbe_ptp_read_82599(const struct cyclecounter *cc) +static u64 ixgbe_ptp_read_82599(const struct cyclecounter *cc) { struct ixgbe_adapter *adapter = container_of(cc, struct ixgbe_adapter, hw_cc); diff --git a/drivers/net/ethernet/marvell/mvpp2.c b/drivers/net/ethernet/marvell/mvpp2.c index cda04b3126bc..4fe430ceb194 100644 --- a/drivers/net/ethernet/marvell/mvpp2.c +++ b/drivers/net/ethernet/marvell/mvpp2.c @@ -4913,7 +4913,7 @@ static void mvpp2_timer_set(struct mvpp2_port_pcpu *port_pcpu) if (!port_pcpu->timer_scheduled) { port_pcpu->timer_scheduled = true; - interval = ktime_set(0, MVPP2_TXDONE_HRTIMER_PERIOD_NS); + interval = MVPP2_TXDONE_HRTIMER_PERIOD_NS; hrtimer_start(&port_pcpu->tx_done_timer, interval, HRTIMER_MODE_REL_PINNED); } diff --git a/drivers/net/ethernet/mellanox/mlx4/en_clock.c b/drivers/net/ethernet/mellanox/mlx4/en_clock.c index a5fc46bbcbe2..015198c14fa8 100644 --- a/drivers/net/ethernet/mellanox/mlx4/en_clock.c +++ b/drivers/net/ethernet/mellanox/mlx4/en_clock.c @@ -38,7 +38,7 @@ /* mlx4_en_read_clock - read raw cycle counter (to be used by time counter) */ -static cycle_t mlx4_en_read_clock(const struct cyclecounter *tc) +static u64 mlx4_en_read_clock(const struct cyclecounter *tc) { struct mlx4_en_dev *mdev = container_of(tc, struct mlx4_en_dev, cycles); diff --git a/drivers/net/ethernet/mellanox/mlx4/main.c b/drivers/net/ethernet/mellanox/mlx4/main.c index b2ca8a635b2e..5e7840a7a33b 100644 --- a/drivers/net/ethernet/mellanox/mlx4/main.c +++ b/drivers/net/ethernet/mellanox/mlx4/main.c @@ -1823,10 +1823,10 @@ static void unmap_bf_area(struct mlx4_dev *dev) io_mapping_free(mlx4_priv(dev)->bf_mapping); } -cycle_t mlx4_read_clock(struct mlx4_dev *dev) +u64 mlx4_read_clock(struct mlx4_dev *dev) { u32 clockhi, clocklo, clockhi1; - cycle_t cycles; + u64 cycles; int i; struct mlx4_priv *priv = mlx4_priv(dev); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/en_clock.c b/drivers/net/ethernet/mellanox/mlx5/core/en_clock.c index 2cd8e56a573b..746a92c13644 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/en_clock.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/en_clock.c @@ -49,7 +49,7 @@ void mlx5e_fill_hwstamp(struct mlx5e_tstamp *tstamp, u64 timestamp, hwts->hwtstamp = ns_to_ktime(nsec); } -static cycle_t mlx5e_read_internal_timer(const struct cyclecounter *cc) +static u64 mlx5e_read_internal_timer(const struct cyclecounter *cc) { struct mlx5e_tstamp *tstamp = container_of(cc, struct mlx5e_tstamp, cycles); diff --git a/drivers/net/ethernet/mellanox/mlx5/core/main.c b/drivers/net/ethernet/mellanox/mlx5/core/main.c index 7b4c339a8a9a..54e5a786f191 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/main.c +++ b/drivers/net/ethernet/mellanox/mlx5/core/main.c @@ -557,7 +557,7 @@ int mlx5_core_disable_hca(struct mlx5_core_dev *dev, u16 func_id) return mlx5_cmd_exec(dev, in, sizeof(in), out, sizeof(out)); } -cycle_t mlx5_read_internal_timer(struct mlx5_core_dev *dev) +u64 mlx5_read_internal_timer(struct mlx5_core_dev *dev) { u32 timer_h, timer_h1, timer_l; @@ -567,7 +567,7 @@ cycle_t mlx5_read_internal_timer(struct mlx5_core_dev *dev) if (timer_h != timer_h1) /* wrap around */ timer_l = ioread32be(&dev->iseg->internal_timer_l); - return (cycle_t)timer_l | (cycle_t)timer_h1 << 32; + return (u64)timer_l | (u64)timer_h1 << 32; } static int mlx5_irq_set_affinity_hint(struct mlx5_core_dev *mdev, int i) diff --git a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h index e0a8fbdd1446..d4a99c9757cb 100644 --- a/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h +++ b/drivers/net/ethernet/mellanox/mlx5/core/mlx5_core.h @@ -106,7 +106,7 @@ int mlx5_modify_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy, int mlx5_destroy_scheduling_element_cmd(struct mlx5_core_dev *dev, u8 hierarchy, u32 element_id); int mlx5_wait_for_vf_pages(struct mlx5_core_dev *dev); -cycle_t mlx5_read_internal_timer(struct mlx5_core_dev *dev); +u64 mlx5_read_internal_timer(struct mlx5_core_dev *dev); u32 mlx5_get_msix_vec(struct mlx5_core_dev *dev, int vecidx); struct mlx5_eq *mlx5_eqn2eq(struct mlx5_core_dev *dev, int eqn); void mlx5_cq_tasklet_cb(unsigned long data); diff --git a/drivers/net/ethernet/ti/cpts.c b/drivers/net/ethernet/ti/cpts.c index 0c0d48e5bea4..32279d21c836 100644 --- a/drivers/net/ethernet/ti/cpts.c +++ b/drivers/net/ethernet/ti/cpts.c @@ -121,7 +121,7 @@ static int cpts_fifo_read(struct cpts *cpts, int match) return type == match ? 0 : -1; } -static cycle_t cpts_systim_read(const struct cyclecounter *cc) +static u64 cpts_systim_read(const struct cyclecounter *cc) { u64 val = 0; struct cpts_event *event; diff --git a/drivers/net/ethernet/tile/tilegx.c b/drivers/net/ethernet/tile/tilegx.c index 0aaf975bb347..2255f9a6f3bc 100644 --- a/drivers/net/ethernet/tile/tilegx.c +++ b/drivers/net/ethernet/tile/tilegx.c @@ -751,7 +751,7 @@ static void tile_net_schedule_tx_wake_timer(struct net_device *dev, &info->mpipe[instance].tx_wake[priv->echannel]; hrtimer_start(&tx_wake->timer, - ktime_set(0, TX_TIMER_DELAY_USEC * 1000UL), + TX_TIMER_DELAY_USEC * 1000UL, HRTIMER_MODE_REL_PINNED); } @@ -770,7 +770,7 @@ static void tile_net_schedule_egress_timer(void) if (!info->egress_timer_scheduled) { hrtimer_start(&info->egress_timer, - ktime_set(0, EGRESS_TIMER_DELAY_USEC * 1000UL), + EGRESS_TIMER_DELAY_USEC * 1000UL, HRTIMER_MODE_REL_PINNED); info->egress_timer_scheduled = true; } diff --git a/drivers/net/ieee802154/at86rf230.c b/drivers/net/ieee802154/at86rf230.c index 057025722e3d..46d53a6c8cf8 100644 --- a/drivers/net/ieee802154/at86rf230.c +++ b/drivers/net/ieee802154/at86rf230.c @@ -510,7 +510,7 @@ at86rf230_async_state_delay(void *context) case STATE_TRX_OFF: switch (ctx->to_state) { case STATE_RX_AACK_ON: - tim = ktime_set(0, c->t_off_to_aack * NSEC_PER_USEC); + tim = c->t_off_to_aack * NSEC_PER_USEC; /* state change from TRX_OFF to RX_AACK_ON to do a * calibration, we need to reset the timeout for the * next one. @@ -519,7 +519,7 @@ at86rf230_async_state_delay(void *context) goto change; case STATE_TX_ARET_ON: case STATE_TX_ON: - tim = ktime_set(0, c->t_off_to_tx_on * NSEC_PER_USEC); + tim = c->t_off_to_tx_on * NSEC_PER_USEC; /* state change from TRX_OFF to TX_ON or ARET_ON to do * a calibration, we need to reset the timeout for the * next one. @@ -539,8 +539,7 @@ at86rf230_async_state_delay(void *context) * to TX_ON or TRX_OFF. */ if (!force) { - tim = ktime_set(0, (c->t_frame + c->t_p_ack) * - NSEC_PER_USEC); + tim = (c->t_frame + c->t_p_ack) * NSEC_PER_USEC; goto change; } break; @@ -552,7 +551,7 @@ at86rf230_async_state_delay(void *context) case STATE_P_ON: switch (ctx->to_state) { case STATE_TRX_OFF: - tim = ktime_set(0, c->t_reset_to_off * NSEC_PER_USEC); + tim = c->t_reset_to_off * NSEC_PER_USEC; goto change; default: break; diff --git a/drivers/net/usb/cdc_ncm.c b/drivers/net/usb/cdc_ncm.c index 2d1a6f2e16ab..f317984f7536 100644 --- a/drivers/net/usb/cdc_ncm.c +++ b/drivers/net/usb/cdc_ncm.c @@ -1282,7 +1282,7 @@ static void cdc_ncm_tx_timeout_start(struct cdc_ncm_ctx *ctx) /* start timer, if not already started */ if (!(hrtimer_active(&ctx->tx_timer) || atomic_read(&ctx->stop))) hrtimer_start(&ctx->tx_timer, - ktime_set(0, ctx->timer_interval), + ctx->timer_interval, HRTIMER_MODE_REL); } diff --git a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c index 9f61293f1a56..f38c44061b5b 100644 --- a/drivers/net/wireless/ralink/rt2x00/rt2800usb.c +++ b/drivers/net/wireless/ralink/rt2x00/rt2800usb.c @@ -177,7 +177,7 @@ static bool rt2800usb_tx_sta_fifo_read_completed(struct rt2x00_dev *rt2x00dev, if (rt2800usb_txstatus_pending(rt2x00dev)) { /* Read register after 1 ms */ hrtimer_start(&rt2x00dev->txstatus_timer, - ktime_set(0, TXSTATUS_READ_INTERVAL), + TXSTATUS_READ_INTERVAL, HRTIMER_MODE_REL); return false; } @@ -204,7 +204,7 @@ static void rt2800usb_async_read_tx_status(struct rt2x00_dev *rt2x00dev) /* Read TX_STA_FIFO register after 2 ms */ hrtimer_start(&rt2x00dev->txstatus_timer, - ktime_set(0, 2*TXSTATUS_READ_INTERVAL), + 2 * TXSTATUS_READ_INTERVAL, HRTIMER_MODE_REL); } |