net: add eth_unregister function
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
cbb773d5d6
commit
2230eea29b
|
@ -78,7 +78,8 @@ struct eth_device {
|
|||
struct device_d *dev;
|
||||
};
|
||||
|
||||
int eth_register(struct eth_device* dev);/* Register network device */
|
||||
int eth_register(struct eth_device* dev); /* Register network device */
|
||||
void eth_unregister(struct eth_device* dev); /* Unregister network device */
|
||||
|
||||
int eth_open(void); /* open the device */
|
||||
int eth_send(void *packet, int length); /* Send a packet */
|
||||
|
|
17
net/eth.c
17
net/eth.c
|
@ -148,3 +148,20 @@ int eth_register(struct eth_device *edev)
|
|||
return 0;
|
||||
}
|
||||
|
||||
void eth_unregister(struct eth_device *edev)
|
||||
{
|
||||
if (edev->param_ip.value)
|
||||
free(edev->param_ip.value);
|
||||
if (edev->param_ethaddr.value)
|
||||
free(edev->param_ethaddr.value);
|
||||
if (edev->param_gateway.value)
|
||||
free(edev->param_gateway.value);
|
||||
if (edev->param_netmask.value)
|
||||
free(edev->param_netmask.value);
|
||||
if (edev->param_serverip.value)
|
||||
free(edev->param_serverip.value);
|
||||
|
||||
if (eth_current == edev)
|
||||
eth_current = NULL;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in New Issue