net: bgmac: allocate struct bgmac just once & don't copy it
So far were were allocating struct bgmac in 3 places: platform code, bcma code and shared bgmac_enet_probe function. The reason for this was bgmac_enet_probe: 1) Requiring early-filled struct bgmac 2) Calling alloc_etherdev on its own in order to use netdev_priv later This solution got few drawbacks: 1) Was duplicating allocating code 2) Required copying early-filled struct 3) Resulted in platform/bcma code having access only to unused struct Solve this situation by simply extracting some probe code into the new bgmac_alloc function. Signed-off-by: Rafał Miłecki <rafal@milecki.pl> Reviewed-by: Florian Fainelli <f.fainelli@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
953046e1af
commit
34a5102c32
@@ -517,7 +517,8 @@ struct bgmac {
|
||||
int (*phy_connect)(struct bgmac *bgmac);
|
||||
};
|
||||
|
||||
int bgmac_enet_probe(struct bgmac *info);
|
||||
struct bgmac *bgmac_alloc(struct device *dev);
|
||||
int bgmac_enet_probe(struct bgmac *bgmac);
|
||||
void bgmac_enet_remove(struct bgmac *bgmac);
|
||||
void bgmac_adjust_link(struct net_device *net_dev);
|
||||
int bgmac_phy_connect_direct(struct bgmac *bgmac);
|
||||
|
Reference in New Issue
Block a user