diff options
author | Al Viro <viro@zeniv.linux.org.uk> | 2006-05-27 00:08:25 -0400 |
---|---|---|
committer | Al Viro <viro@zeniv.linux.org.uk> | 2006-05-27 02:26:14 -0400 |
commit | d886cb586f60a5ccf156392f96a39bc52db925d0 (patch) | |
tree | 5862de796cf8dfd2f38e30d36cc589a07b5f9d88 /drivers/char/rio/rioctrl.c | |
parent | a8bd60705aa17a998516837d9c1e503ad4cbd7fc (diff) |
[PATCH] trivial annotations in rio
Signed-off-by: Al Viro <viro@zeniv.linux.org.uk>
Diffstat (limited to 'drivers/char/rio/rioctrl.c')
-rw-r--r-- | drivers/char/rio/rioctrl.c | 164 |
1 files changed, 80 insertions, 84 deletions
diff --git a/drivers/char/rio/rioctrl.c b/drivers/char/rio/rioctrl.c index 75b2557c37ec..732e7db5f717 100644 --- a/drivers/char/rio/rioctrl.c +++ b/drivers/char/rio/rioctrl.c | |||
@@ -80,7 +80,7 @@ static char *_rioctrl_c_sccs_ = "@(#)rioctrl.c 1.3"; | |||
80 | static struct LpbReq LpbReq; | 80 | static struct LpbReq LpbReq; |
81 | static struct RupReq RupReq; | 81 | static struct RupReq RupReq; |
82 | static struct PortReq PortReq; | 82 | static struct PortReq PortReq; |
83 | static struct HostReq HostReq; | 83 | static struct HostReq HostReq; /* oh really? global? and no locking? */ |
84 | static struct HostDpRam HostDpRam; | 84 | static struct HostDpRam HostDpRam; |
85 | static struct DebugCtrl DebugCtrl; | 85 | static struct DebugCtrl DebugCtrl; |
86 | static struct Map MapEnt; | 86 | static struct Map MapEnt; |
@@ -126,12 +126,7 @@ static int | |||
126 | 126 | ||
127 | #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff)) | 127 | #define drv_makedev(maj, min) ((((uint) maj & 0xff) << 8) | ((uint) min & 0xff)) |
128 | 128 | ||
129 | int riocontrol(p, dev, cmd, arg, su) | 129 | int riocontrol(struct rio_info *p, dev_t dev, int cmd, unsigned long arg, int su) |
130 | struct rio_info *p; | ||
131 | dev_t dev; | ||
132 | int cmd; | ||
133 | caddr_t arg; | ||
134 | int su; | ||
135 | { | 130 | { |
136 | uint Host; /* leave me unsigned! */ | 131 | uint Host; /* leave me unsigned! */ |
137 | uint port; /* and me! */ | 132 | uint port; /* and me! */ |
@@ -139,9 +134,10 @@ int su; | |||
139 | ushort loop; | 134 | ushort loop; |
140 | int Entry; | 135 | int Entry; |
141 | struct Port *PortP; | 136 | struct Port *PortP; |
142 | struct PKT *PacketP; | 137 | struct PKT __iomem *PacketP; |
143 | int retval = 0; | 138 | int retval = 0; |
144 | unsigned long flags; | 139 | unsigned long flags; |
140 | void __user *argp = (void __user *)arg; | ||
145 | 141 | ||
146 | func_enter(); | 142 | func_enter(); |
147 | 143 | ||
@@ -149,7 +145,7 @@ int su; | |||
149 | Host = 0; | 145 | Host = 0; |
150 | PortP = NULL; | 146 | PortP = NULL; |
151 | 147 | ||
152 | rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: %p\n", cmd, arg); | 148 | rio_dprintk(RIO_DEBUG_CTRL, "control ioctl cmd: 0x%x arg: %p\n", cmd, argp); |
153 | 149 | ||
154 | switch (cmd) { | 150 | switch (cmd) { |
155 | /* | 151 | /* |
@@ -160,11 +156,11 @@ int su; | |||
160 | ** otherwise just the specified host card will be changed. | 156 | ** otherwise just the specified host card will be changed. |
161 | */ | 157 | */ |
162 | case RIO_SET_TIMER: | 158 | case RIO_SET_TIMER: |
163 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %ldms\n", (unsigned long)arg); | 159 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_TIMER to %ldms\n", arg); |
164 | { | 160 | { |
165 | int host, value; | 161 | int host, value; |
166 | host = ((unsigned long) arg >> 16) & 0x0000FFFF; | 162 | host = (arg >> 16) & 0x0000FFFF; |
167 | value = (unsigned long) arg & 0x0000ffff; | 163 | value = arg & 0x0000ffff; |
168 | if (host == -1) { | 164 | if (host == -1) { |
169 | for (host = 0; host < p->RIONumHosts; host++) { | 165 | for (host = 0; host < p->RIONumHosts; host++) { |
170 | if (p->RIOHosts[host].Flags == RC_RUNNING) { | 166 | if (p->RIOHosts[host].Flags == RC_RUNNING) { |
@@ -183,26 +179,26 @@ int su; | |||
183 | 179 | ||
184 | case RIO_FOAD_RTA: | 180 | case RIO_FOAD_RTA: |
185 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n"); | 181 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_FOAD_RTA\n"); |
186 | return RIOCommandRta(p, (unsigned long)arg, RIOFoadRta); | 182 | return RIOCommandRta(p, arg, RIOFoadRta); |
187 | 183 | ||
188 | case RIO_ZOMBIE_RTA: | 184 | case RIO_ZOMBIE_RTA: |
189 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n"); | 185 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_ZOMBIE_RTA\n"); |
190 | return RIOCommandRta(p, (unsigned long)arg, RIOZombieRta); | 186 | return RIOCommandRta(p, arg, RIOZombieRta); |
191 | 187 | ||
192 | case RIO_IDENTIFY_RTA: | 188 | case RIO_IDENTIFY_RTA: |
193 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n"); | 189 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_IDENTIFY_RTA\n"); |
194 | return RIOIdentifyRta(p, arg); | 190 | return RIOIdentifyRta(p, argp); |
195 | 191 | ||
196 | case RIO_KILL_NEIGHBOUR: | 192 | case RIO_KILL_NEIGHBOUR: |
197 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n"); | 193 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_KILL_NEIGHBOUR\n"); |
198 | return RIOKillNeighbour(p, arg); | 194 | return RIOKillNeighbour(p, argp); |
199 | 195 | ||
200 | case SPECIAL_RUP_CMD: | 196 | case SPECIAL_RUP_CMD: |
201 | { | 197 | { |
202 | struct CmdBlk *CmdBlkP; | 198 | struct CmdBlk *CmdBlkP; |
203 | 199 | ||
204 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n"); | 200 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD\n"); |
205 | if (copy_from_user(&SpecialRupCmd, arg, sizeof(SpecialRupCmd))) { | 201 | if (copy_from_user(&SpecialRupCmd, argp, sizeof(SpecialRupCmd))) { |
206 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n"); | 202 | rio_dprintk(RIO_DEBUG_CTRL, "SPECIAL_RUP_CMD copy failed\n"); |
207 | p->RIOError.Error = COPYIN_FAILED; | 203 | p->RIOError.Error = COPYIN_FAILED; |
208 | return -EFAULT; | 204 | return -EFAULT; |
@@ -239,7 +235,7 @@ int su; | |||
239 | if ((retval = RIOApel(p)) != 0) | 235 | if ((retval = RIOApel(p)) != 0) |
240 | return retval; | 236 | return retval; |
241 | 237 | ||
242 | if (copy_to_user(arg, p->RIOConnectTable, TOTAL_MAP_ENTRIES * sizeof(struct Map))) { | 238 | if (copy_to_user(argp, p->RIOConnectTable, TOTAL_MAP_ENTRIES * sizeof(struct Map))) { |
243 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n"); | 239 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_TABLE copy failed\n"); |
244 | p->RIOError.Error = COPYOUT_FAILED; | 240 | p->RIOError.Error = COPYOUT_FAILED; |
245 | return -EFAULT; | 241 | return -EFAULT; |
@@ -284,7 +280,7 @@ int su; | |||
284 | p->RIOError.Error = NOT_SUPER_USER; | 280 | p->RIOError.Error = NOT_SUPER_USER; |
285 | return -EPERM; | 281 | return -EPERM; |
286 | } | 282 | } |
287 | if (copy_from_user(&p->RIOConnectTable[0], arg, TOTAL_MAP_ENTRIES * sizeof(struct Map))) { | 283 | if (copy_from_user(&p->RIOConnectTable[0], argp, TOTAL_MAP_ENTRIES * sizeof(struct Map))) { |
288 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n"); | 284 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_TABLE copy failed\n"); |
289 | p->RIOError.Error = COPYIN_FAILED; | 285 | p->RIOError.Error = COPYIN_FAILED; |
290 | return -EFAULT; | 286 | return -EFAULT; |
@@ -330,7 +326,7 @@ int su; | |||
330 | p->RIOError.Error = NOT_SUPER_USER; | 326 | p->RIOError.Error = NOT_SUPER_USER; |
331 | return -EPERM; | 327 | return -EPERM; |
332 | } | 328 | } |
333 | if (copy_to_user(arg, p->RIOBindTab, (sizeof(ulong) * MAX_RTA_BINDINGS))) { | 329 | if (copy_to_user(argp, p->RIOBindTab, (sizeof(ulong) * MAX_RTA_BINDINGS))) { |
334 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n"); | 330 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_BINDINGS copy failed\n"); |
335 | p->RIOError.Error = COPYOUT_FAILED; | 331 | p->RIOError.Error = COPYOUT_FAILED; |
336 | return -EFAULT; | 332 | return -EFAULT; |
@@ -349,7 +345,7 @@ int su; | |||
349 | p->RIOError.Error = NOT_SUPER_USER; | 345 | p->RIOError.Error = NOT_SUPER_USER; |
350 | return -EPERM; | 346 | return -EPERM; |
351 | } | 347 | } |
352 | if (copy_from_user(&p->RIOBindTab[0], arg, (sizeof(ulong) * MAX_RTA_BINDINGS))) { | 348 | if (copy_from_user(&p->RIOBindTab[0], argp, (sizeof(ulong) * MAX_RTA_BINDINGS))) { |
353 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n"); | 349 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PUT_BINDINGS copy failed\n"); |
354 | p->RIOError.Error = COPYIN_FAILED; | 350 | p->RIOError.Error = COPYIN_FAILED; |
355 | return -EFAULT; | 351 | return -EFAULT; |
@@ -373,12 +369,12 @@ int su; | |||
373 | for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) { | 369 | for (Entry = 0; Entry < MAX_RTA_BINDINGS; Entry++) { |
374 | if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L)) | 370 | if ((EmptySlot == -1) && (p->RIOBindTab[Entry] == 0L)) |
375 | EmptySlot = Entry; | 371 | EmptySlot = Entry; |
376 | else if (p->RIOBindTab[Entry] == (long)arg) { | 372 | else if (p->RIOBindTab[Entry] == arg) { |
377 | /* | 373 | /* |
378 | ** Already exists - delete | 374 | ** Already exists - delete |
379 | */ | 375 | */ |
380 | p->RIOBindTab[Entry] = 0L; | 376 | p->RIOBindTab[Entry] = 0L; |
381 | rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %ld from p->RIOBindTab\n", (unsigned long)arg); | 377 | rio_dprintk(RIO_DEBUG_CTRL, "Removing Rta %ld from p->RIOBindTab\n", arg); |
382 | return 0; | 378 | return 0; |
383 | } | 379 | } |
384 | } | 380 | } |
@@ -386,10 +382,10 @@ int su; | |||
386 | ** Dosen't exist - add | 382 | ** Dosen't exist - add |
387 | */ | 383 | */ |
388 | if (EmptySlot != -1) { | 384 | if (EmptySlot != -1) { |
389 | p->RIOBindTab[EmptySlot] = (unsigned long)arg; | 385 | p->RIOBindTab[EmptySlot] = arg; |
390 | rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %lx to p->RIOBindTab\n", (unsigned long) arg); | 386 | rio_dprintk(RIO_DEBUG_CTRL, "Adding Rta %lx to p->RIOBindTab\n", arg); |
391 | } else { | 387 | } else { |
392 | rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %lx not added\n", (unsigned long) arg); | 388 | rio_dprintk(RIO_DEBUG_CTRL, "p->RIOBindTab full! - Rta %lx not added\n", arg); |
393 | return -ENOMEM; | 389 | return -ENOMEM; |
394 | } | 390 | } |
395 | return 0; | 391 | return 0; |
@@ -397,7 +393,7 @@ int su; | |||
397 | 393 | ||
398 | case RIO_RESUME: | 394 | case RIO_RESUME: |
399 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n"); | 395 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME\n"); |
400 | port = (unsigned long) arg; | 396 | port = arg; |
401 | if ((port < 0) || (port > 511)) { | 397 | if ((port < 0) || (port > 511)) { |
402 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); | 398 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESUME: Bad port number %d\n", port); |
403 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 399 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
@@ -433,7 +429,7 @@ int su; | |||
433 | p->RIOError.Error = NOT_SUPER_USER; | 429 | p->RIOError.Error = NOT_SUPER_USER; |
434 | return -EPERM; | 430 | return -EPERM; |
435 | } | 431 | } |
436 | if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) { | 432 | if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) { |
437 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); | 433 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); |
438 | p->RIOError.Error = COPYIN_FAILED; | 434 | p->RIOError.Error = COPYIN_FAILED; |
439 | return -EFAULT; | 435 | return -EFAULT; |
@@ -447,7 +443,7 @@ int su; | |||
447 | p->RIOError.Error = NOT_SUPER_USER; | 443 | p->RIOError.Error = NOT_SUPER_USER; |
448 | return -EPERM; | 444 | return -EPERM; |
449 | } | 445 | } |
450 | if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) { | 446 | if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) { |
451 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); | 447 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from user space failed\n"); |
452 | p->RIOError.Error = COPYIN_FAILED; | 448 | p->RIOError.Error = COPYIN_FAILED; |
453 | return -EFAULT; | 449 | return -EFAULT; |
@@ -461,7 +457,7 @@ int su; | |||
461 | p->RIOError.Error = NOT_SUPER_USER; | 457 | p->RIOError.Error = NOT_SUPER_USER; |
462 | return -EPERM; | 458 | return -EPERM; |
463 | } | 459 | } |
464 | if (copy_from_user(&MapEnt, arg, sizeof(MapEnt))) { | 460 | if (copy_from_user(&MapEnt, argp, sizeof(MapEnt))) { |
465 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n"); | 461 | rio_dprintk(RIO_DEBUG_CTRL, "Copy from data space failed\n"); |
466 | p->RIOError.Error = COPYIN_FAILED; | 462 | p->RIOError.Error = COPYIN_FAILED; |
467 | return -EFAULT; | 463 | return -EFAULT; |
@@ -469,14 +465,14 @@ int su; | |||
469 | return RIODeleteRta(p, &MapEnt); | 465 | return RIODeleteRta(p, &MapEnt); |
470 | 466 | ||
471 | case RIO_QUICK_CHECK: | 467 | case RIO_QUICK_CHECK: |
472 | if (copy_to_user(arg, &p->RIORtaDisCons, sizeof(unsigned int))) { | 468 | if (copy_to_user(argp, &p->RIORtaDisCons, sizeof(unsigned int))) { |
473 | p->RIOError.Error = COPYOUT_FAILED; | 469 | p->RIOError.Error = COPYOUT_FAILED; |
474 | return -EFAULT; | 470 | return -EFAULT; |
475 | } | 471 | } |
476 | return 0; | 472 | return 0; |
477 | 473 | ||
478 | case RIO_LAST_ERROR: | 474 | case RIO_LAST_ERROR: |
479 | if (copy_to_user(arg, &p->RIOError, sizeof(struct Error))) | 475 | if (copy_to_user(argp, &p->RIOError, sizeof(struct Error))) |
480 | return -EFAULT; | 476 | return -EFAULT; |
481 | return 0; | 477 | return 0; |
482 | 478 | ||
@@ -485,7 +481,7 @@ int su; | |||
485 | return -EINVAL; | 481 | return -EINVAL; |
486 | 482 | ||
487 | case RIO_GET_MODTYPE: | 483 | case RIO_GET_MODTYPE: |
488 | if (copy_from_user(&port, arg, sizeof(unsigned int))) { | 484 | if (copy_from_user(&port, argp, sizeof(unsigned int))) { |
489 | p->RIOError.Error = COPYIN_FAILED; | 485 | p->RIOError.Error = COPYIN_FAILED; |
490 | return -EFAULT; | 486 | return -EFAULT; |
491 | } | 487 | } |
@@ -505,7 +501,7 @@ int su; | |||
505 | ** Return module type of port | 501 | ** Return module type of port |
506 | */ | 502 | */ |
507 | port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes; | 503 | port = PortP->HostP->UnixRups[PortP->RupNum].ModTypes; |
508 | if (copy_to_user(arg, &port, sizeof(unsigned int))) { | 504 | if (copy_to_user(argp, &port, sizeof(unsigned int))) { |
509 | p->RIOError.Error = COPYOUT_FAILED; | 505 | p->RIOError.Error = COPYOUT_FAILED; |
510 | return -EFAULT; | 506 | return -EFAULT; |
511 | } | 507 | } |
@@ -521,7 +517,7 @@ int su; | |||
521 | 517 | ||
522 | case RIO_SETUP_PORTS: | 518 | case RIO_SETUP_PORTS: |
523 | rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n"); | 519 | rio_dprintk(RIO_DEBUG_CTRL, "Setup ports\n"); |
524 | if (copy_from_user(&PortSetup, arg, sizeof(PortSetup))) { | 520 | if (copy_from_user(&PortSetup, argp, sizeof(PortSetup))) { |
525 | p->RIOError.Error = COPYIN_FAILED; | 521 | p->RIOError.Error = COPYIN_FAILED; |
526 | rio_dprintk(RIO_DEBUG_CTRL, "EFAULT"); | 522 | rio_dprintk(RIO_DEBUG_CTRL, "EFAULT"); |
527 | return -EFAULT; | 523 | return -EFAULT; |
@@ -551,7 +547,7 @@ int su; | |||
551 | 547 | ||
552 | case RIO_GET_PORT_SETUP: | 548 | case RIO_GET_PORT_SETUP: |
553 | rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n"); | 549 | rio_dprintk(RIO_DEBUG_CTRL, "Get port setup\n"); |
554 | if (copy_from_user(&PortSetup, arg, sizeof(PortSetup))) { | 550 | if (copy_from_user(&PortSetup, argp, sizeof(PortSetup))) { |
555 | p->RIOError.Error = COPYIN_FAILED; | 551 | p->RIOError.Error = COPYIN_FAILED; |
556 | return -EFAULT; | 552 | return -EFAULT; |
557 | } | 553 | } |
@@ -572,7 +568,7 @@ int su; | |||
572 | PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; | 568 | PortSetup.XpOn[MAX_XP_CTRL_LEN - 1] = '\0'; |
573 | PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; | 569 | PortSetup.XpOff[MAX_XP_CTRL_LEN - 1] = '\0'; |
574 | 570 | ||
575 | if (copy_to_user(arg, &PortSetup, sizeof(PortSetup))) { | 571 | if (copy_to_user(argp, &PortSetup, sizeof(PortSetup))) { |
576 | p->RIOError.Error = COPYOUT_FAILED; | 572 | p->RIOError.Error = COPYOUT_FAILED; |
577 | return -EFAULT; | 573 | return -EFAULT; |
578 | } | 574 | } |
@@ -580,7 +576,7 @@ int su; | |||
580 | 576 | ||
581 | case RIO_GET_PORT_PARAMS: | 577 | case RIO_GET_PORT_PARAMS: |
582 | rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n"); | 578 | rio_dprintk(RIO_DEBUG_CTRL, "Get port params\n"); |
583 | if (copy_from_user(&PortParams, arg, sizeof(struct PortParams))) { | 579 | if (copy_from_user(&PortParams, argp, sizeof(struct PortParams))) { |
584 | p->RIOError.Error = COPYIN_FAILED; | 580 | p->RIOError.Error = COPYIN_FAILED; |
585 | return -EFAULT; | 581 | return -EFAULT; |
586 | } | 582 | } |
@@ -593,7 +589,7 @@ int su; | |||
593 | PortParams.State = PortP->State; | 589 | PortParams.State = PortP->State; |
594 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port); | 590 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortParams.Port); |
595 | 591 | ||
596 | if (copy_to_user(arg, &PortParams, sizeof(struct PortParams))) { | 592 | if (copy_to_user(argp, &PortParams, sizeof(struct PortParams))) { |
597 | p->RIOError.Error = COPYOUT_FAILED; | 593 | p->RIOError.Error = COPYOUT_FAILED; |
598 | return -EFAULT; | 594 | return -EFAULT; |
599 | } | 595 | } |
@@ -601,7 +597,7 @@ int su; | |||
601 | 597 | ||
602 | case RIO_GET_PORT_TTY: | 598 | case RIO_GET_PORT_TTY: |
603 | rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n"); | 599 | rio_dprintk(RIO_DEBUG_CTRL, "Get port tty\n"); |
604 | if (copy_from_user(&PortTty, arg, sizeof(struct PortTty))) { | 600 | if (copy_from_user(&PortTty, argp, sizeof(struct PortTty))) { |
605 | p->RIOError.Error = COPYIN_FAILED; | 601 | p->RIOError.Error = COPYIN_FAILED; |
606 | return -EFAULT; | 602 | return -EFAULT; |
607 | } | 603 | } |
@@ -612,14 +608,14 @@ int su; | |||
612 | 608 | ||
613 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); | 609 | rio_dprintk(RIO_DEBUG_CTRL, "Port %d\n", PortTty.port); |
614 | PortP = (p->RIOPortp[PortTty.port]); | 610 | PortP = (p->RIOPortp[PortTty.port]); |
615 | if (copy_to_user(arg, &PortTty, sizeof(struct PortTty))) { | 611 | if (copy_to_user(argp, &PortTty, sizeof(struct PortTty))) { |
616 | p->RIOError.Error = COPYOUT_FAILED; | 612 | p->RIOError.Error = COPYOUT_FAILED; |
617 | return -EFAULT; | 613 | return -EFAULT; |
618 | } | 614 | } |
619 | return retval; | 615 | return retval; |
620 | 616 | ||
621 | case RIO_SET_PORT_TTY: | 617 | case RIO_SET_PORT_TTY: |
622 | if (copy_from_user(&PortTty, arg, sizeof(struct PortTty))) { | 618 | if (copy_from_user(&PortTty, argp, sizeof(struct PortTty))) { |
623 | p->RIOError.Error = COPYIN_FAILED; | 619 | p->RIOError.Error = COPYIN_FAILED; |
624 | return -EFAULT; | 620 | return -EFAULT; |
625 | } | 621 | } |
@@ -634,7 +630,7 @@ int su; | |||
634 | 630 | ||
635 | case RIO_SET_PORT_PARAMS: | 631 | case RIO_SET_PORT_PARAMS: |
636 | rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n"); | 632 | rio_dprintk(RIO_DEBUG_CTRL, "Set port params\n"); |
637 | if (copy_from_user(&PortParams, arg, sizeof(PortParams))) { | 633 | if (copy_from_user(&PortParams, argp, sizeof(PortParams))) { |
638 | p->RIOError.Error = COPYIN_FAILED; | 634 | p->RIOError.Error = COPYIN_FAILED; |
639 | return -EFAULT; | 635 | return -EFAULT; |
640 | } | 636 | } |
@@ -650,7 +646,7 @@ int su; | |||
650 | 646 | ||
651 | case RIO_GET_PORT_STATS: | 647 | case RIO_GET_PORT_STATS: |
652 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n"); | 648 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GET_PORT_STATS\n"); |
653 | if (copy_from_user(&portStats, arg, sizeof(struct portStats))) { | 649 | if (copy_from_user(&portStats, argp, sizeof(struct portStats))) { |
654 | p->RIOError.Error = COPYIN_FAILED; | 650 | p->RIOError.Error = COPYIN_FAILED; |
655 | return -EFAULT; | 651 | return -EFAULT; |
656 | } | 652 | } |
@@ -665,14 +661,14 @@ int su; | |||
665 | portStats.opens = PortP->opens; | 661 | portStats.opens = PortP->opens; |
666 | portStats.closes = PortP->closes; | 662 | portStats.closes = PortP->closes; |
667 | portStats.ioctls = PortP->ioctls; | 663 | portStats.ioctls = PortP->ioctls; |
668 | if (copy_to_user(arg, &portStats, sizeof(struct portStats))) { | 664 | if (copy_to_user(argp, &portStats, sizeof(struct portStats))) { |
669 | p->RIOError.Error = COPYOUT_FAILED; | 665 | p->RIOError.Error = COPYOUT_FAILED; |
670 | return -EFAULT; | 666 | return -EFAULT; |
671 | } | 667 | } |
672 | return retval; | 668 | return retval; |
673 | 669 | ||
674 | case RIO_RESET_PORT_STATS: | 670 | case RIO_RESET_PORT_STATS: |
675 | port = (unsigned long) arg; | 671 | port = arg; |
676 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); | 672 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_RESET_PORT_STATS\n"); |
677 | if (port >= RIO_PORTS) { | 673 | if (port >= RIO_PORTS) { |
678 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 674 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
@@ -690,7 +686,7 @@ int su; | |||
690 | 686 | ||
691 | case RIO_GATHER_PORT_STATS: | 687 | case RIO_GATHER_PORT_STATS: |
692 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n"); | 688 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GATHER_PORT_STATS\n"); |
693 | if (copy_from_user(&portStats, arg, sizeof(struct portStats))) { | 689 | if (copy_from_user(&portStats, argp, sizeof(struct portStats))) { |
694 | p->RIOError.Error = COPYIN_FAILED; | 690 | p->RIOError.Error = COPYIN_FAILED; |
695 | return -EFAULT; | 691 | return -EFAULT; |
696 | } | 692 | } |
@@ -706,7 +702,7 @@ int su; | |||
706 | 702 | ||
707 | case RIO_READ_CONFIG: | 703 | case RIO_READ_CONFIG: |
708 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); | 704 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_CONFIG\n"); |
709 | if (copy_to_user(arg, &p->RIOConf, sizeof(struct Conf))) { | 705 | if (copy_to_user(argp, &p->RIOConf, sizeof(struct Conf))) { |
710 | p->RIOError.Error = COPYOUT_FAILED; | 706 | p->RIOError.Error = COPYOUT_FAILED; |
711 | return -EFAULT; | 707 | return -EFAULT; |
712 | } | 708 | } |
@@ -718,7 +714,7 @@ int su; | |||
718 | p->RIOError.Error = NOT_SUPER_USER; | 714 | p->RIOError.Error = NOT_SUPER_USER; |
719 | return -EPERM; | 715 | return -EPERM; |
720 | } | 716 | } |
721 | if (copy_from_user(&p->RIOConf, arg, sizeof(struct Conf))) { | 717 | if (copy_from_user(&p->RIOConf, argp, sizeof(struct Conf))) { |
722 | p->RIOError.Error = COPYIN_FAILED; | 718 | p->RIOError.Error = COPYIN_FAILED; |
723 | return -EFAULT; | 719 | return -EFAULT; |
724 | } | 720 | } |
@@ -746,7 +742,7 @@ int su; | |||
746 | case RIO_SETDEBUG: | 742 | case RIO_SETDEBUG: |
747 | case RIO_GETDEBUG: | 743 | case RIO_GETDEBUG: |
748 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n"); | 744 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SETDEBUG/RIO_GETDEBUG\n"); |
749 | if (copy_from_user(&DebugCtrl, arg, sizeof(DebugCtrl))) { | 745 | if (copy_from_user(&DebugCtrl, argp, sizeof(DebugCtrl))) { |
750 | p->RIOError.Error = COPYIN_FAILED; | 746 | p->RIOError.Error = COPYIN_FAILED; |
751 | return -EFAULT; | 747 | return -EFAULT; |
752 | } | 748 | } |
@@ -763,7 +759,7 @@ int su; | |||
763 | rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait); | 759 | rio_dprintk(RIO_DEBUG_CTRL, "Get global debug 0x%x wait 0x%x\n", p->rio_debug, p->RIODebugWait); |
764 | DebugCtrl.Debug = p->rio_debug; | 760 | DebugCtrl.Debug = p->rio_debug; |
765 | DebugCtrl.Wait = p->RIODebugWait; | 761 | DebugCtrl.Wait = p->RIODebugWait; |
766 | if (copy_to_user(arg, &DebugCtrl, sizeof(DebugCtrl))) { | 762 | if (copy_to_user(argp, &DebugCtrl, sizeof(DebugCtrl))) { |
767 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort); | 763 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET/GET DEBUG: bad port number %d\n", DebugCtrl.SysPort); |
768 | p->RIOError.Error = COPYOUT_FAILED; | 764 | p->RIOError.Error = COPYOUT_FAILED; |
769 | return -EFAULT; | 765 | return -EFAULT; |
@@ -785,7 +781,7 @@ int su; | |||
785 | } else { | 781 | } else { |
786 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug); | 782 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG 0x%x\n", p->RIOPortp[DebugCtrl.SysPort]->Debug); |
787 | DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug; | 783 | DebugCtrl.Debug = p->RIOPortp[DebugCtrl.SysPort]->Debug; |
788 | if (copy_to_user(arg, &DebugCtrl, sizeof(DebugCtrl))) { | 784 | if (copy_to_user(argp, &DebugCtrl, sizeof(DebugCtrl))) { |
789 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n"); | 785 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_GETDEBUG: Bad copy to user space\n"); |
790 | p->RIOError.Error = COPYOUT_FAILED; | 786 | p->RIOError.Error = COPYOUT_FAILED; |
791 | return -EFAULT; | 787 | return -EFAULT; |
@@ -800,7 +796,7 @@ int su; | |||
800 | ** textual null terminated string. | 796 | ** textual null terminated string. |
801 | */ | 797 | */ |
802 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n"); | 798 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID\n"); |
803 | if (copy_to_user(arg, RIOVersid(), sizeof(struct rioVersion))) { | 799 | if (copy_to_user(argp, RIOVersid(), sizeof(struct rioVersion))) { |
804 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host); | 800 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_VERSID: Bad copy to user space (host=%d)\n", Host); |
805 | p->RIOError.Error = COPYOUT_FAILED; | 801 | p->RIOError.Error = COPYOUT_FAILED; |
806 | return -EFAULT; | 802 | return -EFAULT; |
@@ -813,7 +809,7 @@ int su; | |||
813 | ** at init time. | 809 | ** at init time. |
814 | */ | 810 | */ |
815 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n"); | 811 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS\n"); |
816 | if (copy_to_user(arg, &p->RIONumHosts, sizeof(p->RIONumHosts))) { | 812 | if (copy_to_user(argp, &p->RIONumHosts, sizeof(p->RIONumHosts))) { |
817 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n"); | 813 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_NUM_HOSTS: Bad copy to user space\n"); |
818 | p->RIOError.Error = COPYOUT_FAILED; | 814 | p->RIOError.Error = COPYOUT_FAILED; |
819 | return -EFAULT; | 815 | return -EFAULT; |
@@ -824,7 +820,7 @@ int su; | |||
824 | /* | 820 | /* |
825 | ** Kill host. This may not be in the final version... | 821 | ** Kill host. This may not be in the final version... |
826 | */ | 822 | */ |
827 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %ld\n", (unsigned long) arg); | 823 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD %ld\n", arg); |
828 | if (!su) { | 824 | if (!su) { |
829 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); | 825 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_FOAD: Not super user\n"); |
830 | p->RIOError.Error = NOT_SUPER_USER; | 826 | p->RIOError.Error = NOT_SUPER_USER; |
@@ -858,7 +854,7 @@ int su; | |||
858 | p->RIOError.Error = NOT_SUPER_USER; | 854 | p->RIOError.Error = NOT_SUPER_USER; |
859 | return -EPERM; | 855 | return -EPERM; |
860 | } | 856 | } |
861 | if (copy_from_user(&DownLoad, arg, sizeof(DownLoad))) { | 857 | if (copy_from_user(&DownLoad, argp, sizeof(DownLoad))) { |
862 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n"); | 858 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_DOWNLOAD: Copy in from user space failed\n"); |
863 | p->RIOError.Error = COPYIN_FAILED; | 859 | p->RIOError.Error = COPYIN_FAILED; |
864 | return -EFAULT; | 860 | return -EFAULT; |
@@ -888,7 +884,7 @@ int su; | |||
888 | { | 884 | { |
889 | unsigned int host; | 885 | unsigned int host; |
890 | 886 | ||
891 | if (copy_from_user(&host, arg, sizeof(host))) { | 887 | if (copy_from_user(&host, argp, sizeof(host))) { |
892 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); | 888 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); |
893 | p->RIOError.Error = COPYIN_FAILED; | 889 | p->RIOError.Error = COPYIN_FAILED; |
894 | return -EFAULT; | 890 | return -EFAULT; |
@@ -897,7 +893,7 @@ int su; | |||
897 | ** Fetch the parmmap | 893 | ** Fetch the parmmap |
898 | */ | 894 | */ |
899 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n"); | 895 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS\n"); |
900 | if (copy_to_user(arg, p->RIOHosts[host].ParmMapP, sizeof(PARM_MAP))) { | 896 | if (copy_to_user(argp, p->RIOHosts[host].ParmMapP, sizeof(PARM_MAP))) { |
901 | p->RIOError.Error = COPYOUT_FAILED; | 897 | p->RIOError.Error = COPYOUT_FAILED; |
902 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); | 898 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_PARMS: Copy out to user space failed\n"); |
903 | return -EFAULT; | 899 | return -EFAULT; |
@@ -907,7 +903,7 @@ int su; | |||
907 | 903 | ||
908 | case RIO_HOST_REQ: | 904 | case RIO_HOST_REQ: |
909 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n"); | 905 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ\n"); |
910 | if (copy_from_user(&HostReq, arg, sizeof(HostReq))) { | 906 | if (copy_from_user(&HostReq, argp, sizeof(HostReq))) { |
911 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); | 907 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_REQ: Copy in from user space failed\n"); |
912 | p->RIOError.Error = COPYIN_FAILED; | 908 | p->RIOError.Error = COPYIN_FAILED; |
913 | return -EFAULT; | 909 | return -EFAULT; |
@@ -928,7 +924,7 @@ int su; | |||
928 | 924 | ||
929 | case RIO_HOST_DPRAM: | 925 | case RIO_HOST_DPRAM: |
930 | rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n"); | 926 | rio_dprintk(RIO_DEBUG_CTRL, "Request for DPRAM\n"); |
931 | if (copy_from_user(&HostDpRam, arg, sizeof(HostDpRam))) { | 927 | if (copy_from_user(&HostDpRam, argp, sizeof(HostDpRam))) { |
932 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n"); | 928 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Copy in from user space failed\n"); |
933 | p->RIOError.Error = COPYIN_FAILED; | 929 | p->RIOError.Error = COPYIN_FAILED; |
934 | return -EFAULT; | 930 | return -EFAULT; |
@@ -945,7 +941,7 @@ int su; | |||
945 | /* It's hardware like this that really gets on my tits. */ | 941 | /* It's hardware like this that really gets on my tits. */ |
946 | static unsigned char copy[sizeof(struct DpRam)]; | 942 | static unsigned char copy[sizeof(struct DpRam)]; |
947 | for (off = 0; off < sizeof(struct DpRam); off++) | 943 | for (off = 0; off < sizeof(struct DpRam); off++) |
948 | copy[off] = readb(&p->RIOHosts[HostDpRam.HostNum].Caddr[off]); | 944 | copy[off] = readb(p->RIOHosts[HostDpRam.HostNum].Caddr + off); |
949 | if (copy_to_user(HostDpRam.DpRamP, copy, sizeof(struct DpRam))) { | 945 | if (copy_to_user(HostDpRam.DpRamP, copy, sizeof(struct DpRam))) { |
950 | p->RIOError.Error = COPYOUT_FAILED; | 946 | p->RIOError.Error = COPYOUT_FAILED; |
951 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); | 947 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_DPRAM: Bad copy to user space\n"); |
@@ -960,13 +956,13 @@ int su; | |||
960 | 956 | ||
961 | case RIO_SET_BUSY: | 957 | case RIO_SET_BUSY: |
962 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n"); | 958 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY\n"); |
963 | if ((unsigned long) arg > 511) { | 959 | if (arg > 511) { |
964 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %ld\n", (unsigned long) arg); | 960 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SET_BUSY: Bad port number %ld\n", arg); |
965 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 961 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
966 | return -EINVAL; | 962 | return -EINVAL; |
967 | } | 963 | } |
968 | rio_spin_lock_irqsave(&PortP->portSem, flags); | 964 | rio_spin_lock_irqsave(&PortP->portSem, flags); |
969 | p->RIOPortp[(unsigned long) arg]->State |= RIO_BUSY; | 965 | p->RIOPortp[arg]->State |= RIO_BUSY; |
970 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 966 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
971 | return retval; | 967 | return retval; |
972 | 968 | ||
@@ -976,7 +972,7 @@ int su; | |||
976 | ** (probably for debug reasons) | 972 | ** (probably for debug reasons) |
977 | */ | 973 | */ |
978 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n"); | 974 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT\n"); |
979 | if (copy_from_user(&PortReq, arg, sizeof(PortReq))) { | 975 | if (copy_from_user(&PortReq, argp, sizeof(PortReq))) { |
980 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n"); | 976 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_PORT: Copy in from user space failed\n"); |
981 | p->RIOError.Error = COPYIN_FAILED; | 977 | p->RIOError.Error = COPYIN_FAILED; |
982 | return -EFAULT; | 978 | return -EFAULT; |
@@ -1001,7 +997,7 @@ int su; | |||
1001 | ** (probably for debug reasons) | 997 | ** (probably for debug reasons) |
1002 | */ | 998 | */ |
1003 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n"); | 999 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP\n"); |
1004 | if (copy_from_user(&RupReq, arg, sizeof(RupReq))) { | 1000 | if (copy_from_user(&RupReq, argp, sizeof(RupReq))) { |
1005 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n"); | 1001 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_RUP: Copy in from user space failed\n"); |
1006 | p->RIOError.Error = COPYIN_FAILED; | 1002 | p->RIOError.Error = COPYIN_FAILED; |
1007 | return -EFAULT; | 1003 | return -EFAULT; |
@@ -1038,7 +1034,7 @@ int su; | |||
1038 | ** (probably for debug reasons) | 1034 | ** (probably for debug reasons) |
1039 | */ | 1035 | */ |
1040 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n"); | 1036 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB\n"); |
1041 | if (copy_from_user(&LpbReq, arg, sizeof(LpbReq))) { | 1037 | if (copy_from_user(&LpbReq, argp, sizeof(LpbReq))) { |
1042 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n"); | 1038 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_HOST_LPB: Bad copy from user space\n"); |
1043 | p->RIOError.Error = COPYIN_FAILED; | 1039 | p->RIOError.Error = COPYIN_FAILED; |
1044 | return -EFAULT; | 1040 | return -EFAULT; |
@@ -1136,7 +1132,7 @@ int su; | |||
1136 | case RIO_MAP_B110_TO_110: | 1132 | case RIO_MAP_B110_TO_110: |
1137 | case RIO_MAP_B110_TO_115200: | 1133 | case RIO_MAP_B110_TO_115200: |
1138 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n"); | 1134 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping\n"); |
1139 | port = (unsigned long) arg; | 1135 | port = arg; |
1140 | if (port < 0 || port > 511) { | 1136 | if (port < 0 || port > 511) { |
1141 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); | 1137 | rio_dprintk(RIO_DEBUG_CTRL, "Baud rate mapping: Bad port number %d\n", port); |
1142 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; | 1138 | p->RIOError.Error = PORT_NUMBER_OUT_OF_RANGE; |
@@ -1166,7 +1162,7 @@ int su; | |||
1166 | 1162 | ||
1167 | case RIO_SEND_PACKET: | 1163 | case RIO_SEND_PACKET: |
1168 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); | 1164 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET\n"); |
1169 | if (copy_from_user(&SendPack, arg, sizeof(SendPack))) { | 1165 | if (copy_from_user(&SendPack, argp, sizeof(SendPack))) { |
1170 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n"); | 1166 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_SEND_PACKET: Bad copy from user space\n"); |
1171 | p->RIOError.Error = COPYIN_FAILED; | 1167 | p->RIOError.Error = COPYIN_FAILED; |
1172 | return -EFAULT; | 1168 | return -EFAULT; |
@@ -1210,7 +1206,7 @@ int su; | |||
1210 | return su ? 0 : -EPERM; | 1206 | return su ? 0 : -EPERM; |
1211 | 1207 | ||
1212 | case RIO_WHAT_MESG: | 1208 | case RIO_WHAT_MESG: |
1213 | if (copy_to_user(arg, &p->RIONoMessage, sizeof(p->RIONoMessage))) { | 1209 | if (copy_to_user(argp, &p->RIONoMessage, sizeof(p->RIONoMessage))) { |
1214 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n"); | 1210 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_WHAT_MESG: Bad copy to user space\n"); |
1215 | p->RIOError.Error = COPYOUT_FAILED; | 1211 | p->RIOError.Error = COPYOUT_FAILED; |
1216 | return -EFAULT; | 1212 | return -EFAULT; |
@@ -1218,7 +1214,7 @@ int su; | |||
1218 | return 0; | 1214 | return 0; |
1219 | 1215 | ||
1220 | case RIO_MEM_DUMP: | 1216 | case RIO_MEM_DUMP: |
1221 | if (copy_from_user(&SubCmd, arg, sizeof(struct SubCmdStruct))) { | 1217 | if (copy_from_user(&SubCmd, argp, sizeof(struct SubCmdStruct))) { |
1222 | p->RIOError.Error = COPYIN_FAILED; | 1218 | p->RIOError.Error = COPYIN_FAILED; |
1223 | return -EFAULT; | 1219 | return -EFAULT; |
1224 | } | 1220 | } |
@@ -1248,7 +1244,7 @@ int su; | |||
1248 | PortP->State |= RIO_BUSY; | 1244 | PortP->State |= RIO_BUSY; |
1249 | 1245 | ||
1250 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1246 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1251 | if (copy_to_user(arg, p->RIOMemDump, MEMDUMP_SIZE)) { | 1247 | if (copy_to_user(argp, p->RIOMemDump, MEMDUMP_SIZE)) { |
1252 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n"); | 1248 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_MEM_DUMP copy failed\n"); |
1253 | p->RIOError.Error = COPYOUT_FAILED; | 1249 | p->RIOError.Error = COPYOUT_FAILED; |
1254 | return -EFAULT; | 1250 | return -EFAULT; |
@@ -1256,30 +1252,30 @@ int su; | |||
1256 | return 0; | 1252 | return 0; |
1257 | 1253 | ||
1258 | case RIO_TICK: | 1254 | case RIO_TICK: |
1259 | if ((unsigned long) arg >= p->RIONumHosts) | 1255 | if (arg >= p->RIONumHosts) |
1260 | return -EINVAL; | 1256 | return -EINVAL; |
1261 | rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %ld\n", (unsigned long) arg); | 1257 | rio_dprintk(RIO_DEBUG_CTRL, "Set interrupt for host %ld\n", arg); |
1262 | writeb(0xFF, &p->RIOHosts[(unsigned long) arg].SetInt); | 1258 | writeb(0xFF, &p->RIOHosts[arg].SetInt); |
1263 | return 0; | 1259 | return 0; |
1264 | 1260 | ||
1265 | case RIO_TOCK: | 1261 | case RIO_TOCK: |
1266 | if ((unsigned long) arg >= p->RIONumHosts) | 1262 | if (arg >= p->RIONumHosts) |
1267 | return -EINVAL; | 1263 | return -EINVAL; |
1268 | rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %ld\n", (unsigned long) arg); | 1264 | rio_dprintk(RIO_DEBUG_CTRL, "Clear interrupt for host %ld\n", arg); |
1269 | writeb(0xFF, &p->RIOHosts[(unsigned long) arg].ResetInt); | 1265 | writeb(0xFF, &p->RIOHosts[arg].ResetInt); |
1270 | return 0; | 1266 | return 0; |
1271 | 1267 | ||
1272 | case RIO_READ_CHECK: | 1268 | case RIO_READ_CHECK: |
1273 | /* Check reads for pkts with data[0] the same */ | 1269 | /* Check reads for pkts with data[0] the same */ |
1274 | p->RIOReadCheck = !p->RIOReadCheck; | 1270 | p->RIOReadCheck = !p->RIOReadCheck; |
1275 | if (copy_to_user(arg, &p->RIOReadCheck, sizeof(unsigned int))) { | 1271 | if (copy_to_user(argp, &p->RIOReadCheck, sizeof(unsigned int))) { |
1276 | p->RIOError.Error = COPYOUT_FAILED; | 1272 | p->RIOError.Error = COPYOUT_FAILED; |
1277 | return -EFAULT; | 1273 | return -EFAULT; |
1278 | } | 1274 | } |
1279 | return 0; | 1275 | return 0; |
1280 | 1276 | ||
1281 | case RIO_READ_REGISTER: | 1277 | case RIO_READ_REGISTER: |
1282 | if (copy_from_user(&SubCmd, arg, sizeof(struct SubCmdStruct))) { | 1278 | if (copy_from_user(&SubCmd, argp, sizeof(struct SubCmdStruct))) { |
1283 | p->RIOError.Error = COPYIN_FAILED; | 1279 | p->RIOError.Error = COPYIN_FAILED; |
1284 | return -EFAULT; | 1280 | return -EFAULT; |
1285 | } | 1281 | } |
@@ -1314,7 +1310,7 @@ int su; | |||
1314 | PortP->State |= RIO_BUSY; | 1310 | PortP->State |= RIO_BUSY; |
1315 | 1311 | ||
1316 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); | 1312 | rio_spin_unlock_irqrestore(&PortP->portSem, flags); |
1317 | if (copy_to_user(arg, &p->CdRegister, sizeof(unsigned int))) { | 1313 | if (copy_to_user(argp, &p->CdRegister, sizeof(unsigned int))) { |
1318 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n"); | 1314 | rio_dprintk(RIO_DEBUG_CTRL, "RIO_READ_REGISTER copy failed\n"); |
1319 | p->RIOError.Error = COPYOUT_FAILED; | 1315 | p->RIOError.Error = COPYOUT_FAILED; |
1320 | return -EFAULT; | 1316 | return -EFAULT; |
@@ -1327,10 +1323,10 @@ int su; | |||
1327 | */ | 1323 | */ |
1328 | case RIO_MAKE_DEV: | 1324 | case RIO_MAKE_DEV: |
1329 | { | 1325 | { |
1330 | unsigned int port = (unsigned long) arg & RIO_MODEM_MASK; | 1326 | unsigned int port = arg & RIO_MODEM_MASK; |
1331 | unsigned int ret; | 1327 | unsigned int ret; |
1332 | 1328 | ||
1333 | switch ((unsigned long) arg & RIO_DEV_MASK) { | 1329 | switch (arg & RIO_DEV_MASK) { |
1334 | case RIO_DEV_DIRECT: | 1330 | case RIO_DEV_DIRECT: |
1335 | ret = drv_makedev(MAJOR(dev), port); | 1331 | ret = drv_makedev(MAJOR(dev), port); |
1336 | rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, ret); | 1332 | rio_dprintk(RIO_DEBUG_CTRL, "Makedev direct 0x%x is 0x%x\n", port, ret); |
@@ -1358,7 +1354,7 @@ int su; | |||
1358 | int mino; | 1354 | int mino; |
1359 | unsigned long ret; | 1355 | unsigned long ret; |
1360 | 1356 | ||
1361 | dv = (dev_t) ((unsigned long) arg); | 1357 | dv = (dev_t) (arg); |
1362 | mino = RIO_UNMODEM(dv); | 1358 | mino = RIO_UNMODEM(dv); |
1363 | 1359 | ||
1364 | if (RIO_ISMODEM(dv)) { | 1360 | if (RIO_ISMODEM(dv)) { |