Commit b567edbf authored by Mark Starovoytov's avatar Mark Starovoytov Committed by David S. Miller

net: atlantic: align return value of ver_match function with function name

This patch aligns the return value of hw_atl_utils_ver_match function with
its name.
Change the return type to bool, because it's better aligned with the actual
usage. Return true when the version matches, false otherwise.
Signed-off-by: default avatarMark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: default avatarIgor Russkikh <irusskikh@marvell.com>
Signed-off-by: default avatarDavid S. Miller <davem@davemloft.net>
parent 11f3c1f5
...@@ -72,14 +72,11 @@ int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops) ...@@ -72,14 +72,11 @@ int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops)
self->fw_ver_actual = hw_atl_utils_get_fw_version(self); self->fw_ver_actual = hw_atl_utils_get_fw_version(self);
if (hw_atl_utils_ver_match(HW_ATL_FW_VER_1X, if (hw_atl_utils_ver_match(HW_ATL_FW_VER_1X, self->fw_ver_actual)) {
self->fw_ver_actual) == 0) {
*fw_ops = &aq_fw_1x_ops; *fw_ops = &aq_fw_1x_ops;
} else if (hw_atl_utils_ver_match(HW_ATL_FW_VER_2X, } else if (hw_atl_utils_ver_match(HW_ATL_FW_VER_2X, self->fw_ver_actual)) {
self->fw_ver_actual) == 0) {
*fw_ops = &aq_fw_2x_ops; *fw_ops = &aq_fw_2x_ops;
} else if (hw_atl_utils_ver_match(HW_ATL_FW_VER_3X, } else if (hw_atl_utils_ver_match(HW_ATL_FW_VER_3X, self->fw_ver_actual)) {
self->fw_ver_actual) == 0) {
*fw_ops = &aq_fw_2x_ops; *fw_ops = &aq_fw_2x_ops;
} else { } else {
aq_pr_err("Bad FW version detected: %x\n", aq_pr_err("Bad FW version detected: %x\n",
...@@ -262,9 +259,9 @@ int hw_atl_utils_soft_reset(struct aq_hw_s *self) ...@@ -262,9 +259,9 @@ int hw_atl_utils_soft_reset(struct aq_hw_s *self)
/* FW 1.x may bootup in an invalid POWER state (WOL feature). /* FW 1.x may bootup in an invalid POWER state (WOL feature).
* We should work around this by forcing its state back to DEINIT * We should work around this by forcing its state back to DEINIT
*/ */
if (!hw_atl_utils_ver_match(HW_ATL_FW_VER_1X, if (hw_atl_utils_ver_match(HW_ATL_FW_VER_1X,
aq_hw_read_reg(self, aq_hw_read_reg(self,
HW_ATL_MPI_FW_VERSION))) { HW_ATL_MPI_FW_VERSION))) {
int err = 0; int err = 0;
hw_atl_utils_mpi_set_state(self, MPI_DEINIT); hw_atl_utils_mpi_set_state(self, MPI_DEINIT);
...@@ -434,20 +431,20 @@ int hw_atl_write_fwsettings_dwords(struct aq_hw_s *self, u32 offset, u32 *p, ...@@ -434,20 +431,20 @@ int hw_atl_write_fwsettings_dwords(struct aq_hw_s *self, u32 offset, u32 *p,
p, cnt, MCP_AREA_SETTINGS); p, cnt, MCP_AREA_SETTINGS);
} }
int hw_atl_utils_ver_match(u32 ver_expected, u32 ver_actual) bool hw_atl_utils_ver_match(u32 ver_expected, u32 ver_actual)
{ {
const u32 dw_major_mask = 0xff000000U; const u32 dw_major_mask = 0xff000000U;
const u32 dw_minor_mask = 0x00ffffffU; const u32 dw_minor_mask = 0x00ffffffU;
int err = 0; bool ver_match;
err = (dw_major_mask & (ver_expected ^ ver_actual)) ? -EOPNOTSUPP : 0; ver_match = (dw_major_mask & (ver_expected ^ ver_actual)) ? false : true;
if (err < 0) if (!ver_match)
goto err_exit; goto err_exit;
err = ((dw_minor_mask & ver_expected) > (dw_minor_mask & ver_actual)) ? ver_match = ((dw_minor_mask & ver_expected) > (dw_minor_mask & ver_actual)) ?
-EOPNOTSUPP : 0; false : true;
err_exit: err_exit:
return err; return ver_match;
} }
static int hw_atl_utils_init_ucp(struct aq_hw_s *self, static int hw_atl_utils_init_ucp(struct aq_hw_s *self,
......
...@@ -635,7 +635,7 @@ int hw_atl_utils_fw_rpc_call(struct aq_hw_s *self, unsigned int rpc_size); ...@@ -635,7 +635,7 @@ int hw_atl_utils_fw_rpc_call(struct aq_hw_s *self, unsigned int rpc_size);
int hw_atl_utils_fw_rpc_wait(struct aq_hw_s *self, int hw_atl_utils_fw_rpc_wait(struct aq_hw_s *self,
struct hw_atl_utils_fw_rpc **rpc); struct hw_atl_utils_fw_rpc **rpc);
int hw_atl_utils_ver_match(u32 ver_expected, u32 ver_actual); bool hw_atl_utils_ver_match(u32 ver_expected, u32 ver_actual);
extern const struct aq_fw_ops aq_fw_1x_ops; extern const struct aq_fw_ops aq_fw_1x_ops;
extern const struct aq_fw_ops aq_fw_2x_ops; extern const struct aq_fw_ops aq_fw_2x_ops;
......
...@@ -36,8 +36,7 @@ int hw_atl2_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops) ...@@ -36,8 +36,7 @@ int hw_atl2_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops)
self->fw_ver_actual = hw_atl2_utils_get_fw_version(self); self->fw_ver_actual = hw_atl2_utils_get_fw_version(self);
if (hw_atl_utils_ver_match(HW_ATL2_FW_VER_1X, if (hw_atl_utils_ver_match(HW_ATL2_FW_VER_1X, self->fw_ver_actual)) {
self->fw_ver_actual) == 0) {
*fw_ops = &aq_a2_fw_ops; *fw_ops = &aq_a2_fw_ops;
} else { } else {
aq_pr_err("Bad FW version detected: %x, but continue\n", aq_pr_err("Bad FW version detected: %x, but continue\n",
......
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