Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

[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>

authored by

Alan Cox and committed by
Linus Torvalds
3d336aa2 00d83a54

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