Commit 777e760f authored by Linus Torvalds's avatar Linus Torvalds

Merge http://kernel-acme.bkbits.net:8080/rio-2.5-cleanups

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 4bce4b2a 84226104
...@@ -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;
} }
......
...@@ -230,7 +230,7 @@ int su; ...@@ -230,7 +230,7 @@ int su;
} }
} }
} else if (host >= p->RIONumHosts) { } else if (host >= p->RIONumHosts) {
return EINVAL; return -EINVAL;
} else { } else {
if ( p->RIOHosts[host].Flags == RC_RUNNING ) { if ( p->RIOHosts[host].Flags == RC_RUNNING ) {
WWORD(p->RIOHosts[host].ParmMapP->timer , value); WWORD(p->RIOHosts[host].ParmMapP->timer , value);
...@@ -320,12 +320,12 @@ int su; ...@@ -320,12 +320,12 @@ int su;
sizeof(SpecialRupCmd)) == COPYFAIL ) { sizeof(SpecialRupCmd)) == COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
CmdBlkP = RIOGetCmdBlk(); CmdBlkP = RIOGetCmdBlk();
if ( !CmdBlkP ) { if ( !CmdBlkP ) {
rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD GetCmdBlk failed\n");
return ENXIO; return -ENXIO;
} }
CmdBlkP->Packet = SpecialRupCmd.Packet; CmdBlkP->Packet = SpecialRupCmd.Packet;
if ( SpecialRupCmd.Host >= p->RIONumHosts ) if ( SpecialRupCmd.Host >= p->RIONumHosts )
...@@ -345,12 +345,12 @@ RIO_DEBUG_CTRL, if (su) ...@@ -345,12 +345,12 @@ RIO_DEBUG_CTRL, if (su)
return rio_RIODebugMemory(RIO_DEBUG_CTRL, arg); return rio_RIODebugMemory(RIO_DEBUG_CTRL, arg);
else else
#endif #endif
return EPERM; return -EPERM;
case RIO_ALL_MODEM: case RIO_ALL_MODEM:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_ALL_MODEM\n");
p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; p->RIOError.Error = IOCTL_COMMAND_UNKNOWN;
return EINVAL; return -EINVAL;
case RIO_GET_TABLE: case RIO_GET_TABLE:
/* /*
...@@ -365,7 +365,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -365,7 +365,7 @@ RIO_DEBUG_CTRL, if (su)
TOTAL_MAP_ENTRIES*sizeof(struct Map)) == COPYFAIL) { TOTAL_MAP_ENTRIES*sizeof(struct Map)) == COPYFAIL) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
{ {
...@@ -407,13 +407,13 @@ RIO_DEBUG_CTRL, if (su) ...@@ -407,13 +407,13 @@ RIO_DEBUG_CTRL, if (su)
if ( !su ) { if ( !su ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return EPERM; return -EPERM;
} }
if ( copyin((int)arg, (caddr_t)&p->RIOConnectTable[0], if ( copyin((int)arg, (caddr_t)&p->RIOConnectTable[0],
TOTAL_MAP_ENTRIES*sizeof(struct Map) ) == COPYFAIL ) { TOTAL_MAP_ENTRIES*sizeof(struct Map) ) == COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
/* /*
*********************************** ***********************************
...@@ -455,13 +455,13 @@ RIO_DEBUG_CTRL, if (su) ...@@ -455,13 +455,13 @@ RIO_DEBUG_CTRL, if (su)
{ {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return EPERM; return -EPERM;
} }
if (copyout((caddr_t) p->RIOBindTab, (int)arg, if (copyout((caddr_t) p->RIOBindTab, (int)arg,
(sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL ) { (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return 0; return 0;
...@@ -476,13 +476,13 @@ RIO_DEBUG_CTRL, if (su) ...@@ -476,13 +476,13 @@ RIO_DEBUG_CTRL, if (su)
{ {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return EPERM; return -EPERM;
} }
if (copyin((int)arg, (caddr_t)&p->RIOBindTab[0], if (copyin((int)arg, (caddr_t)&p->RIOBindTab[0],
(sizeof(ulong) * MAX_RTA_BINDINGS))==COPYFAIL ) { (sizeof(ulong) * MAX_RTA_BINDINGS))==COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
return 0; return 0;
...@@ -498,7 +498,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -498,7 +498,7 @@ RIO_DEBUG_CTRL, if (su)
if ( !su ) { if ( !su ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_BIND_RTA !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return EPERM; return -EPERM;
} }
for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) { for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) {
if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L)) if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L))
...@@ -535,17 +535,17 @@ RIO_DEBUG_CTRL, if (su) ...@@ -535,17 +535,17 @@ RIO_DEBUG_CTRL, if (su)
if ((port < 0) || (port > 511)) { if ((port < 0) || (port > 511)) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
PortP = p->RIOPortp[port]; PortP = p->RIOPortp[port];
if (!PortP->Mapped) { if (!PortP->Mapped) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port); rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not mapped\n", port);
p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM;
return EINVAL; return -EINVAL;
} }
if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) { if (!(PortP->State & (RIO_LOPEN | RIO_MOPEN))) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port); rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d not open\n", port);
return EINVAL; return -EINVAL;
} }
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
...@@ -553,7 +553,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -553,7 +553,7 @@ RIO_DEBUG_CTRL, if (su)
RIO_FAIL) { RIO_FAIL) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME failed\n");
rio_spin_unlock_irqrestore(&PortP->portSem, flags); rio_spin_unlock_irqrestore(&PortP->portSem, flags);
return EBUSY; return -EBUSY;
} }
else { else {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port); rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESUME: Port %d resumed\n", port);
...@@ -567,13 +567,13 @@ RIO_DEBUG_CTRL, if (su) ...@@ -567,13 +567,13 @@ RIO_DEBUG_CTRL, if (su)
if ( !su ) { if ( !su ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_ASSIGN_RTA !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return EPERM; return -EPERM;
} }
if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt))
== COPYFAIL) { == COPYFAIL) {
rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
return RIOAssignRta(p, &MapEnt); return RIOAssignRta(p, &MapEnt);
...@@ -582,13 +582,13 @@ RIO_DEBUG_CTRL, if (su) ...@@ -582,13 +582,13 @@ RIO_DEBUG_CTRL, if (su)
if ( !su ) { if ( !su ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_CHANGE_NAME !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return EPERM; return -EPERM;
} }
if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt))
== COPYFAIL) { == COPYFAIL) {
rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "Copy from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
return RIOChangeName(p, &MapEnt); return RIOChangeName(p, &MapEnt);
...@@ -597,13 +597,13 @@ RIO_DEBUG_CTRL, if (su) ...@@ -597,13 +597,13 @@ RIO_DEBUG_CTRL, if (su)
if ( !su ) { if ( !su ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_DELETE_RTA !Root\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return EPERM; return -EPERM;
} }
if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt)) if (copyin((int)arg, (caddr_t)&MapEnt, sizeof(MapEnt))
== COPYFAIL ) { == COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "Copy from data space failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "Copy from data space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
return RIODeleteRta(p, &MapEnt); return RIODeleteRta(p, &MapEnt);
...@@ -627,14 +627,14 @@ RIO_DEBUG_CTRL, if (su) ...@@ -627,14 +627,14 @@ RIO_DEBUG_CTRL, if (su)
if (copyout((caddr_t)&p->RIORtaDisCons,(int)arg, if (copyout((caddr_t)&p->RIORtaDisCons,(int)arg,
sizeof(uint))==COPYFAIL) { sizeof(uint))==COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return 0; return 0;
case RIO_LAST_ERROR: case RIO_LAST_ERROR:
if (copyout((caddr_t)&p->RIOError, (int)arg, if (copyout((caddr_t)&p->RIOError, (int)arg,
sizeof(struct Error)) ==COPYFAIL ) sizeof(struct Error)) ==COPYFAIL )
return EFAULT; return -EFAULT;
return 0; return 0;
case RIO_GET_LOG: case RIO_GET_LOG:
...@@ -643,7 +643,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -643,7 +643,7 @@ RIO_DEBUG_CTRL, if (su)
RIOGetLog(arg); RIOGetLog(arg);
return 0; return 0;
#else #else
return EINVAL; return -EINVAL;
#endif #endif
case RIO_GET_MODTYPE: case RIO_GET_MODTYPE:
...@@ -651,21 +651,21 @@ RIO_DEBUG_CTRL, if (su) ...@@ -651,21 +651,21 @@ RIO_DEBUG_CTRL, if (su)
sizeof(uint)) == COPYFAIL ) sizeof(uint)) == COPYFAIL )
{ {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Get module type for port %d\n", port); rio_dprintk (RIO_DEBUG_CTRL, "Get module type for port %d\n", port);
if ( port < 0 || port > 511 ) if ( port < 0 || port > 511 )
{ {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port); rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Bad port number %d\n", port);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
PortP = (p->RIOPortp[port]); PortP = (p->RIOPortp[port]);
if (!PortP->Mapped) if (!PortP->Mapped)
{ {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port); rio_dprintk (RIO_DEBUG_CTRL, "RIO_GET_MODTYPE: Port %d not mapped\n", port);
p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM; p->RIOError.Error = PORT_NOT_MAPPED_INTO_SYSTEM;
return EINVAL; return -EINVAL;
} }
/* /*
** Return module type of port ** Return module type of port
...@@ -674,7 +674,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -674,7 +674,7 @@ RIO_DEBUG_CTRL, if (su)
if (copyout((caddr_t)&port, (int)arg, if (copyout((caddr_t)&port, (int)arg,
sizeof(uint)) == COPYFAIL) { sizeof(uint)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return(0); return(0);
/* /*
...@@ -690,7 +690,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -690,7 +690,7 @@ RIO_DEBUG_CTRL, if (su)
if (copyout((caddr_t)&p->RIOBootMode, (int)arg, if (copyout((caddr_t)&p->RIOBootMode, (int)arg,
sizeof(p->RIOBootMode)) == COPYFAIL) { sizeof(p->RIOBootMode)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return(0); return(0);
...@@ -717,24 +717,24 @@ RIO_DEBUG_CTRL, if (su) ...@@ -717,24 +717,24 @@ RIO_DEBUG_CTRL, if (su)
== COPYFAIL ) { == COPYFAIL ) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "EFAULT"); rio_dprintk (RIO_DEBUG_CTRL, "EFAULT");
return EFAULT; return -EFAULT;
} }
if ( PortSetup.From > PortSetup.To || if ( PortSetup.From > PortSetup.To ||
PortSetup.To >= RIO_PORTS ) { PortSetup.To >= RIO_PORTS ) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
rio_dprintk (RIO_DEBUG_CTRL, "ENXIO"); rio_dprintk (RIO_DEBUG_CTRL, "ENXIO");
return ENXIO; return -ENXIO;
} }
if ( PortSetup.XpCps > p->RIOConf.MaxXpCps || if ( PortSetup.XpCps > p->RIOConf.MaxXpCps ||
PortSetup.XpCps < p->RIOConf.MinXpCps ) { PortSetup.XpCps < p->RIOConf.MinXpCps ) {
p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE; p->RIOError.Error = XPRINT_CPS_OUT_OF_RANGE;
rio_dprintk (RIO_DEBUG_CTRL, "EINVAL"); rio_dprintk (RIO_DEBUG_CTRL, "EINVAL");
return EINVAL; return -EINVAL;
} }
if ( !p->RIOPortp ) { if ( !p->RIOPortp ) {
cprintf("No p->RIOPortp array!\n"); cprintf("No p->RIOPortp array!\n");
rio_dprintk (RIO_DEBUG_CTRL, "No p->RIOPortp array!\n"); rio_dprintk (RIO_DEBUG_CTRL, "No p->RIOPortp array!\n");
return EIO; return -EIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To); rio_dprintk (RIO_DEBUG_CTRL, "entering loop (%d %d)!\n", PortSetup.From, PortSetup.To);
for (loop=PortSetup.From; loop<=PortSetup.To; loop++) { for (loop=PortSetup.From; loop<=PortSetup.To; loop++) {
...@@ -800,11 +800,11 @@ RIO_DEBUG_CTRL, if (su) ...@@ -800,11 +800,11 @@ RIO_DEBUG_CTRL, if (su)
if (copyin((int)arg, (caddr_t)&PortSetup, sizeof(PortSetup)) if (copyin((int)arg, (caddr_t)&PortSetup, sizeof(PortSetup))
== COPYFAIL ) { == COPYFAIL ) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if ( PortSetup.From >= RIO_PORTS ) { if ( PortSetup.From >= RIO_PORTS ) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return ENXIO; return -ENXIO;
} }
port = PortSetup.To = PortSetup.From; port = PortSetup.To = PortSetup.From;
...@@ -827,7 +827,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -827,7 +827,7 @@ RIO_DEBUG_CTRL, if (su)
if ( copyout((caddr_t)&PortSetup,(int)arg,sizeof(PortSetup)) if ( copyout((caddr_t)&PortSetup,(int)arg,sizeof(PortSetup))
==COPYFAIL ) { ==COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -836,11 +836,11 @@ RIO_DEBUG_CTRL, if (su) ...@@ -836,11 +836,11 @@ RIO_DEBUG_CTRL, if (su)
if (copyin( (int)arg, (caddr_t)&PortParams, if (copyin( (int)arg, (caddr_t)&PortParams,
sizeof(struct PortParams)) == COPYFAIL) { sizeof(struct PortParams)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if (PortParams.Port >= RIO_PORTS) { if (PortParams.Port >= RIO_PORTS) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return ENXIO; return -ENXIO;
} }
PortP = (p->RIOPortp[PortParams.Port]); PortP = (p->RIOPortp[PortParams.Port]);
PortParams.Config = PortP->Config; PortParams.Config = PortP->Config;
...@@ -850,7 +850,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -850,7 +850,7 @@ RIO_DEBUG_CTRL, if (su)
if (copyout((caddr_t)&PortParams, (int)arg, if (copyout((caddr_t)&PortParams, (int)arg,
sizeof(struct PortParams)) == COPYFAIL ) { sizeof(struct PortParams)) == COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -859,11 +859,11 @@ RIO_DEBUG_CTRL, if (su) ...@@ -859,11 +859,11 @@ RIO_DEBUG_CTRL, if (su)
if (copyin((int)arg, (caddr_t)&PortTty, sizeof(struct PortTty)) if (copyin((int)arg, (caddr_t)&PortTty, sizeof(struct PortTty))
== COPYFAIL) { == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if ( PortTty.port >= RIO_PORTS ) { if ( PortTty.port >= RIO_PORTS ) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); rio_dprintk (RIO_DEBUG_CTRL, "Port %d\n", PortTty.port);
...@@ -877,7 +877,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -877,7 +877,7 @@ RIO_DEBUG_CTRL, if (su)
if (copyout((caddr_t)&PortTty, (int)arg, if (copyout((caddr_t)&PortTty, (int)arg,
sizeof(struct PortTty)) == COPYFAIL) { sizeof(struct PortTty)) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -885,12 +885,12 @@ RIO_DEBUG_CTRL, if (su) ...@@ -885,12 +885,12 @@ RIO_DEBUG_CTRL, if (su)
if (copyin((int)arg, (caddr_t)&PortTty, if (copyin((int)arg, (caddr_t)&PortTty,
sizeof(struct PortTty)) == COPYFAIL) { sizeof(struct PortTty)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port); rio_dprintk (RIO_DEBUG_CTRL, "Set port %d tty\n", PortTty.port);
if (PortTty.port >= (ushort) RIO_PORTS) { if (PortTty.port >= (ushort) RIO_PORTS) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return ENXIO; return -ENXIO;
} }
PortP = (p->RIOPortp[PortTty.port]); PortP = (p->RIOPortp[PortTty.port]);
#if 0 #if 0
...@@ -910,11 +910,11 @@ RIO_DEBUG_CTRL, if (su) ...@@ -910,11 +910,11 @@ RIO_DEBUG_CTRL, if (su)
if ( copyin((int)arg, (caddr_t)&PortParams, sizeof(PortParams)) if ( copyin((int)arg, (caddr_t)&PortParams, sizeof(PortParams))
== COPYFAIL ) { == COPYFAIL ) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if (PortParams.Port >= (ushort) RIO_PORTS) { if (PortParams.Port >= (ushort) RIO_PORTS) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return ENXIO; return -ENXIO;
} }
PortP = (p->RIOPortp[PortParams.Port]); PortP = (p->RIOPortp[PortParams.Port]);
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
...@@ -927,11 +927,11 @@ RIO_DEBUG_CTRL, if (su) ...@@ -927,11 +927,11 @@ RIO_DEBUG_CTRL, if (su)
if ( copyin((int)arg, (caddr_t)&portStats, if ( copyin((int)arg, (caddr_t)&portStats,
sizeof(struct portStats)) == COPYFAIL ) { sizeof(struct portStats)) == COPYFAIL ) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if ( portStats.port >= RIO_PORTS ) { if ( portStats.port >= RIO_PORTS ) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return ENXIO; return -ENXIO;
} }
PortP = (p->RIOPortp[portStats.port]); PortP = (p->RIOPortp[portStats.port]);
portStats.gather = PortP->statsGather; portStats.gather = PortP->statsGather;
...@@ -943,7 +943,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -943,7 +943,7 @@ RIO_DEBUG_CTRL, if (su)
if ( copyout((caddr_t)&portStats, (int)arg, if ( copyout((caddr_t)&portStats, (int)arg,
sizeof(struct portStats)) == COPYFAIL ) { sizeof(struct portStats)) == COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -952,7 +952,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -952,7 +952,7 @@ RIO_DEBUG_CTRL, if (su)
rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n");
if ( port >= RIO_PORTS ) { if ( port >= RIO_PORTS ) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return ENXIO; return -ENXIO;
} }
PortP = (p->RIOPortp[port]); PortP = (p->RIOPortp[port]);
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
...@@ -969,11 +969,11 @@ RIO_DEBUG_CTRL, if (su) ...@@ -969,11 +969,11 @@ RIO_DEBUG_CTRL, if (su)
if ( copyin( (int)arg, (caddr_t)&portStats, if ( copyin( (int)arg, (caddr_t)&portStats,
sizeof(struct portStats)) == COPYFAIL ) { sizeof(struct portStats)) == COPYFAIL ) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if ( portStats.port >= RIO_PORTS ) { if ( portStats.port >= RIO_PORTS ) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return ENXIO; return -ENXIO;
} }
PortP = (p->RIOPortp[portStats.port]); PortP = (p->RIOPortp[portStats.port]);
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
...@@ -992,7 +992,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -992,7 +992,7 @@ RIO_DEBUG_CTRL, if (su)
sizeof(struct DbInf)*(num+1))==COPYFAIL) { sizeof(struct DbInf)*(num+1))==COPYFAIL) {
rio_dprintk (RIO_DEBUG_CTRL, "ReadLevels Copy failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "ReadLevels Copy failed\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_CTRL, "%d levels to copied\n",num); rio_dprintk (RIO_DEBUG_CTRL, "%d levels to copied\n",num);
return retval; return retval;
...@@ -1004,7 +1004,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1004,7 +1004,7 @@ RIO_DEBUG_CTRL, if (su)
if (copyout((caddr_t)&p->RIOConf, (int)arg, if (copyout((caddr_t)&p->RIOConf, (int)arg,
sizeof(struct Conf)) ==COPYFAIL ) { sizeof(struct Conf)) ==COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -1012,12 +1012,12 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1012,12 +1012,12 @@ RIO_DEBUG_CTRL, if (su)
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_CONFIG\n");
if ( !su ) { if ( !su ) {
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return EPERM; return -EPERM;
} }
if ( copyin((int)arg, (caddr_t)&p->RIOConf, sizeof(struct Conf) ) if ( copyin((int)arg, (caddr_t)&p->RIOConf, sizeof(struct Conf) )
==COPYFAIL ) { ==COPYFAIL ) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
/* /*
** move a few value around ** move a few value around
...@@ -1030,13 +1030,13 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1030,13 +1030,13 @@ RIO_DEBUG_CTRL, if (su)
case RIO_START_POLLER: case RIO_START_POLLER:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_START_POLLER\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_START_POLLER\n");
return EINVAL; return -EINVAL;
case RIO_STOP_POLLER: case RIO_STOP_POLLER:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_STOP_POLLER\n");
if ( !su ) { if ( !su ) {
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return EPERM; return -EPERM;
} }
p->RIOPolling = NOT_POLLING; p->RIOPolling = NOT_POLLING;
return retval; return retval;
...@@ -1047,13 +1047,13 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1047,13 +1047,13 @@ RIO_DEBUG_CTRL, if (su)
if ( copyin( (int)arg, (caddr_t)&DebugCtrl, sizeof(DebugCtrl) ) if ( copyin( (int)arg, (caddr_t)&DebugCtrl, sizeof(DebugCtrl) )
==COPYFAIL ) { ==COPYFAIL ) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if ( DebugCtrl.SysPort == NO_PORT ) { if ( DebugCtrl.SysPort == NO_PORT ) {
if ( cmd == RIO_SETDEBUG ) { if ( cmd == RIO_SETDEBUG ) {
if ( !su ) { if ( !su ) {
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return EPERM; return -EPERM;
} }
p->rio_debug = DebugCtrl.Debug; p->rio_debug = DebugCtrl.Debug;
p->RIODebugWait = DebugCtrl.Wait; p->RIODebugWait = DebugCtrl.Wait;
...@@ -1070,7 +1070,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1070,7 +1070,7 @@ RIO_DEBUG_CTRL, if (su)
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n",
DebugCtrl.SysPort); DebugCtrl.SysPort);
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
} }
} }
...@@ -1079,12 +1079,12 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1079,12 +1079,12 @@ RIO_DEBUG_CTRL, if (su)
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n",
DebugCtrl.SysPort); DebugCtrl.SysPort);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return ENXIO; return -ENXIO;
} }
else if ( cmd == RIO_SETDEBUG ) { else if ( cmd == RIO_SETDEBUG ) {
if ( !su ) { if ( !su ) {
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return EPERM; return -EPERM;
} }
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug; p->RIOPortp[DebugCtrl.SysPort]->Debug = DebugCtrl.Debug;
...@@ -1100,7 +1100,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1100,7 +1100,7 @@ RIO_DEBUG_CTRL, if (su)
sizeof(DebugCtrl))==COPYFAIL ) { sizeof(DebugCtrl))==COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
} }
return retval; return retval;
...@@ -1118,7 +1118,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1118,7 +1118,7 @@ RIO_DEBUG_CTRL, if (su)
{ {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host); rio_dprintk (RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host);
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -1138,7 +1138,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1138,7 +1138,7 @@ RIO_DEBUG_CTRL, if (su)
(int)arg, MAX_VERSION_LEN ) == COPYFAIL ) { (int)arg, MAX_VERSION_LEN ) == COPYFAIL ) {
rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID: Bad copy to user space\n",Host)); rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID: Bad copy to user space\n",Host));
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return retval; return retval;
** **
...@@ -1155,7 +1155,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1155,7 +1155,7 @@ RIO_DEBUG_CTRL, if (su)
sizeof(p->RIONumHosts) )==COPYFAIL ) { sizeof(p->RIONumHosts) )==COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -1167,7 +1167,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1167,7 +1167,7 @@ RIO_DEBUG_CTRL, if (su)
if ( !su ) { if ( !su ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return EPERM; return -EPERM;
} }
p->RIOHalted = 1; p->RIOHalted = 1;
p->RIOSystemUp = 0; p->RIOSystemUp = 0;
...@@ -1217,13 +1217,13 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1217,13 +1217,13 @@ RIO_DEBUG_CTRL, if (su)
if ( !su ) { if ( !su ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Not super user\n");
p->RIOError.Error = NOT_SUPER_USER; p->RIOError.Error = NOT_SUPER_USER;
return EPERM; return -EPERM;
} }
if ( copyin((int)arg, (caddr_t)&DownLoad, if ( copyin((int)arg, (caddr_t)&DownLoad,
sizeof(DownLoad) )==COPYFAIL ) { sizeof(DownLoad) )==COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n", rio_dprintk (RIO_DEBUG_CTRL, "Copied in download code for product code 0x%x\n",
DownLoad.ProductCode); DownLoad.ProductCode);
...@@ -1235,7 +1235,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1235,7 +1235,7 @@ RIO_DEBUG_CTRL, if (su)
rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Bad product code %d passed\n",
DownLoad.ProductCode); DownLoad.ProductCode);
p->RIOError.Error = NO_SUCH_PRODUCT; p->RIOError.Error = NO_SUCH_PRODUCT;
return ENXIO; return -ENXIO;
} }
/* /*
** do something! ** do something!
...@@ -1257,7 +1257,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1257,7 +1257,7 @@ RIO_DEBUG_CTRL, if (su)
rio_dprintk (RIO_DEBUG_CTRL, rio_dprintk (RIO_DEBUG_CTRL,
"RIO_HOST_REQ: Copy in from user space failed\n"); "RIO_HOST_REQ: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
/* /*
** Fetch the parmmap ** Fetch the parmmap
...@@ -1267,7 +1267,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1267,7 +1267,7 @@ RIO_DEBUG_CTRL, if (su)
(int)arg, sizeof(PARM_MAP) )==COPYFAIL ) { (int)arg, sizeof(PARM_MAP) )==COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n");
return EFAULT; return -EFAULT;
} }
} }
return retval; return retval;
...@@ -1278,13 +1278,13 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1278,13 +1278,13 @@ RIO_DEBUG_CTRL, if (su)
sizeof(HostReq) )==COPYFAIL ) { sizeof(HostReq) )==COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if ( HostReq.HostNum >= p->RIONumHosts ) { if ( HostReq.HostNum >= p->RIONumHosts ) {
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Illegal host number %d\n",
HostReq.HostNum); HostReq.HostNum);
return ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum); rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum);
...@@ -1292,7 +1292,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1292,7 +1292,7 @@ RIO_DEBUG_CTRL, if (su)
(int)HostReq.HostP,sizeof(struct Host) ) == COPYFAIL) { (int)HostReq.HostP,sizeof(struct Host) ) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n");
return EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -1302,13 +1302,13 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1302,13 +1302,13 @@ RIO_DEBUG_CTRL, if (su)
sizeof(HostDpRam) )==COPYFAIL ) { sizeof(HostDpRam) )==COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if ( HostDpRam.HostNum >= p->RIONumHosts ) { if ( HostDpRam.HostNum >= p->RIONumHosts ) {
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Illegal host number %d\n",
HostDpRam.HostNum); HostDpRam.HostNum);
return ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum); rio_dprintk (RIO_DEBUG_CTRL, "Request for host %d\n", HostDpRam.HostNum);
...@@ -1322,7 +1322,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1322,7 +1322,7 @@ RIO_DEBUG_CTRL, if (su)
sizeof(struct DpRam) ) == COPYFAIL ) { sizeof(struct DpRam) ) == COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
return EFAULT; return -EFAULT;
} }
} }
else if (copyout((caddr_t)p->RIOHosts[HostDpRam.HostNum].Caddr, else if (copyout((caddr_t)p->RIOHosts[HostDpRam.HostNum].Caddr,
...@@ -1330,7 +1330,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1330,7 +1330,7 @@ RIO_DEBUG_CTRL, if (su)
sizeof(struct DpRam) ) == COPYFAIL ) { sizeof(struct DpRam) ) == COPYFAIL ) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
return EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -1339,7 +1339,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1339,7 +1339,7 @@ RIO_DEBUG_CTRL, if (su)
if ( (int)arg < 0 || (int)arg > 511 ) { if ( (int)arg < 0 || (int)arg > 511 ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n",(int)arg); rio_dprintk (RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n",(int)arg);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
p->RIOPortp[(int)arg]->State |= RIO_BUSY; p->RIOPortp[(int)arg]->State |= RIO_BUSY;
...@@ -1356,14 +1356,14 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1356,14 +1356,14 @@ RIO_DEBUG_CTRL, if (su)
sizeof(PortReq) )==COPYFAIL ) { sizeof(PortReq) )==COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if (PortReq.SysPort >= RIO_PORTS) { /* SysPort is unsigned */ if (PortReq.SysPort >= RIO_PORTS) { /* SysPort is unsigned */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Illegal port number %d\n",
PortReq.SysPort); PortReq.SysPort);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return ENXIO; return -ENXIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort); rio_dprintk (RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort);
if (copyout((caddr_t)p->RIOPortp[PortReq.SysPort], if (copyout((caddr_t)p->RIOPortp[PortReq.SysPort],
...@@ -1371,7 +1371,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1371,7 +1371,7 @@ RIO_DEBUG_CTRL, if (su)
sizeof(struct Port) ) == COPYFAIL) { sizeof(struct Port) ) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n");
return EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -1385,19 +1385,19 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1385,19 +1385,19 @@ RIO_DEBUG_CTRL, if (su)
sizeof(RupReq) )==COPYFAIL ) { sizeof(RupReq) )==COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */ if (RupReq.HostNum >= p->RIONumHosts) { /* host is unsigned */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal host number %d\n",
RupReq.HostNum); RupReq.HostNum);
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
return ENXIO; return -ENXIO;
} }
if ( RupReq.RupNum >= MAX_RUP+LINKS_PER_UNIT ) { /* eek! */ if ( RupReq.RupNum >= MAX_RUP+LINKS_PER_UNIT ) { /* eek! */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Illegal rup number %d\n",
RupReq.RupNum); RupReq.RupNum);
p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
HostP = &p->RIOHosts[RupReq.HostNum]; HostP = &p->RIOHosts[RupReq.HostNum];
...@@ -1405,7 +1405,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1405,7 +1405,7 @@ RIO_DEBUG_CTRL, if (su)
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Host %d not running\n",
RupReq.HostNum); RupReq.HostNum);
p->RIOError.Error = HOST_NOT_RUNNING; p->RIOError.Error = HOST_NOT_RUNNING;
return EIO; return -EIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", rio_dprintk (RIO_DEBUG_CTRL, "Request for rup %d from host %d\n",
RupReq.RupNum,RupReq.HostNum); RupReq.RupNum,RupReq.HostNum);
...@@ -1414,7 +1414,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1414,7 +1414,7 @@ RIO_DEBUG_CTRL, if (su)
(int)RupReq.RupP,sizeof(struct RUP) ) == COPYFAIL) { (int)RupReq.RupP,sizeof(struct RUP) ) == COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n");
return EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -1428,19 +1428,19 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1428,19 +1428,19 @@ RIO_DEBUG_CTRL, if (su)
sizeof(LpbReq) )==COPYFAIL ) { sizeof(LpbReq) )==COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if (LpbReq.Host >= p->RIONumHosts) { /* host is unsigned */ if (LpbReq.Host >= p->RIONumHosts) { /* host is unsigned */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal host number %d\n",
LpbReq.Host); LpbReq.Host);
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
return ENXIO; return -ENXIO;
} }
if ( LpbReq.Link >= LINKS_PER_UNIT ) { /* eek! */ if ( LpbReq.Link >= LINKS_PER_UNIT ) { /* eek! */
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Illegal link number %d\n",
LpbReq.Link); LpbReq.Link);
p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE; p->RIOError.Error = LINK_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
HostP = &p->RIOHosts[LpbReq.Host]; HostP = &p->RIOHosts[LpbReq.Host];
...@@ -1448,7 +1448,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1448,7 +1448,7 @@ RIO_DEBUG_CTRL, if (su)
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Host %d not running\n",
LpbReq.Host ); LpbReq.Host );
p->RIOError.Error = HOST_NOT_RUNNING; p->RIOError.Error = HOST_NOT_RUNNING;
return EIO; return -EIO;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", rio_dprintk (RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n",
LpbReq.Link, LpbReq.Host); LpbReq.Link, LpbReq.Host);
...@@ -1457,7 +1457,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1457,7 +1457,7 @@ RIO_DEBUG_CTRL, if (su)
(int)LpbReq.LpbP,sizeof(struct LPB) ) == COPYFAIL) { (int)LpbReq.LpbP,sizeof(struct LPB) ) == COPYFAIL) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return retval; return retval;
...@@ -1483,7 +1483,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1483,7 +1483,7 @@ RIO_DEBUG_CTRL, if (su)
case RIO_SIGNALS_ON: case RIO_SIGNALS_ON:
if ( p->RIOSignalProcess ) { if ( p->RIOSignalProcess ) {
p->RIOError.Error = SIGNALS_ALREADY_SET; p->RIOError.Error = SIGNALS_ALREADY_SET;
return EBUSY; return -EBUSY;
} }
p->RIOSignalProcess = getpid(); p->RIOSignalProcess = getpid();
p->RIOPrintDisabled = DONT_PRINT; p->RIOPrintDisabled = DONT_PRINT;
...@@ -1492,7 +1492,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1492,7 +1492,7 @@ RIO_DEBUG_CTRL, if (su)
case RIO_SIGNALS_OFF: case RIO_SIGNALS_OFF:
if ( p->RIOSignalProcess != getpid() ) { if ( p->RIOSignalProcess != getpid() ) {
p->RIOError.Error = NOT_RECEIVING_PROCESS; p->RIOError.Error = NOT_RECEIVING_PROCESS;
return EPERM; return -EPERM;
} }
rio_dprintk (RIO_DEBUG_CTRL, "Clear signal process to zero\n"); rio_dprintk (RIO_DEBUG_CTRL, "Clear signal process to zero\n");
p->RIOSignalProcess = 0; p->RIOSignalProcess = 0;
...@@ -1531,7 +1531,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1531,7 +1531,7 @@ RIO_DEBUG_CTRL, if (su)
if ( port < 0 || port > 511 ) { if ( port < 0 || port > 511 ) {
rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
rio_spin_lock_irqsave(&PortP->portSem, flags); rio_spin_lock_irqsave(&PortP->portSem, flags);
switch( cmd ) switch( cmd )
...@@ -1554,7 +1554,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1554,7 +1554,7 @@ RIO_DEBUG_CTRL, if (su)
case RIO_STREAM_INFO: case RIO_STREAM_INFO:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_STREAM_INFO\n");
return EINVAL; return -EINVAL;
case RIO_SEND_PACKET: case RIO_SEND_PACKET:
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n");
...@@ -1562,11 +1562,11 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1562,11 +1562,11 @@ RIO_DEBUG_CTRL, if (su)
sizeof(SendPack) )==COPYFAIL ) { sizeof(SendPack) )==COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n");
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
if ( SendPack.PortNum >= 128 ) { if ( SendPack.PortNum >= 128 ) {
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return ENXIO; return -ENXIO;
} }
PortP = p->RIOPortp[SendPack.PortNum]; PortP = p->RIOPortp[SendPack.PortNum];
...@@ -1575,7 +1575,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1575,7 +1575,7 @@ RIO_DEBUG_CTRL, if (su)
if ( !can_add_transmit(&PacketP,PortP) ) { if ( !can_add_transmit(&PacketP,PortP) ) {
p->RIOError.Error = UNIT_IS_IN_USE; p->RIOError.Error = UNIT_IS_IN_USE;
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore( &PortP->portSem , flags);
return ENOSPC; return -ENOSPC;
} }
for ( loop=0; loop<(ushort)(SendPack.Len & 127); loop++ ) for ( loop=0; loop<(ushort)(SendPack.Len & 127); loop++ )
...@@ -1607,7 +1607,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1607,7 +1607,7 @@ RIO_DEBUG_CTRL, if (su)
sizeof(p->RIONoMessage) )==COPYFAIL ) { sizeof(p->RIONoMessage) )==COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return 0; return 0;
...@@ -1615,19 +1615,19 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1615,19 +1615,19 @@ RIO_DEBUG_CTRL, if (su)
if (copyin((int)arg, (caddr_t)&SubCmd, if (copyin((int)arg, (caddr_t)&SubCmd,
sizeof(struct SubCmdStruct)) == COPYFAIL) { sizeof(struct SubCmdStruct)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP host %d rup %d addr %x\n",
SubCmd.Host, SubCmd.Rup, SubCmd.Addr); SubCmd.Host, SubCmd.Rup, SubCmd.Addr);
if (SubCmd.Rup >= MAX_RUP+LINKS_PER_UNIT ) { if (SubCmd.Rup >= MAX_RUP+LINKS_PER_UNIT ) {
p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
if (SubCmd.Host >= p->RIONumHosts ) { if (SubCmd.Host >= p->RIONumHosts ) {
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
port = p->RIOHosts[SubCmd.Host]. port = p->RIOHosts[SubCmd.Host].
...@@ -1640,7 +1640,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1640,7 +1640,7 @@ RIO_DEBUG_CTRL, if (su)
if ( RIOPreemptiveCmd(p, PortP, MEMDUMP ) == RIO_FAIL ) { if ( RIOPreemptiveCmd(p, PortP, MEMDUMP ) == RIO_FAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP failed\n");
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore( &PortP->portSem , flags);
return EBUSY; return -EBUSY;
} }
else else
PortP->State |= RIO_BUSY; PortP->State |= RIO_BUSY;
...@@ -1650,20 +1650,20 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1650,20 +1650,20 @@ RIO_DEBUG_CTRL, if (su)
MEMDUMP_SIZE) == COPYFAIL ) { MEMDUMP_SIZE) == COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return 0; return 0;
case RIO_TICK: case RIO_TICK:
if ((int)arg < 0 || (int)arg >= p->RIONumHosts) if ((int)arg < 0 || (int)arg >= p->RIONumHosts)
return EINVAL; return -EINVAL;
rio_dprintk (RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int)arg); rio_dprintk (RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int)arg);
WBYTE(p->RIOHosts[(int)arg].SetInt , 0xff); WBYTE(p->RIOHosts[(int)arg].SetInt , 0xff);
return 0; return 0;
case RIO_TOCK: case RIO_TOCK:
if ((int)arg < 0 || (int)arg >= p->RIONumHosts) if ((int)arg < 0 || (int)arg >= p->RIONumHosts)
return EINVAL; return -EINVAL;
rio_dprintk (RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int)arg); rio_dprintk (RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int)arg);
WBYTE((p->RIOHosts[(int)arg].ResetInt) , 0xff); WBYTE((p->RIOHosts[(int)arg].ResetInt) , 0xff);
return 0; return 0;
...@@ -1674,7 +1674,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1674,7 +1674,7 @@ RIO_DEBUG_CTRL, if (su)
if (copyout((caddr_t)&p->RIOReadCheck,(int)arg, if (copyout((caddr_t)&p->RIOReadCheck,(int)arg,
sizeof(uint))== COPYFAIL) { sizeof(uint))== COPYFAIL) {
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return 0; return 0;
...@@ -1682,7 +1682,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1682,7 +1682,7 @@ RIO_DEBUG_CTRL, if (su)
if (copyin((int)arg, (caddr_t)&SubCmd, if (copyin((int)arg, (caddr_t)&SubCmd,
sizeof(struct SubCmdStruct)) == COPYFAIL) { sizeof(struct SubCmdStruct)) == COPYFAIL) {
p->RIOError.Error = COPYIN_FAILED; p->RIOError.Error = COPYIN_FAILED;
return EFAULT; return -EFAULT;
} }
rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER host %d rup %d port %d reg %x\n", rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER host %d rup %d port %d reg %x\n",
SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr); SubCmd.Host, SubCmd.Rup, SubCmd.Port, SubCmd.Addr);
...@@ -1691,17 +1691,17 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1691,17 +1691,17 @@ RIO_DEBUG_CTRL, if (su)
rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", rio_dprintk (RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n",
SubCmd.Port); SubCmd.Port);
p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
if (SubCmd.Rup >= MAX_RUP+LINKS_PER_UNIT ) { if (SubCmd.Rup >= MAX_RUP+LINKS_PER_UNIT ) {
p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE; p->RIOError.Error = RUP_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
if (SubCmd.Host >= p->RIONumHosts ) { if (SubCmd.Host >= p->RIONumHosts ) {
p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE; p->RIOError.Error = HOST_NUMBER_OUT_OF_RANGE;
return EINVAL; return -EINVAL;
} }
port = p->RIOHosts[SubCmd.Host]. port = p->RIOHosts[SubCmd.Host].
...@@ -1713,7 +1713,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1713,7 +1713,7 @@ RIO_DEBUG_CTRL, if (su)
if (RIOPreemptiveCmd(p, PortP, READ_REGISTER) == RIO_FAIL) { if (RIOPreemptiveCmd(p, PortP, READ_REGISTER) == RIO_FAIL) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER failed\n");
rio_spin_unlock_irqrestore( &PortP->portSem , flags); rio_spin_unlock_irqrestore( &PortP->portSem , flags);
return EBUSY; return -EBUSY;
} }
else else
PortP->State |= RIO_BUSY; PortP->State |= RIO_BUSY;
...@@ -1723,7 +1723,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1723,7 +1723,7 @@ RIO_DEBUG_CTRL, if (su)
sizeof(uint)) == COPYFAIL ) { sizeof(uint)) == COPYFAIL ) {
rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n"); rio_dprintk (RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n");
p->RIOError.Error = COPYOUT_FAILED; p->RIOError.Error = COPYOUT_FAILED;
return EFAULT; return -EFAULT;
} }
return 0; return 0;
/* /*
...@@ -1750,7 +1750,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1750,7 +1750,7 @@ RIO_DEBUG_CTRL, if (su)
return (int)arg; return (int)arg;
} }
rio_dprintk (RIO_DEBUG_CTRL, "MAKE Device is called\n"); rio_dprintk (RIO_DEBUG_CTRL, "MAKE Device is called\n");
return EINVAL; return -EINVAL;
} }
/* /*
** rio_minor: given a dev_t from a stat() call, return ** rio_minor: given a dev_t from a stat() call, return
...@@ -1780,7 +1780,7 @@ RIO_DEBUG_CTRL, if (su) ...@@ -1780,7 +1780,7 @@ RIO_DEBUG_CTRL, if (su)
p->RIOError.Error = IOCTL_COMMAND_UNKNOWN; p->RIOError.Error = IOCTL_COMMAND_UNKNOWN;
func_exit (); func_exit ();
return EINVAL; return -EINVAL;
} }
/* /*
......
...@@ -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