mirror of
https://github.com/ipxe/ipxe
synced 2025-12-27 18:12:36 +03:00
[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:
@@ -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,
|
||||
};
|
||||
|
||||
@@ -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,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user