Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

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

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
Loading
Loading
Loading
Loading
+3 −3
Original line number Diff line number Diff line
@@ -322,9 +322,9 @@ struct board_info {
	unsigned char           mdio_mdiinv;
	unsigned char           mdio_mdc;
	unsigned char           mdio_phybaseaddr;
	struct gmac            *gmac;
	struct gphy            *gphy;
	struct mdio_ops        *mdio_ops;
	const struct gmac      *gmac;
	const struct gphy      *gphy;
	const struct mdio_ops  *mdio_ops;
	const char             *desc;
};

+7 −9
Original line number Diff line number Diff line
@@ -100,7 +100,7 @@ struct cphy {

	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 reg_addr, unsigned int *val);
	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,
/* Convenience initializer */
static inline void cphy_init(struct cphy *phy, adapter_t *adapter,
			     int phy_addr, struct cphy_ops *phy_ops,
			     struct mdio_ops *mdio_ops)
			     const struct mdio_ops *mdio_ops)
{
	phy->adapter = adapter;
	phy->addr    = phy_addr;
@@ -151,7 +151,7 @@ static inline void cphy_init(struct cphy *phy, adapter_t *adapter,
struct gphy {
	/* Construct a PHY instance with the given PHY address */
	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
@@ -160,11 +160,9 @@ struct gphy {
	int (*reset)(adapter_t *adapter);
};

extern struct gphy t1_my3126_ops;
extern struct gphy t1_mv88e1xxx_ops;
extern struct gphy t1_vsc8244_ops;
extern struct gphy t1_xpak_ops;
extern struct gphy t1_mv88x201x_ops;
extern struct gphy t1_dummy_phy_ops;
extern const struct gphy t1_my3126_ops;
extern const struct gphy t1_mv88e1xxx_ops;
extern const struct gphy t1_vsc8244_ops;
extern const struct gphy t1_mv88x201x_ops;

#endif /* _CXGB_CPHY_H_ */
+3 −7
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ typedef struct _cmac_instance cmac_instance;
struct cmac {
	struct cmac_statistics stats;
	adapter_t *adapter;
	struct cmac_ops *ops;
	const struct cmac_ops *ops;
	cmac_instance *instance;
};

@@ -136,11 +136,7 @@ struct gmac {
	int (*reset)(adapter_t *);
};

extern struct gmac t1_pm3393_ops;
extern struct gmac t1_chelsio_mac_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;
extern const struct gmac t1_pm3393_ops;
extern const struct gmac t1_vsc7326_ops;

#endif /* _CXGB_GMAC_H_ */
+1 −1
Original line number Diff line number Diff line
@@ -363,6 +363,6 @@ static struct cmac *mac_create(adapter_t *adapter, int index)
	return mac;
}

struct gmac t1_chelsio_mac_ops = {
const struct gmac t1_chelsio_mac_ops = {
	.create = mac_create
};
+4 −4
Original line number Diff line number Diff line
@@ -354,7 +354,7 @@ static struct cphy_ops mv88e1xxx_ops = {
};

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);

@@ -390,7 +390,7 @@ static int mv88e1xxx_phy_reset(adapter_t* adapter)
	return 0;
}

struct gphy t1_mv88e1xxx_ops = {
	mv88e1xxx_phy_create,
	mv88e1xxx_phy_reset
const struct gphy t1_mv88e1xxx_ops = {
	.create = mv88e1xxx_phy_create,
	.reset =  mv88e1xxx_phy_reset
};
Loading