[netdevice] Make all net_driver methods optional

Most network upper-layer drivers do not implement all three methods
(probe, notify, and remove).  Save code by making all methods
optional.

Signed-off-by: Michael Brown <mcb30@ipxe.org>
This commit is contained in:
Michael Brown
2013-10-31 14:09:43 +00:00
parent 5e1fa5cd40
commit 5c11ff6304
6 changed files with 13 additions and 72 deletions

View File

@@ -159,30 +159,8 @@ static int cachedhcp_probe ( struct net_device *netdev ) {
return 0;
}
/**
* Handle network device link state change
*
* @v netdev Network device
*/
static void cachedhcp_notify ( struct net_device *netdev __unused ) {
/* Nothing to do */
}
/**
* Handle network device removal
*
* @v netdev Network device
*/
static void cachedhcp_remove ( struct net_device *netdev __unused ) {
/* Nothing to do */
}
/** Cached DHCP packet network device driver */
struct net_driver cachedhcp_driver __net_driver = {
.name = "cachedhcp",
.probe = cachedhcp_probe,
.notify = cachedhcp_notify,
.remove = cachedhcp_remove,
};

View File

@@ -243,15 +243,6 @@ static int guestinfo_net_probe ( struct net_device *netdev ) {
return rc;
}
/**
* Handle network device or link state change
*
* @v netdev Network device
*/
static void guestinfo_net_notify ( struct net_device *netdev __unused ) {
/* Nothing to do */
}
/**
* Remove per-netdevice GuestInfo settings
*
@@ -276,6 +267,5 @@ static void guestinfo_net_remove ( struct net_device *netdev ) {
struct net_driver guestinfo_net_driver __net_driver = {
.name = "GuestInfo",
.probe = guestinfo_net_probe,
.notify = guestinfo_net_notify,
.remove = guestinfo_net_remove,
};