Commit 459e536b authored by Stephen Hemminger's avatar Stephen Hemminger Committed by Jeff Garzik

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: default avatarStephen Hemminger <shemminger@linux-foundation.org>
Signed-off-by: default avatarJeff Garzik <jeff@garzik.org>
parent 4c247db1
...@@ -322,9 +322,9 @@ struct board_info { ...@@ -322,9 +322,9 @@ struct board_info {
unsigned char mdio_mdiinv; unsigned char mdio_mdiinv;
unsigned char mdio_mdc; unsigned char mdio_mdc;
unsigned char mdio_phybaseaddr; unsigned char mdio_phybaseaddr;
struct gmac *gmac; const struct gmac *gmac;
struct gphy *gphy; const struct gphy *gphy;
struct mdio_ops *mdio_ops; const struct mdio_ops *mdio_ops;
const char *desc; const char *desc;
}; };
......
...@@ -100,7 +100,7 @@ struct cphy { ...@@ -100,7 +100,7 @@ struct cphy {
u32 elmer_gpo; u32 elmer_gpo;
struct cphy_ops *ops; /* PHY operations */ const struct cphy_ops *ops; /* PHY operations */
int (*mdio_read)(adapter_t *adapter, int phy_addr, int mmd_addr, int (*mdio_read)(adapter_t *adapter, int phy_addr, int mmd_addr,
int reg_addr, unsigned int *val); int reg_addr, unsigned int *val);
int (*mdio_write)(adapter_t *adapter, int phy_addr, int mmd_addr, 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,7 +136,7 @@ static inline int simple_mdio_write(struct cphy *cphy, int reg,
/* Convenience initializer */ /* Convenience initializer */
static inline void cphy_init(struct cphy *phy, adapter_t *adapter, static inline void cphy_init(struct cphy *phy, adapter_t *adapter,
int phy_addr, struct cphy_ops *phy_ops, int phy_addr, struct cphy_ops *phy_ops,
struct mdio_ops *mdio_ops) const struct mdio_ops *mdio_ops)
{ {
phy->adapter = adapter; phy->adapter = adapter;
phy->addr = phy_addr; phy->addr = phy_addr;
...@@ -151,7 +151,7 @@ static inline void cphy_init(struct cphy *phy, adapter_t *adapter, ...@@ -151,7 +151,7 @@ static inline void cphy_init(struct cphy *phy, adapter_t *adapter,
struct gphy { struct gphy {
/* Construct a PHY instance with the given PHY address */ /* Construct a PHY instance with the given PHY address */
struct cphy *(*create)(adapter_t *adapter, int phy_addr, struct cphy *(*create)(adapter_t *adapter, int phy_addr,
struct mdio_ops *mdio_ops); const struct mdio_ops *mdio_ops);
/* /*
* Reset the PHY chip. This resets the whole PHY chip, not individual * Reset the PHY chip. This resets the whole PHY chip, not individual
...@@ -160,11 +160,9 @@ struct gphy { ...@@ -160,11 +160,9 @@ struct gphy {
int (*reset)(adapter_t *adapter); int (*reset)(adapter_t *adapter);
}; };
extern struct gphy t1_my3126_ops; extern const struct gphy t1_my3126_ops;
extern struct gphy t1_mv88e1xxx_ops; extern const struct gphy t1_mv88e1xxx_ops;
extern struct gphy t1_vsc8244_ops; extern const struct gphy t1_vsc8244_ops;
extern struct gphy t1_xpak_ops; extern const struct gphy t1_mv88x201x_ops;
extern struct gphy t1_mv88x201x_ops;
extern struct gphy t1_dummy_phy_ops;
#endif /* _CXGB_CPHY_H_ */ #endif /* _CXGB_CPHY_H_ */
...@@ -126,7 +126,7 @@ typedef struct _cmac_instance cmac_instance; ...@@ -126,7 +126,7 @@ typedef struct _cmac_instance cmac_instance;
struct cmac { struct cmac {
struct cmac_statistics stats; struct cmac_statistics stats;
adapter_t *adapter; adapter_t *adapter;
struct cmac_ops *ops; const struct cmac_ops *ops;
cmac_instance *instance; cmac_instance *instance;
}; };
...@@ -136,11 +136,7 @@ struct gmac { ...@@ -136,11 +136,7 @@ struct gmac {
int (*reset)(adapter_t *); int (*reset)(adapter_t *);
}; };
extern struct gmac t1_pm3393_ops; extern const struct gmac t1_pm3393_ops;
extern struct gmac t1_chelsio_mac_ops; extern const struct gmac t1_vsc7326_ops;
extern struct gmac t1_vsc7321_ops;
extern struct gmac t1_vsc7326_ops;
extern struct gmac t1_ixf1010_ops;
extern struct gmac t1_dummy_mac_ops;
#endif /* _CXGB_GMAC_H_ */ #endif /* _CXGB_GMAC_H_ */
...@@ -363,6 +363,6 @@ static struct cmac *mac_create(adapter_t *adapter, int index) ...@@ -363,6 +363,6 @@ static struct cmac *mac_create(adapter_t *adapter, int index)
return mac; return mac;
} }
struct gmac t1_chelsio_mac_ops = { const struct gmac t1_chelsio_mac_ops = {
.create = mac_create .create = mac_create
}; };
...@@ -354,7 +354,7 @@ static struct cphy_ops mv88e1xxx_ops = { ...@@ -354,7 +354,7 @@ static struct cphy_ops mv88e1xxx_ops = {
}; };
static struct cphy *mv88e1xxx_phy_create(adapter_t *adapter, int phy_addr, static struct cphy *mv88e1xxx_phy_create(adapter_t *adapter, int phy_addr,
struct mdio_ops *mdio_ops) const struct mdio_ops *mdio_ops)
{ {
struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL); struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL);
...@@ -390,7 +390,7 @@ static int mv88e1xxx_phy_reset(adapter_t* adapter) ...@@ -390,7 +390,7 @@ static int mv88e1xxx_phy_reset(adapter_t* adapter)
return 0; return 0;
} }
struct gphy t1_mv88e1xxx_ops = { const struct gphy t1_mv88e1xxx_ops = {
mv88e1xxx_phy_create, .create = mv88e1xxx_phy_create,
mv88e1xxx_phy_reset .reset = mv88e1xxx_phy_reset
}; };
...@@ -208,7 +208,7 @@ static struct cphy_ops mv88x201x_ops = { ...@@ -208,7 +208,7 @@ static struct cphy_ops mv88x201x_ops = {
}; };
static struct cphy *mv88x201x_phy_create(adapter_t *adapter, int phy_addr, static struct cphy *mv88x201x_phy_create(adapter_t *adapter, int phy_addr,
struct mdio_ops *mdio_ops) const struct mdio_ops *mdio_ops)
{ {
u32 val; u32 val;
struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL); struct cphy *cphy = kzalloc(sizeof(*cphy), GFP_KERNEL);
...@@ -252,7 +252,7 @@ static int mv88x201x_phy_reset(adapter_t *adapter) ...@@ -252,7 +252,7 @@ static int mv88x201x_phy_reset(adapter_t *adapter)
return 0; return 0;
} }
struct gphy t1_mv88x201x_ops = { const struct gphy t1_mv88x201x_ops = {
mv88x201x_phy_create, .create = mv88x201x_phy_create,
mv88x201x_phy_reset .reset = mv88x201x_phy_reset
}; };
...@@ -166,7 +166,7 @@ static struct cphy_ops my3126_ops = { ...@@ -166,7 +166,7 @@ static struct cphy_ops my3126_ops = {
}; };
static struct cphy *my3126_phy_create(adapter_t *adapter, static struct cphy *my3126_phy_create(adapter_t *adapter,
int phy_addr, struct mdio_ops *mdio_ops) int phy_addr, const struct mdio_ops *mdio_ops)
{ {
struct cphy *cphy = kzalloc(sizeof (*cphy), GFP_KERNEL); struct cphy *cphy = kzalloc(sizeof (*cphy), GFP_KERNEL);
...@@ -201,7 +201,7 @@ static int my3126_phy_reset(adapter_t * adapter) ...@@ -201,7 +201,7 @@ static int my3126_phy_reset(adapter_t * adapter)
return 0; return 0;
} }
struct gphy t1_my3126_ops = { const struct gphy t1_my3126_ops = {
my3126_phy_create, .create = my3126_phy_create,
my3126_phy_reset .reset = my3126_phy_reset
}; };
...@@ -807,8 +807,8 @@ static int pm3393_mac_reset(adapter_t * adapter) ...@@ -807,8 +807,8 @@ static int pm3393_mac_reset(adapter_t * adapter)
return successful_reset ? 0 : 1; return successful_reset ? 0 : 1;
} }
struct gmac t1_pm3393_ops = { const struct gmac t1_pm3393_ops = {
STATS_TICK_SECS, .stats_update_period = STATS_TICK_SECS,
pm3393_mac_create, .create = pm3393_mac_create,
pm3393_mac_reset .reset = pm3393_mac_reset,
}; };
...@@ -321,7 +321,7 @@ static int mi1_mdio_write(adapter_t *adapter, int phy_addr, int mmd_addr, ...@@ -321,7 +321,7 @@ static int mi1_mdio_write(adapter_t *adapter, int phy_addr, int mmd_addr,
} }
#if defined(CONFIG_CHELSIO_T1_1G) || defined(CONFIG_CHELSIO_T1_COUGAR) #if defined(CONFIG_CHELSIO_T1_1G) || defined(CONFIG_CHELSIO_T1_COUGAR)
static struct mdio_ops mi1_mdio_ops = { static const struct mdio_ops mi1_mdio_ops = {
.init = mi1_mdio_init, .init = mi1_mdio_init,
.read = mi1_mdio_read, .read = mi1_mdio_read,
.write = mi1_mdio_write .write = mi1_mdio_write
...@@ -377,7 +377,7 @@ static int mi1_mdio_ext_write(adapter_t *adapter, int phy_addr, int mmd_addr, ...@@ -377,7 +377,7 @@ static int mi1_mdio_ext_write(adapter_t *adapter, int phy_addr, int mmd_addr,
return 0; return 0;
} }
static struct mdio_ops mi1_mdio_ext_ops = { static const struct mdio_ops mi1_mdio_ext_ops = {
.init = mi1_mdio_init, .init = mi1_mdio_init,
.read = mi1_mdio_ext_read, .read = mi1_mdio_ext_read,
.write = mi1_mdio_ext_write .write = mi1_mdio_ext_write
......
...@@ -723,7 +723,7 @@ static int vsc7326_mac_reset(adapter_t *adapter) ...@@ -723,7 +723,7 @@ static int vsc7326_mac_reset(adapter_t *adapter)
return 0; return 0;
} }
struct gmac t1_vsc7326_ops = { const struct gmac t1_vsc7326_ops = {
.stats_update_period = STATS_TICK_SECS, .stats_update_period = STATS_TICK_SECS,
.create = vsc7326_mac_create, .create = vsc7326_mac_create,
.reset = vsc7326_mac_reset, .reset = vsc7326_mac_reset,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment