Commit 3d336aa257ba382c3ad7883ee000cbacb761e411

Authored by Alan Cox
Committed by Linus Torvalds
1 parent 00d83a54aa

[PATCH] rio driver rework continued #4

Third large chunk of code cleanup.  The split between this and #3 and #4 is
fairly arbitary and due to the message length limit on the list.  These
patches continue the process of ripping out macros and typedefs while cleaning
up lots of 32bit assumptions.  Several inlines for compatibility also get
removed and that causes a lot of noise.

Signed-off-by: Alan Cox <alan@redhat.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>

Showing 1 changed file with 118 additions and 272 deletions Side-by-side Diff

drivers/char/rio/rioctrl.c
Changes suppressed. Click to show
... ... @@ -131,30 +131,6 @@
131 131  
132 132 #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff))
133 133  
134   -int copyin(int arg, caddr_t dp, int siz)
135   -{
136   - int rv;
137   -
138   - rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes from user %p to %p.\n", siz, (void *) arg, dp);
139   - rv = copy_from_user(dp, (void *) arg, siz);
140   - if (rv)
141   - return COPYFAIL;
142   - else
143   - return rv;
144   -}
145   -
146   -static int copyout(caddr_t dp, int arg, int siz)
147   -{
148   - int rv;
149   -
150   - rio_dprintk(RIO_DEBUG_CTRL, "Copying %d bytes to user %p from %p.\n", siz, (void *) arg, dp);
151   - rv = copy_to_user((void *) arg, dp, siz);
152   - if (rv)
153   - return COPYFAIL;
154   - else
155   - return rv;
156   -}
157   -
158 134 int riocontrol(p, dev, cmd, arg, su)
159 135 struct rio_info *p;
160 136 dev_t dev;
... ... @@ -178,7 +154,7 @@
178 154 Host = 0;
179 155 PortP = NULL;
180 156  
181   - rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%x\n", cmd, (int) arg);
  157 + rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: 0x%p\n", cmd, arg);
