From: Min Li <min.li.xe@renesas.com>
To: richardcochran@gmail.com, lee.jones@linaro.org
Cc: linux-kernel@vger.kernel.org, netdev@vger.kernel.org,
Min Li <min.li.xe@renesas.com>
Subject: [PATCH net v5 3/3] ptp: clockmatrix: miscellaneous cosmetic change
Date: Wed, 11 May 2022 10:25:14 -0400 [thread overview]
Message-ID: <1652279114-25939-3-git-send-email-min.li.xe@renesas.com> (raw)
In-Reply-To: <1652279114-25939-1-git-send-email-min.li.xe@renesas.com>
suggested by Jakub Kicinski
Signed-off-by: Min Li <min.li.xe@renesas.com>
---
drivers/ptp/ptp_clockmatrix.c | 69 +++++++++++++------------------------------
1 file changed, 20 insertions(+), 49 deletions(-)
diff --git a/drivers/ptp/ptp_clockmatrix.c b/drivers/ptp/ptp_clockmatrix.c
index ea87487..4461635 100644
--- a/drivers/ptp/ptp_clockmatrix.c
+++ b/drivers/ptp/ptp_clockmatrix.c
@@ -261,17 +261,13 @@ static int arm_tod_read_trig_sel_refclk(struct idtcm_channel *channel, u8 ref)
if (err)
dev_err(idtcm->dev, "%s: err = %d", __func__, err);
-
return err;
}
static bool is_single_shot(u8 mask)
{
/* Treat single bit ToD masks as continuous trigger */
- if ((mask == 1) || (mask == 2) || (mask == 4) || (mask == 8))
- return false;
- else
- return true;
+ return mask <= 8 && is_power_of_2(mask);
}
static int idtcm_extts_enable(struct idtcm_channel *channel,
@@ -418,13 +414,10 @@ static int _idtcm_gettime_triggered(struct idtcm_channel *channel,
err = idtcm_read(idtcm, channel->tod_read_secondary,
TOD_READ_SECONDARY_BASE, buf, sizeof(buf));
-
if (err)
return err;
- err = char_array_to_timespec(buf, sizeof(buf), ts);
-
- return err;
+ return char_array_to_timespec(buf, sizeof(buf), ts);
}
static int _idtcm_gettime(struct idtcm_channel *channel,
@@ -456,9 +449,7 @@ static int _idtcm_gettime(struct idtcm_channel *channel,
if (err)
return err;
- err = char_array_to_timespec(buf, sizeof(buf), ts);
-
- return err;
+ return char_array_to_timespec(buf, sizeof(buf), ts);
}
static int idtcm_extts_check_channel(struct idtcm *idtcm, u8 todn)
@@ -500,13 +491,10 @@ static int _idtcm_gettime_immediate(struct idtcm_channel *channel,
err = idtcm_write(idtcm, channel->tod_read_primary,
tod_read_cmd, &val, sizeof(val));
-
if (err)
return err;
- err = _idtcm_gettime(channel, ts, 10);
-
- return err;
+ return _idtcm_gettime(channel, ts, 10);
}
static int _sync_pll_output(struct idtcm *idtcm,
@@ -631,9 +619,7 @@ static int _sync_pll_output(struct idtcm *idtcm,
/* Place master sync out of reset */
val &= ~(SYNCTRL1_MASTER_SYNC_RST);
- err = idtcm_write(idtcm, 0, sync_ctrl1, &val, sizeof(val));
-
- return err;
+ return idtcm_write(idtcm, 0, sync_ctrl1, &val, sizeof(val));
}
static int idtcm_sync_pps_output(struct idtcm_channel *channel)
@@ -917,7 +903,6 @@ static int _idtcm_settime(struct idtcm_channel *channel,
static int idtcm_set_phase_pull_in_offset(struct idtcm_channel *channel,
s32 offset_ns)
{
- int err;
int i;
struct idtcm *idtcm = channel->idtcm;
u8 buf[4];
@@ -927,16 +912,13 @@ static int idtcm_set_phase_pull_in_offset(struct idtcm_channel *channel,
offset_ns >>= 8;
}
- err = idtcm_write(idtcm, channel->dpll_phase_pull_in, PULL_IN_OFFSET,
- buf, sizeof(buf));
-
- return err;
+ return idtcm_write(idtcm, channel->dpll_phase_pull_in, PULL_IN_OFFSET,
+ buf, sizeof(buf));
}
static int idtcm_set_phase_pull_in_slope_limit(struct idtcm_channel *channel,
u32 max_ffo_ppb)
{
- int err;
u8 i;
struct idtcm *idtcm = channel->idtcm;
u8 buf[3];
@@ -949,10 +931,8 @@ static int idtcm_set_phase_pull_in_slope_limit(struct idtcm_channel *channel,
max_ffo_ppb >>= 8;
}
- err = idtcm_write(idtcm, channel->dpll_phase_pull_in,
- PULL_IN_SLOPE_LIMIT, buf, sizeof(buf));
-
- return err;
+ return idtcm_write(idtcm, channel->dpll_phase_pull_in,
+ PULL_IN_SLOPE_LIMIT, buf, sizeof(buf));
}
static int idtcm_start_phase_pull_in(struct idtcm_channel *channel)
@@ -991,9 +971,7 @@ static int do_phase_pull_in_fw(struct idtcm_channel *channel,
if (err)
return err;
- err = idtcm_start_phase_pull_in(channel);
-
- return err;
+ return idtcm_start_phase_pull_in(channel);
}
static int set_tod_write_overhead(struct idtcm_channel *channel)
@@ -1417,10 +1395,9 @@ static int idtcm_set_pll_mode(struct idtcm_channel *channel,
dpll_mode |= (mode << PLL_MODE_SHIFT);
- err = idtcm_write(idtcm, channel->dpll_n,
- IDTCM_FW_REG(idtcm->fw_ver, V520, DPLL_MODE),
- &dpll_mode, sizeof(dpll_mode));
- return err;
+ return idtcm_write(idtcm, channel->dpll_n,
+ IDTCM_FW_REG(idtcm->fw_ver, V520, DPLL_MODE),
+ &dpll_mode, sizeof(dpll_mode));
}
static int idtcm_get_manual_reference(struct idtcm_channel *channel,
@@ -1460,11 +1437,9 @@ static int idtcm_set_manual_reference(struct idtcm_channel *channel,
dpll_manu_ref_cfg |= (ref << MANUAL_REFERENCE_SHIFT);
- err = idtcm_write(idtcm, channel->dpll_ctrl_n,
- DPLL_CTRL_DPLL_MANU_REF_CFG,
- &dpll_manu_ref_cfg, sizeof(dpll_manu_ref_cfg));
-
- return err;
+ return idtcm_write(idtcm, channel->dpll_ctrl_n,
+ DPLL_CTRL_DPLL_MANU_REF_CFG,
+ &dpll_manu_ref_cfg, sizeof(dpll_manu_ref_cfg));
}
static int configure_dpll_mode_write_frequency(struct idtcm_channel *channel)
@@ -1746,10 +1721,8 @@ static int _idtcm_adjphase(struct idtcm_channel *channel, s32 delta_ns)
phase_50ps >>= 8;
}
- err = idtcm_write(idtcm, channel->dpll_phase, DPLL_WR_PHASE,
- buf, sizeof(buf));
-
- return err;
+ return idtcm_write(idtcm, channel->dpll_phase, DPLL_WR_PHASE,
+ buf, sizeof(buf));
}
static int _idtcm_adjfine(struct idtcm_channel *channel, long scaled_ppm)
@@ -1790,10 +1763,8 @@ static int _idtcm_adjfine(struct idtcm_channel *channel, long scaled_ppm)
fcw >>= 8;
}
- err = idtcm_write(idtcm, channel->dpll_freq, DPLL_WR_FREQ,
- buf, sizeof(buf));
-
- return err;
+ return idtcm_write(idtcm, channel->dpll_freq, DPLL_WR_FREQ,
+ buf, sizeof(buf));
}
static int idtcm_gettime(struct ptp_clock_info *ptp, struct timespec64 *ts)
--
2.7.4
next prev parent reply other threads:[~2022-05-11 14:27 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-05-11 14:25 [PATCH net v5 1/3] ptp: ptp_clockmatrix: Add PTP_CLK_REQ_EXTTS support Min Li
2022-05-11 14:25 ` [PATCH net v5 2/3] ptp: ptp_clockmatrix: return -EBUSY if phase pull-in is in progress Min Li
2022-05-11 14:25 ` Min Li [this message]
2022-05-12 0:37 ` [PATCH net v5 3/3] ptp: clockmatrix: miscellaneous cosmetic change Jakub Kicinski
2022-05-12 3:12 ` Min Li
2022-05-12 16:03 ` Jakub Kicinski
2022-05-13 19:57 ` Min Li
2022-05-13 21:33 ` Jakub Kicinski
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1652279114-25939-3-git-send-email-min.li.xe@renesas.com \
--to=min.li.xe@renesas.com \
--cc=lee.jones@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=netdev@vger.kernel.org \
--cc=richardcochran@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).