]> asedeno.scripts.mit.edu Git - linux.git/commitdiff
net: aquantia: Add const qualifiers for hardware ops tables
authorIgor Russkikh <igor.russkikh@aquantia.com>
Mon, 15 Jan 2018 13:41:17 +0000 (16:41 +0300)
committerDavid S. Miller <davem@davemloft.net>
Tue, 16 Jan 2018 19:40:00 +0000 (14:40 -0500)
Hardware operations and capabilities tables are constants and
never changed. Declare these as constants.

Signed-off-by: Igor Russkikh <igor.russkikh@aquantia.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
14 files changed:
drivers/net/ethernet/aquantia/atlantic/aq_hw.h
drivers/net/ethernet/aquantia/atlantic/aq_main.c
drivers/net/ethernet/aquantia/atlantic/aq_nic.c
drivers/net/ethernet/aquantia/atlantic/aq_nic.h
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.c
drivers/net/ethernet/aquantia/atlantic/aq_pci_func.h
drivers/net/ethernet/aquantia/atlantic/aq_vec.c
drivers/net/ethernet/aquantia/atlantic/aq_vec.h
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_a0.h
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_b0.h
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.c
drivers/net/ethernet/aquantia/atlantic/hw_atl/hw_atl_utils.h

index 2f7ecd6607de6d8959b54357e5ce33b2b3e3ceeb..cdd1acd417c2094049a049888bcf9fe8246a10a5 100644 (file)
@@ -196,7 +196,8 @@ struct aq_hw_ops {
                               struct aq_rss_parameters *rss_params);
 
        int (*hw_get_regs)(struct aq_hw_s *self,
-                          struct aq_hw_caps_s *aq_hw_caps, u32 *regs_buff);
+                          const struct aq_hw_caps_s *aq_hw_caps,
+                          u32 *regs_buff);
 
        int (*hw_update_stats)(struct aq_hw_s *self);
 
index 5d6c40d86775dd0189de49173210f4d38ee6934c..1b0399c37584609289864bc5f29a5dcb82d9fcc9 100644 (file)
@@ -35,9 +35,9 @@ MODULE_VERSION(AQ_CFG_DRV_VERSION);
 MODULE_AUTHOR(AQ_CFG_DRV_AUTHOR);
 MODULE_DESCRIPTION(AQ_CFG_DRV_DESC);
 
