Make open() and close() an official part of the netdevice API.

Call netdevice's poll() and transmit() methods only when device is open.
This commit is contained in:
Michael Brown
2007-01-04 04:20:08 +00:00
parent d4894f0127
commit 0c03bb5a9a
6 changed files with 138 additions and 19 deletions

View File

@@ -56,6 +56,14 @@ static void legacy_poll ( struct net_device *netdev ) {
}
}
static int legacy_open ( struct net_device *netdev __unused ) {
return 0;
}
static void legacy_close ( struct net_device *netdev __unused ) {
/* Nothing to do */
}
int legacy_probe ( struct pci_device *pci,
const struct pci_device_id *id __unused,
int ( * probe ) ( struct nic *nic,
@@ -74,6 +82,8 @@ int legacy_probe ( struct pci_device *pci,
memset ( &nic, 0, sizeof ( nic ) );
pci_set_drvdata ( pci, netdev );
netdev->open = legacy_open;
netdev->close = legacy_close;
netdev->transmit = legacy_transmit;
netdev->poll = legacy_poll;
nic.node_addr = netdev->ll_addr;

View File

@@ -185,6 +185,20 @@ static void pnic_irq ( struct net_device *netdev, irq_action_t action ) {
}
#endif
/**************************************************************************
OPEN - Open network device
***************************************************************************/
static int pnic_open ( struct net_device *netdev __unused ) {
return 0;
}
/**************************************************************************
CLOSE - Close network device
***************************************************************************/
static void pnic_close ( struct net_device *netdev __unused ) {
/* Nothing to do */
}
/**************************************************************************
DISABLE - Turn off ethernet interface
***************************************************************************/
@@ -238,6 +252,8 @@ static int pnic_probe ( struct pci_device *pci,
netdev->ll_addr, ETH_ALEN, NULL );
/* Point to NIC specific routines */
netdev->open = pnic_open;
netdev->close = pnic_close;
netdev->poll = pnic_poll;
netdev->transmit = pnic_transmit;

View File

@@ -542,8 +542,8 @@ static int rtl_probe ( struct pci_device *pci,
nvs_read ( &rtl->eeprom.nvs, EE_MAC, netdev->ll_addr, ETH_ALEN );
/* Point to NIC specific routines */
// netdev->open = rtl_open;
// netdev->close = rtl_close;
netdev->open = rtl_open;
netdev->close = rtl_close;
netdev->transmit = rtl_transmit;
netdev->poll = rtl_poll;
@@ -558,10 +558,6 @@ static int rtl_probe ( struct pci_device *pci,
goto err;
}
#warning "Hack alert"
rtl_open ( netdev );
return 0;
err:
@@ -584,10 +580,6 @@ static void rtl_remove ( struct pci_device *pci ) {
struct net_device *netdev = pci_get_drvdata ( pci );
struct rtl8139_nic *rtl = netdev->priv;
#warning "Hack alert"
rtl_close ( netdev );
if ( rtl->nvo.nvs )
nvo_unregister ( &rtl->nvo );
unregister_netdev ( netdev );