Minor cleanup.
git-svn-id: file:///srv/svn/repos/haiku/trunk/current@8682 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
** Copyright 2002/03, Thomas Kurschel. All rights reserved.
|
||||||
** Distributed under the terms of the OpenBeOS License.
|
** Distributed under the terms of the Haiku License.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@@ -21,15 +21,13 @@
|
|||||||
status_t
|
status_t
|
||||||
scsi_alloc_dpc(scsi_dpc_info **dpc)
|
scsi_alloc_dpc(scsi_dpc_info **dpc)
|
||||||
{
|
{
|
||||||
SHOW_FLOW0( 3, "" );
|
SHOW_FLOW0(3, "");
|
||||||
|
|
||||||
*dpc = (scsi_dpc_info *)malloc( sizeof( **dpc ));
|
*dpc = (scsi_dpc_info *)malloc(sizeof(scsi_dpc_info));
|
||||||
|
if (*dpc == NULL)
|
||||||
if( *dpc == NULL )
|
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
memset( *dpc, 0, sizeof( **dpc ));
|
memset(*dpc, 0, sizeof(scsi_dpc_info));
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -37,37 +35,34 @@ scsi_alloc_dpc(scsi_dpc_info **dpc)
|
|||||||
status_t
|
status_t
|
||||||
scsi_free_dpc(scsi_dpc_info *dpc)
|
scsi_free_dpc(scsi_dpc_info *dpc)
|
||||||
{
|
{
|
||||||
SHOW_FLOW0( 3, "" );
|
SHOW_FLOW0(3, "");
|
||||||
|
|
||||||
if( dpc != NULL )
|
free(dpc);
|
||||||
free( dpc );
|
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
scsi_schedule_dpc(scsi_bus_info *bus, scsi_dpc_info *dpc, /*int flags,*/
|
scsi_schedule_dpc(scsi_bus_info *bus, scsi_dpc_info *dpc, /*int flags,*/
|
||||||
void (*func)( void *arg ), void *arg)
|
void (*func)(void *arg), void *arg)
|
||||||
{
|
{
|
||||||
SHOW_FLOW( 3, "bus=%p, dpc=%p", bus, dpc );
|
SHOW_FLOW(3, "bus=%p, dpc=%p", bus, dpc);
|
||||||
acquire_spinlock_irq( &bus->dpc_lock );
|
acquire_spinlock_irq(&bus->dpc_lock);
|
||||||
|
|
||||||
dpc->func = func;
|
dpc->func = func;
|
||||||
dpc->arg = arg;
|
dpc->arg = arg;
|
||||||
|
|
||||||
if( !dpc->registered ) {
|
if (!dpc->registered) {
|
||||||
dpc->registered = true;
|
dpc->registered = true;
|
||||||
dpc->next = bus->dpc_list;
|
dpc->next = bus->dpc_list;
|
||||||
bus->dpc_list = dpc;
|
bus->dpc_list = dpc;
|
||||||
} else
|
} else
|
||||||
SHOW_FLOW0( 3, "already registered - ignored" );
|
SHOW_FLOW0(3, "already registered - ignored");
|
||||||
|
|
||||||
release_spinlock_irq( &bus->dpc_lock );
|
release_spinlock_irq(&bus->dpc_lock);
|
||||||
|
|
||||||
// this is called in IRQ context, so scheduler is not allowed
|
// this is called in IRQ context, so scheduler is not allowed
|
||||||
release_sem_etc( bus->start_service, 1, B_DO_NOT_RESCHEDULE );
|
release_sem_etc(bus->start_service, 1, B_DO_NOT_RESCHEDULE);
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -77,12 +72,12 @@ scsi_schedule_dpc(scsi_bus_info *bus, scsi_dpc_info *dpc, /*int flags,*/
|
|||||||
bool
|
bool
|
||||||
scsi_check_exec_dpc(scsi_bus_info *bus)
|
scsi_check_exec_dpc(scsi_bus_info *bus)
|
||||||
{
|
{
|
||||||
SHOW_FLOW( 3, "bus=%p, dpc_list=%p", bus, bus->dpc_list );
|
SHOW_FLOW(3, "bus=%p, dpc_list=%p", bus, bus->dpc_list);
|
||||||
acquire_spinlock_irq(&bus->dpc_lock);
|
acquire_spinlock_irq(&bus->dpc_lock);
|
||||||
|
|
||||||
if (bus->dpc_list) {
|
if (bus->dpc_list) {
|
||||||
scsi_dpc_info *dpc;
|
scsi_dpc_info *dpc;
|
||||||
void (*dpc_func)( void * );
|
void (*dpc_func)(void *);
|
||||||
void *dpc_arg;
|
void *dpc_arg;
|
||||||
|
|
||||||
dpc = bus->dpc_list;
|
dpc = bus->dpc_list;
|
||||||
@@ -95,11 +90,10 @@ scsi_check_exec_dpc(scsi_bus_info *bus)
|
|||||||
release_spinlock_irq(&bus->dpc_lock);
|
release_spinlock_irq(&bus->dpc_lock);
|
||||||
|
|
||||||
dpc_func(dpc_arg);
|
dpc_func(dpc_arg);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
release_spinlock_irq(&bus->dpc_lock);
|
release_spinlock_irq(&bus->dpc_lock);
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user