diff options
author | Rafał Miłecki <rafal@milecki.pl> | 2017-01-31 19:37:54 +0100 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2017-01-31 19:44:48 +0100 |
commit | 34a5102c3235c470a6c77fba16cb971964d9c136 (patch) | |
tree | 40eaf79e6b76d53a889ad8c6168c85e0f79acce1 /drivers/net/ethernet/broadcom/bgmac.h | |
parent | net: dsa: bcm_sf2: Fix build module (diff) | |
download | linux-34a5102c3235c470a6c77fba16cb971964d9c136.tar.xz linux-34a5102c3235c470a6c77fba16cb971964d9c136.zip |
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>
Diffstat (limited to 'drivers/net/ethernet/broadcom/bgmac.h')
-rw-r--r-- | drivers/net/ethernet/broadcom/bgmac.h | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/drivers/net/ethernet/broadcom/bgmac.h b/drivers/net/ethernet/broadcom/bgmac.h index 71f493f2451f..dfebaded3b52 100644 --- a/drivers/net/ethernet/broadcom/bgmac.h +++ b/drivers/net/ethernet/broadcom/bgmac.h @@ -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); |