drivers/char/rio/*.c

  - make sure return codes are negative (i.e. return -ENOMEM and not return ENOMEM et al)
parent d9a704ee
...@@ -129,7 +129,7 @@ struct DownLoad * rbp; ...@@ -129,7 +129,7 @@ struct DownLoad * rbp;
p->RIOError.Error = HOST_FILE_TOO_LARGE; p->RIOError.Error = HOST_FILE_TOO_LARGE;
/* restore(oldspl); */ /* restore(oldspl); */
func_exit (); func_exit ();
return ENOMEM; return -ENOMEM;
} }
if ( p->RIOBooting ) { if ( p->RIOBooting ) {
...@@ -137,7 +137,7 @@ struct DownLoad * rbp; ...@@ -137,7 +137,7 @@ struct DownLoad * rbp;
p->RIOError.Error = BOOT_IN_PROGRESS; p->RIOError.Error = BOOT_IN_PROGRESS;
/* restore(oldspl); */ /* restore(oldspl); */
func_exit (); func_exit ();
return EBUSY; return -EBUSY;
} }
/* /*
...@@ -165,7 +165,7 @@ struct DownLoad * rbp; ...@@ -165,7 +165,7 @@ struct DownLoad * rbp;
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
/* restore(oldspl); */ /* restore(oldspl); */
func_exit (); func_exit ();
return EFAULT; return -EFAULT;
} }
/* /*
...@@ -295,7 +295,7 @@ register struct DownLoad *rbp; ...@@ -295,7 +295,7 @@ register struct DownLoad *rbp;
rio_dprintk (RIO_DEBUG_BOOT, "Bin too large\n"); rio_dprintk (RIO_DEBUG_BOOT, "Bin too large\n");
p->RIOError.Error = HOST_FILE_TOO_LARGE; p->RIOError.Error = HOST_FILE_TOO_LARGE;
func_exit (); func_exit ();
return EFBIG; return -EFBIG;
} }
/* /*
** Ensure that the host really is stopped. ** Ensure that the host really is stopped.
...@@ -322,7 +322,7 @@ register struct DownLoad *rbp; ...@@ -322,7 +322,7 @@ register struct DownLoad *rbp;
rio_dprintk (RIO_DEBUG_BOOT, "No system memory available\n"); rio_dprintk (RIO_DEBUG_BOOT, "No system memory available\n");
p->RIOError.Error = NOT_ENOUGH_CORE_FOR_PCI_COPY; p->RIOError.Error = NOT_ENOUGH_CORE_FOR_PCI_COPY;
func_exit (); func_exit ();
return ENOMEM; return -ENOMEM;
} }
bzero(DownCode, rbp->Count); bzero(DownCode, rbp->Count);
...@@ -330,7 +330,7 @@ register struct DownLoad *rbp; ...@@ -330,7 +330,7 @@ register struct DownLoad *rbp;
rio_dprintk (RIO_DEBUG_BOOT, "Bad copyin of host data\n"); rio_dprintk (RIO_DEBUG_BOOT, "Bad copyin of host data\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
func_exit (); func_exit ();
return EFAULT; return -EFAULT;
} }
HostP->Copy( DownCode, StartP, rbp->Count ); HostP->Copy( DownCode, StartP, rbp->Count );
...@@ -341,7 +341,7 @@ register struct DownLoad *rbp; ...@@ -341,7 +341,7 @@ register struct DownLoad *rbp;
rio_dprintk (RIO_DEBUG_BOOT, "Bad copyin of host data\n"); rio_dprintk (RIO_DEBUG_BOOT, "Bad copyin of host data\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
func_exit (); func_exit ();
return EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_BOOT, "Copy completed\n"); rio_dprintk (RIO_DEBUG_BOOT, "Copy completed\n");
......
...@@ -98,7 +98,7 @@ struct Map * MapP; ...@@ -98,7 +98,7 @@ struct Map * MapP;
if ( !CmdBlkP ) { if ( !CmdBlkP ) {
rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n"); rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: GetCmdBlk failed\n");
return ENXIO; return -ENXIO;
} }
CmdBlkP->Packet.dest_unit = MapP->ID; CmdBlkP->Packet.dest_unit = MapP->ID;
...@@ -113,7 +113,7 @@ struct Map * MapP; ...@@ -113,7 +113,7 @@ struct Map * MapP;
if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) {
rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n"); rio_dprintk (RIO_DEBUG_CMD, "FOAD RTA: Failed to queue foad command\n");
return EIO; return -EIO;
} }
return 0; return 0;
} }
...@@ -131,7 +131,7 @@ struct Map * MapP; ...@@ -131,7 +131,7 @@ struct Map * MapP;
if ( !CmdBlkP ) { if ( !CmdBlkP ) {
rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n"); rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: GetCmdBlk failed\n");
return ENXIO; return -ENXIO;
} }
CmdBlkP->Packet.dest_unit = MapP->ID; CmdBlkP->Packet.dest_unit = MapP->ID;
...@@ -146,7 +146,7 @@ struct Map * MapP; ...@@ -146,7 +146,7 @@ struct Map * MapP;
if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) {
rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n"); rio_dprintk (RIO_DEBUG_CMD, "ZOMBIE RTA: Failed to queue zombie command\n");
return EIO; return -EIO;
} }
return 0; return 0;
} }
...@@ -192,7 +192,7 @@ int (* func)( struct Host *HostP, struct Map *MapP ); ...@@ -192,7 +192,7 @@ int (* func)( struct Host *HostP, struct Map *MapP );
} }
} }
} }
return ENXIO; return -ENXIO;
} }
...@@ -206,7 +206,7 @@ caddr_t arg; ...@@ -206,7 +206,7 @@ caddr_t arg;
if ( copyin( (int)arg, (caddr_t)&IdRta, sizeof(IdRta) ) == COPYFAIL ) { if ( copyin( (int)arg, (caddr_t)&IdRta, sizeof(IdRta) ) == COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n"); rio_dprintk (RIO_DEBUG_CMD, "RIO_IDENTIFY_RTA copy failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
for ( Host = 0 ; Host < p->RIONumHosts; Host++ ) { for ( Host = 0 ; Host < p->RIONumHosts; Host++ ) {
...@@ -238,7 +238,7 @@ caddr_t arg; ...@@ -238,7 +238,7 @@ caddr_t arg;
if ( !CmdBlkP ) { if ( !CmdBlkP ) {
rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n"); rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: GetCmdBlk failed\n");
return ENXIO; return -ENXIO;
} }
CmdBlkP->Packet.dest_unit = MapP->ID; CmdBlkP->Packet.dest_unit = MapP->ID;
...@@ -252,7 +252,7 @@ caddr_t arg; ...@@ -252,7 +252,7 @@ caddr_t arg;
if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) { if ( RIOQueueCmdBlk( HostP, MapP->ID-1, CmdBlkP) == RIO_FAIL ) {
rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n"); rio_dprintk (RIO_DEBUG_CMD, "IDENTIFY RTA: Failed to queue command\n");
return EIO; return -EIO;
} }
return 0; return 0;
} }
...@@ -260,7 +260,7 @@ caddr_t arg; ...@@ -260,7 +260,7 @@ caddr_t arg;
} }
} }
} }
return ENOENT; return -ENOENT;
} }
...@@ -279,17 +279,17 @@ caddr_t arg; ...@@ -279,17 +279,17 @@ caddr_t arg;
if ( copyin( (int)arg, (caddr_t)&KillUnit, sizeof(KillUnit) ) == COPYFAIL ) { if ( copyin( (int)arg, (caddr_t)&KillUnit, sizeof(KillUnit) ) == COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n"); rio_dprintk (RIO_DEBUG_CMD, "RIO_KILL_NEIGHBOUR copy failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if ( KillUnit.Link > 3 ) if ( KillUnit.Link > 3 )
return ENXIO; return -ENXIO;
CmdBlkP = RIOGetCmdBlk(); CmdBlkP = RIOGetCmdBlk();
if ( !CmdBlkP ) { if ( !CmdBlkP ) {
rio_dprintk (RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n"); rio_dprintk (RIO_DEBUG_CMD, "UFOAD: GetCmdBlk failed\n");
return ENXIO; return -ENXIO;
} }
CmdBlkP->Packet.dest_unit = 0; CmdBlkP->Packet.dest_unit = 0;
...@@ -310,7 +310,7 @@ caddr_t arg; ...@@ -310,7 +310,7 @@ caddr_t arg;
if ( RIOQueueCmdBlk( HostP, RTAS_PER_HOST+KillUnit.Link, if ( RIOQueueCmdBlk( HostP, RTAS_PER_HOST+KillUnit.Link,
CmdBlkP) == RIO_FAIL ) { CmdBlkP) == RIO_FAIL ) {
rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
return EIO; return -EIO;
} }
return 0; return 0;
} }
...@@ -320,14 +320,14 @@ caddr_t arg; ...@@ -320,14 +320,14 @@ caddr_t arg;
CmdBlkP->Packet.dest_unit = ID+1; CmdBlkP->Packet.dest_unit = ID+1;
if ( RIOQueueCmdBlk( HostP, ID, CmdBlkP) == RIO_FAIL ) { if ( RIOQueueCmdBlk( HostP, ID, CmdBlkP) == RIO_FAIL ) {
rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n"); rio_dprintk (RIO_DEBUG_CMD, "UFOAD: Failed queue command\n");
return EIO; return -EIO;
} }
return 0; return 0;
} }
} }
} }
RIOFreeCmdBlk( CmdBlkP ); RIOFreeCmdBlk( CmdBlkP );
return ENXIO; return -ENXIO;
} }
int int
...@@ -344,7 +344,7 @@ int Link; ...@@ -344,7 +344,7 @@ int Link;
if ( !CmdBlkP ) { if ( !CmdBlkP ) {
rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n"); rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: GetCmdBlk failed\n");
return ENXIO; return -ENXIO;
} }
CmdBlkP->Packet.dest_unit = ID; CmdBlkP->Packet.dest_unit = ID;
...@@ -359,7 +359,7 @@ int Link; ...@@ -359,7 +359,7 @@ int Link;
if ( RIOQueueCmdBlk( HostP, ID - 1, CmdBlkP) == RIO_FAIL ) { if ( RIOQueueCmdBlk( HostP, ID - 1, CmdBlkP) == RIO_FAIL ) {
rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n"); rio_dprintk (RIO_DEBUG_CMD, "SUSPEND BOOT ON RTA: Failed to queue iwait command\n");
return EIO; return -EIO;
} }
return 0; return 0;
} }
......
This diff is collapsed.
...@@ -125,7 +125,7 @@ struct rio_info * p; ...@@ -125,7 +125,7 @@ struct rio_info * p;
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n"); rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(1)\n");
if ( p->RIOSystemUp ) { /* (1) */ if ( p->RIOSystemUp ) { /* (1) */
p->RIOError.Error = HOST_HAS_ALREADY_BEEN_BOOTED; p->RIOError.Error = HOST_HAS_ALREADY_BEEN_BOOTED;
return EBUSY; return -EBUSY;
} }
p->RIOError.Error = NOTHING_WRONG_AT_ALL; p->RIOError.Error = NOTHING_WRONG_AT_ALL;
...@@ -147,7 +147,7 @@ struct rio_info * p; ...@@ -147,7 +147,7 @@ struct rio_info * p;
if ( *cptr<' ' || *cptr>'~' ) { if ( *cptr<' ' || *cptr>'~' ) {
p->RIOError.Error = BAD_CHARACTER_IN_NAME; p->RIOError.Error = BAD_CHARACTER_IN_NAME;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return ENXIO; return -ENXIO;
} }
cptr++; cptr++;
} }
...@@ -169,7 +169,7 @@ struct rio_info * p; ...@@ -169,7 +169,7 @@ struct rio_info * p;
rio_dprintk (RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n",MapP->Name); rio_dprintk (RIO_DEBUG_TABLE, "%s pretending to be empty but isn't\n",MapP->Name);
p->RIOError.Error = TABLE_ENTRY_ISNT_PROPERLY_NULL; p->RIOError.Error = TABLE_ENTRY_ISNT_PROPERLY_NULL;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n"); rio_dprintk (RIO_DEBUG_TABLE, "!RIO: Daemon: test (3) passes\n");
continue; continue;
...@@ -207,14 +207,14 @@ struct rio_info * p; ...@@ -207,14 +207,14 @@ struct rio_info * p;
MapP->Name); MapP->Name);
p->RIOError.Error = ZERO_RTA_ID; p->RIOError.Error = ZERO_RTA_ID;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return ENXIO; return -ENXIO;
} }
if ( MapP->ID > MAX_RUP ) { if ( MapP->ID > MAX_RUP ) {
rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an illegal ID %d\n", rio_dprintk (RIO_DEBUG_TABLE, "RIO: RTA %s has been allocated an illegal ID %d\n",
MapP->Name, MapP->ID); MapP->Name, MapP->ID);
p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return ENXIO; return -ENXIO;
} }
for ( SubEnt=0; SubEnt<Entry; SubEnt++ ) { for ( SubEnt=0; SubEnt<Entry; SubEnt++ ) {
if ( MapP->HostUniqueNum == if ( MapP->HostUniqueNum ==
...@@ -225,7 +225,7 @@ struct rio_info * p; ...@@ -225,7 +225,7 @@ struct rio_info * p;
p->RIOError.Error = DUPLICATED_RTA_ID; p->RIOError.Error = DUPLICATED_RTA_ID;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
p->RIOError.Other = SubEnt; p->RIOError.Other = SubEnt;
return ENXIO; return -ENXIO;
} }
/* /*
** If the RtaUniqueNum is the same, it may be looking at both ** If the RtaUniqueNum is the same, it may be looking at both
...@@ -240,7 +240,7 @@ struct rio_info * p; ...@@ -240,7 +240,7 @@ struct rio_info * p;
p->RIOError.Error = DUPLICATE_UNIQUE_NUMBER; p->RIOError.Error = DUPLICATE_UNIQUE_NUMBER;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
p->RIOError.Other = SubEnt; p->RIOError.Other = SubEnt;
return ENXIO; return -ENXIO;
} }
} }
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n"); rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7a)\n");
...@@ -250,7 +250,7 @@ struct rio_info * p; ...@@ -250,7 +250,7 @@ struct rio_info * p;
(int)MapP->SysPort,MapP->Name, PORTS_PER_RTA); (int)MapP->SysPort,MapP->Name, PORTS_PER_RTA);
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n"); rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(7b)\n");
/* (7b) */ /* (7b) */
...@@ -259,7 +259,7 @@ struct rio_info * p; ...@@ -259,7 +259,7 @@ struct rio_info * p;
(int)MapP->SysPort, MapP->Name); (int)MapP->SysPort, MapP->Name);
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return ENXIO; return -ENXIO;
} }
for ( SubEnt=0; SubEnt<Entry; SubEnt++ ) { for ( SubEnt=0; SubEnt<Entry; SubEnt++ ) {
if ( p->RIOConnectTable[SubEnt].Flags & RTA16_SECOND_SLOT ) if ( p->RIOConnectTable[SubEnt].Flags & RTA16_SECOND_SLOT )
...@@ -275,7 +275,7 @@ struct rio_info * p; ...@@ -275,7 +275,7 @@ struct rio_info * p;
p->RIOError.Error = TTY_NUMBER_IN_USE; p->RIOError.Error = TTY_NUMBER_IN_USE;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
p->RIOError.Other = SubEnt; p->RIOError.Other = SubEnt;
return ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n"); rio_dprintk (RIO_DEBUG_TABLE, "RIONewTable: entering(9)\n");
if (RIOStrCmp(MapP->Name, if (RIOStrCmp(MapP->Name,
...@@ -284,7 +284,7 @@ struct rio_info * p; ...@@ -284,7 +284,7 @@ struct rio_info * p;
p->RIOError.Error = NAME_USED_TWICE; p->RIOError.Error = NAME_USED_TWICE;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
p->RIOError.Other = SubEnt; p->RIOError.Other = SubEnt;
return ENXIO; return -ENXIO;
} }
} }
} }
...@@ -296,14 +296,14 @@ struct rio_info * p; ...@@ -296,14 +296,14 @@ struct rio_info * p;
MapP->Name); MapP->Name);
p->RIOError.Error = HOST_ID_NOT_ZERO; p->RIOError.Error = HOST_ID_NOT_ZERO;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return ENXIO; return -ENXIO;
} }
if ( MapP->SysPort != NO_PORT ) { if ( MapP->SysPort != NO_PORT ) {
rio_dprintk (RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n", rio_dprintk (RIO_DEBUG_TABLE, "RIO: HOST %s has been allocated port numbers!\n",
MapP->Name); MapP->Name);
p->RIOError.Error = HOST_SYSPORT_BAD; p->RIOError.Error = HOST_SYSPORT_BAD;
p->RIOError.Entry = Entry; p->RIOError.Entry = Entry;
return ENXIO; return -ENXIO;
} }
} }
} }
...@@ -530,7 +530,7 @@ struct Map *MapP; ...@@ -530,7 +530,7 @@ struct Map *MapP;
rio_dprintk (RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n"); rio_dprintk (RIO_DEBUG_TABLE, "Entry is in use and cannot be deleted!\n");
p->RIOError.Error = UNIT_IS_IN_USE; p->RIOError.Error = UNIT_IS_IN_USE;
rio_spin_unlock_irqrestore( &HostP->HostLock, lock_flags); rio_spin_unlock_irqrestore( &HostP->HostLock, lock_flags);
return EBUSY; return -EBUSY;
} }
} }
/* /*
...@@ -629,7 +629,7 @@ struct Map *MapP; ...@@ -629,7 +629,7 @@ struct Map *MapP;
rio_dprintk (RIO_DEBUG_TABLE, "Couldn't find entry to be deleted\n"); rio_dprintk (RIO_DEBUG_TABLE, "Couldn't find entry to be deleted\n");
p->RIOError.Error = COULDNT_FIND_ENTRY; p->RIOError.Error = COULDNT_FIND_ENTRY;
return ENXIO; return -ENXIO;
} }
int RIOAssignRta( struct rio_info *p, struct Map *MapP ) int RIOAssignRta( struct rio_info *p, struct Map *MapP )
...@@ -649,25 +649,25 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) ...@@ -649,25 +649,25 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
{ {
rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n");
p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
if (MapP->RtaUniqueNum == 0) if (MapP->RtaUniqueNum == 0)
{ {
rio_dprintk (RIO_DEBUG_TABLE, "Rta Unique number zero!\n"); rio_dprintk (RIO_DEBUG_TABLE, "Rta Unique number zero!\n");
p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO; p->RIOError.Error = RTA_UNIQUE_NUMBER_ZERO;
return EINVAL; return -EINVAL;
} }
if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA) ) if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort % PORTS_PER_RTA) )
{ {
rio_dprintk (RIO_DEBUG_TABLE, "Port %d not multiple of %d!\n",(int)MapP->SysPort,PORTS_PER_RTA); rio_dprintk (RIO_DEBUG_TABLE, "Port %d not multiple of %d!\n",(int)MapP->SysPort,PORTS_PER_RTA);
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS) ) if ( (MapP->SysPort != NO_PORT) && (MapP->SysPort >= RIO_PORTS) )
{ {
rio_dprintk (RIO_DEBUG_TABLE, "Port %d not valid!\n",(int)MapP->SysPort); rio_dprintk (RIO_DEBUG_TABLE, "Port %d not valid!\n",(int)MapP->SysPort);
p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE; p->RIOError.Error = TTY_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
/* /*
...@@ -681,7 +681,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) ...@@ -681,7 +681,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
{ {
rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n");
p->RIOError.Error = BAD_CHARACTER_IN_NAME; p->RIOError.Error = BAD_CHARACTER_IN_NAME;
return EINVAL; return -EINVAL;
} }
sptr++; sptr++;
} }
...@@ -693,7 +693,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) ...@@ -693,7 +693,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
if ( (p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING ) if ( (p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING )
{ {
p->RIOError.Error = HOST_NOT_RUNNING; p->RIOError.Error = HOST_NOT_RUNNING;
return ENXIO; return -ENXIO;
} }
/* /*
...@@ -720,7 +720,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) ...@@ -720,7 +720,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
if (RIOFindFreeID(p, &p->RIOHosts[host], &nNewID, NULL) != 0) if (RIOFindFreeID(p, &p->RIOHosts[host], &nNewID, NULL) != 0)
{ {
p->RIOError.Error = COULDNT_FIND_ENTRY; p->RIOError.Error = COULDNT_FIND_ENTRY;
return EBUSY; return -EBUSY;
} }
MapP->ID = (ushort)nNewID + 1; MapP->ID = (ushort)nNewID + 1;
rio_dprintk (RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID); rio_dprintk (RIO_DEBUG_TABLE, "Allocated ID %d for this new RTA.\n", MapP->ID);
...@@ -744,7 +744,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) ...@@ -744,7 +744,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
if (unit == MAX_RUP) if (unit == MAX_RUP)
{ {
p->RIOError.Error = COULDNT_FIND_ENTRY; p->RIOError.Error = COULDNT_FIND_ENTRY;
return EBUSY; return -EBUSY;
} }
HostMapP->Flags |= RTA16_SECOND_SLOT; HostMapP->Flags |= RTA16_SECOND_SLOT;
HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID; HostMapP->ID2 = MapP->ID2 = p->RIOHosts[host].Mapping[unit].ID;
...@@ -761,7 +761,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) ...@@ -761,7 +761,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
{ {
rio_dprintk (RIO_DEBUG_TABLE, "Map table slot for ID %d is already in use.\n", MapP->ID); rio_dprintk (RIO_DEBUG_TABLE, "Map table slot for ID %d is already in use.\n", MapP->ID);
p->RIOError.Error = ID_ALREADY_IN_USE; p->RIOError.Error = ID_ALREADY_IN_USE;
return EBUSY; return -EBUSY;
} }
/* /*
...@@ -802,7 +802,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP ) ...@@ -802,7 +802,7 @@ int RIOAssignRta( struct rio_info *p, struct Map *MapP )
} }
p->RIOError.Error = UNKNOWN_HOST_NUMBER; p->RIOError.Error = UNKNOWN_HOST_NUMBER;
rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum);
return ENXIO; return -ENXIO;
} }
...@@ -1017,7 +1017,7 @@ struct Map* MapP; ...@@ -1017,7 +1017,7 @@ struct Map* MapP;
if ( MapP->ID > MAX_RUP ) { if ( MapP->ID > MAX_RUP ) {
rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n"); rio_dprintk (RIO_DEBUG_TABLE, "Bad ID in map entry!\n");
p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE; p->RIOError.Error = ID_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
MapP->Name[MAX_NAME_LEN-1] = '\0'; MapP->Name[MAX_NAME_LEN-1] = '\0';
...@@ -1027,7 +1027,7 @@ struct Map* MapP; ...@@ -1027,7 +1027,7 @@ struct Map* MapP;
if ( *sptr<' ' || *sptr>'~' ) { if ( *sptr<' ' || *sptr>'~' ) {
rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n"); rio_dprintk (RIO_DEBUG_TABLE, "Name entry contains non-printing characters!\n");
p->RIOError.Error = BAD_CHARACTER_IN_NAME; p->RIOError.Error = BAD_CHARACTER_IN_NAME;
return EINVAL; return -EINVAL;
} }
sptr++; sptr++;
} }
...@@ -1036,7 +1036,7 @@ struct Map* MapP; ...@@ -1036,7 +1036,7 @@ struct Map* MapP;
if ( MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum ) { if ( MapP->HostUniqueNum == p->RIOHosts[host].UniqueNum ) {
if ( (p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING ) { if ( (p->RIOHosts[host].Flags & RUN_STATE) != RC_RUNNING ) {
p->RIOError.Error = HOST_NOT_RUNNING; p->RIOError.Error = HOST_NOT_RUNNING;
return ENXIO; return -ENXIO;
} }
if ( MapP->ID==0 ) { if ( MapP->ID==0 ) {
CCOPY( MapP->Name, p->RIOHosts[host].Name, MAX_NAME_LEN ); CCOPY( MapP->Name, p->RIOHosts[host].Name, MAX_NAME_LEN );
...@@ -1047,7 +1047,7 @@ struct Map* MapP; ...@@ -1047,7 +1047,7 @@ struct Map* MapP;
if ( HostMapP->RtaUniqueNum != MapP->RtaUniqueNum ) { if ( HostMapP->RtaUniqueNum != MapP->RtaUniqueNum ) {
p->RIOError.Error = RTA_NUMBER_WRONG; p->RIOError.Error = RTA_NUMBER_WRONG;
return ENXIO; return -ENXIO;
} }
CCOPY( MapP->Name, HostMapP->Name, MAX_NAME_LEN ); CCOPY( MapP->Name, HostMapP->Name, MAX_NAME_LEN );
return 0; return 0;
...@@ -1055,5 +1055,5 @@ struct Map* MapP; ...@@ -1055,5 +1055,5 @@ struct Map* MapP;
} }
p->RIOError.Error = UNKNOWN_HOST_NUMBER; p->RIOError.Error = UNKNOWN_HOST_NUMBER;
rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum); rio_dprintk (RIO_DEBUG_TABLE, "Unknown host %x\n", MapP->HostUniqueNum);
return ENXIO; return -ENXIO;
} }
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment