diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-09-16 07:09:51 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-09-16 19:20:20 -0400 |
commit | d91d25d537af07ba71ed9751d5319daa8eee5066 (patch) | |
tree | 98e74416319a55d84de9c3401c63b7809926e18d | |
parent | 1d70cb06db4f8105997672378ae248f44c3a4379 (diff) |
bna: make function tables cont
To prevent malicious usage, all tables of pointers must be const.
Compile tested only.
Gleaned for PAX.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
-rw-r--r-- | drivers/net/ethernet/brocade/bna/bfa_ioc.h | 2 | ||||
-rw-r--r-- | drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c | 36 | ||||
-rw-r--r-- | drivers/net/ethernet/brocade/bna/bna.h | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/brocade/bna/bna_tx_rx.c | 4 | ||||
-rw-r--r-- | drivers/net/ethernet/brocade/bna/bnad.c | 33 |
5 files changed, 36 insertions, 43 deletions
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc.h b/drivers/net/ethernet/brocade/bna/bfa_ioc.h index 9116324865cc..e11496db7ac6 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc.h +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc.h | |||
@@ -199,7 +199,7 @@ struct bfa_ioc { | |||
199 | struct bfi_ioc_attr *attr; | 199 | struct bfi_ioc_attr *attr; |
200 | struct bfa_ioc_cbfn *cbfn; | 200 | struct bfa_ioc_cbfn *cbfn; |
201 | struct bfa_ioc_mbox_mod mbox_mod; | 201 | struct bfa_ioc_mbox_mod mbox_mod; |
202 | struct bfa_ioc_hwif *ioc_hwif; | 202 | const struct bfa_ioc_hwif *ioc_hwif; |
203 | struct bfa_iocpf iocpf; | 203 | struct bfa_iocpf iocpf; |
204 | enum bfi_asic_gen asic_gen; | 204 | enum bfi_asic_gen asic_gen; |
205 | enum bfi_asic_mode asic_mode; | 205 | enum bfi_asic_mode asic_mode; |
diff --git a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c index b4429bc67c34..7d0d8ffc01bf 100644 --- a/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c +++ b/drivers/net/ethernet/brocade/bna/bfa_ioc_ct.c | |||
@@ -49,21 +49,21 @@ static bool bfa_ioc_ct_sync_complete(struct bfa_ioc *ioc); | |||
49 | static enum bfa_status bfa_ioc_ct_pll_init(void __iomem *rb, | 49 | static enum bfa_status bfa_ioc_ct_pll_init(void __iomem *rb, |
50 | enum bfi_asic_mode asic_mode); | 50 | enum bfi_asic_mode asic_mode); |
51 | 51 | ||
52 | static struct bfa_ioc_hwif nw_hwif_ct; | 52 | static const struct bfa_ioc_hwif nw_hwif_ct = { |
53 | 53 | .ioc_pll_init = bfa_ioc_ct_pll_init, | |
54 | static void | 54 | .ioc_firmware_lock = bfa_ioc_ct_firmware_lock, |
55 | bfa_ioc_set_ctx_hwif(struct bfa_ioc *ioc, struct bfa_ioc_hwif *hwif) | 55 | .ioc_firmware_unlock = bfa_ioc_ct_firmware_unlock, |
56 | { | 56 | .ioc_reg_init = bfa_ioc_ct_reg_init, |
57 | hwif->ioc_firmware_lock = bfa_ioc_ct_firmware_lock; | 57 | .ioc_map_port = bfa_ioc_ct_map_port, |
58 | hwif->ioc_firmware_unlock = bfa_ioc_ct_firmware_unlock; | 58 | .ioc_isr_mode_set = bfa_ioc_ct_isr_mode_set, |
59 | hwif->ioc_notify_fail = bfa_ioc_ct_notify_fail; | 59 | .ioc_notify_fail = bfa_ioc_ct_notify_fail, |
60 | hwif->ioc_ownership_reset = bfa_ioc_ct_ownership_reset; | 60 | .ioc_ownership_reset = bfa_ioc_ct_ownership_reset, |
61 | hwif->ioc_sync_start = bfa_ioc_ct_sync_start; | 61 | .ioc_sync_start = bfa_ioc_ct_sync_start, |
62 | hwif->ioc_sync_join = bfa_ioc_ct_sync_join; | 62 | .ioc_sync_join = bfa_ioc_ct_sync_join, |
63 | hwif->ioc_sync_leave = bfa_ioc_ct_sync_leave; | 63 | .ioc_sync_leave = bfa_ioc_ct_sync_leave, |
64 | hwif->ioc_sync_ack = bfa_ioc_ct_sync_ack; | 64 | .ioc_sync_ack = bfa_ioc_ct_sync_ack, |
65 | hwif->ioc_sync_complete = bfa_ioc_ct_sync_complete; | 65 | .ioc_sync_complete = bfa_ioc_ct_sync_complete, |
66 | } | 66 | }; |
67 | 67 | ||
68 | /** | 68 | /** |
69 | * Called from bfa_ioc_attach() to map asic specific calls. | 69 | * Called from bfa_ioc_attach() to map asic specific calls. |
@@ -71,12 +71,6 @@ bfa_ioc_set_ctx_hwif(struct bfa_ioc *ioc, struct bfa_ioc_hwif *hwif) | |||
71 | void | 71 | void |
72 | bfa_nw_ioc_set_ct_hwif(struct bfa_ioc *ioc) | 72 | bfa_nw_ioc_set_ct_hwif(struct bfa_ioc *ioc) |
73 | { | 73 | { |
74 | bfa_ioc_set_ctx_hwif(ioc, &nw_hwif_ct); | ||
75 | |||
76 | nw_hwif_ct.ioc_pll_init = bfa_ioc_ct_pll_init; | ||
77 | nw_hwif_ct.ioc_reg_init = bfa_ioc_ct_reg_init; | ||
78 | nw_hwif_ct.ioc_map_port = bfa_ioc_ct_map_port; | ||
79 | nw_hwif_ct.ioc_isr_mode_set = bfa_ioc_ct_isr_mode_set; | ||
80 | ioc->ioc_hwif = &nw_hwif_ct; | 74 | ioc->ioc_hwif = &nw_hwif_ct; |
81 | } | 75 | } |
82 | 76 | ||
diff --git a/drivers/net/ethernet/brocade/bna/bna.h b/drivers/net/ethernet/brocade/bna/bna.h index 3a6e7906149c..4d7a5de08e12 100644 --- a/drivers/net/ethernet/brocade/bna/bna.h +++ b/drivers/net/ethernet/brocade/bna/bna.h | |||
@@ -453,7 +453,7 @@ void bna_tx_res_req(int num_txq, int txq_depth, | |||
453 | struct bna_res_info *res_info); | 453 | struct bna_res_info *res_info); |
454 | struct bna_tx *bna_tx_create(struct bna *bna, struct bnad *bnad, | 454 | struct bna_tx *bna_tx_create(struct bna *bna, struct bnad *bnad, |
455 | struct bna_tx_config *tx_cfg, | 455 | struct bna_tx_config *tx_cfg, |
456 | struct bna_tx_event_cbfn *tx_cbfn, | 456 | const struct bna_tx_event_cbfn *tx_cbfn, |
457 | struct bna_res_info *res_info, void *priv); | 457 | struct bna_res_info *res_info, void *priv); |
458 | void bna_tx_destroy(struct bna_tx *tx); | 458 | void bna_tx_destroy(struct bna_tx *tx); |
459 | void bna_tx_enable(struct bna_tx *tx); | 459 | void bna_tx_enable(struct bna_tx *tx); |
@@ -490,7 +490,7 @@ void bna_rx_res_req(struct bna_rx_config *rx_config, | |||
490 | struct bna_res_info *res_info); | 490 | struct bna_res_info *res_info); |
491 | struct bna_rx *bna_rx_create(struct bna *bna, struct bnad *bnad, | 491 | struct bna_rx *bna_rx_create(struct bna *bna, struct bnad *bnad, |
492 | struct bna_rx_config *rx_cfg, | 492 | struct bna_rx_config *rx_cfg, |
493 | struct bna_rx_event_cbfn *rx_cbfn, | 493 | const struct bna_rx_event_cbfn *rx_cbfn, |
494 | struct bna_res_info *res_info, void *priv); | 494 | struct bna_res_info *res_info, void *priv); |
495 | void bna_rx_destroy(struct bna_rx *rx); | 495 | void bna_rx_destroy(struct bna_rx *rx); |
496 | void bna_rx_enable(struct bna_rx *rx); | 496 | void bna_rx_enable(struct bna_rx *rx); |
diff --git a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c index 92214137ca32..066704efe34d 100644 --- a/drivers/net/ethernet/brocade/bna/bna_tx_rx.c +++ b/drivers/net/ethernet/brocade/bna/bna_tx_rx.c | |||
@@ -2305,7 +2305,7 @@ bna_rx_res_req(struct bna_rx_config *q_cfg, struct bna_res_info *res_info) | |||
2305 | struct bna_rx * | 2305 | struct bna_rx * |
2306 | bna_rx_create(struct bna *bna, struct bnad *bnad, | 2306 | bna_rx_create(struct bna *bna, struct bnad *bnad, |
2307 | struct bna_rx_config *rx_cfg, | 2307 | struct bna_rx_config *rx_cfg, |
2308 | struct bna_rx_event_cbfn *rx_cbfn, | 2308 | const struct bna_rx_event_cbfn *rx_cbfn, |
2309 | struct bna_res_info *res_info, | 2309 | struct bna_res_info *res_info, |
2310 | void *priv) | 2310 | void *priv) |
2311 | { | 2311 | { |
@@ -3444,7 +3444,7 @@ bna_tx_res_req(int num_txq, int txq_depth, struct bna_res_info *res_info) | |||
3444 | struct bna_tx * | 3444 | struct bna_tx * |
3445 | bna_tx_create(struct bna *bna, struct bnad *bnad, | 3445 | bna_tx_create(struct bna *bna, struct bnad *bnad, |
3446 | struct bna_tx_config *tx_cfg, | 3446 | struct bna_tx_config *tx_cfg, |
3447 | struct bna_tx_event_cbfn *tx_cbfn, | 3447 | const struct bna_tx_event_cbfn *tx_cbfn, |
3448 | struct bna_res_info *res_info, void *priv) | 3448 | struct bna_res_info *res_info, void *priv) |
3449 | { | 3449 | { |
3450 | struct bna_intr_info *intr_info; | 3450 | struct bna_intr_info *intr_info; |
diff --git a/drivers/net/ethernet/brocade/bna/bnad.c b/drivers/net/ethernet/brocade/bna/bnad.c index b7f96ab8b30c..33ab1f81c1c2 100644 --- a/drivers/net/ethernet/brocade/bna/bnad.c +++ b/drivers/net/ethernet/brocade/bna/bnad.c | |||
@@ -1730,7 +1730,14 @@ bnad_setup_tx(struct bnad *bnad, u32 tx_id) | |||
1730 | struct bna_intr_info *intr_info = | 1730 | struct bna_intr_info *intr_info = |
1731 | &res_info[BNA_TX_RES_INTR_T_TXCMPL].res_u.intr_info; | 1731 | &res_info[BNA_TX_RES_INTR_T_TXCMPL].res_u.intr_info; |
1732 | struct bna_tx_config *tx_config = &bnad->tx_config[tx_id]; | 1732 | struct bna_tx_config *tx_config = &bnad->tx_config[tx_id]; |
1733 | struct bna_tx_event_cbfn tx_cbfn; | 1733 | static const struct bna_tx_event_cbfn tx_cbfn = { |
1734 | .tcb_setup_cbfn = bnad_cb_tcb_setup, | ||
1735 | .tcb_destroy_cbfn = bnad_cb_tcb_destroy, | ||
1736 | .tx_stall_cbfn = bnad_cb_tx_stall, | ||
1737 | .tx_resume_cbfn = bnad_cb_tx_resume, | ||
1738 | .tx_cleanup_cbfn = bnad_cb_tx_cleanup, | ||
1739 | }; | ||
1740 | |||
1734 | struct bna_tx *tx; | 1741 | struct bna_tx *tx; |
1735 | unsigned long flags; | 1742 | unsigned long flags; |
1736 | 1743 | ||
@@ -1742,13 +1749,6 @@ bnad_setup_tx(struct bnad *bnad, u32 tx_id) | |||
1742 | tx_config->tx_type = BNA_TX_T_REGULAR; | 1749 | tx_config->tx_type = BNA_TX_T_REGULAR; |
1743 | tx_config->coalescing_timeo = bnad->tx_coalescing_timeo; | 1750 | tx_config->coalescing_timeo = bnad->tx_coalescing_timeo; |
1744 | 1751 | ||
1745 | /* Initialize the tx event handlers */ | ||
1746 | tx_cbfn.tcb_setup_cbfn = bnad_cb_tcb_setup; | ||
1747 | tx_cbfn.tcb_destroy_cbfn = bnad_cb_tcb_destroy; | ||
1748 | tx_cbfn.tx_stall_cbfn = bnad_cb_tx_stall; | ||
1749 | tx_cbfn.tx_resume_cbfn = bnad_cb_tx_resume; | ||
1750 | tx_cbfn.tx_cleanup_cbfn = bnad_cb_tx_cleanup; | ||
1751 | |||
1752 | /* Get BNA's resource requirement for one tx object */ | 1752 | /* Get BNA's resource requirement for one tx object */ |
1753 | spin_lock_irqsave(&bnad->bna_lock, flags); | 1753 | spin_lock_irqsave(&bnad->bna_lock, flags); |
1754 | bna_tx_res_req(bnad->num_txq_per_tx, | 1754 | bna_tx_res_req(bnad->num_txq_per_tx, |
@@ -1893,7 +1893,14 @@ bnad_setup_rx(struct bnad *bnad, u32 rx_id) | |||
1893 | struct bna_intr_info *intr_info = | 1893 | struct bna_intr_info *intr_info = |
1894 | &res_info[BNA_RX_RES_T_INTR].res_u.intr_info; | 1894 | &res_info[BNA_RX_RES_T_INTR].res_u.intr_info; |
1895 | struct bna_rx_config *rx_config = &bnad->rx_config[rx_id]; | 1895 | struct bna_rx_config *rx_config = &bnad->rx_config[rx_id]; |
1896 | struct bna_rx_event_cbfn rx_cbfn; | 1896 | static const struct bna_rx_event_cbfn rx_cbfn = { |
1897 | .rcb_setup_cbfn = bnad_cb_rcb_setup, | ||
1898 | .rcb_destroy_cbfn = bnad_cb_rcb_destroy, | ||
1899 | .ccb_setup_cbfn = bnad_cb_ccb_setup, | ||
1900 | .ccb_destroy_cbfn = bnad_cb_ccb_destroy, | ||
1901 | .rx_cleanup_cbfn = bnad_cb_rx_cleanup, | ||
1902 | .rx_post_cbfn = bnad_cb_rx_post, | ||
1903 | }; | ||
1897 | struct bna_rx *rx; | 1904 | struct bna_rx *rx; |
1898 | unsigned long flags; | 1905 | unsigned long flags; |
1899 | 1906 | ||
@@ -1902,14 +1909,6 @@ bnad_setup_rx(struct bnad *bnad, u32 rx_id) | |||
1902 | /* Initialize the Rx object configuration */ | 1909 | /* Initialize the Rx object configuration */ |
1903 | bnad_init_rx_config(bnad, rx_config); | 1910 | bnad_init_rx_config(bnad, rx_config); |
1904 | 1911 | ||
1905 | /* Initialize the Rx event handlers */ | ||
1906 | rx_cbfn.rcb_setup_cbfn = bnad_cb_rcb_setup; | ||
1907 | rx_cbfn.rcb_destroy_cbfn = bnad_cb_rcb_destroy; | ||
1908 | rx_cbfn.ccb_setup_cbfn = bnad_cb_ccb_setup; | ||
1909 | rx_cbfn.ccb_destroy_cbfn = bnad_cb_ccb_destroy; | ||
1910 | rx_cbfn.rx_cleanup_cbfn = bnad_cb_rx_cleanup; | ||
1911 | rx_cbfn.rx_post_cbfn = bnad_cb_rx_post; | ||
1912 | |||
1913 | /* Get BNA's resource requirement for one Rx object */ | 1912 | /* Get BNA's resource requirement for one Rx object */ |
1914 | spin_lock_irqsave(&bnad->bna_lock, flags); | 1913 | spin_lock_irqsave(&bnad->bna_lock, flags); |
1915 | bna_rx_res_req(rx_config, res_info); | 1914 | bna_rx_res_req(rx_config, res_info); |