diff options
author | stephen hemminger <shemminger@vyatta.com> | 2011-04-14 01:50:12 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2011-04-15 00:53:42 -0400 |
commit | 6c8c2513c86c589a819c161c9abbdea2a3d56f5e (patch) | |
tree | 043371fbd07fce16159abf9d58cfd0df35b99268 /drivers/net/sfc | |
parent | 44f4d5a27ee63ec80d498e0d0673605d5ce1427d (diff) |
sfc: make function tables const
The phy, mac, and board information structures should be const.
Since tables contain function pointer this improves security
(at least theoretically).
Compile tested only.
Signed-off-by: Stephen Hemminger <shemminger@vyatta.com>
Acked-by: Ben Hutchings <bhutchings@solarflare.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers/net/sfc')
-rw-r--r-- | drivers/net/sfc/efx.c | 6 | ||||
-rw-r--r-- | drivers/net/sfc/falcon.c | 4 | ||||
-rw-r--r-- | drivers/net/sfc/falcon_xmac.c | 2 | ||||
-rw-r--r-- | drivers/net/sfc/mac.h | 4 | ||||
-rw-r--r-- | drivers/net/sfc/mcdi_mac.c | 2 | ||||
-rw-r--r-- | drivers/net/sfc/mcdi_phy.c | 2 | ||||
-rw-r--r-- | drivers/net/sfc/net_driver.h | 6 | ||||
-rw-r--r-- | drivers/net/sfc/nic.h | 6 | ||||
-rw-r--r-- | drivers/net/sfc/phy.h | 8 | ||||
-rw-r--r-- | drivers/net/sfc/qt202x_phy.c | 2 | ||||
-rw-r--r-- | drivers/net/sfc/siena.c | 2 | ||||
-rw-r--r-- | drivers/net/sfc/tenxpress.c | 2 | ||||
-rw-r--r-- | drivers/net/sfc/txc43128_phy.c | 2 |
13 files changed, 24 insertions, 24 deletions
diff --git a/drivers/net/sfc/efx.c b/drivers/net/sfc/efx.c index db72a6e054e1..c8871b2db38c 100644 --- a/drivers/net/sfc/efx.c +++ b/drivers/net/sfc/efx.c | |||
@@ -2245,7 +2245,7 @@ static bool efx_port_dummy_op_poll(struct efx_nic *efx) | |||
2245 | return false; | 2245 | return false; |
2246 | } | 2246 | } |
2247 | 2247 | ||
2248 | static struct efx_phy_operations efx_dummy_phy_operations = { | 2248 | static const struct efx_phy_operations efx_dummy_phy_operations = { |
2249 | .init = efx_port_dummy_op_int, | 2249 | .init = efx_port_dummy_op_int, |
2250 | .reconfigure = efx_port_dummy_op_int, | 2250 | .reconfigure = efx_port_dummy_op_int, |
2251 | .poll = efx_port_dummy_op_poll, | 2251 | .poll = efx_port_dummy_op_poll, |
@@ -2261,7 +2261,7 @@ static struct efx_phy_operations efx_dummy_phy_operations = { | |||
2261 | /* This zeroes out and then fills in the invariants in a struct | 2261 | /* This zeroes out and then fills in the invariants in a struct |
2262 | * efx_nic (including all sub-structures). | 2262 | * efx_nic (including all sub-structures). |
2263 | */ | 2263 | */ |
2264 | static int efx_init_struct(struct efx_nic *efx, struct efx_nic_type *type, | 2264 | static int efx_init_struct(struct efx_nic *efx, const struct efx_nic_type *type, |
2265 | struct pci_dev *pci_dev, struct net_device *net_dev) | 2265 | struct pci_dev *pci_dev, struct net_device *net_dev) |
2266 | { | 2266 | { |
2267 | int i; | 2267 | int i; |
@@ -2451,7 +2451,7 @@ static int efx_pci_probe_main(struct efx_nic *efx) | |||
2451 | static int __devinit efx_pci_probe(struct pci_dev *pci_dev, | 2451 | static int __devinit efx_pci_probe(struct pci_dev *pci_dev, |
2452 | const struct pci_device_id *entry) | 2452 | const struct pci_device_id *entry) |
2453 | { | 2453 | { |
2454 | struct efx_nic_type *type = (struct efx_nic_type *) entry->driver_data; | 2454 | const struct efx_nic_type *type = (const struct efx_nic_type *) entry->driver_data; |
2455 | struct net_device *net_dev; | 2455 | struct net_device *net_dev; |
2456 | struct efx_nic *efx; | 2456 | struct efx_nic *efx; |
2457 | int i, rc; | 2457 | int i, rc; |
diff --git a/drivers/net/sfc/falcon.c b/drivers/net/sfc/falcon.c index d96b23769bd1..60176e873d62 100644 --- a/drivers/net/sfc/falcon.c +++ b/drivers/net/sfc/falcon.c | |||
@@ -1703,7 +1703,7 @@ static int falcon_set_wol(struct efx_nic *efx, u32 type) | |||
1703 | ************************************************************************** | 1703 | ************************************************************************** |
1704 | */ | 1704 | */ |
1705 | 1705 | ||
1706 | struct efx_nic_type falcon_a1_nic_type = { | 1706 | const struct efx_nic_type falcon_a1_nic_type = { |
1707 | .probe = falcon_probe_nic, | 1707 | .probe = falcon_probe_nic, |
1708 | .remove = falcon_remove_nic, | 1708 | .remove = falcon_remove_nic, |
1709 | .init = falcon_init_nic, | 1709 | .init = falcon_init_nic, |
@@ -1744,7 +1744,7 @@ struct efx_nic_type falcon_a1_nic_type = { | |||
1744 | .reset_world_flags = ETH_RESET_IRQ, | 1744 | .reset_world_flags = ETH_RESET_IRQ, |
1745 | }; | 1745 | }; |
1746 | 1746 | ||
1747 | struct efx_nic_type falcon_b0_nic_type = { | 1747 | const struct efx_nic_type falcon_b0_nic_type = { |
1748 | .probe = falcon_probe_nic, | 1748 | .probe = falcon_probe_nic, |
1749 | .remove = falcon_remove_nic, | 1749 | .remove = falcon_remove_nic, |
1750 | .init = falcon_init_nic, | 1750 | .init = falcon_init_nic, |
diff --git a/drivers/net/sfc/falcon_xmac.c b/drivers/net/sfc/falcon_xmac.c index 2c9ee5db3bf7..9516452c079c 100644 --- a/drivers/net/sfc/falcon_xmac.c +++ b/drivers/net/sfc/falcon_xmac.c | |||
@@ -362,7 +362,7 @@ void falcon_poll_xmac(struct efx_nic *efx) | |||
362 | falcon_ack_status_intr(efx); | 362 | falcon_ack_status_intr(efx); |
363 | } | 363 | } |
364 | 364 | ||
365 | struct efx_mac_operations falcon_xmac_operations = { | 365 | const struct efx_mac_operations falcon_xmac_operations = { |
366 | .reconfigure = falcon_reconfigure_xmac, | 366 | .reconfigure = falcon_reconfigure_xmac, |
367 | .update_stats = falcon_update_stats_xmac, | 367 | .update_stats = falcon_update_stats_xmac, |
368 | .check_fault = falcon_xmac_check_fault, | 368 | .check_fault = falcon_xmac_check_fault, |
diff --git a/drivers/net/sfc/mac.h b/drivers/net/sfc/mac.h index 6886cdf87c12..d6a255d0856b 100644 --- a/drivers/net/sfc/mac.h +++ b/drivers/net/sfc/mac.h | |||
@@ -13,8 +13,8 @@ | |||
13 | 13 | ||
14 | #include "net_driver.h" | 14 | #include "net_driver.h" |
15 | 15 | ||
16 | extern struct efx_mac_operations falcon_xmac_operations; | 16 | extern const struct efx_mac_operations falcon_xmac_operations; |
17 | extern struct efx_mac_operations efx_mcdi_mac_operations; | 17 | extern const struct efx_mac_operations efx_mcdi_mac_operations; |
18 | extern int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr, | 18 | extern int efx_mcdi_mac_stats(struct efx_nic *efx, dma_addr_t dma_addr, |
19 | u32 dma_len, int enable, int clear); | 19 | u32 dma_len, int enable, int clear); |
20 | 20 | ||
diff --git a/drivers/net/sfc/mcdi_mac.c b/drivers/net/sfc/mcdi_mac.c index 33f7294edb47..50c20777a564 100644 --- a/drivers/net/sfc/mcdi_mac.c +++ b/drivers/net/sfc/mcdi_mac.c | |||
@@ -138,7 +138,7 @@ static bool efx_mcdi_mac_check_fault(struct efx_nic *efx) | |||
138 | } | 138 | } |
139 | 139 | ||
140 | 140 | ||
141 | struct efx_mac_operations efx_mcdi_mac_operations = { | 141 | const struct efx_mac_operations efx_mcdi_mac_operations = { |
142 | .reconfigure = efx_mcdi_mac_reconfigure, | 142 | .reconfigure = efx_mcdi_mac_reconfigure, |
143 | .update_stats = efx_port_dummy_op_void, | 143 | .update_stats = efx_port_dummy_op_void, |
144 | .check_fault = efx_mcdi_mac_check_fault, | 144 | .check_fault = efx_mcdi_mac_check_fault, |
diff --git a/drivers/net/sfc/mcdi_phy.c b/drivers/net/sfc/mcdi_phy.c index 7e3c65b0c99f..1fcda2d82399 100644 --- a/drivers/net/sfc/mcdi_phy.c +++ b/drivers/net/sfc/mcdi_phy.c | |||
@@ -739,7 +739,7 @@ static const char *efx_mcdi_phy_test_name(struct efx_nic *efx, | |||
739 | return NULL; | 739 | return NULL; |
740 | } | 740 | } |
741 | 741 | ||
742 | struct efx_phy_operations efx_mcdi_phy_ops = { | 742 | const struct efx_phy_operations efx_mcdi_phy_ops = { |
743 | .probe = efx_mcdi_phy_probe, | 743 | .probe = efx_mcdi_phy_probe, |
744 | .init = efx_port_dummy_op_int, | 744 | .init = efx_port_dummy_op_int, |
745 | .reconfigure = efx_mcdi_phy_reconfigure, | 745 | .reconfigure = efx_mcdi_phy_reconfigure, |
diff --git a/drivers/net/sfc/net_driver.h b/drivers/net/sfc/net_driver.h index 92a9067e8e77..ab4d05b84eb7 100644 --- a/drivers/net/sfc/net_driver.h +++ b/drivers/net/sfc/net_driver.h | |||
@@ -773,10 +773,10 @@ struct efx_nic { | |||
773 | 773 | ||
774 | struct efx_buffer stats_buffer; | 774 | struct efx_buffer stats_buffer; |
775 | 775 | ||
776 | struct efx_mac_operations *mac_op; | 776 | const struct efx_mac_operations *mac_op; |
777 | 777 | ||
778 | unsigned int phy_type; | 778 | unsigned int phy_type; |
779 | struct efx_phy_operations *phy_op; | 779 | const struct efx_phy_operations *phy_op; |
780 | void *phy_data; | 780 | void *phy_data; |
781 | struct mdio_if_info mdio; | 781 | struct mdio_if_info mdio; |
782 | unsigned int mdio_bus; | 782 | unsigned int mdio_bus; |
@@ -897,7 +897,7 @@ struct efx_nic_type { | |||
897 | void (*resume_wol)(struct efx_nic *efx); | 897 | void (*resume_wol)(struct efx_nic *efx); |
898 | int (*test_registers)(struct efx_nic *efx); | 898 | int (*test_registers)(struct efx_nic *efx); |
899 | int (*test_nvram)(struct efx_nic *efx); | 899 | int (*test_nvram)(struct efx_nic *efx); |
900 | struct efx_mac_operations *default_mac_ops; | 900 | const struct efx_mac_operations *default_mac_ops; |
901 | 901 | ||
902 | int revision; | 902 | int revision; |
903 | unsigned int mem_map_size; | 903 | unsigned int mem_map_size; |
diff --git a/drivers/net/sfc/nic.h b/drivers/net/sfc/nic.h index d9de1b647d41..f7ec03cc002d 100644 --- a/drivers/net/sfc/nic.h +++ b/drivers/net/sfc/nic.h | |||
@@ -150,9 +150,9 @@ struct siena_nic_data { | |||
150 | int wol_filter_id; | 150 | int wol_filter_id; |
151 | }; | 151 | }; |
152 | 152 | ||
153 | extern struct efx_nic_type falcon_a1_nic_type; | 153 | extern const struct efx_nic_type falcon_a1_nic_type; |
154 | extern struct efx_nic_type falcon_b0_nic_type; | 154 | extern const struct efx_nic_type falcon_b0_nic_type; |
155 | extern struct efx_nic_type siena_a0_nic_type; | 155 | extern const struct efx_nic_type siena_a0_nic_type; |
156 | 156 | ||
157 | /************************************************************************** | 157 | /************************************************************************** |
158 | * | 158 | * |
diff --git a/drivers/net/sfc/phy.h b/drivers/net/sfc/phy.h index b3b79472421e..11d148cd8441 100644 --- a/drivers/net/sfc/phy.h +++ b/drivers/net/sfc/phy.h | |||
@@ -13,14 +13,14 @@ | |||
13 | /**************************************************************************** | 13 | /**************************************************************************** |
14 | * 10Xpress (SFX7101) PHY | 14 | * 10Xpress (SFX7101) PHY |
15 | */ | 15 | */ |
16 | extern struct efx_phy_operations falcon_sfx7101_phy_ops; | 16 | extern const struct efx_phy_operations falcon_sfx7101_phy_ops; |
17 | 17 | ||
18 | extern void tenxpress_set_id_led(struct efx_nic *efx, enum efx_led_mode mode); | 18 | extern void tenxpress_set_id_led(struct efx_nic *efx, enum efx_led_mode mode); |
19 | 19 | ||
20 | /**************************************************************************** | 20 | /**************************************************************************** |
21 | * AMCC/Quake QT202x PHYs | 21 | * AMCC/Quake QT202x PHYs |
22 | */ | 22 | */ |
23 | extern struct efx_phy_operations falcon_qt202x_phy_ops; | 23 | extern const struct efx_phy_operations falcon_qt202x_phy_ops; |
24 | 24 | ||
25 | /* These PHYs provide various H/W control states for LEDs */ | 25 | /* These PHYs provide various H/W control states for LEDs */ |
26 | #define QUAKE_LED_LINK_INVAL (0) | 26 | #define QUAKE_LED_LINK_INVAL (0) |
@@ -39,7 +39,7 @@ extern void falcon_qt202x_set_led(struct efx_nic *p, int led, int state); | |||
39 | /**************************************************************************** | 39 | /**************************************************************************** |
40 | * Transwitch CX4 retimer | 40 | * Transwitch CX4 retimer |
41 | */ | 41 | */ |
42 | extern struct efx_phy_operations falcon_txc_phy_ops; | 42 | extern const struct efx_phy_operations falcon_txc_phy_ops; |
43 | 43 | ||
44 | #define TXC_GPIO_DIR_INPUT 0 | 44 | #define TXC_GPIO_DIR_INPUT 0 |
45 | #define TXC_GPIO_DIR_OUTPUT 1 | 45 | #define TXC_GPIO_DIR_OUTPUT 1 |
@@ -50,7 +50,7 @@ extern void falcon_txc_set_gpio_val(struct efx_nic *efx, int pin, int val); | |||
50 | /**************************************************************************** | 50 | /**************************************************************************** |
51 | * Siena managed PHYs | 51 | * Siena managed PHYs |
52 | */ | 52 | */ |
53 | extern struct efx_phy_operations efx_mcdi_phy_ops; | 53 | extern const struct efx_phy_operations efx_mcdi_phy_ops; |
54 | 54 | ||
55 | extern int efx_mcdi_mdio_read(struct efx_nic *efx, unsigned int bus, | 55 | extern int efx_mcdi_mdio_read(struct efx_nic *efx, unsigned int bus, |
56 | unsigned int prtad, unsigned int devad, | 56 | unsigned int prtad, unsigned int devad, |
diff --git a/drivers/net/sfc/qt202x_phy.c b/drivers/net/sfc/qt202x_phy.c index 55f90924247e..7ad97e397406 100644 --- a/drivers/net/sfc/qt202x_phy.c +++ b/drivers/net/sfc/qt202x_phy.c | |||
@@ -449,7 +449,7 @@ static void qt202x_phy_remove(struct efx_nic *efx) | |||
449 | efx->phy_data = NULL; | 449 | efx->phy_data = NULL; |
450 | } | 450 | } |
451 | 451 | ||
452 | struct efx_phy_operations falcon_qt202x_phy_ops = { | 452 | const struct efx_phy_operations falcon_qt202x_phy_ops = { |
453 | .probe = qt202x_phy_probe, | 453 | .probe = qt202x_phy_probe, |
454 | .init = qt202x_phy_init, | 454 | .init = qt202x_phy_init, |
455 | .reconfigure = qt202x_phy_reconfigure, | 455 | .reconfigure = qt202x_phy_reconfigure, |
diff --git a/drivers/net/sfc/siena.c b/drivers/net/sfc/siena.c index e4dd8986b1fe..ceac1c9907f0 100644 --- a/drivers/net/sfc/siena.c +++ b/drivers/net/sfc/siena.c | |||
@@ -581,7 +581,7 @@ static void siena_init_wol(struct efx_nic *efx) | |||
581 | ************************************************************************** | 581 | ************************************************************************** |
582 | */ | 582 | */ |
583 | 583 | ||
584 | struct efx_nic_type siena_a0_nic_type = { | 584 | const struct efx_nic_type siena_a0_nic_type = { |
585 | .probe = siena_probe_nic, | 585 | .probe = siena_probe_nic, |
586 | .remove = siena_remove_nic, | 586 | .remove = siena_remove_nic, |
587 | .init = siena_init_nic, | 587 | .init = siena_init_nic, |
diff --git a/drivers/net/sfc/tenxpress.c b/drivers/net/sfc/tenxpress.c index efdceb35aaae..204ecdaac9ab 100644 --- a/drivers/net/sfc/tenxpress.c +++ b/drivers/net/sfc/tenxpress.c | |||
@@ -478,7 +478,7 @@ static void sfx7101_set_npage_adv(struct efx_nic *efx, u32 advertising) | |||
478 | advertising & ADVERTISED_10000baseT_Full); | 478 | advertising & ADVERTISED_10000baseT_Full); |
479 | } | 479 | } |
480 | 480 | ||
481 | struct efx_phy_operations falcon_sfx7101_phy_ops = { | 481 | const struct efx_phy_operations falcon_sfx7101_phy_ops = { |
482 | .probe = tenxpress_phy_probe, | 482 | .probe = tenxpress_phy_probe, |
483 | .init = tenxpress_phy_init, | 483 | .init = tenxpress_phy_init, |
484 | .reconfigure = tenxpress_phy_reconfigure, | 484 | .reconfigure = tenxpress_phy_reconfigure, |
diff --git a/drivers/net/sfc/txc43128_phy.c b/drivers/net/sfc/txc43128_phy.c index d9886addcc99..7c21b334a75b 100644 --- a/drivers/net/sfc/txc43128_phy.c +++ b/drivers/net/sfc/txc43128_phy.c | |||
@@ -545,7 +545,7 @@ static void txc43128_get_settings(struct efx_nic *efx, struct ethtool_cmd *ecmd) | |||
545 | mdio45_ethtool_gset(&efx->mdio, ecmd); | 545 | mdio45_ethtool_gset(&efx->mdio, ecmd); |
546 | } | 546 | } |
547 | 547 | ||
548 | struct efx_phy_operations falcon_txc_phy_ops = { | 548 | const struct efx_phy_operations falcon_txc_phy_ops = { |
549 | .probe = txc43128_phy_probe, | 549 | .probe = txc43128_phy_probe, |
550 | .init = txc43128_phy_init, | 550 | .init = txc43128_phy_init, |
551 | .reconfigure = txc43128_phy_reconfigure, | 551 | .reconfigure = txc43128_phy_reconfigure, |