]> git.baikalelectronics.ru Git - kernel.git/commit
net: bgmac: allocate struct bgmac just once & don't copy it
authorRafał Miłecki <rafal@milecki.pl>
Tue, 31 Jan 2017 18:37:54 +0000 (19:37 +0100)
committerDavid S. Miller <davem@davemloft.net>
Tue, 31 Jan 2017 18:44:48 +0000 (13:44 -0500)
commit1a32f7d0962eca0f126608fb4b0802e4ea8159f2
tree40eaf79e6b76d53a889ad8c6168c85e0f79acce1
parent4dde9755f83490c380f5c18e20bf64c9aebdc9fe
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>
drivers/net/ethernet/broadcom/bgmac-bcma.c
drivers/net/ethernet/broadcom/bgmac-platform.c
drivers/net/ethernet/broadcom/bgmac.c
drivers/net/ethernet/broadcom/bgmac.h