aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorStephen Hemminger <shemminger@linux-foundation.org>2007-02-20 18:58:02 -0500
committerJeff Garzik <jeff@garzik.org>2007-04-28 11:00:56 -0400
commit459e536b1ddfd217ec8a3437a3214968a98223c7 (patch)
tree89fa87d66c29f8688586218e96d60de8a7be631f /drivers
parent4c247db114d95fb42528afe4c16db522dd050d7b (diff)
chelsio: use const for virtual functions
There are several uses of _ops structure in this driver that can be converted to const. Signed-off-by: Stephen Hemminger <shemminger@linux-foundation.org> Signed-off-by: Jeff Garzik <jeff@garzik.org>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/net/chelsio/common.h6
-rw-r--r--drivers/net/chelsio/cphy.h16
-rw-r--r--drivers/net/chelsio/gmac.h10
-rw-r--r--drivers/net/chelsio/mac.c2
-rw-r--r--drivers/net/chelsio/mv88e1xxx.c8
-rw-r--r--drivers/net/chelsio/mv88x201x.c8
-rw-r--r--drivers/net/chelsio/my3126.c8
-rw-r--r--drivers/net/chelsio/pm3393.c8
-rw-r--r--drivers/net/chelsio/subr.c4
-rw-r--r--drivers/net/chelsio/vsc7326.c2
10 files changed, 33 insertions, 39 deletions
diff --git a/drivers/net/chelsio/common.h b/drivers/net/chelsio/common.h
index 787f2f2820fe..8ba702c8b560 100644
--- a/drivers/net/chelsio/common.h
+++ b/drivers/net/chelsio/common.h
@@ -322,9 +322,9 @@ struct board_info {
322 unsigned char mdio_mdiinv; 322 unsigned char mdio_mdiinv;
323 unsigned char mdio_mdc; 323 unsigned char mdio_mdc;
324 unsigned char mdio_phybaseaddr; 324 unsigned char mdio_phybaseaddr;
325 struct gmac *gmac; 325 const struct gmac *gmac;
326 struct gphy *gphy; 326 const struct gphy *gphy;
327 struct mdio_ops *mdio_ops; 327 const struct mdio_ops *mdio_ops;
328 const char *desc; 328 const char *desc;
329}; 329};
330 330
diff --git a/drivers/net/chelsio/cphy.h b/drivers/net/chelsio/cphy.h
index cf9143499882..79d855e267e0 100644
--- a/drivers/net/chelsio/cphy.h
+++ b/drivers/net/chelsio/cphy.h
@@ -100,7 +100,7 @@ struct cphy {
100 100
101 u32 elmer_gpo; 101 u32 elmer_gpo;
102 102
103 struct cphy_ops *ops; /* PHY operations */ 103 const struct cphy_ops *ops; /* PHY operations */
104 int (*mdio_read)(adapter_t *adapter, int phy_addr, int mmd_addr, 104 int (*mdio_read)(adapter_t *adapter, int phy_addr, int mmd_addr,
105 int reg_addr, unsigned int *val); 105 int reg_addr, unsigned int *val);
106 int (*mdio_write)(adapter_t *adapter, int phy_addr, int mmd_addr, 106 int (*mdio_write)(adapter_t *adapter, int phy_addr, int mmd_addr,
@@ -136,7 +136,7 @@ static inline int simple_mdio_write(struct cphy *cphy, int reg,
136/* Convenience initializer */ 136/* Convenience initializer */
137static inline void cphy_init(struct cphy *phy, adapter_t *adapter, 137static inline void cphy_init(struct cphy *phy, adapter_t *adapter,
138 int phy_addr, struct cphy_ops *phy_ops, 138 int phy_addr, struct cphy_ops *phy_ops,
139 struct mdio_ops *mdio_ops) 139 const struct mdio_ops *mdio_ops)
140{ 140{
141 phy->adapter = adapter; 141 phy->adapter = adapter;
142 phy->addr = phy_addr; 142 phy->addr = phy_addr;
@@ -151,7 +151,7 @@ static inline void cphy_init(struct cphy *phy, adapter_t *adapter,
151struct gphy { 151struct gphy {
152 /* Construct a PHY instance with the given PHY address */ 152 /* Construct a PHY instance with the given PHY address */
153 struct cphy *(*create)(adapter_t *adapter, int phy_addr, 153 struct cphy *(*create)(adapter_t *adapter, int phy_addr,
154 struct mdio_ops *mdio_ops); 154 const struct mdio_ops *mdio_ops);
155 155
156 /* 156 /*
157 * Reset the PHY chip. This resets the whole PHY chip, not individual 157 * Reset the PHY chip. This resets the whole PHY chip, not individual
@@ -160,11 +160,9 @@ struct gphy {
160 int (*reset)(adapter_t *adapter); 160 int (*reset)(adapter_t *adapter);
161}; 161};
162 162
163extern struct gphy t1_my3126_ops; 163extern const struct gphy t1_my3126_ops;
164extern struct gphy t1_mv88e1xxx_ops; 164extern const struct gphy t1_mv88e1xxx_ops;
165extern struct gphy t1_vsc8244_ops; 165extern const struct gphy t1_vsc8244_ops;
166extern struct gphy t1_xpak_ops; 166extern const struct gphy t1_mv88x201x_ops;
167extern struct gphy t1_mv88x201x_ops;
168extern struct gphy t1_dummy_phy_ops;
169 167
170#endif /* _CXGB_CPHY_H_ */ 168#endif /* _CXGB_CPHY_H_ */
diff --git a/drivers/net/chelsio/gmac.h b/drivers/net/chelsio/gmac.h
index 006a2eb2d362..d42337457cf7 100644
--- a/drivers/net/chelsio/gmac.h
+++ b/drivers/net/chelsio/gmac.h
@@ -126,7 +126,7 @@ typedef struct _cmac_instance cmac_instance;
126struct cmac { 126struct cmac {
127 struct cmac_statistics stats; 127 struct cmac_statistics stats;
128 adapter_t *adapter; 128 adapter_t *adapter;
129 struct cmac_ops *ops; 129 const struct cmac_ops *ops;
130 cmac_instance *instance; 130 cmac_instance *instance;
131}; 131};
132 132
@@ -136,11 +136,7 @@ struct gmac {
136 int (*reset)(adapter_t *); 136 int (*reset)(adapter_t *);
137}; 137};
138 138
139extern struct gmac t1_pm3393_ops; 139extern const struct gmac t1_pm3393_ops;
140extern struct gmac t1_chelsio_mac_ops; 140extern const struct gmac t1_vsc7326_ops;
141extern struct gmac t1_vsc7321_ops;
142extern struct gmac t1_vsc7326_ops;
143extern struct gmac t1_ixf1010_ops;
144extern struct gmac t1_dummy_mac_ops;
145 141
146#endif /* _CXGB_GMAC_H_ */ 142#endif /* _CXGB_GMAC_H_ */
diff --git a/drivers/net/chelsio/mac.c b/drivers/net/chelsio/mac.c
index 6af39dc70459..1d972825eac3 100644
--- a/drivers/net/chelsio/mac.c
+++ b/drivers/net/chelsio/mac.c
@@ -363,6 +363,6 @@ static struct cmac *mac_create(adapter_t *adapter, int index)
363 return mac; 363 return mac;
364} 364}
365 365
366struct gmac t1_chelsio_mac_ops = { 366const struct gmac t1_chelsio_mac_ops = {
367 .create = mac_create 367 .create = mac_create
368}; 368};
diff --git a/drivers/net/chelsio/mv88e1xxx.c b/drivers/net/chelsio/mv88e1xxx.c
index 5867e3b0a887..0632be0d6494 100644
--- a/drivers/net/chelsio/mv88e1xxx.c
+++ b/drivers/net/chelsio/mv88e1xxx.c
@@ -354,7 +354,7 @@ static struct cphy_ops mv88e1xxx_ops = {
354}; 354};
355 355
356static struct cphy *mv88e1xxx_phy_create(adapter_t *adapter, int phy_addr, 356static struct cphy *mv88e1xxx_phy_create(adapter_t *adapter, int phy_addr,
357 struct mdio_ops *mdio_ops) 357 const struct mdio_ops *mdio_ops)
358{ 358{
359 struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL); 359 struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL);
360 360
@@ -390,7 +390,7 @@ static int mv88e1xxx_phy_reset(adapter_t* adapter)
390 return 0; 390 return 0;
391} 391}
392 392
393struct gphy t1_mv88e1xxx_ops = { 393const struct gphy t1_mv88e1xxx_ops = {
394 mv88e1xxx_phy_create, 394 .create = mv88e1xxx_phy_create,
395 mv88e1xxx_phy_reset 395 .reset = mv88e1xxx_phy_reset
396}; 396};
diff --git a/drivers/net/chelsio/mv88x201x.c b/drivers/net/chelsio/mv88x201x.c
index c8e89480d906..cd856041af34 100644
--- a/drivers/net/chelsio/mv88x201x.c
+++ b/drivers/net/chelsio/mv88x201x.c
@@ -208,7 +208,7 @@ static struct cphy_ops mv88x201x_ops = {
208}; 208};
209 209
210static struct cphy *mv88x201x_phy_create(adapter_t *adapter, int phy_addr, 210static struct cphy *mv88x201x_phy_create(adapter_t *adapter, int phy_addr,
211 struct mdio_ops *mdio_ops) 211 const struct mdio_ops *mdio_ops)
212{ 212{
213 u32 val; 213 u32 val;
214 struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL); 214 struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL);
@@ -252,7 +252,7 @@ static int mv88x201x_phy_reset(adapter_t *adapter)
252 return 0; 252 return 0;
253} 253}
254 254
255struct gphy t1_mv88x201x_ops = { 255const struct gphy t1_mv88x201x_ops = {
256 mv88x201x_phy_create, 256 .create = mv88x201x_phy_create,
257 mv88x201x_phy_reset 257 .reset = mv88x201x_phy_reset
258}; 258};
diff --git a/drivers/net/chelsio/my3126.c b/drivers/net/chelsio/my3126.c
index 87dde3e60046..040acd29995a 100644
--- a/drivers/net/chelsio/my3126.c
+++ b/drivers/net/chelsio/my3126.c
@@ -166,7 +166,7 @@ static struct cphy_ops my3126_ops = {
166}; 166};
167 167
168static struct cphy *my3126_phy_create(adapter_t *adapter, 168static struct cphy *my3126_phy_create(adapter_t *adapter,
169 int phy_addr, struct mdio_ops *mdio_ops) 169 int phy_addr, const struct mdio_ops *mdio_ops)
170{ 170{
171 struct cphy *cphy = kzalloc(sizeof (*cphy), GFP_KERNEL); 171 struct cphy *cphy = kzalloc(sizeof (*cphy), GFP_KERNEL);
172 172
@@ -201,7 +201,7 @@ static int my3126_phy_reset(adapter_t * adapter)
201 return 0; 201 return 0;
202} 202}
203 203
204struct gphy t1_my3126_ops = { 204const struct gphy t1_my3126_ops = {
205 my3126_phy_create, 205 .create = my3126_phy_create,
206 my3126_phy_reset 206 .reset = my3126_phy_reset
207}; 207};
diff --git a/drivers/net/chelsio/pm3393.c b/drivers/net/chelsio/pm3393.c
index 69129edeefd6..678778a8d133 100644
--- a/drivers/net/chelsio/pm3393.c
+++ b/drivers/net/chelsio/pm3393.c
@@ -807,8 +807,8 @@ static int pm3393_mac_reset(adapter_t * adapter)
807 return successful_reset ? 0 : 1; 807 return successful_reset ? 0 : 1;
808} 808}
809 809
810struct gmac t1_pm3393_ops = { 810const struct gmac t1_pm3393_ops = {
811 STATS_TICK_SECS, 811 .stats_update_period = STATS_TICK_SECS,
812 pm3393_mac_create, 812 .create = pm3393_mac_create,
813 pm3393_mac_reset 813 .reset = pm3393_mac_reset,
814}; 814};
diff --git a/drivers/net/chelsio/subr.c b/drivers/net/chelsio/subr.c
index 56d1d15a8f96..7de9a611e1f7 100644
--- a/drivers/net/chelsio/subr.c
+++ b/drivers/net/chelsio/subr.c
@@ -321,7 +321,7 @@ static int mi1_mdio_write(adapter_t *adapter, int phy_addr, int mmd_addr,
321} 321}
322 322
323#if defined(CONFIG_CHELSIO_T1_1G) || defined(CONFIG_CHELSIO_T1_COUGAR) 323#if defined(CONFIG_CHELSIO_T1_1G) || defined(CONFIG_CHELSIO_T1_COUGAR)
324static struct mdio_ops mi1_mdio_ops = { 324static const struct mdio_ops mi1_mdio_ops = {
325 .init = mi1_mdio_init, 325 .init = mi1_mdio_init,
326 .read = mi1_mdio_read, 326 .read = mi1_mdio_read,
327 .write = mi1_mdio_write 327 .write = mi1_mdio_write
@@ -377,7 +377,7 @@ static int mi1_mdio_ext_write(adapter_t *adapter, int phy_addr, int mmd_addr,
377 return 0; 377 return 0;
378} 378}
379 379
380static struct mdio_ops mi1_mdio_ext_ops = { 380static const struct mdio_ops mi1_mdio_ext_ops = {
381 .init = mi1_mdio_init, 381 .init = mi1_mdio_init,
382 .read = mi1_mdio_ext_read, 382 .read = mi1_mdio_ext_read,
383 .write = mi1_mdio_ext_write 383 .write = mi1_mdio_ext_write
diff --git a/drivers/net/chelsio/vsc7326.c b/drivers/net/chelsio/vsc7326.c
index 534ffa0f616e..99b51f61fe77 100644
--- a/drivers/net/chelsio/vsc7326.c
+++ b/drivers/net/chelsio/vsc7326.c
@@ -723,7 +723,7 @@ static int vsc7326_mac_reset(adapter_t *adapter)
723 return 0; 723 return 0;
724} 724}
725 725
726struct gmac t1_vsc7326_ops = { 726const struct gmac t1_vsc7326_ops = {
727 .stats_update_period = STATS_TICK_SECS, 727 .stats_update_period = STATS_TICK_SECS,
728 .create = vsc7326_mac_create, 728 .create = vsc7326_mac_create,
729 .reset = vsc7326_mac_reset, 729 .reset = vsc7326_mac_reset,