Commit 3f5c91b4 authored by Marc Kleine-Budde's avatar Marc Kleine-Budde

can: mcp251xfd: mcp251xfd_reg_invalid(): rename from mcp251xfd_osc_invalid()

This patch renames mcp251xfd_osc_invalid() to mcp251xfd_reg_invalid(),
as it will be used for other registers than the "osc" register in a
later patch.

This patch also moves this function to more towards the beginning of
the file, to be available for other functions, too.

Link: https://lore.kernel.org/all/20220207131047.282110-2-mkl@pengutronix.deSigned-off-by: default avatarMarc Kleine-Budde <mkl@pengutronix.de>
parent 2ae9856d
...@@ -178,6 +178,11 @@ static int mcp251xfd_clks_and_vdd_disable(const struct mcp251xfd_priv *priv) ...@@ -178,6 +178,11 @@ static int mcp251xfd_clks_and_vdd_disable(const struct mcp251xfd_priv *priv)
return 0; return 0;
} }
static inline bool mcp251xfd_reg_invalid(u32 reg)
{
return reg == 0x0 || reg == 0xffffffff;
}
static inline int static inline int
mcp251xfd_chip_get_mode(const struct mcp251xfd_priv *priv, u8 *mode) mcp251xfd_chip_get_mode(const struct mcp251xfd_priv *priv, u8 *mode)
{ {
...@@ -241,11 +246,6 @@ mcp251xfd_chip_set_mode_nowait(const struct mcp251xfd_priv *priv, ...@@ -241,11 +246,6 @@ mcp251xfd_chip_set_mode_nowait(const struct mcp251xfd_priv *priv,
return __mcp251xfd_chip_set_mode(priv, mode_req, true); return __mcp251xfd_chip_set_mode(priv, mode_req, true);
} }
static inline bool mcp251xfd_osc_invalid(u32 reg)
{
return reg == 0x0 || reg == 0xffffffff;
}
static int mcp251xfd_chip_clock_enable(const struct mcp251xfd_priv *priv) static int mcp251xfd_chip_clock_enable(const struct mcp251xfd_priv *priv)
{ {
u32 osc, osc_reference, osc_mask; u32 osc, osc_reference, osc_mask;
...@@ -274,7 +274,7 @@ static int mcp251xfd_chip_clock_enable(const struct mcp251xfd_priv *priv) ...@@ -274,7 +274,7 @@ static int mcp251xfd_chip_clock_enable(const struct mcp251xfd_priv *priv)
(osc & osc_mask) == osc_reference, (osc & osc_mask) == osc_reference,
MCP251XFD_OSC_STAB_SLEEP_US, MCP251XFD_OSC_STAB_SLEEP_US,
MCP251XFD_OSC_STAB_TIMEOUT_US); MCP251XFD_OSC_STAB_TIMEOUT_US);
if (mcp251xfd_osc_invalid(osc)) { if (mcp251xfd_reg_invalid(osc)) {
netdev_err(priv->ndev, netdev_err(priv->ndev,
"Failed to detect %s (osc=0x%08x).\n", "Failed to detect %s (osc=0x%08x).\n",
mcp251xfd_get_model_str(priv), osc); mcp251xfd_get_model_str(priv), osc);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment