aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/ethernet/neterion
diff options
context:
space:
mode:
authorstephen hemminger <shemminger@vyatta.com>2011-09-16 07:10:01 -0400
committerDavid S. Miller <davem@davemloft.net>2011-09-16 19:20:20 -0400
commit956a206620fa048afdcd8ab714ac3cf6a9e884b7 (patch)
tree5eeddd3697ca86c53b79bdfea0b81f6b1168a275 /drivers/net/ethernet/neterion
parentd91d25d537af07ba71ed9751d5319daa8eee5066 (diff)
vxge: make function table const
All tables of function pointers should be const. The pre-existing code has lots of needless indirection... Inspired by similar change in PAX. Compile tested only. Signed-off-by: Stephen Hemminger <shemminger@vyatta.com> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/ethernet/neterion')
-rw-r--r--drivers/net/ethernet/neterion/vxge/vxge-config.c11
-rw-r--r--drivers/net/ethernet/neterion/vxge/vxge-config.h4
-rw-r--r--drivers/net/ethernet/neterion/vxge/vxge-main.c10
-rw-r--r--drivers/net/ethernet/neterion/vxge/vxge-traffic.c12
4 files changed, 20 insertions, 17 deletions
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-config.c b/drivers/net/ethernet/neterion/vxge/vxge-config.c
index 1520c574cb20..98e2c10ae08b 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-config.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-config.c
@@ -1342,9 +1342,7 @@ vxge_hw_device_initialize(
1342 hldev->bar0 = attr->bar0; 1342 hldev->bar0 = attr->bar0;
1343 hldev->pdev = attr->pdev; 1343 hldev->pdev = attr->pdev;
1344 1344
1345 hldev->uld_callbacks.link_up = attr->uld_callbacks.link_up; 1345 hldev->uld_callbacks = attr->uld_callbacks;
1346 hldev->uld_callbacks.link_down = attr->uld_callbacks.link_down;
1347 hldev->uld_callbacks.crit_err = attr->uld_callbacks.crit_err;
1348 1346
1349 __vxge_hw_device_pci_e_init(hldev); 1347 __vxge_hw_device_pci_e_init(hldev);
1350 1348
@@ -2633,7 +2631,7 @@ __vxge_hw_mempool_create(struct __vxge_hw_device *devh,
2633 u32 items_priv_size, 2631 u32 items_priv_size,
2634 u32 items_initial, 2632 u32 items_initial,
2635 u32 items_max, 2633 u32 items_max,
2636 struct vxge_hw_mempool_cbs *mp_callback, 2634 const struct vxge_hw_mempool_cbs *mp_callback,
2637 void *userdata) 2635 void *userdata)
2638{ 2636{
2639 enum vxge_hw_status status = VXGE_HW_OK; 2637 enum vxge_hw_status status = VXGE_HW_OK;
@@ -2817,7 +2815,9 @@ __vxge_hw_ring_create(struct __vxge_hw_vpath_handle *vp,
2817 struct vxge_hw_ring_config *config; 2815 struct vxge_hw_ring_config *config;
2818 struct __vxge_hw_device *hldev; 2816 struct __vxge_hw_device *hldev;
2819 u32 vp_id; 2817 u32 vp_id;
2820 struct vxge_hw_mempool_cbs ring_mp_callback; 2818 static const struct vxge_hw_mempool_cbs ring_mp_callback = {
2819 .item_func_alloc = __vxge_hw_ring_mempool_item_alloc,
2820 };
2821 2821
2822 if ((vp == NULL) || (attr == NULL)) { 2822 if ((vp == NULL) || (attr == NULL)) {
2823 status = VXGE_HW_FAIL; 2823 status = VXGE_HW_FAIL;
@@ -2872,7 +2872,6 @@ __vxge_hw_ring_create(struct __vxge_hw_vpath_handle *vp,
2872 2872
2873 /* calculate actual RxD block private size */ 2873 /* calculate actual RxD block private size */
2874 ring->rxdblock_priv_size = ring->rxd_priv_size * ring->rxds_per_block; 2874 ring->rxdblock_priv_size = ring->rxd_priv_size * ring->rxds_per_block;
2875 ring_mp_callback.item_func_alloc = __vxge_hw_ring_mempool_item_alloc;
2876 ring->mempool = __vxge_hw_mempool_create(hldev, 2875 ring->mempool = __vxge_hw_mempool_create(hldev,
2877 VXGE_HW_BLOCK_SIZE, 2876 VXGE_HW_BLOCK_SIZE,
2878 VXGE_HW_BLOCK_SIZE, 2877 VXGE_HW_BLOCK_SIZE,
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-config.h b/drivers/net/ethernet/neterion/vxge/vxge-config.h
index dd362584f5ca..5046a64f0fe8 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-config.h
+++ b/drivers/net/ethernet/neterion/vxge/vxge-config.h
@@ -740,7 +740,7 @@ struct __vxge_hw_device {
740 struct vxge_hw_device_config config; 740 struct vxge_hw_device_config config;
741 enum vxge_hw_device_link_state link_state; 741 enum vxge_hw_device_link_state link_state;
742 742
743 struct vxge_hw_uld_cbs uld_callbacks; 743 const struct vxge_hw_uld_cbs *uld_callbacks;
744 744
745 u32 host_type; 745 u32 host_type;
746 u32 func_id; 746 u32 func_id;
@@ -840,7 +840,7 @@ struct vxge_hw_device_hw_info {
840struct vxge_hw_device_attr { 840struct vxge_hw_device_attr {
841 void __iomem *bar0; 841 void __iomem *bar0;
842 struct pci_dev *pdev; 842 struct pci_dev *pdev;
843 struct vxge_hw_uld_cbs uld_callbacks; 843 const struct vxge_hw_uld_cbs *uld_callbacks;
844}; 844};
845 845
846#define VXGE_HW_DEVICE_LINK_STATE_SET(hldev, ls) (hldev->link_state = ls) 846#define VXGE_HW_DEVICE_LINK_STATE_SET(hldev, ls) (hldev->link_state = ls)
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-main.c b/drivers/net/ethernet/neterion/vxge/vxge-main.c
index 1a53a24fe3d4..ef1ba204bc59 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-main.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-main.c
@@ -4284,6 +4284,12 @@ static int __devinit is_sriov_initialized(struct pci_dev *pdev)
4284 return 0; 4284 return 0;
4285} 4285}
4286 4286
4287static const struct vxge_hw_uld_cbs vxge_callbacks = {
4288 .link_up = vxge_callback_link_up,
4289 .link_down = vxge_callback_link_down,
4290 .crit_err = vxge_callback_crit_err,
4291};
4292
4287/** 4293/**
4288 * vxge_probe 4294 * vxge_probe
4289 * @pdev : structure containing the PCI related information of the device. 4295 * @pdev : structure containing the PCI related information of the device.
@@ -4494,9 +4500,7 @@ vxge_probe(struct pci_dev *pdev, const struct pci_device_id *pre)
4494 } 4500 }
4495 4501
4496 /* Setting driver callbacks */ 4502 /* Setting driver callbacks */
4497 attr.uld_callbacks.link_up = vxge_callback_link_up; 4503 attr.uld_callbacks = &vxge_callbacks;
4498 attr.uld_callbacks.link_down = vxge_callback_link_down;
4499 attr.uld_callbacks.crit_err = vxge_callback_crit_err;
4500 4504
4501 status = vxge_hw_device_initialize(&hldev, &attr, device_config); 4505 status = vxge_hw_device_initialize(&hldev, &attr, device_config);
4502 if (status != VXGE_HW_OK) { 4506 if (status != VXGE_HW_OK) {
diff --git a/drivers/net/ethernet/neterion/vxge/vxge-traffic.c b/drivers/net/ethernet/neterion/vxge/vxge-traffic.c
index ad64ce0afe3f..5954fa264da1 100644
--- a/drivers/net/ethernet/neterion/vxge/vxge-traffic.c
+++ b/drivers/net/ethernet/neterion/vxge/vxge-traffic.c
@@ -532,8 +532,8 @@ __vxge_hw_device_handle_error(struct __vxge_hw_device *hldev, u32 vp_id,
532 } 532 }
533 533
534 /* notify driver */ 534 /* notify driver */
535 if (hldev->uld_callbacks.crit_err) 535 if (hldev->uld_callbacks->crit_err)
536 hldev->uld_callbacks.crit_err( 536 hldev->uld_callbacks->crit_err(
537 (struct __vxge_hw_device *)hldev, 537 (struct __vxge_hw_device *)hldev,
538 type, vp_id); 538 type, vp_id);
539out: 539out:
@@ -560,8 +560,8 @@ __vxge_hw_device_handle_link_down_ind(struct __vxge_hw_device *hldev)
560 hldev->link_state = VXGE_HW_LINK_DOWN; 560 hldev->link_state = VXGE_HW_LINK_DOWN;
561 561
562 /* notify driver */ 562 /* notify driver */
563 if (hldev->uld_callbacks.link_down) 563 if (hldev->uld_callbacks->link_down)
564 hldev->uld_callbacks.link_down(hldev); 564 hldev->uld_callbacks->link_down(hldev);
565exit: 565exit:
566 return VXGE_HW_OK; 566 return VXGE_HW_OK;
567} 567}
@@ -585,8 +585,8 @@ __vxge_hw_device_handle_link_up_ind(struct __vxge_hw_device *hldev)
585 hldev->link_state = VXGE_HW_LINK_UP; 585 hldev->link_state = VXGE_HW_LINK_UP;
586 586
587 /* notify driver */ 587 /* notify driver */
588 if (hldev->uld_callbacks.link_up) 588 if (hldev->uld_callbacks->link_up)
589 hldev->uld_callbacks.link_up(hldev); 589 hldev->uld_callbacks->link_up(hldev);
590exit: 590exit:
591 return VXGE_HW_OK; 591 return VXGE_HW_OK;
592} 592}