[PATCH 06/27] bnx2x: Use timecounter_initialize interface
From: Sagar Arun Kamble
Date: Fri Dec 15 2017 - 02:35:39 EST
With new interface timecounter_initialize we can initialize timecounter
fields and underlying cyclecounter together. Update bnx2x timecounter
init with this new function.
Signed-off-by: Sagar Arun Kamble <sagar.a.kamble@xxxxxxxxx>
Cc: Richard Cochran <richardcochran@xxxxxxxxx>
Cc: Ariel Elior <ariel.elior@xxxxxxxxxx>
Cc: everest-linux-l2@xxxxxxxxxx
Cc: netdev@xxxxxxxxxxxxxxx
Cc: linux-kernel@xxxxxxxxxxxxxxx
---
drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c | 18 ++++++------------
1 file changed, 6 insertions(+), 12 deletions(-)
diff --git a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
index 83624ad..1e10a81 100644
--- a/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
+++ b/drivers/net/ethernet/broadcom/bnx2x/bnx2x_main.c
@@ -15269,15 +15269,6 @@ static u64 bnx2x_cyclecounter_read(const struct cyclecounter *cc)
return phc_cycles;
}
-static void bnx2x_init_cyclecounter(struct cyclecounter *cc)
-{
- memset(cc, 0, sizeof(*cc));
- cc->read = bnx2x_cyclecounter_read;
- cc->mask = CYCLECOUNTER_MASK(64);
- cc->shift = 0;
- cc->mult = 1;
-}
-
static int bnx2x_send_reset_timesync_ramrod(struct bnx2x *bp)
{
struct bnx2x_func_state_params func_params = {NULL};
@@ -15511,9 +15502,12 @@ void bnx2x_init_ptp(struct bnx2x *bp)
* unload / load (e.g. MTU change) while it is running.
*/
if (!bp->timecounter_init_done) {
- bnx2x_init_cyclecounter(&bp->timecounter.cc);
- timecounter_init(&bp->timecounter,
- ktime_to_ns(ktime_get_real()));
+ timecounter_initialize(&bp->timecounter,
+ bnx2x_cyclecounter_read,
+ CYCLECOUNTER_MASK(64),
+ 1,
+ 0,
+ ktime_to_ns(ktime_get_real()));
bp->timecounter_init_done = 1;
}
--
1.9.1