Kill off hotplug.h and just make net devices normal reference-counted

structures.

DHCP still broken and #if 0'd out.
This commit is contained in:
Michael Brown
2007-06-27 14:48:31 +01:00
parent e381714c07
commit f77815f2b1
16 changed files with 112 additions and 256 deletions

View File

@@ -90,13 +90,13 @@ int legacy_probe ( void *hwdev,
nic.node_addr = netdev->ll_addr;
if ( ! probe ( &nic, hwdev ) ) {
free_netdev ( netdev );
netdev_put ( netdev );
return -ENODEV;
}
if ( ( rc = register_netdev ( netdev ) ) != 0 ) {
disable ( &nic, hwdev );
free_netdev ( netdev );
netdev_put ( netdev );
return rc;
}
@@ -116,7 +116,7 @@ void legacy_remove ( void *hwdev,
unregister_netdev ( netdev );
disable ( nic, hwdev );
free_netdev ( netdev );
netdev_put ( netdev );
legacy_registered = 0;
}

View File

@@ -206,7 +206,7 @@ static void pnic_remove ( struct pci_device *pci ) {
unregister_netdev ( netdev );
pnic_command ( pnic, PNIC_CMD_RESET, NULL, 0, NULL, 0, NULL );
free_netdev ( netdev );
netdev_put ( netdev );
}
/**************************************************************************
@@ -220,20 +220,18 @@ static int pnic_probe ( struct pci_device *pci,
uint16_t status;
int rc;
/* Fix up PCI device */
adjust_pci_device ( pci );
/* Allocate net device */
netdev = alloc_etherdev ( sizeof ( *pnic ) );
if ( ! netdev ) {
rc = -ENOMEM;
goto err;
}
if ( ! netdev )
return -ENOMEM;
pnic = netdev->priv;
pci_set_drvdata ( pci, netdev );
netdev->dev = &pci->dev;
pnic->ioaddr = pci->ioaddr;
/* Fix up PCI device */
adjust_pci_device ( pci );
/* API version check */
status = pnic_command_quiet ( pnic, PNIC_CMD_API_VER, NULL, 0,
&api_version,
@@ -264,7 +262,7 @@ static int pnic_probe ( struct pci_device *pci,
err:
/* Free net device */
free_netdev ( netdev );
netdev_put ( netdev );
return rc;
}

View File

@@ -501,25 +501,22 @@ static void rtl_irq(struct nic *nic, irq_action_t action)
static int rtl_probe ( struct pci_device *pci,
const struct pci_device_id *id __unused ) {
struct net_device *netdev;
struct rtl8139_nic *rtl = NULL;
int registered_netdev = 0;
struct rtl8139_nic *rtl;
int rc;
/* Fix up PCI device */
adjust_pci_device ( pci );
/* Allocate net device */
netdev = alloc_etherdev ( sizeof ( *rtl ) );
if ( ! netdev ) {
rc = -ENOMEM;
goto err;
}
if ( ! netdev )
return -ENOMEM;
rtl = netdev->priv;
pci_set_drvdata ( pci, netdev );
netdev->dev = &pci->dev;
memset ( rtl, 0, sizeof ( *rtl ) );
rtl->ioaddr = pci->ioaddr;
/* Fix up PCI device */
adjust_pci_device ( pci );
/* Reset the NIC, set up EEPROM access and read MAC address */
rtl_reset ( rtl );
rtl_init_eeprom ( rtl );
@@ -533,25 +530,21 @@ static int rtl_probe ( struct pci_device *pci,
/* Register network device */
if ( ( rc = register_netdev ( netdev ) ) != 0 )
goto err;
registered_netdev = 1;
goto err_register_netdev;
/* Register non-volatile storage */
if ( rtl->nvo.nvs ) {
if ( ( rc = nvo_register ( &rtl->nvo ) ) != 0 )
goto err;
goto err_register_nvo;
}
return 0;
err:
/* Disable NIC */
if ( rtl )
rtl_reset ( rtl );
if ( registered_netdev )
unregister_netdev ( netdev );
/* Free net device */
free_netdev ( netdev );
err_register_nvo:
unregister_netdev ( netdev );
err_register_netdev:
rtl_reset ( rtl );
netdev_put ( netdev );
return rc;
}
@@ -568,7 +561,7 @@ static void rtl_remove ( struct pci_device *pci ) {
nvo_unregister ( &rtl->nvo );
unregister_netdev ( netdev );
rtl_reset ( rtl );
free_netdev ( netdev );
netdev_put ( netdev );
}
static struct pci_device_id rtl8139_nics[] = {