Skip to content

Commit 1e9614c

Browse files
Michael ChanPaolo Abeni
authored andcommitted
bnxt_en: Refactor bnxt_ptp_init()
Instead of passing the 2nd parameter phc_cfg to bnxt_ptp_init(). Store it in bp->ptp_cfg so that the caller doesn't need to know what the value should be. In the next patch, we'll need to call bnxt_ptp_init() in bnxt_resume() and this will make it easier. Reviewed-by: Somnath Kotur <somnath.kotur@broadcom.com> Reviewed-by: Pavan Chebbi <pavan.chebbi@broadcom.com> Reviewed-by: Kalesh AP <kalesh-anakkur.purayil@broadcom.com> Signed-off-by: Michael Chan <michael.chan@broadcom.com> Signed-off-by: Paolo Abeni <pabeni@redhat.com>
1 parent 3051a77 commit 1e9614c

File tree

3 files changed

+7
-6
lines changed

3 files changed

+7
-6
lines changed

drivers/net/ethernet/broadcom/bnxt/bnxt.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -9296,7 +9296,6 @@ static int __bnxt_hwrm_ptp_qcfg(struct bnxt *bp)
92969296
struct hwrm_port_mac_ptp_qcfg_output *resp;
92979297
struct hwrm_port_mac_ptp_qcfg_input *req;
92989298
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
9299-
bool phc_cfg;
93009299
u8 flags;
93019300
int rc;
93029301

@@ -9343,8 +9342,9 @@ static int __bnxt_hwrm_ptp_qcfg(struct bnxt *bp)
93439342
rc = -ENODEV;
93449343
goto exit;
93459344
}
9346-
phc_cfg = (flags & PORT_MAC_PTP_QCFG_RESP_FLAGS_RTC_CONFIGURED) != 0;
9347-
rc = bnxt_ptp_init(bp, phc_cfg);
9345+
ptp->rtc_configured =
9346+
(flags & PORT_MAC_PTP_QCFG_RESP_FLAGS_RTC_CONFIGURED) != 0;
9347+
rc = bnxt_ptp_init(bp);
93489348
if (rc)
93499349
netdev_warn(bp->dev, "PTP initialization failed.\n");
93509350
exit:

drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ static void bnxt_ptp_free(struct bnxt *bp)
10381038
}
10391039
}
10401040

1041-
int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg)
1041+
int bnxt_ptp_init(struct bnxt *bp)
10421042
{
10431043
struct bnxt_ptp_cfg *ptp = bp->ptp_cfg;
10441044
int rc;
@@ -1061,7 +1061,7 @@ int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg)
10611061

10621062
if (BNXT_PTP_USE_RTC(bp)) {
10631063
bnxt_ptp_timecounter_init(bp, false);
1064-
rc = bnxt_ptp_init_rtc(bp, phc_cfg);
1064+
rc = bnxt_ptp_init_rtc(bp, ptp->rtc_configured);
10651065
if (rc)
10661066
goto out;
10671067
} else {

drivers/net/ethernet/broadcom/bnxt/bnxt_ptp.h

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,6 +135,7 @@ struct bnxt_ptp_cfg {
135135
BNXT_PTP_MSG_PDELAY_REQ | \
136136
BNXT_PTP_MSG_PDELAY_RESP)
137137
u8 tx_tstamp_en:1;
138+
u8 rtc_configured:1;
138139
int rx_filter;
139140
u32 tstamp_filters;
140141

@@ -168,7 +169,7 @@ void bnxt_tx_ts_cmp(struct bnxt *bp, struct bnxt_napi *bnapi,
168169
struct tx_ts_cmp *tscmp);
169170
void bnxt_ptp_rtc_timecounter_init(struct bnxt_ptp_cfg *ptp, u64 ns);
170171
int bnxt_ptp_init_rtc(struct bnxt *bp, bool phc_cfg);
171-
int bnxt_ptp_init(struct bnxt *bp, bool phc_cfg);
172+
int bnxt_ptp_init(struct bnxt *bp);
172173
void bnxt_ptp_clear(struct bnxt *bp);
173174
static inline u64 bnxt_timecounter_cyc2time(struct bnxt_ptp_cfg *ptp, u64 ts)
174175
{

0 commit comments

Comments
 (0)