-static struct aq_hw_ops *aq_pci_probe_get_hw_ops_by_id(struct pci_dev *pdev)
+static const struct aq_hw_ops *aq_pci_probe_get_hw_ops_by_id(struct pci_dev *pdev)
 {
-       struct aq_hw_ops *ops = NULL;
+       const struct aq_hw_ops *ops = NULL;
 
        ops = hw_atl_a0_get_ops_by_id(pdev);
        if (!ops)
@@ -174,7 +174,7 @@ static const struct net_device_ops aq_ndev_ops = {
 static int aq_pci_probe(struct pci_dev *pdev,
                        const struct pci_device_id *pci_id)
 {
-       struct aq_hw_ops *aq_hw_ops = NULL;
+       const struct aq_hw_ops *aq_hw_ops = NULL;
        struct aq_pci_func_s *aq_pci_func = NULL;
        int err = 0;
 
index f934b095bb195993259bd41e6b4febb467856572..f210e62376791fc41b2fb50d76e900c77da82ed0 100644 (file)
@@ -295,7 +295,7 @@ int aq_nic_ndev_register(struct aq_nic_s *self)
 
 int aq_nic_ndev_init(struct aq_nic_s *self)
 {
-       struct aq_hw_caps_s *aq_hw_caps = self->aq_nic_cfg.aq_hw_caps;
+       const struct aq_hw_caps_s *aq_hw_caps = self->aq_nic_cfg.aq_hw_caps;
        struct aq_nic_cfg_s *aq_nic_cfg = &self->aq_nic_cfg;
 
        self->ndev->hw_features |= aq_hw_caps->hw_features;
index be3b4ce49749e1db364f3d12fc3f8c0187d251d1..715b53c689ef512fbfbd2e9fc7ad35a05cf05fef 100644 (file)
@@ -34,7 +34,7 @@ struct aq_hw_ops;
 #define AQ_NIC_RATE_100M       BIT(5)
 
 struct aq_nic_cfg_s {
-       struct aq_hw_caps_s *aq_hw_caps;
+       const struct aq_hw_caps_s *aq_hw_caps;
        u64 hw_features;
        u32 rxds;               /* rx ring size, descriptors # */
        u32 txds;               /* tx ring size, descriptors # */
index 58c29d04b186e634686ca667bc5afe9bd86e63a3..bc85809288ee6ea259aa6116ae617766abae3dea 100644 (file)
@@ -29,7 +29,7 @@ struct aq_pci_func_s {
        struct aq_hw_caps_s aq_hw_caps;
 };
 
-struct aq_pci_func_s *aq_pci_func_alloc(struct aq_hw_ops *aq_hw_ops,
+struct aq_pci_func_s *aq_pci_func_alloc(const struct aq_hw_ops *aq_hw_ops,
                                        struct pci_dev *pdev,
                                        const struct net_device_ops *ndev_ops,
                                        const struct ethtool_ops *eth_ops)
index a174d900dd048f94bfea7348d04e53323829e8a9..84465220b36bb20e02de322708faa1e7982af9b8 100644 (file)
@@ -15,7 +15,7 @@
 #include "aq_common.h"
 #include "aq_nic.h"
 
-struct aq_pci_func_s *aq_pci_func_alloc(struct aq_hw_ops *hw_ops,
+struct aq_pci_func_s *aq_pci_func_alloc(const struct aq_hw_ops *hw_ops,
                                        struct pci_dev *pdev,
                                        const struct net_device_ops *ndev_ops,
                                        const struct ethtool_ops *eth_ops);
index 5477524dd429cf8e62e0560ccc6dd6edab3e01d2..f890b8a5a8623ef20a4c3ca016b4dbe2ad16f475 100644 (file)
@@ -19,7 +19,7 @@
 #include <linux/netdevice.h>
 
 struct aq_vec_s {
-       struct aq_hw_ops *aq_hw_ops;
+       const struct aq_hw_ops *aq_hw_ops;
        struct aq_hw_s *aq_hw;
        struct aq_nic_s *aq_nic;
        unsigned int tx_rings;
@@ -165,7 +165,7 @@ struct aq_vec_s *aq_vec_alloc(struct aq_nic_s *aq_nic, unsigned int idx,
        return self;
 }
 
-int aq_vec_init(struct aq_vec_s *self, struct aq_hw_ops *aq_hw_ops,
+int aq_vec_init(struct aq_vec_s *self, const struct aq_hw_ops *aq_hw_ops,
                struct aq_hw_s *aq_hw)
 {
        struct aq_ring_s *ring = NULL;
index 6c68b184236ca8a96e5372642b5a45fa77978b13..78cc6c36b5504f19741bdf68fa4c86069df76341 100644 (file)
@@ -26,7 +26,7 @@ irqreturn_t aq_vec_isr(int irq, void *private);
 irqreturn_t aq_vec_isr_legacy(int irq, void *private);
 struct aq_vec_s *aq_vec_alloc(struct aq_nic_s *aq_nic, unsigned int idx,
                              struct aq_nic_cfg_s *aq_nic_cfg);
-int aq_vec_init(struct aq_vec_s *self, struct aq_hw_ops *aq_hw_ops,
+int aq_vec_init(struct aq_vec_s *self, const struct aq_hw_ops *aq_hw_ops,
                struct aq_hw_s *aq_hw);
 void aq_vec_deinit(struct aq_vec_s *self);
 void aq_vec_free(struct aq_vec_s *self);
index 5c616e4f782ee17a9cbf63e065a00416ecaa61f9..5b1f3c19d8ba9e0148d0729f6fb0de337327ac12 100644 (file)
@@ -851,7 +851,7 @@ static int hw_atl_a0_hw_set_speed(struct aq_hw_s *self, u32 speed)
        return err;
 }
 
-static struct aq_hw_ops hw_atl_ops_ = {
+static const struct aq_hw_ops hw_atl_ops_ = {
        .create               = hw_atl_a0_create,
        .destroy              = hw_atl_a0_destroy,
        .get_hw_caps          = hw_atl_a0_get_hw_caps,
@@ -894,7 +894,7 @@ static struct aq_hw_ops hw_atl_ops_ = {
        .hw_get_fw_version           = hw_atl_utils_get_fw_version,
 };
 
-struct aq_hw_ops *hw_atl_a0_get_ops_by_id(struct pci_dev *pdev)
+const struct aq_hw_ops *hw_atl_a0_get_ops_by_id(struct pci_dev *pdev)
 {
        bool is_vid_ok = (pdev->vendor == PCI_VENDOR_ID_AQUANTIA);
        bool is_did_ok = ((pdev->device == HW_ATL_DEVICE_ID_0001) ||
index 6e1d527954c9fc8d34cb9b7df34fe985d48e5884..4fdd51b6709747f9d0d16cbd8e900576b7998b25 100644 (file)
@@ -29,6 +29,6 @@
 
 #endif
 
-struct aq_hw_ops *hw_atl_a0_get_ops_by_id(struct pci_dev *pdev);
+const struct aq_hw_ops *hw_atl_a0_get_ops_by_id(struct pci_dev *pdev);
 
 #endif /* HW_ATL_A0_H */
index e2240ab649873bdadbf35335b8ea0b1c102cc97a..1c47811a03e718039aa02ecd1b1d874e55ff2e12 100644 (file)
@@ -928,7 +928,7 @@ static int hw_atl_b0_hw_set_speed(struct aq_hw_s *self, u32 speed)
        return err;
 }
 
-static struct aq_hw_ops hw_atl_ops_ = {
+static const struct aq_hw_ops hw_atl_ops_ = {
        .create               = hw_atl_b0_create,
        .destroy              = hw_atl_b0_destroy,
        .get_hw_caps          = hw_atl_b0_get_hw_caps,
@@ -971,7 +971,7 @@ static struct aq_hw_ops hw_atl_ops_ = {
        .hw_get_fw_version           = hw_atl_utils_get_fw_version,
 };
 
-struct aq_hw_ops *hw_atl_b0_get_ops_by_id(struct pci_dev *pdev)
+const struct aq_hw_ops *hw_atl_b0_get_ops_by_id(struct pci_dev *pdev)
 {
        bool is_vid_ok = (pdev->vendor == PCI_VENDOR_ID_AQUANTIA);
        bool is_did_ok = ((pdev->device == HW_ATL_DEVICE_ID_0001) ||
index a1e1bce6c1f3e2b94e4b65a0d5425d3715e3589b..3e10969c1df5704a39f181786a23a81e7eb91e52 100644 (file)
@@ -29,6 +29,6 @@
 
 #endif
 
-struct aq_hw_ops *hw_atl_b0_get_ops_by_id(struct pci_dev *pdev);
+const struct aq_hw_ops *hw_atl_b0_get_ops_by_id(struct pci_dev *pdev);
 
 #endif /* HW_ATL_B0_H */
index 407dc06ab2539c37863ef4f0a125da1af806f6a0..0abb7d788db22d53782c5d553d348c1ffc70f8d3 100644 (file)
@@ -117,7 +117,7 @@ static int hw_atl_utils_ver_match(u32 ver_expected, u32 ver_actual)
 }
 
 static int hw_atl_utils_init_ucp(struct aq_hw_s *self,
-                                struct aq_hw_caps_s *aq_hw_caps)
+                                const struct aq_hw_caps_s *aq_hw_caps)
 {
        int err = 0;
 
@@ -564,7 +564,7 @@ static const u32 hw_atl_utils_hw_mac_regs[] = {
 };
 
 int hw_atl_utils_hw_get_regs(struct aq_hw_s *self,
-                            struct aq_hw_caps_s *aq_hw_caps,
+                            const struct aq_hw_caps_s *aq_hw_caps,
                             u32 *regs_buff)
 {
        unsigned int i = 0U;
index 1530abd6ed8408e2d8430e9e05263edffa0c1250..40e2319c65d57e17336d23dc21eb180cc8ff8984 100644 (file)
@@ -207,7 +207,7 @@ int hw_atl_utils_get_mac_permanent(struct aq_hw_s *self,
 unsigned int hw_atl_utils_mbps_2_speed_index(unsigned int mbps);
 
 int hw_atl_utils_hw_get_regs(struct aq_hw_s *self,
-                            struct aq_hw_caps_s *aq_hw_caps,
+                            const struct aq_hw_caps_s *aq_hw_caps,
                             u32 *regs_buff);
 
 int hw_atl_utils_hw_set_power(struct aq_hw_s *self,