182 158  
183 159 switch (cmd) {
184 160 /*
185 161  
186 162  
187 163  
188 164  
189 165  
190 166  
... ... @@ -189,90 +165,34 @@
189 165 ** otherwise just the specified host card will be changed.
190 166 */
191 167 case RIO_SET_TIMER:
192   - rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %dms\n", (uint) arg);
  168 + rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %ldms\n", (unsigned long)arg);
193 169 {
194 170 int host, value;
195   - host = (uint) arg >> 16;
196   - value = (uint) arg & 0x0000ffff;
  171 + host = ((unsigned long) arg >> 16) & 0x0000FFFF;
  172 + value = (unsigned long) arg & 0x0000ffff;
197 173 if (host == -1) {
198 174 for (host = 0; host < p->RIONumHosts; host++) {
199 175 if (p->RIOHosts[host].Flags == RC_RUNNING) {
200   - WWORD(p->RIOHosts[host].ParmMapP->timer, value);
  176 + writew(value, &p->RIOHosts[host].ParmMapP->timer);
201 177 }
202 178 }
203 179 } else if (host >= p->RIONumHosts) {
204 180 return -EINVAL;
205 181 } else {
206 182 if (p->RIOHosts[host].Flags == RC_RUNNING) {
207   - WWORD(p->RIOHosts[host].ParmMapP->timer, value);
  183 + writew(value, &p->RIOHosts[host].ParmMapP->timer);
208 184 }
209 185 }
210 186 }
211 187 return 0;
212 188  
213   - case RIO_IDENTIFY_DRIVER:
214   - /*
215   - ** 15.10.1998 ARG - ESIL 0760 part fix
216   - ** Added driver ident string output.
217   - **
218   - #ifndef __THIS_RELEASE__
219   - #warning Driver Version string not defined !
220   - #endif
221   - cprintf("%s %s %s %s\n",
222   - RIO_DRV_STR,
223   - __THIS_RELEASE__,
224   - __DATE__, __TIME__ );
225   -
226   - return 0;
227   -
228   - case RIO_DISPLAY_HOST_CFG:
229   - **
230   - ** 15.10.1998 ARG - ESIL 0760 part fix
231   - ** Added driver host card ident string output.
232   - **
233   - ** Note that the only types currently supported
234   - ** are ISA and PCI. Also this driver does not
235   - ** (yet) distinguish between the Old PCI card
236   - ** and the Jet PCI card. In fact I think this
237   - ** driver only supports JET PCI !
238   - **
239   -
240   - for (Host = 0; Host < p->RIONumHosts; Host++)
241   - {
242   - HostP = &(p->RIOHosts[Host]);
243   -
244   - switch ( HostP->Type )
245   - {
246   - case RIO_AT :
247   - strcpy( host_type, RIO_AT_HOST_STR );
248   - break;
249   -
250   - case RIO_PCI :
251   - strcpy( host_type, RIO_PCI_HOST_STR );
252   - break;
253   -
254   - default :
255   - strcpy( host_type, "Unknown" );
256   - break;
257   - }
258   -
259   - cprintf(
260   - "RIO Host %d - Type:%s Addr:%X IRQ:%d\n",
261   - Host, host_type,
262   - (uint)HostP->PaddrP,
263   - (int)HostP->Ivec - 32 );
264   - }
265   - return 0;
266   - **
267   - */
268   -
269 189 case RIO_FOAD_RTA:
270 190 rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n");
271   - return RIOCommandRta(p, (uint) arg, RIOFoadRta);
  191 + return RIOCommandRta(p, (unsigned long)arg, RIOFoadRta);
272 192  
273 193 case RIO_ZOMBIE_RTA:
274 194 rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n");
275   - return RIOCommandRta(p, (uint) arg, RIOZombieRta);
  195 + return RIOCommandRta(p, (unsigned long)arg, RIOZombieRta);
276 196  
277 197 case RIO_IDENTIFY_RTA:
278 198 rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n");
... ... @@ -287,7 +207,7 @@
287 207 struct CmdBlk *CmdBlkP;
288 208  
289 209 rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n");
290   - if (copyin((int) arg, (caddr_t) & SpecialRupCmd, sizeof(SpecialRupCmd)) == COPYFAIL) {
  210 + if (copy_from_user(&SpecialRupCmd, arg, sizeof(SpecialRupCmd))) {
291 211 rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n");
292 212 p->RIOError.Error = COPYIN_FAILED;
293 213 return -EFAULT;
... ... @@ -302,7 +222,7 @@
302 222 SpecialRupCmd.Host = 0;
303 223 rio_dprintk(RIO_DEBUG_CTRL, "Queue special rup command for host %d rup %d\n", SpecialRupCmd.Host, SpecialRupCmd.RupNum);
304 224 if (RIOQueueCmdBlk(&p->RIOHosts[SpecialRupCmd.Host], SpecialRupCmd.RupNum, CmdBlkP) == RIO_FAIL) {
305   - cprintf("FAILED TO QUEUE SPECIAL RUP COMMAND\n");
  225 + printk(KERN_WARNING "rio: FAILED TO QUEUE SPECIAL RUP COMMAND\n");
306 226 }
307 227 return 0;
308 228 }
... ... @@ -324,7 +244,7 @@
324 244 if ((retval = RIOApel(p)) != 0)
325 245 return retval;
326 246  
327   - if (copyout((caddr_t) p->RIOConnectTable, (int) arg, TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) {
  247 + if (copy_to_user(arg, p->RIOConnectTable, TOTAL_MAP_ENTRIES * sizeof(struct Map))) {
328 248 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n");
329 249 p->RIOError.Error = COPYOUT_FAILED;
330 250 return -EFAULT;
... ... @@ -369,7 +289,7 @@
369 289 p->RIOError.Error = NOT_SUPER_USER;
370 290 return -EPERM;
371 291 }
372   - if (copyin((int) arg, (caddr_t) & p->RIOConnectTable[0], TOTAL_MAP_ENTRIES * sizeof(struct Map)) == COPYFAIL) {
  292 + if (copy_from_user(&p->RIOConnectTable[0], arg, TOTAL_MAP_ENTRIES * sizeof(struct Map))) {
373 293 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n");
374 294 p->RIOError.Error = COPYIN_FAILED;
375 295 return -EFAULT;
... ... @@ -415,7 +335,7 @@
415 335 p->RIOError.Error = NOT_SUPER_USER;
416 336 return -EPERM;
417 337 }
418   - if (copyout((caddr_t) p->RIOBindTab, (int) arg, (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) {
  338 + if (copy_to_user(arg, p->RIOBindTab, (sizeof(ulong) * MAX_RTA_BINDINGS))) {
419 339 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n");
420 340 p->RIOError.Error = COPYOUT_FAILED;
421 341 return -EFAULT;
... ... @@ -434,7 +354,7 @@
434 354 p->RIOError.Error = NOT_SUPER_USER;
435 355 return -EPERM;
436 356 }
437   - if (copyin((int) arg, (caddr_t) & p->RIOBindTab[0], (sizeof(ulong) * MAX_RTA_BINDINGS)) == COPYFAIL) {
  357 + if (copy_from_user(&p->RIOBindTab[0], arg, (sizeof(ulong) * MAX_RTA_BINDINGS))) {
438 358 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n");
439 359 p->RIOError.Error = COPYIN_FAILED;
440 360 return -EFAULT;
441 361  
... ... @@ -458,12 +378,12 @@
458 378 for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) {
459 379 if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L))
460 380 EmptySlot = Entry;
461   - else if (p->RIOBindTab[Entry] == (int) arg) {
  381 + else if (p->RIOBindTab[Entry] == (long)arg) {
462 382 /*
463 383 ** Already exists - delete
464 384 */
465 385 p->RIOBindTab[Entry] = 0L;
466   - rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %x from p->RIOBindTab\n", (int) arg);
  386 + rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %ld from p->RIOBindTab\n", (unsigned long)arg);
467 387 return 0;
468 388 }
469 389 }
470 390  
... ... @@ -471,10 +391,10 @@
471 391 ** Dosen't exist - add
472 392 */
473 393 if (EmptySlot != -1) {
474   - p->RIOBindTab[EmptySlot] = (int) arg;
475   - rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %x to p->RIOBindTab\n", (int) arg);
  394 + p->RIOBindTab[EmptySlot] = (unsigned long)arg;
  395 + rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %lx to p->RIOBindTab\n", (unsigned long) arg);
476 396 } else {
477   - rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %x not added\n", (int) arg);
  397 + rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %lx not added\n", (unsigned long) arg);
478 398 return -ENOMEM;
479 399 }
480 400 return 0;
... ... @@ -482,7 +402,7 @@
482 402  
483 403 case RIO_RESUME:
484 404 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n");
485   - port = (uint) arg;
  405 + port = (unsigned long) arg;
486 406 if ((port < 0) || (port > 511)) {
487 407 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port);
488 408 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
... ... @@ -518,8 +438,7 @@
518 438 p->RIOError.Error = NOT_SUPER_USER;
519 439 return -EPERM;
520 440 }
521   - if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt))
522   - == COPYFAIL) {
  441 + if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) {
523 442 rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n");
524 443 p->RIOError.Error = COPYIN_FAILED;
525 444 return -EFAULT;
... ... @@ -533,8 +452,7 @@
533 452 p->RIOError.Error = NOT_SUPER_USER;
534 453 return -EPERM;
535 454 }
536   - if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt))
537   - == COPYFAIL) {
  455 + if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) {
538 456 rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n");
539 457 p->RIOError.Error = COPYIN_FAILED;
540 458 return -EFAULT;
... ... @@ -548,8 +466,7 @@
548 466 p->RIOError.Error = NOT_SUPER_USER;
549 467 return -EPERM;
550 468 }
551   - if (copyin((int) arg, (caddr_t) & MapEnt, sizeof(MapEnt))
552   - == COPYFAIL) {
  469 + if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) {
553 470 rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n");
554 471 p->RIOError.Error = COPYIN_FAILED;
555 472 return -EFAULT;
556 473  
... ... @@ -557,30 +474,14 @@
557 474 return RIODeleteRta(p, &MapEnt);
558 475  
559 476 case RIO_QUICK_CHECK:
560   - /*
561   - ** 09.12.1998 ARG - ESIL 0776 part fix
562   - ** A customer was using this to get the RTAs
563   - ** connect/disconnect status.
564   - ** RIOConCon() had been botched use RIOHalted
565   - ** to keep track of RTA connections and
566   - ** disconnections. That has been changed and
567   - ** RIORtaDisCons in the rio_info struct now
568   - ** does the job. So we need to return the value
569   - ** of RIORtaCons instead of RIOHalted.
570   - **
571   - if (copyout((caddr_t)&p->RIOHalted,(int)arg,
572   - sizeof(uint))==COPYFAIL) {
573   - **
574   - */
575   -
576   - if (copyout((caddr_t) & p->RIORtaDisCons, (int) arg, sizeof(uint)) == COPYFAIL) {
  477 + if (copy_to_user(arg, &p->RIORtaDisCons, sizeof(unsigned int))) {
577 478 p->RIOError.Error = COPYOUT_FAILED;
578 479 return -EFAULT;
579 480 }
580 481 return 0;
581 482  
582 483 case RIO_LAST_ERROR:
583   - if (copyout((caddr_t) & p->RIOError, (int) arg, sizeof(struct Error)) == COPYFAIL)
  484 + if (copy_to_user(arg, &p->RIOError, sizeof(struct Error)))
584 485 return -EFAULT;
585 486 return 0;
586 487  
... ... @@ -589,7 +490,7 @@
589 490 return -EINVAL;
590 491  
591 492 case RIO_GET_MODTYPE:
592   - if (copyin((int) arg, (caddr_t) & port, sizeof(uint)) == COPYFAIL) {
  493 + if (copy_from_user(&port, arg, sizeof(unsigned int))) {
593 494 p->RIOError.Error = COPYIN_FAILED;
594 495 return -EFAULT;
595 496 }
596 497  
... ... @@ -609,36 +510,11 @@
609 510 ** Return module type of port
610 511 */
611 512 port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes;
612   - if (copyout((caddr_t) & port, (int) arg, sizeof(uint)) == COPYFAIL) {
  513 + if (copy_to_user(arg, &port, sizeof(unsigned int))) {
613 514 p->RIOError.Error = COPYOUT_FAILED;
614 515 return -EFAULT;
615 516 }
616 517 return (0);
617   - /*
618   - ** 02.03.1999 ARG - ESIL 0820 fix
619   - ** We are no longer using "Boot Mode", so these ioctls
620   - ** are not required :
621   - **
622   - case RIO_GET_BOOT_MODE :
623   - rio_dprint(RIO_DEBUG_CTRL, ("Get boot mode - %x\n", p->RIOBootMode));
624   - **
625   - ** Return boot state of system - BOOT_ALL, BOOT_OWN or BOOT_NONE
626   - **
627   - if (copyout((caddr_t)&p->RIOBootMode, (int)arg,
628   - sizeof(p->RIOBootMode)) == COPYFAIL) {
629   - p->RIOError.Error = COPYOUT_FAILED;
630   - return -EFAULT;
631   - }
632   - return(0);
633   -
634   - case RIO_SET_BOOT_MODE :
635   - p->RIOBootMode = (uint) arg;
636   - rio_dprint(RIO_DEBUG_CTRL, ("Set boot mode to 0x%x\n", p->RIOBootMode));
637   - return(0);
638   - **
639   - ** End ESIL 0820 fix
640   - */
641   -
642 518 case RIO_BLOCK_OPENS:
643 519 rio_dprintk(RIO_DEBUG_CTRL, "Opens block until booted\n");
644 520 for (Entry = 0; Entry < RIO_PORTS; Entry++) {
... ... @@ -650,8 +526,7 @@
650 526  
651 527 case RIO_SETUP_PORTS:
652 528 rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n");
653   - if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup))
654   - == COPYFAIL) {
  529 + if (copy_from_user(&PortSetup, arg, sizeof(PortSetup))) {
655 530 p->RIOError.Error = COPYIN_FAILED;
656 531 rio_dprintk(RIO_DEBUG_CTRL, "EFAULT");
657 532 return -EFAULT;
... ... @@ -667,7 +542,7 @@
667 542 return -EINVAL;
668 543 }
669 544 if (!p->RIOPortp) {
670   - cprintf("No p->RIOPortp array!\n");
  545 + printk(KERN_ERR "rio: No p->RIOPortp array!\n");
671 546 rio_dprintk(RIO_DEBUG_CTRL, "No p->RIOPortp array!\n");
672 547 return -EIO;
673 548 }
... ... @@ -681,8 +556,7 @@
681 556  
682 557 case RIO_GET_PORT_SETUP:
683 558 rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n");
684   - if (copyin((int) arg, (caddr_t) & PortSetup, sizeof(PortSetup))
685   - == COPYFAIL) {
  559 + if (copy_from_user(&PortSetup, arg, sizeof(PortSetup))) {
686 560 p->RIOError.Error = COPYIN_FAILED;
687 561 return -EFAULT;
688 562 }
... ... @@ -703,8 +577,7 @@
703 577 PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0';
704 578 PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0';
705 579  
706   - if (copyout((caddr_t) & PortSetup, (int) arg, sizeof(PortSetup))
707   - == COPYFAIL) {
  580 + if (copy_to_user(arg, &PortSetup, sizeof(PortSetup))) {
708 581 p->RIOError.Error = COPYOUT_FAILED;
709 582 return -EFAULT;
710 583 }
... ... @@ -712,7 +585,7 @@
712 585  
713 586 case RIO_GET_PORT_PARAMS:
714 587 rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n");
715   - if (copyin((int) arg, (caddr_t) & PortParams, sizeof(struct PortParams)) == COPYFAIL) {
  588 + if (copy_from_user(&PortParams, arg, sizeof(struct PortParams))) {
716 589 p->RIOError.Error = COPYIN_FAILED;
717 590 return -EFAULT;
718 591 }
... ... @@ -725,7 +598,7 @@
725 598 PortParams.State = PortP->State;
726 599 rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port);
727 600  
728   - if (copyout((caddr_t) & PortParams, (int) arg, sizeof(struct PortParams)) == COPYFAIL) {
  601 + if (copy_to_user(arg, &PortParams, sizeof(struct PortParams))) {
729 602 p->RIOError.Error = COPYOUT_FAILED;
730 603 return -EFAULT;
731 604 }
... ... @@ -733,8 +606,7 @@
733 606  
734 607 case RIO_GET_PORT_TTY:
735 608 rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n");
736   - if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty))
737   - == COPYFAIL) {
  609 + if (copy_from_user(&PortTty, arg, sizeof(struct PortTty))) {
738 610 p->RIOError.Error = COPYIN_FAILED;
739 611 return -EFAULT;
740 612 }
741 613  
... ... @@ -745,14 +617,14 @@
745 617  
746 618 rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port);
747 619 PortP = (p->RIOPortp[PortTty.port]);
748   - if (copyout((caddr_t) & PortTty, (int) arg, sizeof(struct PortTty)) == COPYFAIL) {
  620 + if (copy_to_user(arg, &PortTty, sizeof(struct PortTty))) {
749 621 p->RIOError.Error = COPYOUT_FAILED;
750 622 return -EFAULT;
751 623 }
752 624 return retval;
753 625  
754 626 case RIO_SET_PORT_TTY:
755   - if (copyin((int) arg, (caddr_t) & PortTty, sizeof(struct PortTty)) == COPYFAIL) {
  627 + if (copy_from_user(&PortTty, arg, sizeof(struct PortTty))) {
756 628 p->RIOError.Error = COPYIN_FAILED;
757 629 return -EFAULT;
758 630 }
... ... @@ -767,8 +639,7 @@
767 639  
768 640 case RIO_SET_PORT_PARAMS:
769 641 rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n");
770   - if (copyin((int) arg, (caddr_t) & PortParams, sizeof(PortParams))
771   - == COPYFAIL) {
  642 + if (copy_from_user(&PortParams, arg, sizeof(PortParams))) {
772 643 p->RIOError.Error = COPYIN_FAILED;
773 644 return -EFAULT;
774 645 }
... ... @@ -784,7 +655,7 @@
784 655  
785 656 case RIO_GET_PORT_STATS:
786 657 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n");
787   - if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) {
  658 + if (copy_from_user(&portStats, arg, sizeof(struct portStats))) {
788 659 p->RIOError.Error = COPYIN_FAILED;
789 660 return -EFAULT;
790 661 }
791 662  
... ... @@ -799,14 +670,14 @@
799 670 portStats.opens = PortP->opens;
800 671 portStats.closes = PortP->closes;
801 672 portStats.ioctls = PortP->ioctls;
802   - if (copyout((caddr_t) & portStats, (int) arg, sizeof(struct portStats)) == COPYFAIL) {
  673 + if (copy_to_user(arg, &portStats, sizeof(struct portStats))) {
803 674 p->RIOError.Error = COPYOUT_FAILED;
804 675 return -EFAULT;
805 676 }
806 677 return retval;
807 678  
808 679 case RIO_RESET_PORT_STATS:
809   - port = (uint) arg;
  680 + port = (unsigned long) arg;
810 681 rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n");
811 682 if (port >= RIO_PORTS) {
812 683 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
... ... @@ -824,7 +695,7 @@
824 695  
825 696 case RIO_GATHER_PORT_STATS:
826 697 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n");
827   - if (copyin((int) arg, (caddr_t) & portStats, sizeof(struct portStats)) == COPYFAIL) {
  698 + if (copy_from_user(&portStats, arg, sizeof(struct portStats))) {
828 699 p->RIOError.Error = COPYIN_FAILED;
829 700 return -EFAULT;
830 701 }
... ... @@ -840,7 +711,7 @@
840 711  
841 712 case RIO_READ_CONFIG:
842 713 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n");
843   - if (copyout((caddr_t) & p->RIOConf, (int) arg, sizeof(struct Conf)) == COPYFAIL) {
  714 + if (copy_to_user(arg, &p->RIOConf, sizeof(struct Conf))) {
844 715 p->RIOError.Error = COPYOUT_FAILED;
845 716 return -EFAULT;
846 717 }
... ... @@ -852,8 +723,7 @@
852 723 p->RIOError.Error = NOT_SUPER_USER;
853 724 return -EPERM;
854 725 }
855   - if (copyin((int) arg, (caddr_t) & p->RIOConf, sizeof(struct Conf))
856   - == COPYFAIL) {
  726 + if (copy_from_user(&p->RIOConf, arg, sizeof(struct Conf))) {
857 727 p->RIOError.Error = COPYIN_FAILED;
858 728 return -EFAULT;
859 729 }
... ... @@ -862,7 +732,7 @@
862 732 */
863 733 for (Host = 0; Host < p->RIONumHosts; Host++)
864 734 if ((p->RIOHosts[Host].Flags & RUN_STATE) == RC_RUNNING)
865   - WWORD(p->RIOHosts[Host].ParmMapP->timer, p->RIOConf.Timer);
  735 + writew(p->RIOConf.Timer, &p->RIOHosts[Host].ParmMapP->timer);
866 736 return retval;
867 737  
868 738 case RIO_START_POLLER:
... ... @@ -881,8 +751,7 @@
881 751 case RIO_SETDEBUG:
882 752 case RIO_GETDEBUG:
883 753 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n");
884   - if (copyin((int) arg, (caddr_t) & DebugCtrl, sizeof(DebugCtrl))
885   - == COPYFAIL) {
  754 + if (copy_from_user(&DebugCtrl, arg, sizeof(DebugCtrl))) {
886 755 p->RIOError.Error = COPYIN_FAILED;
887 756 return -EFAULT;
888 757 }
... ... @@ -899,7 +768,7 @@
899 768 rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait);
900 769 DebugCtrl.Debug = p->rio_debug;
901 770 DebugCtrl.Wait = p->RIODebugWait;
902   - if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) {
  771 + if (copy_to_user(arg, &DebugCtrl, sizeof(DebugCtrl))) {
903 772 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort);
904 773 p->RIOError.Error = COPYOUT_FAILED;
905 774 return -EFAULT;
... ... @@ -921,7 +790,7 @@
921 790 } else {
922 791 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug);
923 792 DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug;
924   - if (copyout((caddr_t) & DebugCtrl, (int) arg, sizeof(DebugCtrl)) == COPYFAIL) {
  793 + if (copy_to_user(arg, &DebugCtrl, sizeof(DebugCtrl))) {
925 794 rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n");
926 795 p->RIOError.Error = COPYOUT_FAILED;
927 796 return -EFAULT;
928 797  
929 798  
... ... @@ -936,43 +805,20 @@
936 805 ** textual null terminated string.
937 806 */
938 807 rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n");
939   - if (copyout((caddr_t) RIOVersid(), (int) arg, sizeof(struct rioVersion)) == COPYFAIL) {
  808 + if (copy_to_user(arg, RIOVersid(), sizeof(struct rioVersion))) {
940 809 rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host);
941 810 p->RIOError.Error = COPYOUT_FAILED;
942 811 return -EFAULT;
943 812 }
944 813 return retval;
945 814  
946   - /*
947   - ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
948   - ** !! commented out previous 'RIO_VERSID' functionality !!
949   - ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
950   - **
951   - case RIO_VERSID:
952   - **
953   - ** Enquire about the release and version.
954   - ** We return MAX_VERSION_LEN bytes, being a textual null
955   - ** terminated string.
956   - **
957   - rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID\n"));
958   - if (copyout((caddr_t)RIOVersid(),
959   - (int)arg, MAX_VERSION_LEN ) == COPYFAIL ) {
960   - rio_dprint(RIO_DEBUG_CTRL, ("RIO_VERSID: Bad copy to user space\n",Host));
961   - p->RIOError.Error = COPYOUT_FAILED;
962   - return -EFAULT;
963   - }
964   - return retval;
965   - **
966   - ** !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
967   - */
968   -
969 815 case RIO_NUM_HOSTS:
970 816 /*
971 817 ** Enquire as to the number of hosts located
972 818 ** at init time.
973 819 */
974 820 rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n");
975   - if (copyout((caddr_t) & p->RIONumHosts, (int) arg, sizeof(p->RIONumHosts)) == COPYFAIL) {
  821 + if (copy_to_user(arg, &p->RIONumHosts, sizeof(p->RIONumHosts))) {
976 822 rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n");
977 823 p->RIOError.Error = COPYOUT_FAILED;
978 824 return -EFAULT;
... ... @@ -983,7 +829,7 @@
983 829 /*
984 830 ** Kill host. This may not be in the final version...
985 831 */
986   - rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %d\n", (int) arg);
  832 + rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %ld\n", (unsigned long) arg);
987 833 if (!su) {
988 834 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n");
989 835 p->RIOError.Error = NOT_SUPER_USER;
... ... @@ -994,7 +840,7 @@
994 840  
995 841 for (Host = 0; Host < p->RIONumHosts; Host++) {
996 842 (void) RIOBoardTest(p->RIOHosts[Host].PaddrP, p->RIOHosts[Host].Caddr, p->RIOHosts[Host].Type, p->RIOHosts[Host].Slot);
997   - bzero((caddr_t) & p->RIOHosts[Host].Flags, ((int) &p->RIOHosts[Host].____end_marker____) - ((int) &p->RIOHosts[Host].Flags));
  843 + memset(&p->RIOHosts[Host].Flags, 0, ((char *) &p->RIOHosts[Host].____end_marker____) - ((char *) &p->RIOHosts[Host].Flags));
998 844 p->RIOHosts[Host].Flags = RC_WAITING;
999 845 }
1000 846 RIOFoadWakeup(p);
... ... @@ -1017,7 +863,7 @@
1017 863 p->RIOError.Error = NOT_SUPER_USER;
1018 864 return -EPERM;
1019 865 }
1020   - if (copyin((int) arg, (caddr_t) & DownLoad, sizeof(DownLoad)) == COPYFAIL) {
  866 + if (copy_from_user(&DownLoad, arg, sizeof(DownLoad))) {
1021 867 rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n");
1022 868 p->RIOError.Error = COPYIN_FAILED;
1023 869 return -EFAULT;
1024 870  
... ... @@ -1045,9 +891,9 @@
1045 891  
1046 892 case RIO_PARMS:
1047 893 {
1048   - uint host;
  894 + unsigned int host;
1049 895  
1050   - if (copyin((int) arg, (caddr_t) & host, sizeof(host)) == COPYFAIL) {
  896 + if (copy_from_user(&host, arg, sizeof(host))) {
1051 897 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
1052 898 p->RIOError.Error = COPYIN_FAILED;
1053 899 return -EFAULT;
... ... @@ -1056,7 +902,7 @@
1056 902 ** Fetch the parmmap
1057 903 */
1058 904 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n");
1059   - if (copyout((caddr_t) p->RIOHosts[host].ParmMapP, (int) arg, sizeof(PARM_MAP)) == COPYFAIL) {
  905 + if (copy_to_user(arg, p->RIOHosts[host].ParmMapP, sizeof(PARM_MAP))) {
1060 906 p->RIOError.Error = COPYOUT_FAILED;
1061 907 rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n");
1062 908 return -EFAULT;
... ... @@ -1066,7 +912,7 @@
1066 912  
1067 913 case RIO_HOST_REQ:
1068 914 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n");
1069   - if (copyin((int) arg, (caddr_t) & HostReq, sizeof(HostReq)) == COPYFAIL) {
  915 + if (copy_from_user(&HostReq, arg, sizeof(HostReq))) {
1070 916 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n");
1071 917 p->RIOError.Error = COPYIN_FAILED;
1072 918 return -EFAULT;
... ... @@ -1078,7 +924,7 @@
1078 924 }
1079 925 rio_dprintk(RIO_DEBUG_CTRL, "Request for host %d\n", HostReq.HostNum);
1080 926  
1081   - if (copyout((caddr_t) & p->RIOHosts[HostReq.HostNum], (int) HostReq.HostP, sizeof(struct Host)) == COPYFAIL) {
  927 + if (copy_to_user(HostReq.HostP, &p->RIOHosts[HostReq.HostNum], sizeof(struct Host))) {
1082 928 p->RIOError.Error = COPYOUT_FAILED;
1083 929 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Bad copy to user space\n");
1084 930 return -EFAULT;
... ... @@ -1087,7 +933,7 @@
1087 933  
1088 934 case RIO_HOST_DPRAM:
1089 935 rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n");
1090   - if (copyin((int) arg, (caddr_t) & HostDpRam, sizeof(HostDpRam)) == COPYFAIL) {
  936 + if (copy_from_user(&HostDpRam, arg, sizeof(HostDpRam))) {
1091 937 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n");
1092 938 p->RIOError.Error = COPYIN_FAILED;
1093 939 return -EFAULT;
1094 940  
... ... @@ -1104,13 +950,13 @@
1104 950 /* It's hardware like this that really gets on my tits. */
1105 951 static unsigned char copy[sizeof(struct DpRam)];
1106 952 for (off = 0; off < sizeof(struct DpRam); off++)
1107   - copy[off] = p->RIOHosts[HostDpRam.HostNum].Caddr[off];
1108   - if (copyout((caddr_t) copy, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) {
  953 + copy[off] = readb(&p->RIOHosts[HostDpRam.HostNum].Caddr[off]);
  954 + if (copy_to_user(HostDpRam.DpRamP, copy, sizeof(struct DpRam))) {
1109 955 p->RIOError.Error = COPYOUT_FAILED;
1110 956 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
1111 957 return -EFAULT;
1112 958 }
1113   - } else if (copyout((caddr_t) p->RIOHosts[HostDpRam.HostNum].Caddr, (int) HostDpRam.DpRamP, sizeof(struct DpRam)) == COPYFAIL) {
  959 + } else if (copy_to_user(HostDpRam.DpRamP, p->RIOHosts[HostDpRam.HostNum].Caddr, sizeof(struct DpRam))) {
1114 960 p->RIOError.Error = COPYOUT_FAILED;
1115 961 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n");
1116 962 return -EFAULT;
1117 963  
... ... @@ -1119,13 +965,13 @@
1119 965  
1120 966 case RIO_SET_BUSY:
1121 967 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n");
1122   - if ((int) arg < 0 || (int) arg > 511) {
1123   - rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %d\n", (int) arg);
  968 + if ((unsigned long) arg > 511) {
  969 + rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %ld\n", (unsigned long) arg);
1124 970 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
1125 971 return -EINVAL;
1126 972 }
1127 973 rio_spin_lock_irqsave(&PortP->portSem, flags);
1128   - p->RIOPortp[(int) arg]->State |= RIO_BUSY;
  974 + p->RIOPortp[(unsigned long) arg]->State |= RIO_BUSY;
1129 975 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1130 976 return retval;
1131 977  
... ... @@ -1135,7 +981,7 @@
1135 981 ** (probably for debug reasons)
1136 982 */
1137 983 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n");
1138   - if (copyin((int) arg, (caddr_t) & PortReq, sizeof(PortReq)) == COPYFAIL) {
  984 + if (copy_from_user(&PortReq, arg, sizeof(PortReq))) {
1139 985 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n");
1140 986 p->RIOError.Error = COPYIN_FAILED;
1141 987 return -EFAULT;
... ... @@ -1147,7 +993,7 @@
1147 993 return -ENXIO;
1148 994 }
1149 995 rio_dprintk(RIO_DEBUG_CTRL, "Request for port %d\n", PortReq.SysPort);
1150   - if (copyout((caddr_t) p->RIOPortp[PortReq.SysPort], (int) PortReq.PortP, sizeof(struct Port)) == COPYFAIL) {
  996 + if (copy_to_user(PortReq.PortP, p->RIOPortp[PortReq.SysPort], sizeof(struct Port))) {
1151 997 p->RIOError.Error = COPYOUT_FAILED;
1152 998 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Bad copy to user space\n");
1153 999 return -EFAULT;
... ... @@ -1160,7 +1006,7 @@
1160 1006 ** (probably for debug reasons)
1161 1007 */
1162 1008 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n");
1163   - if (copyin((int) arg, (caddr_t) & RupReq, sizeof(RupReq)) == COPYFAIL) {
  1009 + if (copy_from_user(&RupReq, arg, sizeof(RupReq))) {
1164 1010 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n");
1165 1011 p->RIOError.Error = COPYIN_FAILED;
1166 1012 return -EFAULT;
... ... @@ -1184,7 +1030,7 @@
1184 1030 }
1185 1031 rio_dprintk(RIO_DEBUG_CTRL, "Request for rup %d from host %d\n", RupReq.RupNum, RupReq.HostNum);
1186 1032  
1187   - if (copyout((caddr_t) HostP->UnixRups[RupReq.RupNum].RupP, (int) RupReq.RupP, sizeof(struct RUP)) == COPYFAIL) {
  1033 + if (copy_to_user(HostP->UnixRups[RupReq.RupNum].RupP, RupReq.RupP, sizeof(struct RUP))) {
1188 1034 p->RIOError.Error = COPYOUT_FAILED;
1189 1035 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Bad copy to user space\n");
1190 1036 return -EFAULT;
... ... @@ -1197,7 +1043,7 @@
1197 1043 ** (probably for debug reasons)
1198 1044 */
1199 1045 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n");
1200   - if (copyin((int) arg, (caddr_t) & LpbReq, sizeof(LpbReq)) == COPYFAIL) {
  1046 + if (copy_from_user(&LpbReq, arg, sizeof(LpbReq))) {
1201 1047 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n");
1202 1048 p->RIOError.Error = COPYIN_FAILED;
1203 1049 return -EFAULT;
... ... @@ -1221,7 +1067,7 @@
1221 1067 }
1222 1068 rio_dprintk(RIO_DEBUG_CTRL, "Request for lpb %d from host %d\n", LpbReq.Link, LpbReq.Host);
1223 1069  
1224   - if (copyout((caddr_t) & HostP->LinkStrP[LpbReq.Link], (int) LpbReq.LpbP, sizeof(struct LPB)) == COPYFAIL) {
  1070 + if (copy_to_user(LpbReq.LpbP, &HostP->LinkStrP[LpbReq.Link], sizeof(struct LPB))) {
1225 1071 rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy to user space\n");
1226 1072 p->RIOError.Error = COPYOUT_FAILED;
1227 1073 return -EFAULT;
1228 1074  
... ... @@ -1252,12 +1098,13 @@
1252 1098 p->RIOError.Error = SIGNALS_ALREADY_SET;
1253 1099 return -EBUSY;
1254 1100 }
1255   - p->RIOSignalProcess = getpid();
  1101 + /* FIXME: PID tracking */
  1102 + p->RIOSignalProcess = current->pid;
1256 1103 p->RIOPrintDisabled = DONT_PRINT;
1257 1104 return retval;
1258 1105  
1259 1106 case RIO_SIGNALS_OFF:
1260   - if (p->RIOSignalProcess != getpid()) {
  1107 + if (p->RIOSignalProcess != current->pid) {
1261 1108 p->RIOError.Error = NOT_RECEIVING_PROCESS;
1262 1109 return -EPERM;
1263 1110 }
... ... @@ -1294,7 +1141,7 @@
1294 1141 case RIO_MAP_B110_TO_110:
1295 1142 case RIO_MAP_B110_TO_115200:
1296 1143 rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n");
1297   - port = (uint) arg;
  1144 + port = (unsigned long) arg;
1298 1145 if (port < 0 || port > 511) {
1299 1146 rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port);
1300 1147 p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE;
... ... @@ -1324,7 +1171,7 @@
1324 1171  
1325 1172 case RIO_SEND_PACKET:
1326 1173 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n");
1327   - if (copyin((int) arg, (caddr_t) & SendPack, sizeof(SendPack)) == COPYFAIL) {
  1174 + if (copy_from_user(&SendPack, arg, sizeof(SendPack))) {
1328 1175 rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n");
1329 1176 p->RIOError.Error = COPYIN_FAILED;
1330 1177 return -EFAULT;
1331 1178  
... ... @@ -1344,9 +1191,9 @@
1344 1191 }
1345 1192  
1346 1193 for (loop = 0; loop < (ushort) (SendPack.Len & 127); loop++)
1347   - WBYTE(PacketP->data[loop], SendPack.Data[loop]);
  1194 + writeb(SendPack.Data[loop], &PacketP->data[loop]);
1348 1195  
1349   - WBYTE(PacketP->len, SendPack.Len);
  1196 + writeb(SendPack.Len, &PacketP->len);
1350 1197  
1351 1198 add_transmit(PortP);
1352 1199 /*
... ... @@ -1368,7 +1215,7 @@
1368 1215 return su ? 0 : -EPERM;
1369 1216  
1370 1217 case RIO_WHAT_MESG:
1371   - if (copyout((caddr_t) & p->RIONoMessage, (int) arg, sizeof(p->RIONoMessage)) == COPYFAIL) {
  1218 + if (copy_to_user(arg, &p->RIONoMessage, sizeof(p->RIONoMessage))) {
1372 1219 rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n");
1373 1220 p->RIOError.Error = COPYOUT_FAILED;
1374 1221 return -EFAULT;
... ... @@ -1376,7 +1223,7 @@
1376 1223 return 0;
1377 1224  
1378 1225 case RIO_MEM_DUMP:
1379   - if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) {
  1226 + if (copy_from_user(&SubCmd, arg, sizeof(struct SubCmdStruct))) {
1380 1227 p->RIOError.Error = COPYIN_FAILED;
1381 1228 return -EFAULT;
1382 1229 }
... ... @@ -1406,7 +1253,7 @@
1406 1253 PortP->State |= RIO_BUSY;
1407 1254  
1408 1255 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1409   - if (copyout((caddr_t) p->RIOMemDump, (int) arg, MEMDUMP_SIZE) == COPYFAIL) {
  1256 + if (copy_to_user(arg, p->RIOMemDump, MEMDUMP_SIZE)) {
1410 1257 rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n");
1411 1258 p->RIOError.Error = COPYOUT_FAILED;
1412 1259 return -EFAULT;
1413 1260  
1414 1261  
1415 1262  
1416 1263  
1417 1264  
... ... @@ -1414,30 +1261,30 @@
1414 1261 return 0;
1415 1262  
1416 1263 case RIO_TICK:
1417   - if ((int) arg < 0 || (int) arg >= p->RIONumHosts)
  1264 + if ((unsigned long) arg >= p->RIONumHosts)
1418 1265 return -EINVAL;
1419   - rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %d\n", (int) arg);
1420   - WBYTE(p->RIOHosts[(int) arg].SetInt, 0xff);
  1266 + rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %ld\n", (unsigned long) arg);
  1267 + writeb(0xFF, &p->RIOHosts[(unsigned long) arg].SetInt);
1421 1268 return 0;
1422 1269  
1423 1270 case RIO_TOCK:
1424   - if ((int) arg < 0 || (int) arg >= p->RIONumHosts)
  1271 + if ((unsigned long) arg >= p->RIONumHosts)
1425 1272 return -EINVAL;
1426   - rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %d\n", (int) arg);
1427   - WBYTE((p->RIOHosts[(int) arg].ResetInt), 0xff);
  1273 + rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %ld\n", (unsigned long) arg);
  1274 + writeb(0xFF, &p->RIOHosts[(unsigned long) arg].ResetInt);
1428 1275 return 0;
1429 1276  
1430 1277 case RIO_READ_CHECK:
1431 1278 /* Check reads for pkts with data[0] the same */
1432 1279 p->RIOReadCheck = !p->RIOReadCheck;
1433   - if (copyout((caddr_t) & p->RIOReadCheck, (int) arg, sizeof(uint)) == COPYFAIL) {
  1280 + if (copy_to_user(arg, &p->RIOReadCheck, sizeof(unsigned int))) {
1434 1281 p->RIOError.Error = COPYOUT_FAILED;
1435 1282 return -EFAULT;
1436 1283 }
1437 1284 return 0;
1438 1285  
1439 1286 case RIO_READ_REGISTER:
1440   - if (copyin((int) arg, (caddr_t) & SubCmd, sizeof(struct SubCmdStruct)) == COPYFAIL) {
  1287 + if (copy_from_user(&SubCmd, arg, sizeof(struct SubCmdStruct))) {
1441 1288 p->RIOError.Error = COPYIN_FAILED;
1442 1289 return -EFAULT;
1443 1290 }
... ... @@ -1472,7 +1319,7 @@
1472 1319 PortP->State |= RIO_BUSY;
1473 1320  
1474 1321 rio_spin_unlock_irqrestore(&PortP->portSem, flags);
1475   - if (copyout((caddr_t) & p->CdRegister, (int) arg, sizeof(uint)) == COPYFAIL) {
  1322 + if (copy_to_user(arg, &p->CdRegister, sizeof(unsigned int))) {
1476 1323 rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n");
1477 1324 p->RIOError.Error = COPYOUT_FAILED;
1478 1325 return -EFAULT;
1479 1326  
1480 1327  
1481 1328  
1482 1329  
... ... @@ -1485,21 +1332,22 @@
1485 1332 */
1486 1333 case RIO_MAKE_DEV:
1487 1334 {
1488   - uint port = (uint) arg & RIO_MODEM_MASK;
  1335 + unsigned int port = (unsigned long) arg & RIO_MODEM_MASK;
  1336 + unsigned int ret;
1489 1337  
1490   - switch ((uint) arg & RIO_DEV_MASK) {
  1338 + switch ((unsigned long) arg & RIO_DEV_MASK) {
1491 1339 case RIO_DEV_DIRECT:
1492   - arg = (caddr_t) drv_makedev(MAJOR(dev), port);
1493   - rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, (int) arg);
1494   - return (int) arg;
  1340 + ret = drv_makedev(MAJOR(dev), port);
  1341 + rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, ret);
  1342 + return ret;
1495 1343 case RIO_DEV_MODEM:
1496   - arg = (caddr_t) drv_makedev(MAJOR(dev), (port | RIO_MODEM_BIT));
1497   - rio_dprintk(RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n", port, (int) arg);
1498   - return (int) arg;
  1344 + ret = drv_makedev(MAJOR(dev), (port | RIO_MODEM_BIT));
  1345 + rio_dprintk(RIO_DEBUG_CTRL, "Makedev modem 0x%x is 0x%x\n", port, ret);
  1346 + return ret;
1499 1347 case RIO_DEV_XPRINT:
1500   - arg = (caddr_t) drv_makedev(MAJOR(dev), port);
1501   - rio_dprintk(RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n", port, (int) arg);
1502   - return (int) arg;
  1348 + ret = drv_makedev(MAJOR(dev), port);
  1349 + rio_dprintk(RIO_DEBUG_CTRL, "Makedev printer 0x%x is 0x%x\n", port, ret);
  1350 + return ret;
1503 1351 }
1504 1352 rio_dprintk(RIO_DEBUG_CTRL, "MAKE Device is called\n");
1505 1353 return -EINVAL;
1506 1354  
1507 1355  
1508 1356  
1509 1357  
... ... @@ -1513,18 +1361,19 @@
1513 1361 {
1514 1362 dev_t dv;
1515 1363 int mino;
  1364 + unsigned long ret;
1516 1365  
1517   - dv = (dev_t) ((int) arg);
  1366 + dv = (dev_t) ((unsigned long) arg);
1518 1367 mino = RIO_UNMODEM(dv);
1519 1368  
1520 1369 if (RIO_ISMODEM(dv)) {
1521 1370 rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: modem %d\n", dv, mino);
1522   - arg = (caddr_t) (mino | RIO_DEV_MODEM);
  1371 + ret = mino | RIO_DEV_MODEM;
1523 1372 } else {
1524 1373 rio_dprintk(RIO_DEBUG_CTRL, "Minor for device 0x%x: direct %d\n", dv, mino);
1525   - arg = (caddr_t) (mino | RIO_DEV_DIRECT);
  1374 + ret = mino | RIO_DEV_DIRECT;
1526 1375 }
1527   - return (int) arg;
  1376 + return ret;
1528 1377 }
1529 1378 }
1530 1379 rio_dprintk(RIO_DEBUG_CTRL, "INVALID DAEMON IOCTL 0x%x\n", cmd);
... ... @@ -1537,10 +1386,7 @@
1537 1386 /*
1538 1387 ** Pre-emptive commands go on RUPs and are only one byte long.
1539 1388 */
1540   -int RIOPreemptiveCmd(p, PortP, Cmd)
1541   -struct rio_info *p;
1542   -struct Port *PortP;
1543   -uchar Cmd;
  1389 +int RIOPreemptiveCmd(struct rio_info *p, struct Port *PortP, u8 Cmd)
1544 1390 {
1545 1391 struct CmdBlk *CmdBlkP;
1546 1392 struct PktCmd_M *PktCmdP;
... ... @@ -1558,7 +1404,7 @@
1558 1404 return RIO_FAIL;
1559 1405 }
1560 1406  
1561   - rio_dprintk(RIO_DEBUG_CTRL, "Command blk 0x%x - InUse now %d\n", (int) CmdBlkP, PortP->InUse);
  1407 + rio_dprintk(RIO_DEBUG_CTRL, "Command blk 0x%p - InUse now %d\n", CmdBlkP, PortP->InUse);
1562 1408  
1563 1409 PktCmdP = (struct PktCmd_M *) &CmdBlkP->Packet.data[0];
1564 1410  
... ... @@ -1572,7 +1418,7 @@
1572 1418 CmdBlkP->Packet.dest_port = COMMAND_RUP;
1573 1419 CmdBlkP->Packet.len = PKT_CMD_BIT | 2;
1574 1420 CmdBlkP->PostFuncP = RIOUnUse;
1575   - CmdBlkP->PostArg = (int) PortP;
  1421 + CmdBlkP->PostArg = (unsigned long) PortP;
1576 1422 PktCmdP->Command = Cmd;
1577 1423 port = PortP->HostPort % (ushort) PORTS_PER_RTA;
1578 1424 /*
1579 1425  
1580 1426  
1581 1427  
1582 1428  
1583 1429  
1584 1430  
1585 1431  
... ... @@ -1584,38 +1430,38 @@
1584 1430  
1585 1431 switch (Cmd) {
1586 1432 case MEMDUMP:
1587   - rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%x (addr 0x%x)\n", (int) CmdBlkP, (int) SubCmd.Addr);
  1433 + rio_dprintk(RIO_DEBUG_CTRL, "Queue MEMDUMP command blk 0x%p (addr 0x%x)\n", CmdBlkP, (int) SubCmd.Addr);
1588 1434 PktCmdP->SubCommand = MEMDUMP;
1589 1435 PktCmdP->SubAddr = SubCmd.Addr;
1590 1436 break;
1591 1437 case FCLOSE:
1592   - rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%x\n", (int) CmdBlkP);
  1438 + rio_dprintk(RIO_DEBUG_CTRL, "Queue FCLOSE command blk 0x%p\n", CmdBlkP);
1593 1439 break;
1594 1440 case READ_REGISTER:
1595   - rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%x\n", (int) SubCmd.Addr, (int) CmdBlkP);
  1441 + rio_dprintk(RIO_DEBUG_CTRL, "Queue READ_REGISTER (0x%x) command blk 0x%p\n", (int) SubCmd.Addr, CmdBlkP);
1596 1442 PktCmdP->SubCommand = READ_REGISTER;
1597 1443 PktCmdP->SubAddr = SubCmd.Addr;
1598 1444 break;
1599 1445 case RESUME:
1600   - rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%x\n", (int) CmdBlkP);
  1446 + rio_dprintk(RIO_DEBUG_CTRL, "Queue RESUME command blk 0x%p\n", CmdBlkP);
1601 1447 break;
1602 1448 case RFLUSH:
1603   - rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%x\n", (int) CmdBlkP);
  1449 + rio_dprintk(RIO_DEBUG_CTRL, "Queue RFLUSH command blk 0x%p\n", CmdBlkP);
1604 1450 CmdBlkP->PostFuncP = RIORFlushEnable;
1605 1451 break;
1606 1452 case SUSPEND:
1607   - rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%x\n", (int) CmdBlkP);
  1453 + rio_dprintk(RIO_DEBUG_CTRL, "Queue SUSPEND command blk 0x%p\n", CmdBlkP);
1608 1454 break;
1609 1455  
1610 1456 case MGET:
1611   - rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk 0x%x\n", (int) CmdBlkP);
  1457 + rio_dprintk(RIO_DEBUG_CTRL, "Queue MGET command blk 0x%p\n", CmdBlkP);
1612 1458 break;
1613 1459  
1614 1460 case MSET:
1615 1461 case MBIC:
1616 1462 case MBIS:
1617 1463 CmdBlkP->Packet.data[4] = (char) PortP->ModemLines;
1618   - rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%x\n", (int) CmdBlkP);
  1464 + rio_dprintk(RIO_DEBUG_CTRL, "Queue MSET/MBIC/MBIS command blk 0x%p\n", CmdBlkP);
1619 1465 break;
1620 1466  
1621 1467 case WFLUSH:
... ... @@ -1629,7 +1475,7 @@
1629 1475 RIOFreeCmdBlk(CmdBlkP);
1630 1476 return (RIO_FAIL);
1631 1477 } else {
1632   - rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%x\n", (int) CmdBlkP);
  1478 + rio_dprintk(RIO_DEBUG_CTRL, "Queue WFLUSH command blk 0x%p\n", CmdBlkP);
1633 1479 CmdBlkP->PostFuncP = RIOWFlushMark;
1634 1480 }
1635 1481 break;