* added deletion of semaphores to close_hook() such that free_hook() is now actually
being called, resulting in the driver supporting taking interfaces down and back up * some more cleanup git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@18509 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -64,7 +64,7 @@ typedef struct supported_device {
|
|||||||
global data
|
global data
|
||||||
----- */
|
----- */
|
||||||
static pci_info *gFoundDevices[RTL_MAX_CARDS];
|
static pci_info *gFoundDevices[RTL_MAX_CARDS];
|
||||||
static pci_module_info *gPCIModule = 0; //To call methods of pci
|
static pci_module_info *gPCIModule = NULL; //To call methods of pci
|
||||||
static char *gDeviceNames[RTL_MAX_CARDS +1];
|
static char *gDeviceNames[RTL_MAX_CARDS +1];
|
||||||
static int32 gDeviceOpenMask = 0; //Is the thing already opened?
|
static int32 gDeviceOpenMask = 0; //Is the thing already opened?
|
||||||
|
|
||||||
@@ -347,8 +347,6 @@ open_hook(const char *name, uint32 flags, void** cookie) {
|
|||||||
|
|
||||||
if (temp32 == 0xFFFFFF) {
|
if (temp32 == 0xFFFFFF) {
|
||||||
TRACE(("rtl8139_nielx open_hook(): Faulty chip\n"));
|
TRACE(("rtl8139_nielx open_hook(): Faulty chip\n"));
|
||||||
free_hook(cookie);
|
|
||||||
put_module(B_PCI_MODULE_NAME);
|
|
||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -385,7 +383,6 @@ open_hook(const char *name, uint32 flags, void** cookie) {
|
|||||||
|
|
||||||
if (temp16 == 0) {
|
if (temp16 == 0) {
|
||||||
TRACE(("rtl8139_nielx open_hook(): Reset failed... Bailing out\n"));
|
TRACE(("rtl8139_nielx open_hook(): Reset failed... Bailing out\n"));
|
||||||
free_hook(cookie);
|
|
||||||
return EIO;
|
return EIO;
|
||||||
}
|
}
|
||||||
TRACE(("rtl8139_nielx open_hook(): Chip reset: %u \n", temp16));
|
TRACE(("rtl8139_nielx open_hook(): Chip reset: %u \n", temp16));
|
||||||
@@ -868,10 +865,20 @@ static status_t
|
|||||||
close_hook (void* cookie)
|
close_hook (void* cookie)
|
||||||
{
|
{
|
||||||
rtl8139_properties_t * data = (rtl8139_properties_t *) cookie;
|
rtl8139_properties_t * data = (rtl8139_properties_t *) cookie;
|
||||||
|
TRACE(("rtl8139_nielx close_hook()\n"));
|
||||||
|
|
||||||
//Stop Rx and Tx process
|
//Stop Rx and Tx process
|
||||||
WRITE_8(Command, 0);
|
WRITE_8(Command, 0);
|
||||||
WRITE_16(IMR, 0);
|
WRITE_16(IMR, 0);
|
||||||
|
|
||||||
|
//Remove interrupt handler
|
||||||
|
remove_io_interrupt_handler(data->pcii->u.h0.interrupt_line,
|
||||||
|
rtl8139_interrupt, cookie);
|
||||||
|
|
||||||
|
delete_sem(data->lock);
|
||||||
|
delete_sem(data->input_wait);
|
||||||
|
delete_sem(data->output_wait);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -884,13 +891,8 @@ static status_t
|
|||||||
free_hook (void* cookie)
|
free_hook (void* cookie)
|
||||||
{
|
{
|
||||||
rtl8139_properties_t *data = (rtl8139_properties_t *) cookie;
|
rtl8139_properties_t *data = (rtl8139_properties_t *) cookie;
|
||||||
|
|
||||||
TRACE(("rtl8139_nielx free_hook()\n"));
|
TRACE(("rtl8139_nielx free_hook()\n"));
|
||||||
|
|
||||||
//Remove interrupt handler
|
|
||||||
remove_io_interrupt_handler(data->pcii->u.h0.interrupt_line,
|
|
||||||
rtl8139_interrupt, cookie);
|
|
||||||
|
|
||||||
//Free Rx and Tx buffers
|
//Free Rx and Tx buffers
|
||||||
delete_area(data->receivebuffer);
|
delete_area(data->receivebuffer);
|
||||||
delete_area(data->transmitbuffer);
|
delete_area(data->transmitbuffer);
|
||||||
@@ -902,9 +904,6 @@ free_hook (void* cookie)
|
|||||||
//Finally, free the cookie
|
//Finally, free the cookie
|
||||||
free(data);
|
free(data);
|
||||||
|
|
||||||
//Put the pci module
|
|
||||||
put_module(B_PCI_MODULE_NAME);
|
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user