net: atlantic: simplify hw_get_fw_version() usage
authorNikita Danilov <ndanilov@marvell.com>
Thu, 30 Apr 2020 08:04:33 +0000 (11:04 +0300)
committerDavid S. Miller <davem@davemloft.net>
Fri, 1 May 2020 22:37:58 +0000 (15:37 -0700)
hw_get_fw_version() never fails, so this patch simplifies its
usage by utilizing return value instead of output argument.

Signed-off-by: Nikita Danilov <ndanilov@marvell.com>
Signed-off-by: Mark Starovoytov <mstarovoitov@marvell.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
drivers/net/ethernet/aquantia/atlantic/aq_hw.h
drivers/net/ethernet/aquantia/atlantic/aq_nic.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h

index 84abce29d5903c5190c1efe2845141f34ba2757c..c0dada1075cf484c4d06f5424f4f500c4050f80d 100644 (file)
@@ -259,7 +259,7 @@ struct aq_hw_ops {
 
        struct aq_stats_s *(*hw_get_hw_stats)(struct aq_hw_s *self);
 
-       int (*hw_get_fw_version)(struct aq_hw_s *self, u32 *fw_version);
+       u32 (*hw_get_fw_version)(struct aq_hw_s *self);
 
        int (*hw_set_offload)(struct aq_hw_s *self,
                              struct aq_nic_cfg_s *aq_nic_cfg);
index 7f4d8abab951298483f5e2de9688fd1fcd54c1d5..57102f35e9f3591acb676cf28e1d952d4f88f048 100644 (file)
@@ -1032,11 +1032,7 @@ struct aq_nic_cfg_s *aq_nic_get_cfg(struct aq_nic_s *self)
 
 u32 aq_nic_get_fw_version(struct aq_nic_s *self)
 {
-       u32 fw_version = 0U;
-
-       self->aq_hw_ops->hw_get_fw_version(self->aq_hw, &fw_version);
-
-       return fw_version;
+       return self->aq_hw_ops->hw_get_fw_version(self->aq_hw);
 }
 
 int aq_nic_set_loopback(struct aq_nic_s *self)
index 7259bcb81e9bda947dfc55c9d9c2c44305dc9575..bd1712ca9ef20eca9ceb5accf1f08d338d0eb5a2 100644 (file)
@@ -70,7 +70,7 @@ int hw_atl_utils_initfw(struct aq_hw_s *self, const struct aq_fw_ops **fw_ops)
        hw_atl_utils_hw_chip_features_init(self,
                                           &self->chip_features);
 
-       hw_atl_utils_get_fw_version(self, &self->fw_ver_actual);
+       self->fw_ver_actual = hw_atl_utils_get_fw_version(self);
 
        if (hw_atl_utils_ver_match(HW_ATL_FW_VER_1X,
                                   self->fw_ver_actual) == 0) {
@@ -915,11 +915,9 @@ int hw_atl_utils_hw_get_regs(struct aq_hw_s *self,
        return 0;
 }
 
-int hw_atl_utils_get_fw_version(struct aq_hw_s *self, u32 *fw_version)
+u32 hw_atl_utils_get_fw_version(struct aq_hw_s *self)
 {
-       *fw_version = aq_hw_read_reg(self, 0x18U);
-
-       return 0;
+       return aq_hw_read_reg(self, HW_ATL_MPI_FW_VERSION);
 }
 
 static int aq_fw1x_set_wake_magic(struct aq_hw_s *self, bool wol_enabled,
index b1551391463632ac4c2b1db7febd869308cd4453..086627a96746dbac70f0371f33cd53cd5757e4a0 100644 (file)
@@ -622,7 +622,7 @@ int hw_atl_utils_hw_set_power(struct aq_hw_s *self,
 
 int hw_atl_utils_hw_deinit(struct aq_hw_s *self);
 
-int hw_atl_utils_get_fw_version(struct aq_hw_s *self, u32 *fw_version);
+u32 hw_atl_utils_get_fw_version(struct aq_hw_s *self);
 
 int hw_atl_utils_update_stats(struct aq_hw_s *self);