diff options
Diffstat (limited to 'drivers')
87 files changed, 2728 insertions, 3442 deletions
diff --git a/drivers/acorn/char/defkeymap-l7200.c b/drivers/acorn/char/defkeymap-l7200.c index 9e18ce742e38..28a5fbc6aa1a 100644 --- a/drivers/acorn/char/defkeymap-l7200.c +++ b/drivers/acorn/char/defkeymap-l7200.c | |||
@@ -346,7 +346,7 @@ char *func_table[MAX_NR_FUNC] = { | |||
346 | 0, | 346 | 0, |
347 | }; | 347 | }; |
348 | 348 | ||
349 | struct kbdiacr accent_table[MAX_DIACR] = { | 349 | struct kbdiacruc accent_table[MAX_DIACR] = { |
350 | {'`', 'A', '\300'}, {'`', 'a', '\340'}, | 350 | {'`', 'A', '\300'}, {'`', 'a', '\340'}, |
351 | {'\'', 'A', '\301'}, {'\'', 'a', '\341'}, | 351 | {'\'', 'A', '\301'}, {'\'', 'a', '\341'}, |
352 | {'^', 'A', '\302'}, {'^', 'a', '\342'}, | 352 | {'^', 'A', '\302'}, {'^', 'a', '\342'}, |
diff --git a/drivers/base/dmapool.c b/drivers/base/dmapool.c index 7647abfe1890..fbae8674e491 100644 --- a/drivers/base/dmapool.c +++ b/drivers/base/dmapool.c | |||
@@ -302,7 +302,7 @@ restart: | |||
302 | if (mem_flags & __GFP_WAIT) { | 302 | if (mem_flags & __GFP_WAIT) { |
303 | DECLARE_WAITQUEUE (wait, current); | 303 | DECLARE_WAITQUEUE (wait, current); |
304 | 304 | ||
305 | current->state = TASK_INTERRUPTIBLE; | 305 | __set_current_state(TASK_INTERRUPTIBLE); |
306 | add_wait_queue (&pool->waitq, &wait); | 306 | add_wait_queue (&pool->waitq, &wait); |
307 | spin_unlock_irqrestore (&pool->lock, flags); | 307 | spin_unlock_irqrestore (&pool->lock, flags); |
308 | 308 | ||
diff --git a/drivers/block/aoe/aoe.h b/drivers/block/aoe/aoe.h index ba07f762c4cb..07f02f855ab5 100644 --- a/drivers/block/aoe/aoe.h +++ b/drivers/block/aoe/aoe.h | |||
@@ -48,15 +48,6 @@ struct aoe_hdr { | |||
48 | __be32 tag; | 48 | __be32 tag; |
49 | }; | 49 | }; |
50 | 50 | ||
51 | #ifdef __KERNEL__ | ||
52 | #include <linux/skbuff.h> | ||
53 | |||
54 | static inline struct aoe_hdr *aoe_hdr(const struct sk_buff *skb) | ||
55 | { | ||
56 | return (struct aoe_hdr *)skb_mac_header(skb); | ||
57 | } | ||
58 | #endif | ||
59 | |||
60 | struct aoe_atahdr { | 51 | struct aoe_atahdr { |
61 | unsigned char aflags; | 52 | unsigned char aflags; |
62 | unsigned char errfeat; | 53 | unsigned char errfeat; |
diff --git a/drivers/block/aoe/aoecmd.c b/drivers/block/aoe/aoecmd.c index 99672017ca56..4d59d5057734 100644 --- a/drivers/block/aoe/aoecmd.c +++ b/drivers/block/aoe/aoecmd.c | |||
@@ -120,7 +120,7 @@ aoecmd_ata_rw(struct aoedev *d, struct frame *f) | |||
120 | 120 | ||
121 | /* initialize the headers & frame */ | 121 | /* initialize the headers & frame */ |
122 | skb = f->skb; | 122 | skb = f->skb; |
123 | h = aoe_hdr(skb); | 123 | h = (struct aoe_hdr *) skb_mac_header(skb); |
124 | ah = (struct aoe_atahdr *) (h+1); | 124 | ah = (struct aoe_atahdr *) (h+1); |
125 | skb_put(skb, sizeof *h + sizeof *ah); | 125 | skb_put(skb, sizeof *h + sizeof *ah); |
126 | memset(h, 0, skb->len); | 126 | memset(h, 0, skb->len); |
@@ -209,7 +209,7 @@ aoecmd_cfg_pkts(ushort aoemajor, unsigned char aoeminor, struct sk_buff **tail) | |||
209 | skb->dev = ifp; | 209 | skb->dev = ifp; |
210 | if (sl_tail == NULL) | 210 | if (sl_tail == NULL) |
211 | sl_tail = skb; | 211 | sl_tail = skb; |
212 | h = aoe_hdr(skb); | 212 | h = (struct aoe_hdr *) skb_mac_header(skb); |
213 | memset(h, 0, sizeof *h + sizeof *ch); | 213 | memset(h, 0, sizeof *h + sizeof *ch); |
214 | 214 | ||
215 | memset(h->dst, 0xff, sizeof h->dst); | 215 | memset(h->dst, 0xff, sizeof h->dst); |
@@ -304,7 +304,7 @@ rexmit(struct aoedev *d, struct frame *f) | |||
304 | aoechr_error(buf); | 304 | aoechr_error(buf); |
305 | 305 | ||
306 | skb = f->skb; | 306 | skb = f->skb; |
307 | h = aoe_hdr(skb); | 307 | h = (struct aoe_hdr *) skb_mac_header(skb); |
308 | ah = (struct aoe_atahdr *) (h+1); | 308 | ah = (struct aoe_atahdr *) (h+1); |
309 | f->tag = n; | 309 | f->tag = n; |
310 | h->tag = cpu_to_be32(n); | 310 | h->tag = cpu_to_be32(n); |
@@ -533,7 +533,7 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
533 | char ebuf[128]; | 533 | char ebuf[128]; |
534 | u16 aoemajor; | 534 | u16 aoemajor; |
535 | 535 | ||
536 | hin = aoe_hdr(skb); | 536 | hin = (struct aoe_hdr *) skb_mac_header(skb); |
537 | aoemajor = be16_to_cpu(get_unaligned(&hin->major)); | 537 | aoemajor = be16_to_cpu(get_unaligned(&hin->major)); |
538 | d = aoedev_by_aoeaddr(aoemajor, hin->minor); | 538 | d = aoedev_by_aoeaddr(aoemajor, hin->minor); |
539 | if (d == NULL) { | 539 | if (d == NULL) { |
@@ -565,7 +565,7 @@ aoecmd_ata_rsp(struct sk_buff *skb) | |||
565 | calc_rttavg(d, tsince(f->tag)); | 565 | calc_rttavg(d, tsince(f->tag)); |
566 | 566 | ||
567 | ahin = (struct aoe_atahdr *) (hin+1); | 567 | ahin = (struct aoe_atahdr *) (hin+1); |
568 | hout = aoe_hdr(f->skb); | 568 | hout = (struct aoe_hdr *) skb_mac_header(f->skb); |
569 | ahout = (struct aoe_atahdr *) (hout+1); | 569 | ahout = (struct aoe_atahdr *) (hout+1); |
570 | buf = f->buf; | 570 | buf = f->buf; |
571 | 571 | ||
@@ -699,7 +699,7 @@ aoecmd_ata_id(struct aoedev *d) | |||
699 | 699 | ||
700 | /* initialize the headers & frame */ | 700 | /* initialize the headers & frame */ |
701 | skb = f->skb; | 701 | skb = f->skb; |
702 | h = aoe_hdr(skb); | 702 | h = (struct aoe_hdr *) skb_mac_header(skb); |
703 | ah = (struct aoe_atahdr *) (h+1); | 703 | ah = (struct aoe_atahdr *) (h+1); |
704 | skb_put(skb, sizeof *h + sizeof *ah); | 704 | skb_put(skb, sizeof *h + sizeof *ah); |
705 | memset(h, 0, skb->len); | 705 | memset(h, 0, skb->len); |
@@ -730,7 +730,7 @@ aoecmd_cfg_rsp(struct sk_buff *skb) | |||
730 | enum { MAXFRAMES = 16 }; | 730 | enum { MAXFRAMES = 16 }; |
731 | u16 n; | 731 | u16 n; |
732 | 732 | ||
733 | h = aoe_hdr(skb); | 733 | h = (struct aoe_hdr *) skb_mac_header(skb); |
734 | ch = (struct aoe_cfghdr *) (h+1); | 734 | ch = (struct aoe_cfghdr *) (h+1); |
735 | 735 | ||
736 | /* | 736 | /* |
diff --git a/drivers/block/aoe/aoenet.c b/drivers/block/aoe/aoenet.c index 4dc0fb7da94b..4e6deb7f5c24 100644 --- a/drivers/block/aoe/aoenet.c +++ b/drivers/block/aoe/aoenet.c | |||
@@ -127,7 +127,7 @@ aoenet_rcv(struct sk_buff *skb, struct net_device *ifp, struct packet_type *pt, | |||
127 | goto exit; | 127 | goto exit; |
128 | skb_push(skb, ETH_HLEN); /* (1) */ | 128 | skb_push(skb, ETH_HLEN); /* (1) */ |
129 | 129 | ||
130 | h = aoe_hdr(skb); | 130 | h = (struct aoe_hdr *) skb_mac_header(skb); |
131 | n = be32_to_cpu(get_unaligned(&h->tag)); | 131 | n = be32_to_cpu(get_unaligned(&h->tag)); |
132 | if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) | 132 | if ((h->verfl & AOEFL_RSP) == 0 || (n & 1<<31)) |
133 | goto exit; | 133 | goto exit; |
diff --git a/drivers/block/cciss.c b/drivers/block/cciss.c index e330c26c5ad9..7c2cfde08f18 100644 --- a/drivers/block/cciss.c +++ b/drivers/block/cciss.c | |||
@@ -1582,38 +1582,36 @@ static int deregister_disk(struct gendisk *disk, drive_info_struct *drv, | |||
1582 | * allows us to delete disk zero but keep the controller registered. | 1582 | * allows us to delete disk zero but keep the controller registered. |
1583 | */ | 1583 | */ |
1584 | if (h->gendisk[0] != disk) { | 1584 | if (h->gendisk[0] != disk) { |
1585 | if (disk) { | 1585 | struct request_queue *q = disk->queue; |
1586 | struct request_queue *q = disk->queue; | 1586 | if (disk->flags & GENHD_FL_UP) |
1587 | if (disk->flags & GENHD_FL_UP) | 1587 | del_gendisk(disk); |
1588 | del_gendisk(disk); | 1588 | if (q) { |
1589 | if (q) { | 1589 | blk_cleanup_queue(q); |
1590 | blk_cleanup_queue(q); | 1590 | /* Set drv->queue to NULL so that we do not try |
1591 | /* Set drv->queue to NULL so that we do not try | 1591 | * to call blk_start_queue on this queue in the |
1592 | * to call blk_start_queue on this queue in the | 1592 | * interrupt handler |
1593 | * interrupt handler | 1593 | */ |
1594 | */ | 1594 | drv->queue = NULL; |
1595 | drv->queue = NULL; | 1595 | } |
1596 | } | 1596 | /* If clear_all is set then we are deleting the logical |
1597 | /* If clear_all is set then we are deleting the logical | 1597 | * drive, not just refreshing its info. For drives |
1598 | * drive, not just refreshing its info. For drives | 1598 | * other than disk 0 we will call put_disk. We do not |
1599 | * other than disk 0 we will call put_disk. We do not | 1599 | * do this for disk 0 as we need it to be able to |
1600 | * do this for disk 0 as we need it to be able to | 1600 | * configure the controller. |
1601 | * configure the controller. | 1601 | */ |
1602 | if (clear_all){ | ||
1603 | /* This isn't pretty, but we need to find the | ||
1604 | * disk in our array and NULL our the pointer. | ||
1605 | * This is so that we will call alloc_disk if | ||
1606 | * this index is used again later. | ||
1602 | */ | 1607 | */ |
1603 | if (clear_all){ | 1608 | for (i=0; i < CISS_MAX_LUN; i++){ |
1604 | /* This isn't pretty, but we need to find the | 1609 | if(h->gendisk[i] == disk){ |
1605 | * disk in our array and NULL our the pointer. | 1610 | h->gendisk[i] = NULL; |
1606 | * This is so that we will call alloc_disk if | 1611 | break; |
1607 | * this index is used again later. | ||
1608 | */ | ||
1609 | for (i=0; i < CISS_MAX_LUN; i++){ | ||
1610 | if(h->gendisk[i] == disk){ | ||
1611 | h->gendisk[i] = NULL; | ||
1612 | break; | ||
1613 | } | ||
1614 | } | 1612 | } |
1615 | put_disk(disk); | ||
1616 | } | 1613 | } |
1614 | put_disk(disk); | ||
1617 | } | 1615 | } |
1618 | } else { | 1616 | } else { |
1619 | set_capacity(disk, 0); | 1617 | set_capacity(disk, 0); |
@@ -2365,30 +2363,55 @@ static inline void resend_cciss_cmd(ctlr_info_t *h, CommandList_struct *c) | |||
2365 | start_io(h); | 2363 | start_io(h); |
2366 | } | 2364 | } |
2367 | 2365 | ||
2366 | static inline unsigned int make_status_bytes(unsigned int scsi_status_byte, | ||
2367 | unsigned int msg_byte, unsigned int host_byte, | ||
2368 | unsigned int driver_byte) | ||
2369 | { | ||
2370 | /* inverse of macros in scsi.h */ | ||
2371 | return (scsi_status_byte & 0xff) | | ||
2372 | ((msg_byte & 0xff) << 8) | | ||
2373 | ((host_byte & 0xff) << 16) | | ||
2374 | ((driver_byte & 0xff) << 24); | ||
2375 | } | ||
2376 | |||
2368 | static inline int evaluate_target_status(CommandList_struct *cmd) | 2377 | static inline int evaluate_target_status(CommandList_struct *cmd) |
2369 | { | 2378 | { |
2370 | unsigned char sense_key; | 2379 | unsigned char sense_key; |
2371 | int error_count = 1; | 2380 | unsigned char status_byte, msg_byte, host_byte, driver_byte; |
2381 | int error_value; | ||
2382 | |||
2383 | /* If we get in here, it means we got "target status", that is, scsi status */ | ||
2384 | status_byte = cmd->err_info->ScsiStatus; | ||
2385 | driver_byte = DRIVER_OK; | ||
2386 | msg_byte = cmd->err_info->CommandStatus; /* correct? seems too device specific */ | ||
2387 | |||
2388 | if (blk_pc_request(cmd->rq)) | ||
2389 | host_byte = DID_PASSTHROUGH; | ||
2390 | else | ||
2391 | host_byte = DID_OK; | ||
2392 | |||
2393 | error_value = make_status_bytes(status_byte, msg_byte, | ||
2394 | host_byte, driver_byte); | ||
2372 | 2395 | ||
2373 | if (cmd->err_info->ScsiStatus != 0x02) { /* not check condition? */ | 2396 | if (cmd->err_info->ScsiStatus != SAM_STAT_CHECK_CONDITION) { |
2374 | if (!blk_pc_request(cmd->rq)) | 2397 | if (!blk_pc_request(cmd->rq)) |
2375 | printk(KERN_WARNING "cciss: cmd %p " | 2398 | printk(KERN_WARNING "cciss: cmd %p " |
2376 | "has SCSI Status 0x%x\n", | 2399 | "has SCSI Status 0x%x\n", |
2377 | cmd, cmd->err_info->ScsiStatus); | 2400 | cmd, cmd->err_info->ScsiStatus); |
2378 | return error_count; | 2401 | return error_value; |
2379 | } | 2402 | } |
2380 | 2403 | ||
2381 | /* check the sense key */ | 2404 | /* check the sense key */ |
2382 | sense_key = 0xf & cmd->err_info->SenseInfo[2]; | 2405 | sense_key = 0xf & cmd->err_info->SenseInfo[2]; |
2383 | /* no status or recovered error */ | 2406 | /* no status or recovered error */ |
2384 | if ((sense_key == 0x0) || (sense_key == 0x1)) | 2407 | if (((sense_key == 0x0) || (sense_key == 0x1)) && !blk_pc_request(cmd->rq)) |
2385 | error_count = 0; | 2408 | error_value = 0; |
2386 | 2409 | ||
2387 | if (!blk_pc_request(cmd->rq)) { /* Not SG_IO or similar? */ | 2410 | if (!blk_pc_request(cmd->rq)) { /* Not SG_IO or similar? */ |
2388 | if (error_count != 0) | 2411 | if (error_value != 0) |
2389 | printk(KERN_WARNING "cciss: cmd %p has CHECK CONDITION" | 2412 | printk(KERN_WARNING "cciss: cmd %p has CHECK CONDITION" |
2390 | " sense key = 0x%x\n", cmd, sense_key); | 2413 | " sense key = 0x%x\n", cmd, sense_key); |
2391 | return error_count; | 2414 | return error_value; |
2392 | } | 2415 | } |
2393 | 2416 | ||
2394 | /* SG_IO or similar, copy sense data back */ | 2417 | /* SG_IO or similar, copy sense data back */ |
@@ -2400,7 +2423,7 @@ static inline int evaluate_target_status(CommandList_struct *cmd) | |||
2400 | } else | 2423 | } else |
2401 | cmd->rq->sense_len = 0; | 2424 | cmd->rq->sense_len = 0; |
2402 | 2425 | ||
2403 | return error_count; | 2426 | return error_value; |
2404 | } | 2427 | } |
2405 | 2428 | ||
2406 | /* checks the status of the job and calls complete buffers to mark all | 2429 | /* checks the status of the job and calls complete buffers to mark all |
@@ -2416,7 +2439,7 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd, | |||
2416 | rq->errors = 0; | 2439 | rq->errors = 0; |
2417 | 2440 | ||
2418 | if (timeout) | 2441 | if (timeout) |
2419 | rq->errors = 1; | 2442 | rq->errors = make_status_bytes(0, 0, 0, DRIVER_TIMEOUT); |
2420 | 2443 | ||
2421 | if (cmd->err_info->CommandStatus == 0) /* no error has occurred */ | 2444 | if (cmd->err_info->CommandStatus == 0) /* no error has occurred */ |
2422 | goto after_error_processing; | 2445 | goto after_error_processing; |
@@ -2442,32 +2465,44 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd, | |||
2442 | case CMD_INVALID: | 2465 | case CMD_INVALID: |
2443 | printk(KERN_WARNING "cciss: cmd %p is " | 2466 | printk(KERN_WARNING "cciss: cmd %p is " |
2444 | "reported invalid\n", cmd); | 2467 | "reported invalid\n", cmd); |
2445 | rq->errors = 1; | 2468 | rq->errors = make_status_bytes(SAM_STAT_GOOD, |
2469 | cmd->err_info->CommandStatus, DRIVER_OK, | ||
2470 | blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); | ||
2446 | break; | 2471 | break; |
2447 | case CMD_PROTOCOL_ERR: | 2472 | case CMD_PROTOCOL_ERR: |
2448 | printk(KERN_WARNING "cciss: cmd %p has " | 2473 | printk(KERN_WARNING "cciss: cmd %p has " |
2449 | "protocol error \n", cmd); | 2474 | "protocol error \n", cmd); |
2450 | rq->errors = 1; | 2475 | rq->errors = make_status_bytes(SAM_STAT_GOOD, |
2476 | cmd->err_info->CommandStatus, DRIVER_OK, | ||
2477 | blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); | ||
2451 | break; | 2478 | break; |
2452 | case CMD_HARDWARE_ERR: | 2479 | case CMD_HARDWARE_ERR: |
2453 | printk(KERN_WARNING "cciss: cmd %p had " | 2480 | printk(KERN_WARNING "cciss: cmd %p had " |
2454 | " hardware error\n", cmd); | 2481 | " hardware error\n", cmd); |
2455 | rq->errors = 1; | 2482 | rq->errors = make_status_bytes(SAM_STAT_GOOD, |
2483 | cmd->err_info->CommandStatus, DRIVER_OK, | ||
2484 | blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); | ||
2456 | break; | 2485 | break; |
2457 | case CMD_CONNECTION_LOST: | 2486 | case CMD_CONNECTION_LOST: |
2458 | printk(KERN_WARNING "cciss: cmd %p had " | 2487 | printk(KERN_WARNING "cciss: cmd %p had " |
2459 | "connection lost\n", cmd); | 2488 | "connection lost\n", cmd); |
2460 | rq->errors = 1; | 2489 | rq->errors = make_status_bytes(SAM_STAT_GOOD, |
2490 | cmd->err_info->CommandStatus, DRIVER_OK, | ||
2491 | blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); | ||
2461 | break; | 2492 | break; |
2462 | case CMD_ABORTED: | 2493 | case CMD_ABORTED: |
2463 | printk(KERN_WARNING "cciss: cmd %p was " | 2494 | printk(KERN_WARNING "cciss: cmd %p was " |
2464 | "aborted\n", cmd); | 2495 | "aborted\n", cmd); |
2465 | rq->errors = 1; | 2496 | rq->errors = make_status_bytes(SAM_STAT_GOOD, |
2497 | cmd->err_info->CommandStatus, DRIVER_OK, | ||
2498 | blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ABORT); | ||
2466 | break; | 2499 | break; |
2467 | case CMD_ABORT_FAILED: | 2500 | case CMD_ABORT_FAILED: |
2468 | printk(KERN_WARNING "cciss: cmd %p reports " | 2501 | printk(KERN_WARNING "cciss: cmd %p reports " |
2469 | "abort failed\n", cmd); | 2502 | "abort failed\n", cmd); |
2470 | rq->errors = 1; | 2503 | rq->errors = make_status_bytes(SAM_STAT_GOOD, |
2504 | cmd->err_info->CommandStatus, DRIVER_OK, | ||
2505 | blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); | ||
2471 | break; | 2506 | break; |
2472 | case CMD_UNSOLICITED_ABORT: | 2507 | case CMD_UNSOLICITED_ABORT: |
2473 | printk(KERN_WARNING "cciss%d: unsolicited " | 2508 | printk(KERN_WARNING "cciss%d: unsolicited " |
@@ -2481,17 +2516,23 @@ static inline void complete_command(ctlr_info_t *h, CommandList_struct *cmd, | |||
2481 | printk(KERN_WARNING | 2516 | printk(KERN_WARNING |
2482 | "cciss%d: %p retried too " | 2517 | "cciss%d: %p retried too " |
2483 | "many times\n", h->ctlr, cmd); | 2518 | "many times\n", h->ctlr, cmd); |
2484 | rq->errors = 1; | 2519 | rq->errors = make_status_bytes(SAM_STAT_GOOD, |
2520 | cmd->err_info->CommandStatus, DRIVER_OK, | ||
2521 | blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ABORT); | ||
2485 | break; | 2522 | break; |
2486 | case CMD_TIMEOUT: | 2523 | case CMD_TIMEOUT: |
2487 | printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd); | 2524 | printk(KERN_WARNING "cciss: cmd %p timedout\n", cmd); |
2488 | rq->errors = 1; | 2525 | rq->errors = make_status_bytes(SAM_STAT_GOOD, |
2526 | cmd->err_info->CommandStatus, DRIVER_OK, | ||
2527 | blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); | ||
2489 | break; | 2528 | break; |
2490 | default: | 2529 | default: |
2491 | printk(KERN_WARNING "cciss: cmd %p returned " | 2530 | printk(KERN_WARNING "cciss: cmd %p returned " |
2492 | "unknown status %x\n", cmd, | 2531 | "unknown status %x\n", cmd, |
2493 | cmd->err_info->CommandStatus); | 2532 | cmd->err_info->CommandStatus); |
2494 | rq->errors = 1; | 2533 | rq->errors = make_status_bytes(SAM_STAT_GOOD, |
2534 | cmd->err_info->CommandStatus, DRIVER_OK, | ||
2535 | blk_pc_request(cmd->rq) ? DID_PASSTHROUGH : DID_ERROR); | ||
2495 | } | 2536 | } |
2496 | 2537 | ||
2497 | after_error_processing: | 2538 | after_error_processing: |
diff --git a/drivers/block/floppy.c b/drivers/block/floppy.c index 80483aac4cc9..639ed14bb08d 100644 --- a/drivers/block/floppy.c +++ b/drivers/block/floppy.c | |||
@@ -5,6 +5,7 @@ | |||
5 | * Copyright (C) 1993, 1994 Alain Knaff | 5 | * Copyright (C) 1993, 1994 Alain Knaff |
6 | * Copyright (C) 1998 Alan Cox | 6 | * Copyright (C) 1998 Alan Cox |
7 | */ | 7 | */ |
8 | |||
8 | /* | 9 | /* |
9 | * 02.12.91 - Changed to static variables to indicate need for reset | 10 | * 02.12.91 - Changed to static variables to indicate need for reset |
10 | * and recalibrate. This makes some things easier (output_byte reset | 11 | * and recalibrate. This makes some things easier (output_byte reset |
@@ -149,7 +150,7 @@ | |||
149 | #define REALLY_SLOW_IO | 150 | #define REALLY_SLOW_IO |
150 | 151 | ||
151 | #define DEBUGT 2 | 152 | #define DEBUGT 2 |
152 | #define DCL_DEBUG /* debug disk change line */ | 153 | #define DCL_DEBUG /* debug disk change line */ |
153 | 154 | ||
154 | /* do print messages for unexpected interrupts */ | 155 | /* do print messages for unexpected interrupts */ |
155 | static int print_unex = 1; | 156 | static int print_unex = 1; |
@@ -161,10 +162,8 @@ static int print_unex = 1; | |||
161 | #include <linux/workqueue.h> | 162 | #include <linux/workqueue.h> |
162 | #define FDPATCHES | 163 | #define FDPATCHES |
163 | #include <linux/fdreg.h> | 164 | #include <linux/fdreg.h> |
164 | |||
165 | #include <linux/fd.h> | 165 | #include <linux/fd.h> |
166 | #include <linux/hdreg.h> | 166 | #include <linux/hdreg.h> |
167 | |||
168 | #include <linux/errno.h> | 167 | #include <linux/errno.h> |
169 | #include <linux/slab.h> | 168 | #include <linux/slab.h> |
170 | #include <linux/mm.h> | 169 | #include <linux/mm.h> |
@@ -274,8 +273,7 @@ static inline void fallback_on_nodma_alloc(char **addr, size_t l) | |||
274 | return; /* we have the memory */ | 273 | return; /* we have the memory */ |
275 | if (can_use_virtual_dma != 2) | 274 | if (can_use_virtual_dma != 2) |
276 | return; /* no fallback allowed */ | 275 | return; /* no fallback allowed */ |
277 | printk | 276 | printk("DMA memory shortage. Temporarily falling back on virtual DMA\n"); |
278 | ("DMA memory shortage. Temporarily falling back on virtual DMA\n"); | ||
279 | *addr = (char *)nodma_mem_alloc(l); | 277 | *addr = (char *)nodma_mem_alloc(l); |
280 | #else | 278 | #else |
281 | return; | 279 | return; |
@@ -291,8 +289,8 @@ static int initialising = 1; | |||
291 | #define TOMINOR(x) ((x & 3) | ((x & 4) << 5)) | 289 | #define TOMINOR(x) ((x & 3) | ((x & 4) << 5)) |
292 | #define UNIT(x) ((x) & 0x03) /* drive on fdc */ | 290 | #define UNIT(x) ((x) & 0x03) /* drive on fdc */ |
293 | #define FDC(x) (((x) & 0x04) >> 2) /* fdc of drive */ | 291 | #define FDC(x) (((x) & 0x04) >> 2) /* fdc of drive */ |
292 | /* reverse mapping from unit and fdc to drive */ | ||
294 | #define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2)) | 293 | #define REVDRIVE(fdc, unit) ((unit) + ((fdc) << 2)) |
295 | /* reverse mapping from unit and fdc to drive */ | ||
296 | #define DP (&drive_params[current_drive]) | 294 | #define DP (&drive_params[current_drive]) |
297 | #define DRS (&drive_state[current_drive]) | 295 | #define DRS (&drive_state[current_drive]) |
298 | #define DRWE (&write_errors[current_drive]) | 296 | #define DRWE (&write_errors[current_drive]) |
@@ -356,7 +354,6 @@ static int inr; /* size of reply buffer, when called from interrupt */ | |||
356 | #define R_HEAD (reply_buffer[4]) | 354 | #define R_HEAD (reply_buffer[4]) |
357 | #define R_SECTOR (reply_buffer[5]) | 355 | #define R_SECTOR (reply_buffer[5]) |
358 | #define R_SIZECODE (reply_buffer[6]) | 356 | #define R_SIZECODE (reply_buffer[6]) |
359 | |||
360 | #define SEL_DLY (2*HZ/100) | 357 | #define SEL_DLY (2*HZ/100) |
361 | 358 | ||
362 | /* | 359 | /* |
@@ -472,8 +469,8 @@ static struct floppy_struct floppy_type[32] = { | |||
472 | { 6400,40,2,80,0,0x25,0x5B,0xCF,0x00,"E3200" }, /* 26 3.20MB 3.5" */ | 469 | { 6400,40,2,80,0,0x25,0x5B,0xCF,0x00,"E3200" }, /* 26 3.20MB 3.5" */ |
473 | { 7040,44,2,80,0,0x25,0x5B,0xCF,0x00,"E3520" }, /* 27 3.52MB 3.5" */ | 470 | { 7040,44,2,80,0,0x25,0x5B,0xCF,0x00,"E3520" }, /* 27 3.52MB 3.5" */ |
474 | { 7680,48,2,80,0,0x25,0x63,0xCF,0x00,"E3840" }, /* 28 3.84MB 3.5" */ | 471 | { 7680,48,2,80,0,0x25,0x63,0xCF,0x00,"E3840" }, /* 28 3.84MB 3.5" */ |
475 | |||
476 | { 3680,23,2,80,0,0x1C,0x10,0xCF,0x00,"H1840" }, /* 29 1.84MB 3.5" */ | 472 | { 3680,23,2,80,0,0x1C,0x10,0xCF,0x00,"H1840" }, /* 29 1.84MB 3.5" */ |
473 | |||
477 | { 1600,10,2,80,0,0x25,0x02,0xDF,0x2E,"D800" }, /* 30 800KB 3.5" */ | 474 | { 1600,10,2,80,0,0x25,0x02,0xDF,0x2E,"D800" }, /* 30 800KB 3.5" */ |
478 | { 3200,20,2,80,0,0x1C,0x00,0xCF,0x2C,"H1600" }, /* 31 1.6MB 3.5" */ | 475 | { 3200,20,2,80,0,0x1C,0x00,0xCF,0x2C,"H1600" }, /* 31 1.6MB 3.5" */ |
479 | }; | 476 | }; |
@@ -539,12 +536,12 @@ static char *floppy_track_buffer; | |||
539 | static int max_buffer_sectors; | 536 | static int max_buffer_sectors; |
540 | 537 | ||
541 | static int *errors; | 538 | static int *errors; |
542 | typedef void (*done_f) (int); | 539 | typedef void (*done_f)(int); |
543 | static struct cont_t { | 540 | static struct cont_t { |
544 | void (*interrupt) (void); /* this is called after the interrupt of the | 541 | void (*interrupt)(void); /* this is called after the interrupt of the |
545 | * main command */ | 542 | * main command */ |
546 | void (*redo) (void); /* this is called to retry the operation */ | 543 | void (*redo)(void); /* this is called to retry the operation */ |
547 | void (*error) (void); /* this is called to tally an error */ | 544 | void (*error)(void); /* this is called to tally an error */ |
548 | done_f done; /* this is called to say if the operation has | 545 | done_f done; /* this is called to say if the operation has |
549 | * succeeded/failed */ | 546 | * succeeded/failed */ |
550 | } *cont; | 547 | } *cont; |
@@ -694,7 +691,6 @@ static void reschedule_timeout(int drive, const char *message, int marg) | |||
694 | } | 691 | } |
695 | 692 | ||
696 | #define INFBOUND(a,b) (a)=max_t(int, a, b) | 693 | #define INFBOUND(a,b) (a)=max_t(int, a, b) |
697 | |||
698 | #define SUPBOUND(a,b) (a)=min_t(int, a, b) | 694 | #define SUPBOUND(a,b) (a)=min_t(int, a, b) |
699 | 695 | ||
700 | /* | 696 | /* |
@@ -733,6 +729,7 @@ static void reschedule_timeout(int drive, const char *message, int marg) | |||
733 | static int disk_change(int drive) | 729 | static int disk_change(int drive) |
734 | { | 730 | { |
735 | int fdc = FDC(drive); | 731 | int fdc = FDC(drive); |
732 | |||
736 | #ifdef FLOPPY_SANITY_CHECK | 733 | #ifdef FLOPPY_SANITY_CHECK |
737 | if (time_before(jiffies, UDRS->select_date + UDP->select_delay)) | 734 | if (time_before(jiffies, UDRS->select_date + UDP->select_delay)) |
738 | DPRINT("WARNING disk change called early\n"); | 735 | DPRINT("WARNING disk change called early\n"); |
@@ -771,7 +768,6 @@ static int disk_change(int drive) | |||
771 | floppy_sizes[TOMINOR(drive)] = MAX_DISK_SIZE << 1; | 768 | floppy_sizes[TOMINOR(drive)] = MAX_DISK_SIZE << 1; |
772 | } | 769 | } |
773 | 770 | ||
774 | /*USETF(FD_DISK_NEWCHANGE); */ | ||
775 | return 1; | 771 | return 1; |
776 | } else { | 772 | } else { |
777 | UDRS->last_checked = jiffies; | 773 | UDRS->last_checked = jiffies; |
@@ -787,7 +783,10 @@ static inline int is_selected(int dor, int unit) | |||
787 | 783 | ||
788 | static int set_dor(int fdc, char mask, char data) | 784 | static int set_dor(int fdc, char mask, char data) |
789 | { | 785 | { |
790 | register unsigned char drive, unit, newdor, olddor; | 786 | unsigned char unit; |
787 | unsigned char drive; | ||
788 | unsigned char newdor; | ||
789 | unsigned char olddor; | ||
791 | 790 | ||
792 | if (FDCS->address == -1) | 791 | if (FDCS->address == -1) |
793 | return -1; | 792 | return -1; |
@@ -892,7 +891,6 @@ static int _lock_fdc(int drive, int interruptible, int line) | |||
892 | 891 | ||
893 | set_current_state(TASK_RUNNING); | 892 | set_current_state(TASK_RUNNING); |
894 | remove_wait_queue(&fdc_wait, &wait); | 893 | remove_wait_queue(&fdc_wait, &wait); |
895 | |||
896 | flush_scheduled_work(); | 894 | flush_scheduled_work(); |
897 | } | 895 | } |
898 | command_status = FD_COMMAND_NONE; | 896 | command_status = FD_COMMAND_NONE; |
@@ -942,7 +940,7 @@ static void motor_off_callback(unsigned long nr) | |||
942 | static void floppy_off(unsigned int drive) | 940 | static void floppy_off(unsigned int drive) |
943 | { | 941 | { |
944 | unsigned long volatile delta; | 942 | unsigned long volatile delta; |
945 | register int fdc = FDC(drive); | 943 | int fdc = FDC(drive); |
946 | 944 | ||
947 | if (!(FDCS->dor & (0x10 << UNIT(drive)))) | 945 | if (!(FDCS->dor & (0x10 << UNIT(drive)))) |
948 | return; | 946 | return; |
@@ -968,7 +966,9 @@ static void floppy_off(unsigned int drive) | |||
968 | */ | 966 | */ |
969 | static void scandrives(void) | 967 | static void scandrives(void) |
970 | { | 968 | { |
971 | int i, drive, saved_drive; | 969 | int i; |
970 | int drive; | ||
971 | int saved_drive; | ||
972 | 972 | ||
973 | if (DP->select_delay) | 973 | if (DP->select_delay) |
974 | return; | 974 | return; |
@@ -1146,7 +1146,9 @@ static void show_floppy(void); | |||
1146 | /* waits until the fdc becomes ready */ | 1146 | /* waits until the fdc becomes ready */ |
1147 | static int wait_til_ready(void) | 1147 | static int wait_til_ready(void) |
1148 | { | 1148 | { |
1149 | int counter, status; | 1149 | int status; |
1150 | int counter; | ||
1151 | |||
1150 | if (FDCS->reset) | 1152 | if (FDCS->reset) |
1151 | return -1; | 1153 | return -1; |
1152 | for (counter = 0; counter < 10000; counter++) { | 1154 | for (counter = 0; counter < 10000; counter++) { |
@@ -1193,7 +1195,8 @@ static int output_byte(char byte) | |||
1193 | /* gets the response from the fdc */ | 1195 | /* gets the response from the fdc */ |
1194 | static int result(void) | 1196 | static int result(void) |
1195 | { | 1197 | { |
1196 | int i, status = 0; | 1198 | int i; |
1199 | int status = 0; | ||
1197 | 1200 | ||
1198 | for (i = 0; i < MAX_REPLIES; i++) { | 1201 | for (i = 0; i < MAX_REPLIES; i++) { |
1199 | if ((status = wait_til_ready()) < 0) | 1202 | if ((status = wait_til_ready()) < 0) |
@@ -1226,6 +1229,7 @@ static int result(void) | |||
1226 | static int need_more_output(void) | 1229 | static int need_more_output(void) |
1227 | { | 1230 | { |
1228 | int status; | 1231 | int status; |
1232 | |||
1229 | if ((status = wait_til_ready()) < 0) | 1233 | if ((status = wait_til_ready()) < 0) |
1230 | return -1; | 1234 | return -1; |
1231 | if ((status & (STATUS_READY | STATUS_DIR | STATUS_DMA)) == STATUS_READY) | 1235 | if ((status & (STATUS_READY | STATUS_DIR | STATUS_DMA)) == STATUS_READY) |
@@ -1309,8 +1313,11 @@ static int fdc_configure(void) | |||
1309 | */ | 1313 | */ |
1310 | static void fdc_specify(void) | 1314 | static void fdc_specify(void) |
1311 | { | 1315 | { |
1312 | unsigned char spec1, spec2; | 1316 | unsigned char spec1; |
1313 | unsigned long srt, hlt, hut; | 1317 | unsigned char spec2; |
1318 | unsigned long srt; | ||
1319 | unsigned long hlt; | ||
1320 | unsigned long hut; | ||
1314 | unsigned long dtr = NOMINAL_DTR; | 1321 | unsigned long dtr = NOMINAL_DTR; |
1315 | unsigned long scale_dtr = NOMINAL_DTR; | 1322 | unsigned long scale_dtr = NOMINAL_DTR; |
1316 | int hlt_max_code = 0x7f; | 1323 | int hlt_max_code = 0x7f; |
@@ -1319,7 +1326,6 @@ static void fdc_specify(void) | |||
1319 | if (FDCS->need_configure && FDCS->version >= FDC_82072A) { | 1326 | if (FDCS->need_configure && FDCS->version >= FDC_82072A) { |
1320 | fdc_configure(); | 1327 | fdc_configure(); |
1321 | FDCS->need_configure = 0; | 1328 | FDCS->need_configure = 0; |
1322 | /*DPRINT("FIFO enabled\n"); */ | ||
1323 | } | 1329 | } |
1324 | 1330 | ||
1325 | switch (raw_cmd->rate & 0x03) { | 1331 | switch (raw_cmd->rate & 0x03) { |
@@ -1472,7 +1478,6 @@ static int interpret_errors(void) | |||
1472 | tell_sector(); | 1478 | tell_sector(); |
1473 | } | 1479 | } |
1474 | printk("\n"); | 1480 | printk("\n"); |
1475 | |||
1476 | } | 1481 | } |
1477 | if (ST2 & ST2_WC || ST2 & ST2_BC) | 1482 | if (ST2 & ST2_WC || ST2 & ST2_BC) |
1478 | /* wrong cylinder => recal */ | 1483 | /* wrong cylinder => recal */ |
@@ -1498,7 +1503,10 @@ static int interpret_errors(void) | |||
1498 | */ | 1503 | */ |
1499 | static void setup_rw_floppy(void) | 1504 | static void setup_rw_floppy(void) |
1500 | { | 1505 | { |
1501 | int i, r, flags, dflags; | 1506 | int i; |
1507 | int r; | ||
1508 | int flags; | ||
1509 | int dflags; | ||
1502 | unsigned long ready_date; | 1510 | unsigned long ready_date; |
1503 | timeout_fn function; | 1511 | timeout_fn function; |
1504 | 1512 | ||
@@ -1728,9 +1736,9 @@ static void print_result(char *message, int inr) | |||
1728 | /* interrupt handler. Note that this can be called externally on the Sparc */ | 1736 | /* interrupt handler. Note that this can be called externally on the Sparc */ |
1729 | irqreturn_t floppy_interrupt(int irq, void *dev_id) | 1737 | irqreturn_t floppy_interrupt(int irq, void *dev_id) |
1730 | { | 1738 | { |
1731 | void (*handler) (void) = do_floppy; | ||
1732 | int do_print; | 1739 | int do_print; |
1733 | unsigned long f; | 1740 | unsigned long f; |
1741 | void (*handler)(void) = do_floppy; | ||
1734 | 1742 | ||
1735 | lasthandler = handler; | 1743 | lasthandler = handler; |
1736 | interruptjiffies = jiffies; | 1744 | interruptjiffies = jiffies; |
@@ -1912,12 +1920,11 @@ static void floppy_shutdown(unsigned long data) | |||
1912 | is_alive("floppy shutdown"); | 1920 | is_alive("floppy shutdown"); |
1913 | } | 1921 | } |
1914 | 1922 | ||
1915 | /*typedef void (*timeout_fn)(unsigned long);*/ | ||
1916 | |||
1917 | /* start motor, check media-changed condition and write protection */ | 1923 | /* start motor, check media-changed condition and write protection */ |
1918 | static int start_motor(void (*function) (void)) | 1924 | static int start_motor(void (*function)(void)) |
1919 | { | 1925 | { |
1920 | int mask, data; | 1926 | int mask; |
1927 | int data; | ||
1921 | 1928 | ||
1922 | mask = 0xfc; | 1929 | mask = 0xfc; |
1923 | data = UNIT(current_drive); | 1930 | data = UNIT(current_drive); |
@@ -2020,17 +2027,17 @@ static struct cont_t wakeup_cont = { | |||
2020 | .interrupt = empty, | 2027 | .interrupt = empty, |
2021 | .redo = do_wakeup, | 2028 | .redo = do_wakeup, |
2022 | .error = empty, | 2029 | .error = empty, |
2023 | .done = (done_f) empty | 2030 | .done = (done_f)empty |
2024 | }; | 2031 | }; |
2025 | 2032 | ||
2026 | static struct cont_t intr_cont = { | 2033 | static struct cont_t intr_cont = { |
2027 | .interrupt = empty, | 2034 | .interrupt = empty, |
2028 | .redo = process_fd_request, | 2035 | .redo = process_fd_request, |
2029 | .error = empty, | 2036 | .error = empty, |
2030 | .done = (done_f) empty | 2037 | .done = (done_f)empty |
2031 | }; | 2038 | }; |
2032 | 2039 | ||
2033 | static int wait_til_done(void (*handler) (void), int interruptible) | 2040 | static int wait_til_done(void (*handler)(void), int interruptible) |
2034 | { | 2041 | { |
2035 | int ret; | 2042 | int ret; |
2036 | 2043 | ||
@@ -2049,7 +2056,6 @@ static int wait_til_done(void (*handler) (void), int interruptible) | |||
2049 | break; | 2056 | break; |
2050 | 2057 | ||
2051 | is_alive("wait_til_done"); | 2058 | is_alive("wait_til_done"); |
2052 | |||
2053 | schedule(); | 2059 | schedule(); |
2054 | } | 2060 | } |
2055 | 2061 | ||
@@ -2141,6 +2147,7 @@ static void bad_flp_intr(void) | |||
2141 | static void set_floppy(int drive) | 2147 | static void set_floppy(int drive) |
2142 | { | 2148 | { |
2143 | int type = ITYPE(UDRS->fd_device); | 2149 | int type = ITYPE(UDRS->fd_device); |
2150 | |||
2144 | if (type) | 2151 | if (type) |
2145 | _floppy = floppy_type + type; | 2152 | _floppy = floppy_type + type; |
2146 | else | 2153 | else |
@@ -2169,11 +2176,14 @@ static void format_interrupt(void) | |||
2169 | #define CT(x) ((x) | 0xc0) | 2176 | #define CT(x) ((x) | 0xc0) |
2170 | static void setup_format_params(int track) | 2177 | static void setup_format_params(int track) |
2171 | { | 2178 | { |
2179 | int n; | ||
2180 | int il; | ||
2181 | int count; | ||
2182 | int head_shift; | ||
2183 | int track_shift; | ||
2172 | struct fparm { | 2184 | struct fparm { |
2173 | unsigned char track, head, sect, size; | 2185 | unsigned char track, head, sect, size; |
2174 | } *here = (struct fparm *)floppy_track_buffer; | 2186 | } *here = (struct fparm *)floppy_track_buffer; |
2175 | int il, n; | ||
2176 | int count, head_shift, track_shift; | ||
2177 | 2187 | ||
2178 | raw_cmd = &default_raw_cmd; | 2188 | raw_cmd = &default_raw_cmd; |
2179 | raw_cmd->track = track; | 2189 | raw_cmd->track = track; |
@@ -2344,7 +2354,10 @@ static void request_done(int uptodate) | |||
2344 | /* Interrupt handler evaluating the result of the r/w operation */ | 2354 | /* Interrupt handler evaluating the result of the r/w operation */ |
2345 | static void rw_interrupt(void) | 2355 | static void rw_interrupt(void) |
2346 | { | 2356 | { |
2347 | int nr_sectors, ssize, eoc, heads; | 2357 | int eoc; |
2358 | int ssize; | ||
2359 | int heads; | ||
2360 | int nr_sectors; | ||
2348 | 2361 | ||
2349 | if (R_HEAD >= 2) { | 2362 | if (R_HEAD >= 2) { |
2350 | /* some Toshiba floppy controllers occasionnally seem to | 2363 | /* some Toshiba floppy controllers occasionnally seem to |
@@ -2476,7 +2489,8 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) | |||
2476 | { | 2489 | { |
2477 | int remaining; /* number of transferred 512-byte sectors */ | 2490 | int remaining; /* number of transferred 512-byte sectors */ |
2478 | struct bio_vec *bv; | 2491 | struct bio_vec *bv; |
2479 | char *buffer, *dma_buffer; | 2492 | char *buffer; |
2493 | char *dma_buffer; | ||
2480 | int size; | 2494 | int size; |
2481 | struct req_iterator iter; | 2495 | struct req_iterator iter; |
2482 | 2496 | ||
@@ -2556,19 +2570,6 @@ static void copy_buffer(int ssize, int max_sector, int max_sector_2) | |||
2556 | #endif | 2570 | #endif |
2557 | } | 2571 | } |
2558 | 2572 | ||
2559 | #if 0 | ||
2560 | static inline int check_dma_crossing(char *start, | ||
2561 | unsigned long length, char *message) | ||
2562 | { | ||
2563 | if (CROSS_64KB(start, length)) { | ||
2564 | printk("DMA xfer crosses 64KB boundary in %s %p-%p\n", | ||
2565 | message, start, start + length); | ||
2566 | return 1; | ||
2567 | } else | ||
2568 | return 0; | ||
2569 | } | ||
2570 | #endif | ||
2571 | |||
2572 | /* work around a bug in pseudo DMA | 2573 | /* work around a bug in pseudo DMA |
2573 | * (on some FDCs) pseudo DMA does not stop when the CPU stops | 2574 | * (on some FDCs) pseudo DMA does not stop when the CPU stops |
2574 | * sending data. Hence we need a different way to signal the | 2575 | * sending data. Hence we need a different way to signal the |
@@ -2578,7 +2579,8 @@ static inline int check_dma_crossing(char *start, | |||
2578 | */ | 2579 | */ |
2579 | static void virtualdmabug_workaround(void) | 2580 | static void virtualdmabug_workaround(void) |
2580 | { | 2581 | { |
2581 | int hard_sectors, end_sector; | 2582 | int hard_sectors; |
2583 | int end_sector; | ||
2582 | 2584 | ||
2583 | if (CT(COMMAND) == FD_WRITE) { | 2585 | if (CT(COMMAND) == FD_WRITE) { |
2584 | COMMAND &= ~0x80; /* switch off multiple track mode */ | 2586 | COMMAND &= ~0x80; /* switch off multiple track mode */ |
@@ -2610,7 +2612,10 @@ static void virtualdmabug_workaround(void) | |||
2610 | static int make_raw_rw_request(void) | 2612 | static int make_raw_rw_request(void) |
2611 | { | 2613 | { |
2612 | int aligned_sector_t; | 2614 | int aligned_sector_t; |
2613 | int max_sector, max_size, tracksize, ssize; | 2615 | int max_sector; |
2616 | int max_size; | ||
2617 | int tracksize; | ||
2618 | int ssize; | ||
2614 | 2619 | ||
2615 | if (max_buffer_sectors == 0) { | 2620 | if (max_buffer_sectors == 0) { |
2616 | printk("VFS: Block I/O scheduled on unopened device\n"); | 2621 | printk("VFS: Block I/O scheduled on unopened device\n"); |
@@ -2762,9 +2767,7 @@ static int make_raw_rw_request(void) | |||
2762 | */ | 2767 | */ |
2763 | if (!direct || | 2768 | if (!direct || |
2764 | (indirect * 2 > direct * 3 && | 2769 | (indirect * 2 > direct * 3 && |
2765 | *errors < DP->max_errors.read_track && | 2770 | *errors < DP->max_errors.read_track && ((!probing |
2766 | /*!TESTF(FD_NEED_TWADDLE) && */ | ||
2767 | ((!probing | ||
2768 | || (DP->read_track & (1 << DRS->probed_format)))))) { | 2771 | || (DP->read_track & (1 << DRS->probed_format)))))) { |
2769 | max_size = current_req->nr_sectors; | 2772 | max_size = current_req->nr_sectors; |
2770 | } else { | 2773 | } else { |
@@ -2777,10 +2780,6 @@ static int make_raw_rw_request(void) | |||
2777 | indirect, direct, fsector_t); | 2780 | indirect, direct, fsector_t); |
2778 | return 0; | 2781 | return 0; |
2779 | } | 2782 | } |
2780 | /* check_dma_crossing(raw_cmd->kernel_data, | ||
2781 | raw_cmd->length, | ||
2782 | "end of make_raw_request [1]");*/ | ||
2783 | |||
2784 | virtualdmabug_workaround(); | 2783 | virtualdmabug_workaround(); |
2785 | return 2; | 2784 | return 2; |
2786 | } | 2785 | } |
@@ -2830,8 +2829,6 @@ static int make_raw_rw_request(void) | |||
2830 | raw_cmd->length = ((raw_cmd->length - 1) | (ssize - 1)) + 1; | 2829 | raw_cmd->length = ((raw_cmd->length - 1) | (ssize - 1)) + 1; |
2831 | raw_cmd->length <<= 9; | 2830 | raw_cmd->length <<= 9; |
2832 | #ifdef FLOPPY_SANITY_CHECK | 2831 | #ifdef FLOPPY_SANITY_CHECK |
2833 | /*check_dma_crossing(raw_cmd->kernel_data, raw_cmd->length, | ||
2834 | "end of make_raw_request"); */ | ||
2835 | if ((raw_cmd->length < current_count_sectors << 9) || | 2832 | if ((raw_cmd->length < current_count_sectors << 9) || |
2836 | (raw_cmd->kernel_data != current_req->buffer && | 2833 | (raw_cmd->kernel_data != current_req->buffer && |
2837 | CT(COMMAND) == FD_WRITE && | 2834 | CT(COMMAND) == FD_WRITE && |
@@ -3011,6 +3008,7 @@ static struct cont_t poll_cont = { | |||
3011 | static int poll_drive(int interruptible, int flag) | 3008 | static int poll_drive(int interruptible, int flag) |
3012 | { | 3009 | { |
3013 | int ret; | 3010 | int ret; |
3011 | |||
3014 | /* no auto-sense, just clear dcl */ | 3012 | /* no auto-sense, just clear dcl */ |
3015 | raw_cmd = &default_raw_cmd; | 3013 | raw_cmd = &default_raw_cmd; |
3016 | raw_cmd->flags = flag; | 3014 | raw_cmd->flags = flag; |
@@ -3173,7 +3171,8 @@ static inline int raw_cmd_copyout(int cmd, char __user *param, | |||
3173 | 3171 | ||
3174 | static void raw_cmd_free(struct floppy_raw_cmd **ptr) | 3172 | static void raw_cmd_free(struct floppy_raw_cmd **ptr) |
3175 | { | 3173 | { |
3176 | struct floppy_raw_cmd *next, *this; | 3174 | struct floppy_raw_cmd *next; |
3175 | struct floppy_raw_cmd *this; | ||
3177 | 3176 | ||
3178 | this = *ptr; | 3177 | this = *ptr; |
3179 | *ptr = NULL; | 3178 | *ptr = NULL; |
@@ -3245,8 +3244,10 @@ static inline int raw_cmd_copyin(int cmd, char __user *param, | |||
3245 | 3244 | ||
3246 | static int raw_cmd_ioctl(int cmd, void __user *param) | 3245 | static int raw_cmd_ioctl(int cmd, void __user *param) |
3247 | { | 3246 | { |
3248 | int drive, ret, ret2; | ||
3249 | struct floppy_raw_cmd *my_raw_cmd; | 3247 | struct floppy_raw_cmd *my_raw_cmd; |
3248 | int drive; | ||
3249 | int ret2; | ||
3250 | int ret; | ||
3250 | 3251 | ||
3251 | if (FDCS->rawcmd <= 1) | 3252 | if (FDCS->rawcmd <= 1) |
3252 | FDCS->rawcmd = 1; | 3253 | FDCS->rawcmd = 1; |
@@ -3453,7 +3454,8 @@ static int fd_ioctl(struct inode *inode, struct file *filp, unsigned int cmd, | |||
3453 | #define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0 | 3454 | #define IN(c,x,tag) case c: *(x) = inparam. tag ; return 0 |
3454 | 3455 | ||
3455 | int drive = (long)inode->i_bdev->bd_disk->private_data; | 3456 | int drive = (long)inode->i_bdev->bd_disk->private_data; |
3456 | int i, type = ITYPE(UDRS->fd_device); | 3457 | int type = ITYPE(UDRS->fd_device); |
3458 | int i; | ||
3457 | int ret; | 3459 | int ret; |
3458 | int size; | 3460 | int size; |
3459 | union inparam { | 3461 | union inparam { |
@@ -3619,8 +3621,7 @@ static void __init config_types(void) | |||
3619 | if (!UDP->cmos && FLOPPY1_TYPE) | 3621 | if (!UDP->cmos && FLOPPY1_TYPE) |
3620 | UDP->cmos = FLOPPY1_TYPE; | 3622 | UDP->cmos = FLOPPY1_TYPE; |
3621 | 3623 | ||
3622 | /* XXX */ | 3624 | /* FIXME: additional physical CMOS drive detection should go here */ |
3623 | /* additional physical CMOS drive detection should go here */ | ||
3624 | 3625 | ||
3625 | for (drive = 0; drive < N_DRIVE; drive++) { | 3626 | for (drive = 0; drive < N_DRIVE; drive++) { |
3626 | unsigned int type = UDP->cmos; | 3627 | unsigned int type = UDP->cmos; |
@@ -3903,13 +3904,13 @@ static int floppy_revalidate(struct gendisk *disk) | |||
3903 | } | 3904 | } |
3904 | 3905 | ||
3905 | static struct block_device_operations floppy_fops = { | 3906 | static struct block_device_operations floppy_fops = { |
3906 | .owner = THIS_MODULE, | 3907 | .owner = THIS_MODULE, |
3907 | .open = floppy_open, | 3908 | .open = floppy_open, |
3908 | .release = floppy_release, | 3909 | .release = floppy_release, |
3909 | .ioctl = fd_ioctl, | 3910 | .ioctl = fd_ioctl, |
3910 | .getgeo = fd_getgeo, | 3911 | .getgeo = fd_getgeo, |
3911 | .media_changed = check_floppy_change, | 3912 | .media_changed = check_floppy_change, |
3912 | .revalidate_disk = floppy_revalidate, | 3913 | .revalidate_disk = floppy_revalidate, |
3913 | }; | 3914 | }; |
3914 | 3915 | ||
3915 | /* | 3916 | /* |
@@ -4388,11 +4389,15 @@ static int floppy_grab_irq_and_dma(void) | |||
4388 | if (fd_request_dma()) { | 4389 | if (fd_request_dma()) { |
4389 | DPRINT("Unable to grab DMA%d for the floppy driver\n", | 4390 | DPRINT("Unable to grab DMA%d for the floppy driver\n", |
4390 | FLOPPY_DMA); | 4391 | FLOPPY_DMA); |
4391 | fd_free_irq(); | 4392 | if (can_use_virtual_dma & 2) |
4392 | spin_lock_irqsave(&floppy_usage_lock, flags); | 4393 | use_virtual_dma = can_use_virtual_dma = 1; |
4393 | usage_count--; | 4394 | if (!(can_use_virtual_dma & 1)) { |
4394 | spin_unlock_irqrestore(&floppy_usage_lock, flags); | 4395 | fd_free_irq(); |
4395 | return -1; | 4396 | spin_lock_irqsave(&floppy_usage_lock, flags); |
4397 | usage_count--; | ||
4398 | spin_unlock_irqrestore(&floppy_usage_lock, flags); | ||
4399 | return -1; | ||
4400 | } | ||
4396 | } | 4401 | } |
4397 | 4402 | ||
4398 | for (fdc = 0; fdc < N_FDC; fdc++) { | 4403 | for (fdc = 0; fdc < N_FDC; fdc++) { |
@@ -4424,8 +4429,8 @@ static int floppy_grab_irq_and_dma(void) | |||
4424 | if (FDCS->address != -1) | 4429 | if (FDCS->address != -1) |
4425 | fd_outb(FDCS->dor, FD_DOR); | 4430 | fd_outb(FDCS->dor, FD_DOR); |
4426 | /* | 4431 | /* |
4427 | * The driver will try and free resources and relies on us | 4432 | * The driver will try and free resources and relies on us |
4428 | * to know if they were allocated or not. | 4433 | * to know if they were allocated or not. |
4429 | */ | 4434 | */ |
4430 | fdc = 0; | 4435 | fdc = 0; |
4431 | irqdma_allocated = 1; | 4436 | irqdma_allocated = 1; |
diff --git a/drivers/block/loop.c b/drivers/block/loop.c index e5a051577a5e..589cbbd9cd4f 100644 --- a/drivers/block/loop.c +++ b/drivers/block/loop.c | |||
@@ -1285,7 +1285,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a | |||
1285 | struct loop_device *lo = inode->i_bdev->bd_disk->private_data; | 1285 | struct loop_device *lo = inode->i_bdev->bd_disk->private_data; |
1286 | int err; | 1286 | int err; |
1287 | 1287 | ||
1288 | lock_kernel(); | ||
1289 | switch(cmd) { | 1288 | switch(cmd) { |
1290 | case LOOP_SET_STATUS: | 1289 | case LOOP_SET_STATUS: |
1291 | mutex_lock(&lo->lo_ctl_mutex); | 1290 | mutex_lock(&lo->lo_ctl_mutex); |
@@ -1311,7 +1310,6 @@ static long lo_compat_ioctl(struct file *file, unsigned int cmd, unsigned long a | |||
1311 | err = -ENOIOCTLCMD; | 1310 | err = -ENOIOCTLCMD; |
1312 | break; | 1311 | break; |
1313 | } | 1312 | } |
1314 | unlock_kernel(); | ||
1315 | return err; | 1313 | return err; |
1316 | } | 1314 | } |
1317 | #endif | 1315 | #endif |
diff --git a/drivers/block/nbd.c b/drivers/block/nbd.c index be5ec3a9b1fc..cb136a919f2a 100644 --- a/drivers/block/nbd.c +++ b/drivers/block/nbd.c | |||
@@ -113,12 +113,42 @@ static void nbd_end_request(struct request *req) | |||
113 | spin_unlock_irqrestore(q->queue_lock, flags); | 113 | spin_unlock_irqrestore(q->queue_lock, flags); |
114 | } | 114 | } |
115 | 115 | ||
116 | static void sock_shutdown(struct nbd_device *lo, int lock) | ||
117 | { | ||
118 | /* Forcibly shutdown the socket causing all listeners | ||
119 | * to error | ||
120 | * | ||
121 | * FIXME: This code is duplicated from sys_shutdown, but | ||
122 | * there should be a more generic interface rather than | ||
123 | * calling socket ops directly here */ | ||
124 | if (lock) | ||
125 | mutex_lock(&lo->tx_lock); | ||
126 | if (lo->sock) { | ||
127 | printk(KERN_WARNING "%s: shutting down socket\n", | ||
128 | lo->disk->disk_name); | ||
129 | lo->sock->ops->shutdown(lo->sock, SEND_SHUTDOWN|RCV_SHUTDOWN); | ||
130 | lo->sock = NULL; | ||
131 | } | ||
132 | if (lock) | ||
133 | mutex_unlock(&lo->tx_lock); | ||
134 | } | ||
135 | |||
136 | static void nbd_xmit_timeout(unsigned long arg) | ||
137 | { | ||
138 | struct task_struct *task = (struct task_struct *)arg; | ||
139 | |||
140 | printk(KERN_WARNING "nbd: killing hung xmit (%s, pid: %d)\n", | ||
141 | task->comm, task->pid); | ||
142 | force_sig(SIGKILL, task); | ||
143 | } | ||
144 | |||
116 | /* | 145 | /* |
117 | * Send or receive packet. | 146 | * Send or receive packet. |
118 | */ | 147 | */ |
119 | static int sock_xmit(struct socket *sock, int send, void *buf, int size, | 148 | static int sock_xmit(struct nbd_device *lo, int send, void *buf, int size, |
120 | int msg_flags) | 149 | int msg_flags) |
121 | { | 150 | { |
151 | struct socket *sock = lo->sock; | ||
122 | int result; | 152 | int result; |
123 | struct msghdr msg; | 153 | struct msghdr msg; |
124 | struct kvec iov; | 154 | struct kvec iov; |
@@ -139,9 +169,20 @@ static int sock_xmit(struct socket *sock, int send, void *buf, int size, | |||
139 | msg.msg_controllen = 0; | 169 | msg.msg_controllen = 0; |
140 | msg.msg_flags = msg_flags | MSG_NOSIGNAL; | 170 | msg.msg_flags = msg_flags | MSG_NOSIGNAL; |
141 | 171 | ||
142 | if (send) | 172 | if (send) { |
173 | struct timer_list ti; | ||
174 | |||
175 | if (lo->xmit_timeout) { | ||
176 | init_timer(&ti); | ||
177 | ti.function = nbd_xmit_timeout; | ||
178 | ti.data = (unsigned long)current; | ||
179 | ti.expires = jiffies + lo->xmit_timeout; | ||
180 | add_timer(&ti); | ||
181 | } | ||
143 | result = kernel_sendmsg(sock, &msg, &iov, 1, size); | 182 | result = kernel_sendmsg(sock, &msg, &iov, 1, size); |
144 | else | 183 | if (lo->xmit_timeout) |
184 | del_timer_sync(&ti); | ||
185 | } else | ||
145 | result = kernel_recvmsg(sock, &msg, &iov, 1, size, 0); | 186 | result = kernel_recvmsg(sock, &msg, &iov, 1, size, 0); |
146 | 187 | ||
147 | if (signal_pending(current)) { | 188 | if (signal_pending(current)) { |
@@ -150,6 +191,7 @@ static int sock_xmit(struct socket *sock, int send, void *buf, int size, | |||
150 | current->pid, current->comm, | 191 | current->pid, current->comm, |
151 | dequeue_signal_lock(current, ¤t->blocked, &info)); | 192 | dequeue_signal_lock(current, ¤t->blocked, &info)); |
152 | result = -EINTR; | 193 | result = -EINTR; |
194 | sock_shutdown(lo, !send); | ||
153 | break; | 195 | break; |
154 | } | 196 | } |
155 | 197 | ||
@@ -167,23 +209,22 @@ static int sock_xmit(struct socket *sock, int send, void *buf, int size, | |||
167 | return result; | 209 | return result; |
168 | } | 210 | } |
169 | 211 | ||
170 | static inline int sock_send_bvec(struct socket *sock, struct bio_vec *bvec, | 212 | static inline int sock_send_bvec(struct nbd_device *lo, struct bio_vec *bvec, |
171 | int flags) | 213 | int flags) |
172 | { | 214 | { |
173 | int result; | 215 | int result; |
174 | void *kaddr = kmap(bvec->bv_page); | 216 | void *kaddr = kmap(bvec->bv_page); |
175 | result = sock_xmit(sock, 1, kaddr + bvec->bv_offset, bvec->bv_len, | 217 | result = sock_xmit(lo, 1, kaddr + bvec->bv_offset, bvec->bv_len, flags); |
176 | flags); | ||
177 | kunmap(bvec->bv_page); | 218 | kunmap(bvec->bv_page); |
178 | return result; | 219 | return result; |
179 | } | 220 | } |
180 | 221 | ||
222 | /* always call with the tx_lock held */ | ||
181 | static int nbd_send_req(struct nbd_device *lo, struct request *req) | 223 | static int nbd_send_req(struct nbd_device *lo, struct request *req) |
182 | { | 224 | { |
183 | int result, flags; | 225 | int result, flags; |
184 | struct nbd_request request; | 226 | struct nbd_request request; |
185 | unsigned long size = req->nr_sectors << 9; | 227 | unsigned long size = req->nr_sectors << 9; |
186 | struct socket *sock = lo->sock; | ||
187 | 228 | ||
188 | request.magic = htonl(NBD_REQUEST_MAGIC); | 229 | request.magic = htonl(NBD_REQUEST_MAGIC); |
189 | request.type = htonl(nbd_cmd(req)); | 230 | request.type = htonl(nbd_cmd(req)); |
@@ -196,8 +237,8 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req) | |||
196 | nbdcmd_to_ascii(nbd_cmd(req)), | 237 | nbdcmd_to_ascii(nbd_cmd(req)), |
197 | (unsigned long long)req->sector << 9, | 238 | (unsigned long long)req->sector << 9, |
198 | req->nr_sectors << 9); | 239 | req->nr_sectors << 9); |
199 | result = sock_xmit(sock, 1, &request, sizeof(request), | 240 | result = sock_xmit(lo, 1, &request, sizeof(request), |
200 | (nbd_cmd(req) == NBD_CMD_WRITE)? MSG_MORE: 0); | 241 | (nbd_cmd(req) == NBD_CMD_WRITE) ? MSG_MORE : 0); |
201 | if (result <= 0) { | 242 | if (result <= 0) { |
202 | printk(KERN_ERR "%s: Send control failed (result %d)\n", | 243 | printk(KERN_ERR "%s: Send control failed (result %d)\n", |
203 | lo->disk->disk_name, result); | 244 | lo->disk->disk_name, result); |
@@ -217,7 +258,7 @@ static int nbd_send_req(struct nbd_device *lo, struct request *req) | |||
217 | flags = MSG_MORE; | 258 | flags = MSG_MORE; |
218 | dprintk(DBG_TX, "%s: request %p: sending %d bytes data\n", | 259 | dprintk(DBG_TX, "%s: request %p: sending %d bytes data\n", |
219 | lo->disk->disk_name, req, bvec->bv_len); | 260 | lo->disk->disk_name, req, bvec->bv_len); |
220 | result = sock_send_bvec(sock, bvec, flags); | 261 | result = sock_send_bvec(lo, bvec, flags); |
221 | if (result <= 0) { | 262 | if (result <= 0) { |
222 | printk(KERN_ERR "%s: Send data failed (result %d)\n", | 263 | printk(KERN_ERR "%s: Send data failed (result %d)\n", |
223 | lo->disk->disk_name, result); | 264 | lo->disk->disk_name, result); |
@@ -231,22 +272,18 @@ error_out: | |||
231 | return 1; | 272 | return 1; |
232 | } | 273 | } |
233 | 274 | ||
234 | static struct request *nbd_find_request(struct nbd_device *lo, char *handle) | 275 | static struct request *nbd_find_request(struct nbd_device *lo, |
276 | struct request *xreq) | ||
235 | { | 277 | { |
236 | struct request *req; | 278 | struct request *req, *tmp; |
237 | struct list_head *tmp; | ||
238 | struct request *xreq; | ||
239 | int err; | 279 | int err; |
240 | 280 | ||
241 | memcpy(&xreq, handle, sizeof(xreq)); | ||
242 | |||
243 | err = wait_event_interruptible(lo->active_wq, lo->active_req != xreq); | 281 | err = wait_event_interruptible(lo->active_wq, lo->active_req != xreq); |
244 | if (unlikely(err)) | 282 | if (unlikely(err)) |
245 | goto out; | 283 | goto out; |
246 | 284 | ||
247 | spin_lock(&lo->queue_lock); | 285 | spin_lock(&lo->queue_lock); |
248 | list_for_each(tmp, &lo->queue_head) { | 286 | list_for_each_entry_safe(req, tmp, &lo->queue_head, queuelist) { |
249 | req = list_entry(tmp, struct request, queuelist); | ||
250 | if (req != xreq) | 287 | if (req != xreq) |
251 | continue; | 288 | continue; |
252 | list_del_init(&req->queuelist); | 289 | list_del_init(&req->queuelist); |
@@ -261,11 +298,11 @@ out: | |||
261 | return ERR_PTR(err); | 298 | return ERR_PTR(err); |
262 | } | 299 | } |
263 | 300 | ||
264 | static inline int sock_recv_bvec(struct socket *sock, struct bio_vec *bvec) | 301 | static inline int sock_recv_bvec(struct nbd_device *lo, struct bio_vec *bvec) |
265 | { | 302 | { |
266 | int result; | 303 | int result; |
267 | void *kaddr = kmap(bvec->bv_page); | 304 | void *kaddr = kmap(bvec->bv_page); |
268 | result = sock_xmit(sock, 0, kaddr + bvec->bv_offset, bvec->bv_len, | 305 | result = sock_xmit(lo, 0, kaddr + bvec->bv_offset, bvec->bv_len, |
269 | MSG_WAITALL); | 306 | MSG_WAITALL); |
270 | kunmap(bvec->bv_page); | 307 | kunmap(bvec->bv_page); |
271 | return result; | 308 | return result; |
@@ -277,10 +314,9 @@ static struct request *nbd_read_stat(struct nbd_device *lo) | |||
277 | int result; | 314 | int result; |
278 | struct nbd_reply reply; | 315 | struct nbd_reply reply; |
279 | struct request *req; | 316 | struct request *req; |
280 | struct socket *sock = lo->sock; | ||
281 | 317 | ||
282 | reply.magic = 0; | 318 | reply.magic = 0; |
283 | result = sock_xmit(sock, 0, &reply, sizeof(reply), MSG_WAITALL); | 319 | result = sock_xmit(lo, 0, &reply, sizeof(reply), MSG_WAITALL); |
284 | if (result <= 0) { | 320 | if (result <= 0) { |
285 | printk(KERN_ERR "%s: Receive control failed (result %d)\n", | 321 | printk(KERN_ERR "%s: Receive control failed (result %d)\n", |
286 | lo->disk->disk_name, result); | 322 | lo->disk->disk_name, result); |
@@ -295,7 +331,7 @@ static struct request *nbd_read_stat(struct nbd_device *lo) | |||
295 | goto harderror; | 331 | goto harderror; |
296 | } | 332 | } |
297 | 333 | ||
298 | req = nbd_find_request(lo, reply.handle); | 334 | req = nbd_find_request(lo, *(struct request **)reply.handle); |
299 | if (unlikely(IS_ERR(req))) { | 335 | if (unlikely(IS_ERR(req))) { |
300 | result = PTR_ERR(req); | 336 | result = PTR_ERR(req); |
301 | if (result != -ENOENT) | 337 | if (result != -ENOENT) |
@@ -321,7 +357,7 @@ static struct request *nbd_read_stat(struct nbd_device *lo) | |||
321 | struct bio_vec *bvec; | 357 | struct bio_vec *bvec; |
322 | 358 | ||
323 | rq_for_each_segment(bvec, req, iter) { | 359 | rq_for_each_segment(bvec, req, iter) { |
324 | result = sock_recv_bvec(sock, bvec); | 360 | result = sock_recv_bvec(lo, bvec); |
325 | if (result <= 0) { | 361 | if (result <= 0) { |
326 | printk(KERN_ERR "%s: Receive data failed (result %d)\n", | 362 | printk(KERN_ERR "%s: Receive data failed (result %d)\n", |
327 | lo->disk->disk_name, result); | 363 | lo->disk->disk_name, result); |
@@ -396,6 +432,7 @@ static void nbd_clear_que(struct nbd_device *lo) | |||
396 | } | 432 | } |
397 | } | 433 | } |
398 | 434 | ||
435 | |||
399 | /* | 436 | /* |
400 | * We always wait for result of write, for now. It would be nice to make it optional | 437 | * We always wait for result of write, for now. It would be nice to make it optional |
401 | * in future | 438 | * in future |
@@ -504,7 +541,9 @@ static int nbd_ioctl(struct inode *inode, struct file *file, | |||
504 | sreq.nr_sectors = 0; | 541 | sreq.nr_sectors = 0; |
505 | if (!lo->sock) | 542 | if (!lo->sock) |
506 | return -EINVAL; | 543 | return -EINVAL; |
544 | mutex_lock(&lo->tx_lock); | ||
507 | nbd_send_req(lo, &sreq); | 545 | nbd_send_req(lo, &sreq); |
546 | mutex_unlock(&lo->tx_lock); | ||
508 | return 0; | 547 | return 0; |
509 | 548 | ||
510 | case NBD_CLEAR_SOCK: | 549 | case NBD_CLEAR_SOCK: |
@@ -548,6 +587,9 @@ static int nbd_ioctl(struct inode *inode, struct file *file, | |||
548 | set_blocksize(inode->i_bdev, lo->blksize); | 587 | set_blocksize(inode->i_bdev, lo->blksize); |
549 | set_capacity(lo->disk, lo->bytesize >> 9); | 588 | set_capacity(lo->disk, lo->bytesize >> 9); |
550 | return 0; | 589 | return 0; |
590 | case NBD_SET_TIMEOUT: | ||
591 | lo->xmit_timeout = arg * HZ; | ||
592 | return 0; | ||
551 | case NBD_SET_SIZE_BLOCKS: | 593 | case NBD_SET_SIZE_BLOCKS: |
552 | lo->bytesize = ((u64) arg) * lo->blksize; | 594 | lo->bytesize = ((u64) arg) * lo->blksize; |
553 | inode->i_bdev->bd_inode->i_size = lo->bytesize; | 595 | inode->i_bdev->bd_inode->i_size = lo->bytesize; |
@@ -560,28 +602,16 @@ static int nbd_ioctl(struct inode *inode, struct file *file, | |||
560 | error = nbd_do_it(lo); | 602 | error = nbd_do_it(lo); |
561 | if (error) | 603 | if (error) |
562 | return error; | 604 | return error; |
563 | /* on return tidy up in case we have a signal */ | 605 | sock_shutdown(lo, 1); |
564 | /* Forcibly shutdown the socket causing all listeners | ||
565 | * to error | ||
566 | * | ||
567 | * FIXME: This code is duplicated from sys_shutdown, but | ||
568 | * there should be a more generic interface rather than | ||
569 | * calling socket ops directly here */ | ||
570 | mutex_lock(&lo->tx_lock); | ||
571 | if (lo->sock) { | ||
572 | printk(KERN_WARNING "%s: shutting down socket\n", | ||
573 | lo->disk->disk_name); | ||
574 | lo->sock->ops->shutdown(lo->sock, | ||
575 | SEND_SHUTDOWN|RCV_SHUTDOWN); | ||
576 | lo->sock = NULL; | ||
577 | } | ||
578 | mutex_unlock(&lo->tx_lock); | ||
579 | file = lo->file; | 606 | file = lo->file; |
580 | lo->file = NULL; | 607 | lo->file = NULL; |
581 | nbd_clear_que(lo); | 608 | nbd_clear_que(lo); |
582 | printk(KERN_WARNING "%s: queue cleared\n", lo->disk->disk_name); | 609 | printk(KERN_WARNING "%s: queue cleared\n", lo->disk->disk_name); |
583 | if (file) | 610 | if (file) |
584 | fput(file); | 611 | fput(file); |
612 | lo->bytesize = 0; | ||
613 | inode->i_bdev->bd_inode->i_size = 0; | ||
614 | set_capacity(lo->disk, 0); | ||
585 | return lo->harderror; | 615 | return lo->harderror; |
586 | case NBD_CLEAR_QUE: | 616 | case NBD_CLEAR_QUE: |
587 | /* | 617 | /* |
@@ -659,14 +689,14 @@ static int __init nbd_init(void) | |||
659 | mutex_init(&nbd_dev[i].tx_lock); | 689 | mutex_init(&nbd_dev[i].tx_lock); |
660 | init_waitqueue_head(&nbd_dev[i].active_wq); | 690 | init_waitqueue_head(&nbd_dev[i].active_wq); |
661 | nbd_dev[i].blksize = 1024; | 691 | nbd_dev[i].blksize = 1024; |
662 | nbd_dev[i].bytesize = 0x7ffffc00ULL << 10; /* 2TB */ | 692 | nbd_dev[i].bytesize = 0; |
663 | disk->major = NBD_MAJOR; | 693 | disk->major = NBD_MAJOR; |
664 | disk->first_minor = i; | 694 | disk->first_minor = i; |
665 | disk->fops = &nbd_fops; | 695 | disk->fops = &nbd_fops; |
666 | disk->private_data = &nbd_dev[i]; | 696 | disk->private_data = &nbd_dev[i]; |
667 | disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; | 697 | disk->flags |= GENHD_FL_SUPPRESS_PARTITION_INFO; |
668 | sprintf(disk->disk_name, "nbd%d", i); | 698 | sprintf(disk->disk_name, "nbd%d", i); |
669 | set_capacity(disk, 0x7ffffc00ULL << 1); /* 2 TB */ | 699 | set_capacity(disk, 0); |
670 | add_disk(disk); | 700 | add_disk(disk); |
671 | } | 701 | } |
672 | 702 | ||
diff --git a/drivers/block/rd.c b/drivers/block/rd.c index 701ea77f62e9..08176d23a46c 100644 --- a/drivers/block/rd.c +++ b/drivers/block/rd.c | |||
@@ -411,6 +411,9 @@ static void __exit rd_cleanup(void) | |||
411 | blk_cleanup_queue(rd_queue[i]); | 411 | blk_cleanup_queue(rd_queue[i]); |
412 | } | 412 | } |
413 | unregister_blkdev(RAMDISK_MAJOR, "ramdisk"); | 413 | unregister_blkdev(RAMDISK_MAJOR, "ramdisk"); |
414 | |||
415 | bdi_destroy(&rd_file_backing_dev_info); | ||
416 | bdi_destroy(&rd_backing_dev_info); | ||
414 | } | 417 | } |
415 | 418 | ||
416 | /* | 419 | /* |
@@ -419,7 +422,19 @@ static void __exit rd_cleanup(void) | |||
419 | static int __init rd_init(void) | 422 | static int __init rd_init(void) |
420 | { | 423 | { |
421 | int i; | 424 | int i; |
422 | int err = -ENOMEM; | 425 | int err; |
426 | |||
427 | err = bdi_init(&rd_backing_dev_info); | ||
428 | if (err) | ||
429 | goto out2; | ||
430 | |||
431 | err = bdi_init(&rd_file_backing_dev_info); | ||
432 | if (err) { | ||
433 | bdi_destroy(&rd_backing_dev_info); | ||
434 | goto out2; | ||
435 | } | ||
436 | |||
437 | err = -ENOMEM; | ||
423 | 438 | ||
424 | if (rd_blocksize > PAGE_SIZE || rd_blocksize < 512 || | 439 | if (rd_blocksize > PAGE_SIZE || rd_blocksize < 512 || |
425 | (rd_blocksize & (rd_blocksize-1))) { | 440 | (rd_blocksize & (rd_blocksize-1))) { |
@@ -473,6 +488,9 @@ out: | |||
473 | put_disk(rd_disks[i]); | 488 | put_disk(rd_disks[i]); |
474 | blk_cleanup_queue(rd_queue[i]); | 489 | blk_cleanup_queue(rd_queue[i]); |
475 | } | 490 | } |
491 | bdi_destroy(&rd_backing_dev_info); | ||
492 | bdi_destroy(&rd_file_backing_dev_info); | ||
493 | out2: | ||
476 | return err; | 494 | return err; |
477 | } | 495 | } |
478 | 496 | ||
@@ -486,17 +504,12 @@ static int __init ramdisk_size(char *str) | |||
486 | rd_size = simple_strtol(str,NULL,0); | 504 | rd_size = simple_strtol(str,NULL,0); |
487 | return 1; | 505 | return 1; |
488 | } | 506 | } |
489 | static int __init ramdisk_size2(char *str) /* kludge */ | ||
490 | { | ||
491 | return ramdisk_size(str); | ||
492 | } | ||
493 | static int __init ramdisk_blocksize(char *str) | 507 | static int __init ramdisk_blocksize(char *str) |
494 | { | 508 | { |
495 | rd_blocksize = simple_strtol(str,NULL,0); | 509 | rd_blocksize = simple_strtol(str,NULL,0); |
496 | return 1; | 510 | return 1; |
497 | } | 511 | } |
498 | __setup("ramdisk=", ramdisk_size); | 512 | __setup("ramdisk_size=", ramdisk_size); |
499 | __setup("ramdisk_size=", ramdisk_size2); | ||
500 | __setup("ramdisk_blocksize=", ramdisk_blocksize); | 513 | __setup("ramdisk_blocksize=", ramdisk_blocksize); |
501 | #endif | 514 | #endif |
502 | 515 | ||
diff --git a/drivers/char/Kconfig b/drivers/char/Kconfig index f6f8c03047fa..204d53e506de 100644 --- a/drivers/char/Kconfig +++ b/drivers/char/Kconfig | |||
@@ -36,6 +36,23 @@ config VT | |||
36 | If unsure, say Y, or else you won't be able to do much with your new | 36 | If unsure, say Y, or else you won't be able to do much with your new |
37 | shiny Linux system :-) | 37 | shiny Linux system :-) |
38 | 38 | ||
39 | config VT_UNICODE | ||
40 | bool "Virtual console is Unicode by default" | ||
41 | depends on VT | ||
42 | default n | ||
43 | ---help--- | ||
44 | If you say Y here, the virtual terminal will be in UTF-8 by default, | ||
45 | and the keyboard will run in unicode mode. | ||
46 | |||
47 | If you say N here, the virtual terminal will not be in UTF-8 by | ||
48 | default, and the keyboard will run in XLATE mode. | ||
49 | |||
50 | This can also be changed by passing 'default_utf8=<0|1>' on the | ||
51 | kernel command line. | ||
52 | |||
53 | Historically, the kernel has defaulted to non-UTF8 and XLATE mode. | ||
54 | If unsure, say N here. | ||
55 | |||
39 | config VT_CONSOLE | 56 | config VT_CONSOLE |
40 | bool "Support for console on virtual terminal" if EMBEDDED | 57 | bool "Support for console on virtual terminal" if EMBEDDED |
41 | depends on VT | 58 | depends on VT |
@@ -568,8 +585,8 @@ config TIPAR | |||
568 | config HVC_DRIVER | 585 | config HVC_DRIVER |
569 | bool | 586 | bool |
570 | help | 587 | help |
571 | Users of pSeries machines that want to utilize the hvc console front-end | 588 | Generic "hypervisor virtual console" infrastructure for various |
572 | module for their backend console driver should select this option. | 589 | hypervisors (pSeries, iSeries, Xen, lguest). |
573 | It will automatically be selected if one of the back-end console drivers | 590 | It will automatically be selected if one of the back-end console drivers |
574 | is selected. | 591 | is selected. |
575 | 592 | ||
diff --git a/drivers/char/agp/hp-agp.c b/drivers/char/agp/hp-agp.c index 313a133a1172..cbb0444467ba 100644 --- a/drivers/char/agp/hp-agp.c +++ b/drivers/char/agp/hp-agp.c | |||
@@ -14,15 +14,12 @@ | |||
14 | #include <linux/pci.h> | 14 | #include <linux/pci.h> |
15 | #include <linux/init.h> | 15 | #include <linux/init.h> |
16 | #include <linux/agp_backend.h> | 16 | #include <linux/agp_backend.h> |
17 | #include <linux/log2.h> | ||
17 | 18 | ||
18 | #include <asm/acpi-ext.h> | 19 | #include <asm/acpi-ext.h> |
19 | 20 | ||
20 | #include "agp.h" | 21 | #include "agp.h" |
21 | 22 | ||
22 | #ifndef log2 | ||
23 | #define log2(x) ffz(~(x)) | ||
24 | #endif | ||
25 | |||
26 | #define HP_ZX1_IOC_OFFSET 0x1000 /* ACPI reports SBA, we want IOC */ | 23 | #define HP_ZX1_IOC_OFFSET 0x1000 /* ACPI reports SBA, we want IOC */ |
27 | 24 | ||
28 | /* HP ZX1 IOC registers */ | 25 | /* HP ZX1 IOC registers */ |
@@ -257,7 +254,7 @@ hp_zx1_configure (void) | |||
257 | readl(hp->ioc_regs+HP_ZX1_IMASK); | 254 | readl(hp->ioc_regs+HP_ZX1_IMASK); |
258 | writel(hp->iova_base|1, hp->ioc_regs+HP_ZX1_IBASE); | 255 | writel(hp->iova_base|1, hp->ioc_regs+HP_ZX1_IBASE); |
259 | readl(hp->ioc_regs+HP_ZX1_IBASE); | 256 | readl(hp->ioc_regs+HP_ZX1_IBASE); |
260 | writel(hp->iova_base|log2(HP_ZX1_IOVA_SIZE), hp->ioc_regs+HP_ZX1_PCOM); | 257 | writel(hp->iova_base|ilog2(HP_ZX1_IOVA_SIZE), hp->ioc_regs+HP_ZX1_PCOM); |
261 | readl(hp->ioc_regs+HP_ZX1_PCOM); | 258 | readl(hp->ioc_regs+HP_ZX1_PCOM); |
262 | } | 259 | } |
263 | 260 | ||
@@ -285,7 +282,7 @@ hp_zx1_tlbflush (struct agp_memory *mem) | |||
285 | { | 282 | { |
286 | struct _hp_private *hp = &hp_private; | 283 | struct _hp_private *hp = &hp_private; |
287 | 284 | ||
288 | writeq(hp->gart_base | log2(hp->gart_size), hp->ioc_regs+HP_ZX1_PCOM); | 285 | writeq(hp->gart_base | ilog2(hp->gart_size), hp->ioc_regs+HP_ZX1_PCOM); |
289 | readq(hp->ioc_regs+HP_ZX1_PCOM); | 286 | readq(hp->ioc_regs+HP_ZX1_PCOM); |
290 | } | 287 | } |
291 | 288 | ||
diff --git a/drivers/char/agp/i460-agp.c b/drivers/char/agp/i460-agp.c index 70117df4d067..e72a83e2bad5 100644 --- a/drivers/char/agp/i460-agp.c +++ b/drivers/char/agp/i460-agp.c | |||
@@ -13,6 +13,7 @@ | |||
13 | #include <linux/string.h> | 13 | #include <linux/string.h> |
14 | #include <linux/slab.h> | 14 | #include <linux/slab.h> |
15 | #include <linux/agp_backend.h> | 15 | #include <linux/agp_backend.h> |
16 | #include <linux/log2.h> | ||
16 | 17 | ||
17 | #include "agp.h" | 18 | #include "agp.h" |
18 | 19 | ||
@@ -59,8 +60,6 @@ | |||
59 | */ | 60 | */ |
60 | #define WR_FLUSH_GATT(index) RD_GATT(index) | 61 | #define WR_FLUSH_GATT(index) RD_GATT(index) |
61 | 62 | ||
62 | #define log2(x) ffz(~(x)) | ||
63 | |||
64 | static struct { | 63 | static struct { |
65 | void *gatt; /* ioremap'd GATT area */ | 64 | void *gatt; /* ioremap'd GATT area */ |
66 | 65 | ||
@@ -148,7 +147,7 @@ static int i460_fetch_size (void) | |||
148 | * values[i].size. | 147 | * values[i].size. |
149 | */ | 148 | */ |
150 | values[i].num_entries = (values[i].size << 8) >> (I460_IO_PAGE_SHIFT - 12); | 149 | values[i].num_entries = (values[i].size << 8) >> (I460_IO_PAGE_SHIFT - 12); |
151 | values[i].page_order = log2((sizeof(u32)*values[i].num_entries) >> PAGE_SHIFT); | 150 | values[i].page_order = ilog2((sizeof(u32)*values[i].num_entries) >> PAGE_SHIFT); |
152 | } | 151 | } |
153 | 152 | ||
154 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { | 153 | for (i = 0; i < agp_bridge->driver->num_aperture_sizes; i++) { |
diff --git a/drivers/char/agp/parisc-agp.c b/drivers/char/agp/parisc-agp.c index f4562cc22343..2939e3570f9d 100644 --- a/drivers/char/agp/parisc-agp.c +++ b/drivers/char/agp/parisc-agp.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/init.h> | 18 | #include <linux/init.h> |
19 | #include <linux/klist.h> | 19 | #include <linux/klist.h> |
20 | #include <linux/agp_backend.h> | 20 | #include <linux/agp_backend.h> |
21 | #include <linux/log2.h> | ||
21 | 22 | ||
22 | #include <asm-parisc/parisc-device.h> | 23 | #include <asm-parisc/parisc-device.h> |
23 | #include <asm-parisc/ropes.h> | 24 | #include <asm-parisc/ropes.h> |
@@ -27,10 +28,6 @@ | |||
27 | #define DRVNAME "quicksilver" | 28 | #define DRVNAME "quicksilver" |
28 | #define DRVPFX DRVNAME ": " | 29 | #define DRVPFX DRVNAME ": " |
29 | 30 | ||
30 | #ifndef log2 | ||
31 | #define log2(x) ffz(~(x)) | ||
32 | #endif | ||
33 | |||
34 | #define AGP8X_MODE_BIT 3 | 31 | #define AGP8X_MODE_BIT 3 |
35 | #define AGP8X_MODE (1 << AGP8X_MODE_BIT) | 32 | #define AGP8X_MODE (1 << AGP8X_MODE_BIT) |
36 | 33 | ||
@@ -92,7 +89,7 @@ parisc_agp_tlbflush(struct agp_memory *mem) | |||
92 | { | 89 | { |
93 | struct _parisc_agp_info *info = &parisc_agp_info; | 90 | struct _parisc_agp_info *info = &parisc_agp_info; |
94 | 91 | ||
95 | writeq(info->gart_base | log2(info->gart_size), info->ioc_regs+IOC_PCOM); | 92 | writeq(info->gart_base | ilog2(info->gart_size), info->ioc_regs+IOC_PCOM); |
96 | readq(info->ioc_regs+IOC_PCOM); /* flush */ | 93 | readq(info->ioc_regs+IOC_PCOM); /* flush */ |
97 | } | 94 | } |
98 | 95 | ||
diff --git a/drivers/char/consolemap.c b/drivers/char/consolemap.c index 4b3916f54909..6b104e45a322 100644 --- a/drivers/char/consolemap.c +++ b/drivers/char/consolemap.c | |||
@@ -494,12 +494,11 @@ int con_clear_unimap(struct vc_data *vc, struct unimapinit *ui) | |||
494 | p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; | 494 | p = (struct uni_pagedir *)*vc->vc_uni_pagedir_loc; |
495 | if (p && p->readonly) return -EIO; | 495 | if (p && p->readonly) return -EIO; |
496 | if (!p || --p->refcount) { | 496 | if (!p || --p->refcount) { |
497 | q = kmalloc(sizeof(*p), GFP_KERNEL); | 497 | q = kzalloc(sizeof(*p), GFP_KERNEL); |
498 | if (!q) { | 498 | if (!q) { |
499 | if (p) p->refcount++; | 499 | if (p) p->refcount++; |
500 | return -ENOMEM; | 500 | return -ENOMEM; |
501 | } | 501 | } |
502 | memset(q, 0, sizeof(*q)); | ||
503 | q->refcount=1; | 502 | q->refcount=1; |
504 | *vc->vc_uni_pagedir_loc = (unsigned long)q; | 503 | *vc->vc_uni_pagedir_loc = (unsigned long)q; |
505 | } else { | 504 | } else { |
@@ -670,19 +669,29 @@ void con_protect_unimap(struct vc_data *vc, int rdonly) | |||
670 | p->readonly = rdonly; | 669 | p->readonly = rdonly; |
671 | } | 670 | } |
672 | 671 | ||
672 | /* | ||
673 | * Always use USER_MAP. These functions are used by the keyboard, | ||
674 | * which shouldn't be affected by G0/G1 switching, etc. | ||
675 | * If the user map still contains default values, i.e. the | ||
676 | * direct-to-font mapping, then assume user is using Latin1. | ||
677 | */ | ||
673 | /* may be called during an interrupt */ | 678 | /* may be called during an interrupt */ |
674 | u32 conv_8bit_to_uni(unsigned char c) | 679 | u32 conv_8bit_to_uni(unsigned char c) |
675 | { | 680 | { |
676 | /* | ||
677 | * Always use USER_MAP. This function is used by the keyboard, | ||
678 | * which shouldn't be affected by G0/G1 switching, etc. | ||
679 | * If the user map still contains default values, i.e. the | ||
680 | * direct-to-font mapping, then assume user is using Latin1. | ||
681 | */ | ||
682 | unsigned short uni = translations[USER_MAP][c]; | 681 | unsigned short uni = translations[USER_MAP][c]; |
683 | return uni == (0xf000 | c) ? c : uni; | 682 | return uni == (0xf000 | c) ? c : uni; |
684 | } | 683 | } |
685 | 684 | ||
685 | int conv_uni_to_8bit(u32 uni) | ||
686 | { | ||
687 | int c; | ||
688 | for (c = 0; c < 0x100; c++) | ||
689 | if (translations[USER_MAP][c] == uni || | ||
690 | (translations[USER_MAP][c] == (c | 0xf000) && uni == c)) | ||
691 | return c; | ||
692 | return -1; | ||
693 | } | ||
694 | |||
686 | int | 695 | int |
687 | conv_uni_to_pc(struct vc_data *conp, long ucs) | 696 | conv_uni_to_pc(struct vc_data *conp, long ucs) |
688 | { | 697 | { |
diff --git a/drivers/char/defkeymap.c_shipped b/drivers/char/defkeymap.c_shipped index 453a2f1ffa15..0aa419a61767 100644 --- a/drivers/char/defkeymap.c_shipped +++ b/drivers/char/defkeymap.c_shipped | |||
@@ -222,7 +222,7 @@ char *func_table[MAX_NR_FUNC] = { | |||
222 | NULL, | 222 | NULL, |
223 | }; | 223 | }; |
224 | 224 | ||
225 | struct kbdiacr accent_table[MAX_DIACR] = { | 225 | struct kbdiacruc accent_table[MAX_DIACR] = { |
226 | {'`', 'A', '\300'}, {'`', 'a', '\340'}, | 226 | {'`', 'A', '\300'}, {'`', 'a', '\340'}, |
227 | {'\'', 'A', '\301'}, {'\'', 'a', '\341'}, | 227 | {'\'', 'A', '\301'}, {'\'', 'a', '\341'}, |
228 | {'^', 'A', '\302'}, {'^', 'a', '\342'}, | 228 | {'^', 'A', '\302'}, {'^', 'a', '\342'}, |
diff --git a/drivers/char/epca.c b/drivers/char/epca.c index c6c56fb8ba50..ffcecde9e2a5 100644 --- a/drivers/char/epca.c +++ b/drivers/char/epca.c | |||
@@ -1,34 +1,30 @@ | |||
1 | /* | 1 | /* |
2 | |||
3 | |||
4 | Copyright (C) 1996 Digi International. | 2 | Copyright (C) 1996 Digi International. |
5 | 3 | ||
6 | For technical support please email digiLinux@dgii.com or | 4 | For technical support please email digiLinux@dgii.com or |
7 | call Digi tech support at (612) 912-3456 | 5 | call Digi tech support at (612) 912-3456 |
8 | 6 | ||
9 | ** This driver is no longer supported by Digi ** | 7 | ** This driver is no longer supported by Digi ** |
10 | 8 | ||
11 | Much of this design and code came from epca.c which was | 9 | Much of this design and code came from epca.c which was |
12 | copyright (C) 1994, 1995 Troy De Jongh, and subsquently | 10 | copyright (C) 1994, 1995 Troy De Jongh, and subsquently |
13 | modified by David Nugent, Christoph Lameter, Mike McLagan. | 11 | modified by David Nugent, Christoph Lameter, Mike McLagan. |
14 | |||
15 | This program is free software; you can redistribute it and/or modify | ||
16 | it under the terms of the GNU General Public License as published by | ||
17 | the Free Software Foundation; either version 2 of the License, or | ||
18 | (at your option) any later version. | ||
19 | |||
20 | This program is distributed in the hope that it will be useful, | ||
21 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
22 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
23 | GNU General Public License for more details. | ||
24 | |||
25 | You should have received a copy of the GNU General Public License | ||
26 | along with this program; if not, write to the Free Software | ||
27 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
28 | |||
29 | --------------------------------------------------------------------------- */ | ||
30 | /* See README.epca for change history --DAT*/ | ||
31 | 12 | ||
13 | This program is free software; you can redistribute it and/or modify | ||
14 | it under the terms of the GNU General Public License as published by | ||
15 | the Free Software Foundation; either version 2 of the License, or | ||
16 | (at your option) any later version. | ||
17 | |||
18 | This program is distributed in the hope that it will be useful, | ||
19 | but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
20 | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
21 | GNU General Public License for more details. | ||
22 | |||
23 | You should have received a copy of the GNU General Public License | ||
24 | along with this program; if not, write to the Free Software | ||
25 | Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
26 | */ | ||
27 | /* See README.epca for change history --DAT*/ | ||
32 | 28 | ||
33 | #include <linux/module.h> | 29 | #include <linux/module.h> |
34 | #include <linux/kernel.h> | 30 | #include <linux/kernel.h> |
@@ -54,13 +50,10 @@ | |||
54 | #include "epca.h" | 50 | #include "epca.h" |
55 | #include "epcaconfig.h" | 51 | #include "epcaconfig.h" |
56 | 52 | ||
57 | /* ---------------------- Begin defines ------------------------ */ | ||
58 | |||
59 | #define VERSION "1.3.0.1-LK2.6" | 53 | #define VERSION "1.3.0.1-LK2.6" |
60 | 54 | ||
61 | /* This major needs to be submitted to Linux to join the majors list */ | 55 | /* This major needs to be submitted to Linux to join the majors list */ |
62 | 56 | #define DIGIINFOMAJOR 35 /* For Digi specific ioctl */ | |
63 | #define DIGIINFOMAJOR 35 /* For Digi specific ioctl */ | ||
64 | 57 | ||
65 | 58 | ||
66 | #define MAXCARDS 7 | 59 | #define MAXCARDS 7 |
@@ -68,60 +61,48 @@ | |||
68 | 61 | ||
69 | #define PFX "epca: " | 62 | #define PFX "epca: " |
70 | 63 | ||
71 | /* ----------------- Begin global definitions ------------------- */ | ||
72 | |||
73 | static int nbdevs, num_cards, liloconfig; | 64 | static int nbdevs, num_cards, liloconfig; |
74 | static int digi_poller_inhibited = 1 ; | 65 | static int digi_poller_inhibited = 1 ; |
75 | 66 | ||
76 | static int setup_error_code; | 67 | static int setup_error_code; |
77 | static int invalid_lilo_config; | 68 | static int invalid_lilo_config; |
78 | 69 | ||
79 | /* The ISA boards do window flipping into the same spaces so its only sane | 70 | /* |
80 | with a single lock. It's still pretty efficient */ | 71 | * The ISA boards do window flipping into the same spaces so its only sane with |
81 | 72 | * a single lock. It's still pretty efficient. | |
73 | */ | ||
82 | static DEFINE_SPINLOCK(epca_lock); | 74 | static DEFINE_SPINLOCK(epca_lock); |
83 | 75 | ||
84 | /* ----------------------------------------------------------------------- | 76 | /* MAXBOARDS is typically 12, but ISA and EISA cards are restricted to 7 below. */ |
85 | MAXBOARDS is typically 12, but ISA and EISA cards are restricted to | ||
86 | 7 below. | ||
87 | --------------------------------------------------------------------------*/ | ||
88 | static struct board_info boards[MAXBOARDS]; | 77 | static struct board_info boards[MAXBOARDS]; |
89 | 78 | ||
90 | |||
91 | /* ------------- Begin structures used for driver registeration ---------- */ | ||
92 | |||
93 | static struct tty_driver *pc_driver; | 79 | static struct tty_driver *pc_driver; |
94 | static struct tty_driver *pc_info; | 80 | static struct tty_driver *pc_info; |
95 | 81 | ||
96 | /* ------------------ Begin Digi specific structures -------------------- */ | 82 | /* ------------------ Begin Digi specific structures -------------------- */ |
97 | 83 | ||
98 | /* ------------------------------------------------------------------------ | 84 | /* |
99 | digi_channels represents an array of structures that keep track of | 85 | * digi_channels represents an array of structures that keep track of each |
100 | each channel of the Digi product. Information such as transmit and | 86 | * channel of the Digi product. Information such as transmit and receive |
101 | receive pointers, termio data, and signal definitions (DTR, CTS, etc ...) | 87 | * pointers, termio data, and signal definitions (DTR, CTS, etc ...) are stored |
102 | are stored here. This structure is NOT used to overlay the cards | 88 | * here. This structure is NOT used to overlay the cards physical channel |
103 | physical channel structure. | 89 | * structure. |
104 | -------------------------------------------------------------------------- */ | 90 | */ |
105 | |||
106 | static struct channel digi_channels[MAX_ALLOC]; | 91 | static struct channel digi_channels[MAX_ALLOC]; |
107 | 92 | ||
108 | /* ------------------------------------------------------------------------ | 93 | /* |
109 | card_ptr is an array used to hold the address of the | 94 | * card_ptr is an array used to hold the address of the first channel structure |
110 | first channel structure of each card. This array will hold | 95 | * of each card. This array will hold the addresses of various channels located |
111 | the addresses of various channels located in digi_channels. | 96 | * in digi_channels. |
112 | -------------------------------------------------------------------------- */ | 97 | */ |
113 | static struct channel *card_ptr[MAXCARDS]; | 98 | static struct channel *card_ptr[MAXCARDS]; |
114 | 99 | ||
115 | static struct timer_list epca_timer; | 100 | static struct timer_list epca_timer; |
116 | 101 | ||
117 | /* ---------------------- Begin function prototypes --------------------- */ | 102 | /* |
118 | 103 | * Begin generic memory functions. These functions will be alias (point at) | |
119 | /* ---------------------------------------------------------------------- | 104 | * more specific functions dependent on the board being configured. |
120 | Begin generic memory functions. These functions will be alias | 105 | */ |
121 | (point at) more specific functions dependent on the board being | ||
122 | configured. | ||
123 | ----------------------------------------------------------------------- */ | ||
124 | |||
125 | static void memwinon(struct board_info *b, unsigned int win); | 106 | static void memwinon(struct board_info *b, unsigned int win); |
126 | static void memwinoff(struct board_info *b, unsigned int win); | 107 | static void memwinoff(struct board_info *b, unsigned int win); |
127 | static void globalwinon(struct channel *ch); | 108 | static void globalwinon(struct channel *ch); |
@@ -170,8 +151,6 @@ static void dummy_memoff(struct channel *ch); | |||
170 | static void dummy_assertgwinon(struct channel *ch); | 151 | static void dummy_assertgwinon(struct channel *ch); |
171 | static void dummy_assertmemoff(struct channel *ch); | 152 | static void dummy_assertmemoff(struct channel *ch); |
172 | 153 | ||
173 | /* ------------------- Begin declare functions ----------------------- */ | ||
174 | |||
175 | static struct channel *verifyChannel(struct tty_struct *); | 154 | static struct channel *verifyChannel(struct tty_struct *); |
176 | static void pc_sched_event(struct channel *, int); | 155 | static void pc_sched_event(struct channel *, int); |
177 | static void epca_error(int, char *); | 156 | static void epca_error(int, char *); |
@@ -213,62 +192,55 @@ static int pc_write(struct tty_struct *, const unsigned char *, int); | |||
213 | static int pc_init(void); | 192 | static int pc_init(void); |
214 | static int init_PCI(void); | 193 | static int init_PCI(void); |
215 | 194 | ||
216 | 195 | /* | |
217 | /* ------------------------------------------------------------------ | 196 | * Table of functions for each board to handle memory. Mantaining parallelism |
218 | Table of functions for each board to handle memory. Mantaining | 197 | * is a *very* good idea here. The idea is for the runtime code to blindly call |
219 | parallelism is a *very* good idea here. The idea is for the | 198 | * these functions, not knowing/caring about the underlying hardware. This |
220 | runtime code to blindly call these functions, not knowing/caring | 199 | * stuff should contain no conditionals; if more functionality is needed a |
221 | about the underlying hardware. This stuff should contain no | 200 | * different entry should be established. These calls are the interface calls |
222 | conditionals; if more functionality is needed a different entry | 201 | * and are the only functions that should be accessed. Anyone caught making |
223 | should be established. These calls are the interface calls and | 202 | * direct calls deserves what they get. |
224 | are the only functions that should be accessed. Anyone caught | 203 | */ |
225 | making direct calls deserves what they get. | ||
226 | -------------------------------------------------------------------- */ | ||
227 | |||
228 | static void memwinon(struct board_info *b, unsigned int win) | 204 | static void memwinon(struct board_info *b, unsigned int win) |
229 | { | 205 | { |
230 | (b->memwinon)(b, win); | 206 | b->memwinon(b, win); |
231 | } | 207 | } |
232 | 208 | ||
233 | static void memwinoff(struct board_info *b, unsigned int win) | 209 | static void memwinoff(struct board_info *b, unsigned int win) |
234 | { | 210 | { |
235 | (b->memwinoff)(b, win); | 211 | b->memwinoff(b, win); |
236 | } | 212 | } |
237 | 213 | ||
238 | static void globalwinon(struct channel *ch) | 214 | static void globalwinon(struct channel *ch) |
239 | { | 215 | { |
240 | (ch->board->globalwinon)(ch); | 216 | ch->board->globalwinon(ch); |
241 | } | 217 | } |
242 | 218 | ||
243 | static void rxwinon(struct channel *ch) | 219 | static void rxwinon(struct channel *ch) |
244 | { | 220 | { |
245 | (ch->board->rxwinon)(ch); | 221 | ch->board->rxwinon(ch); |
246 | } | 222 | } |
247 | 223 | ||
248 | static void txwinon(struct channel *ch) | 224 | static void txwinon(struct channel *ch) |
249 | { | 225 | { |
250 | (ch->board->txwinon)(ch); | 226 | ch->board->txwinon(ch); |
251 | } | 227 | } |
252 | 228 | ||
253 | static void memoff(struct channel *ch) | 229 | static void memoff(struct channel *ch) |
254 | { | 230 | { |
255 | (ch->board->memoff)(ch); | 231 | ch->board->memoff(ch); |
256 | } | 232 | } |
257 | static void assertgwinon(struct channel *ch) | 233 | static void assertgwinon(struct channel *ch) |
258 | { | 234 | { |
259 | (ch->board->assertgwinon)(ch); | 235 | ch->board->assertgwinon(ch); |
260 | } | 236 | } |
261 | 237 | ||
262 | static void assertmemoff(struct channel *ch) | 238 | static void assertmemoff(struct channel *ch) |
263 | { | 239 | { |
264 | (ch->board->assertmemoff)(ch); | 240 | ch->board->assertmemoff(ch); |
265 | } | 241 | } |
266 | 242 | ||
267 | /* --------------------------------------------------------- | 243 | /* PCXEM windowing is the same as that used in the PCXR and CX series cards. */ |
268 | PCXEM windowing is the same as that used in the PCXR | ||
269 | and CX series cards. | ||
270 | ------------------------------------------------------------ */ | ||
271 | |||
272 | static void pcxem_memwinon(struct board_info *b, unsigned int win) | 244 | static void pcxem_memwinon(struct board_info *b, unsigned int win) |
273 | { | 245 | { |
274 | outb_p(FEPWIN|win, b->port + 1); | 246 | outb_p(FEPWIN|win, b->port + 1); |
@@ -300,32 +272,30 @@ static void pcxem_memoff(struct channel *ch) | |||
300 | } | 272 | } |
301 | 273 | ||
302 | /* ----------------- Begin pcxe memory window stuff ------------------ */ | 274 | /* ----------------- Begin pcxe memory window stuff ------------------ */ |
303 | |||
304 | static void pcxe_memwinon(struct board_info *b, unsigned int win) | 275 | static void pcxe_memwinon(struct board_info *b, unsigned int win) |
305 | { | 276 | { |
306 | outb_p(FEPWIN | win, b->port + 1); | 277 | outb_p(FEPWIN | win, b->port + 1); |
307 | } | 278 | } |
308 | 279 | ||
309 | static void pcxe_memwinoff(struct board_info *b, unsigned int win) | 280 | static void pcxe_memwinoff(struct board_info *b, unsigned int win) |
310 | { | 281 | { |
311 | outb_p(inb(b->port) & ~FEPMEM, | 282 | outb_p(inb(b->port) & ~FEPMEM, b->port + 1); |
312 | b->port + 1); | ||
313 | outb_p(0, b->port + 1); | 283 | outb_p(0, b->port + 1); |
314 | } | 284 | } |
315 | 285 | ||
316 | static void pcxe_globalwinon(struct channel *ch) | 286 | static void pcxe_globalwinon(struct channel *ch) |
317 | { | 287 | { |
318 | outb_p( FEPWIN, (int)ch->board->port + 1); | 288 | outb_p(FEPWIN, (int)ch->board->port + 1); |
319 | } | 289 | } |
320 | 290 | ||
321 | static void pcxe_rxwinon(struct channel *ch) | 291 | static void pcxe_rxwinon(struct channel *ch) |
322 | { | 292 | { |
323 | outb_p(ch->rxwin, (int)ch->board->port + 1); | 293 | outb_p(ch->rxwin, (int)ch->board->port + 1); |
324 | } | 294 | } |
325 | 295 | ||
326 | static void pcxe_txwinon(struct channel *ch) | 296 | static void pcxe_txwinon(struct channel *ch) |
327 | { | 297 | { |
328 | outb_p(ch->txwin, (int)ch->board->port + 1); | 298 | outb_p(ch->txwin, (int)ch->board->port + 1); |
329 | } | 299 | } |
330 | 300 | ||
331 | static void pcxe_memoff(struct channel *ch) | 301 | static void pcxe_memoff(struct channel *ch) |
@@ -335,10 +305,9 @@ static void pcxe_memoff(struct channel *ch) | |||
335 | } | 305 | } |
336 | 306 | ||
337 | /* ------------- Begin pc64xe and pcxi memory window stuff -------------- */ | 307 | /* ------------- Begin pc64xe and pcxi memory window stuff -------------- */ |
338 | |||
339 | static void pcxi_memwinon(struct board_info *b, unsigned int win) | 308 | static void pcxi_memwinon(struct board_info *b, unsigned int win) |
340 | { | 309 | { |
341 | outb_p(inb(b->port) | FEPMEM, b->port); | 310 | outb_p(inb(b->port) | FEPMEM, b->port); |
342 | } | 311 | } |
343 | 312 | ||
344 | static void pcxi_memwinoff(struct board_info *b, unsigned int win) | 313 | static void pcxi_memwinoff(struct board_info *b, unsigned int win) |
@@ -353,12 +322,12 @@ static void pcxi_globalwinon(struct channel *ch) | |||
353 | 322 | ||
354 | static void pcxi_rxwinon(struct channel *ch) | 323 | static void pcxi_rxwinon(struct channel *ch) |
355 | { | 324 | { |
356 | outb_p(FEPMEM, ch->board->port); | 325 | outb_p(FEPMEM, ch->board->port); |
357 | } | 326 | } |
358 | 327 | ||
359 | static void pcxi_txwinon(struct channel *ch) | 328 | static void pcxi_txwinon(struct channel *ch) |
360 | { | 329 | { |
361 | outb_p(FEPMEM, ch->board->port); | 330 | outb_p(FEPMEM, ch->board->port); |
362 | } | 331 | } |
363 | 332 | ||
364 | static void pcxi_memoff(struct channel *ch) | 333 | static void pcxi_memoff(struct channel *ch) |
@@ -376,16 +345,13 @@ static void pcxi_assertmemoff(struct channel *ch) | |||
376 | epcaassert(!(inb(ch->board->port) & FEPMEM), "Memory on"); | 345 | epcaassert(!(inb(ch->board->port) & FEPMEM), "Memory on"); |
377 | } | 346 | } |
378 | 347 | ||
379 | 348 | /* | |
380 | /* ---------------------------------------------------------------------- | 349 | * Not all of the cards need specific memory windowing routines. Some cards |
381 | Not all of the cards need specific memory windowing routines. Some | 350 | * (Such as PCI) needs no windowing routines at all. We provide these do |
382 | cards (Such as PCI) needs no windowing routines at all. We provide | 351 | * nothing routines so that the same code base can be used. The driver will |
383 | these do nothing routines so that the same code base can be used. | 352 | * ALWAYS call a windowing routine if it thinks it needs to; regardless of the |
384 | The driver will ALWAYS call a windowing routine if it thinks it needs | 353 | * card. However, dependent on the card the routine may or may not do anything. |
385 | to; regardless of the card. However, dependent on the card the routine | 354 | */ |
386 | may or may not do anything. | ||
387 | ---------------------------------------------------------------------------*/ | ||
388 | |||
389 | static void dummy_memwinon(struct board_info *b, unsigned int win) | 355 | static void dummy_memwinon(struct board_info *b, unsigned int win) |
390 | { | 356 | { |
391 | } | 357 | } |
@@ -418,15 +384,14 @@ static void dummy_assertmemoff(struct channel *ch) | |||
418 | { | 384 | { |
419 | } | 385 | } |
420 | 386 | ||
421 | /* ----------------- Begin verifyChannel function ----------------------- */ | ||
422 | static struct channel *verifyChannel(struct tty_struct *tty) | 387 | static struct channel *verifyChannel(struct tty_struct *tty) |
423 | { /* Begin verifyChannel */ | 388 | { |
424 | /* -------------------------------------------------------------------- | 389 | /* |
425 | This routine basically provides a sanity check. It insures that | 390 | * This routine basically provides a sanity check. It insures that the |
426 | the channel returned is within the proper range of addresses as | 391 | * channel returned is within the proper range of addresses as well as |
427 | well as properly initialized. If some bogus info gets passed in | 392 | * properly initialized. If some bogus info gets passed in |
428 | through tty->driver_data this should catch it. | 393 | * through tty->driver_data this should catch it. |
429 | --------------------------------------------------------------------- */ | 394 | */ |
430 | if (tty) { | 395 | if (tty) { |
431 | struct channel *ch = (struct channel *)tty->driver_data; | 396 | struct channel *ch = (struct channel *)tty->driver_data; |
432 | if ((ch >= &digi_channels[0]) && (ch < &digi_channels[nbdevs])) { | 397 | if ((ch >= &digi_channels[0]) && (ch < &digi_channels[nbdevs])) { |
@@ -435,62 +400,55 @@ static struct channel *verifyChannel(struct tty_struct *tty) | |||
435 | } | 400 | } |
436 | } | 401 | } |
437 | return NULL; | 402 | return NULL; |
438 | 403 | } | |
439 | } /* End verifyChannel */ | ||
440 | |||
441 | /* ------------------ Begin pc_sched_event ------------------------- */ | ||
442 | 404 | ||
443 | static void pc_sched_event(struct channel *ch, int event) | 405 | static void pc_sched_event(struct channel *ch, int event) |
444 | { | 406 | { |
445 | /* ---------------------------------------------------------------------- | 407 | /* |
446 | We call this to schedule interrupt processing on some event. The | 408 | * We call this to schedule interrupt processing on some event. The |
447 | kernel sees our request and calls the related routine in OUR driver. | 409 | * kernel sees our request and calls the related routine in OUR driver. |
448 | -------------------------------------------------------------------------*/ | 410 | */ |
449 | ch->event |= 1 << event; | 411 | ch->event |= 1 << event; |
450 | schedule_work(&ch->tqueue); | 412 | schedule_work(&ch->tqueue); |
451 | } /* End pc_sched_event */ | 413 | } |
452 | |||
453 | /* ------------------ Begin epca_error ------------------------- */ | ||
454 | 414 | ||
455 | static void epca_error(int line, char *msg) | 415 | static void epca_error(int line, char *msg) |
456 | { | 416 | { |
457 | printk(KERN_ERR "epca_error (Digi): line = %d %s\n",line,msg); | 417 | printk(KERN_ERR "epca_error (Digi): line = %d %s\n",line,msg); |
458 | } | 418 | } |
459 | 419 | ||
460 | /* ------------------ Begin pc_close ------------------------- */ | 420 | static void pc_close(struct tty_struct *tty, struct file *filp) |
461 | static void pc_close(struct tty_struct * tty, struct file * filp) | ||
462 | { | 421 | { |
463 | struct channel *ch; | 422 | struct channel *ch; |
464 | unsigned long flags; | 423 | unsigned long flags; |
465 | /* --------------------------------------------------------- | 424 | /* |
466 | verifyChannel returns the channel from the tty struct | 425 | * verifyChannel returns the channel from the tty struct if it is |
467 | if it is valid. This serves as a sanity check. | 426 | * valid. This serves as a sanity check. |
468 | ------------------------------------------------------------- */ | 427 | */ |
469 | if ((ch = verifyChannel(tty)) != NULL) { /* Begin if ch != NULL */ | 428 | if ((ch = verifyChannel(tty)) != NULL) { |
470 | spin_lock_irqsave(&epca_lock, flags); | 429 | spin_lock_irqsave(&epca_lock, flags); |
471 | if (tty_hung_up_p(filp)) { | 430 | if (tty_hung_up_p(filp)) { |
472 | spin_unlock_irqrestore(&epca_lock, flags); | 431 | spin_unlock_irqrestore(&epca_lock, flags); |
473 | return; | 432 | return; |
474 | } | 433 | } |
475 | /* Check to see if the channel is open more than once */ | ||
476 | if (ch->count-- > 1) { | 434 | if (ch->count-- > 1) { |
477 | /* Begin channel is open more than once */ | 435 | /* Begin channel is open more than once */ |
478 | /* ------------------------------------------------------------- | 436 | /* |
479 | Return without doing anything. Someone might still be using | 437 | * Return without doing anything. Someone might still |
480 | the channel. | 438 | * be using the channel. |
481 | ---------------------------------------------------------------- */ | 439 | */ |
482 | spin_unlock_irqrestore(&epca_lock, flags); | 440 | spin_unlock_irqrestore(&epca_lock, flags); |
483 | return; | 441 | return; |
484 | } /* End channel is open more than once */ | 442 | } |
485 | 443 | ||
486 | /* Port open only once go ahead with shutdown & reset */ | 444 | /* Port open only once go ahead with shutdown & reset */ |
487 | BUG_ON(ch->count < 0); | 445 | BUG_ON(ch->count < 0); |
488 | 446 | ||
489 | /* --------------------------------------------------------------- | 447 | /* |
490 | Let the rest of the driver know the channel is being closed. | 448 | * Let the rest of the driver know the channel is being closed. |
491 | This becomes important if an open is attempted before close | 449 | * This becomes important if an open is attempted before close |
492 | is finished. | 450 | * is finished. |
493 | ------------------------------------------------------------------ */ | 451 | */ |
494 | ch->asyncflags |= ASYNC_CLOSING; | 452 | ch->asyncflags |= ASYNC_CLOSING; |
495 | tty->closing = 1; | 453 | tty->closing = 1; |
496 | 454 | ||
@@ -498,7 +456,7 @@ static void pc_close(struct tty_struct * tty, struct file * filp) | |||
498 | 456 | ||
499 | if (ch->asyncflags & ASYNC_INITIALIZED) { | 457 | if (ch->asyncflags & ASYNC_INITIALIZED) { |
500 | /* Setup an event to indicate when the transmit buffer empties */ | 458 | /* Setup an event to indicate when the transmit buffer empties */ |
501 | setup_empty_event(tty, ch); | 459 | setup_empty_event(tty, ch); |
502 | tty_wait_until_sent(tty, 3000); /* 30 seconds timeout */ | 460 | tty_wait_until_sent(tty, 3000); /* 30 seconds timeout */ |
503 | } | 461 | } |
504 | if (tty->driver->flush_buffer) | 462 | if (tty->driver->flush_buffer) |
@@ -513,27 +471,24 @@ static void pc_close(struct tty_struct * tty, struct file * filp) | |||
513 | ch->tty = NULL; | 471 | ch->tty = NULL; |
514 | spin_unlock_irqrestore(&epca_lock, flags); | 472 | spin_unlock_irqrestore(&epca_lock, flags); |
515 | 473 | ||
516 | if (ch->blocked_open) { /* Begin if blocked_open */ | 474 | if (ch->blocked_open) { |
517 | if (ch->close_delay) | 475 | if (ch->close_delay) |
518 | msleep_interruptible(jiffies_to_msecs(ch->close_delay)); | 476 | msleep_interruptible(jiffies_to_msecs(ch->close_delay)); |
519 | wake_up_interruptible(&ch->open_wait); | 477 | wake_up_interruptible(&ch->open_wait); |
520 | } /* End if blocked_open */ | 478 | } |
521 | ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED | | 479 | ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED | |
522 | ASYNC_CLOSING); | 480 | ASYNC_CLOSING); |
523 | wake_up_interruptible(&ch->close_wait); | 481 | wake_up_interruptible(&ch->close_wait); |
524 | } /* End if ch != NULL */ | 482 | } |
525 | } /* End pc_close */ | 483 | } |
526 | |||
527 | /* ------------------ Begin shutdown ------------------------- */ | ||
528 | 484 | ||
529 | static void shutdown(struct channel *ch) | 485 | static void shutdown(struct channel *ch) |
530 | { /* Begin shutdown */ | 486 | { |
531 | |||
532 | unsigned long flags; | 487 | unsigned long flags; |
533 | struct tty_struct *tty; | 488 | struct tty_struct *tty; |
534 | struct board_chan __iomem *bc; | 489 | struct board_chan __iomem *bc; |
535 | 490 | ||
536 | if (!(ch->asyncflags & ASYNC_INITIALIZED)) | 491 | if (!(ch->asyncflags & ASYNC_INITIALIZED)) |
537 | return; | 492 | return; |
538 | 493 | ||
539 | spin_lock_irqsave(&epca_lock, flags); | 494 | spin_lock_irqsave(&epca_lock, flags); |
@@ -541,50 +496,40 @@ static void shutdown(struct channel *ch) | |||
541 | globalwinon(ch); | 496 | globalwinon(ch); |
542 | bc = ch->brdchan; | 497 | bc = ch->brdchan; |
543 | 498 | ||
544 | /* ------------------------------------------------------------------ | 499 | /* |
545 | In order for an event to be generated on the receipt of data the | 500 | * In order for an event to be generated on the receipt of data the |
546 | idata flag must be set. Since we are shutting down, this is not | 501 | * idata flag must be set. Since we are shutting down, this is not |
547 | necessary clear this flag. | 502 | * necessary clear this flag. |
548 | --------------------------------------------------------------------- */ | 503 | */ |
549 | |||
550 | if (bc) | 504 | if (bc) |
551 | writeb(0, &bc->idata); | 505 | writeb(0, &bc->idata); |
552 | tty = ch->tty; | 506 | tty = ch->tty; |
553 | 507 | ||
554 | /* ---------------------------------------------------------------- | 508 | /* If we're a modem control device and HUPCL is on, drop RTS & DTR. */ |
555 | If we're a modem control device and HUPCL is on, drop RTS & DTR. | ||
556 | ------------------------------------------------------------------ */ | ||
557 | |||
558 | if (tty->termios->c_cflag & HUPCL) { | 509 | if (tty->termios->c_cflag & HUPCL) { |
559 | ch->omodem &= ~(ch->m_rts | ch->m_dtr); | 510 | ch->omodem &= ~(ch->m_rts | ch->m_dtr); |
560 | fepcmd(ch, SETMODEM, 0, ch->m_dtr | ch->m_rts, 10, 1); | 511 | fepcmd(ch, SETMODEM, 0, ch->m_dtr | ch->m_rts, 10, 1); |
561 | } | 512 | } |
562 | memoff(ch); | 513 | memoff(ch); |
563 | 514 | ||
564 | /* ------------------------------------------------------------------ | 515 | /* |
565 | The channel has officialy been closed. The next time it is opened | 516 | * The channel has officialy been closed. The next time it is opened it |
566 | it will have to reinitialized. Set a flag to indicate this. | 517 | * will have to reinitialized. Set a flag to indicate this. |
567 | ---------------------------------------------------------------------- */ | 518 | */ |
568 | |||
569 | /* Prevent future Digi programmed interrupts from coming active */ | 519 | /* Prevent future Digi programmed interrupts from coming active */ |
570 | |||
571 | ch->asyncflags &= ~ASYNC_INITIALIZED; | 520 | ch->asyncflags &= ~ASYNC_INITIALIZED; |
572 | spin_unlock_irqrestore(&epca_lock, flags); | 521 | spin_unlock_irqrestore(&epca_lock, flags); |
573 | 522 | } | |
574 | } /* End shutdown */ | ||
575 | |||
576 | /* ------------------ Begin pc_hangup ------------------------- */ | ||
577 | 523 | ||
578 | static void pc_hangup(struct tty_struct *tty) | 524 | static void pc_hangup(struct tty_struct *tty) |
579 | { /* Begin pc_hangup */ | 525 | { |
580 | struct channel *ch; | 526 | struct channel *ch; |
581 | |||
582 | /* --------------------------------------------------------- | ||
583 | verifyChannel returns the channel from the tty struct | ||
584 | if it is valid. This serves as a sanity check. | ||
585 | ------------------------------------------------------------- */ | ||
586 | 527 | ||
587 | if ((ch = verifyChannel(tty)) != NULL) { /* Begin if ch != NULL */ | 528 | /* |
529 | * verifyChannel returns the channel from the tty struct if it is | ||
530 | * valid. This serves as a sanity check. | ||
531 | */ | ||
532 | if ((ch = verifyChannel(tty)) != NULL) { | ||
588 | unsigned long flags; | 533 | unsigned long flags; |
589 | 534 | ||
590 | if (tty->driver->flush_buffer) | 535 | if (tty->driver->flush_buffer) |
@@ -599,15 +544,12 @@ static void pc_hangup(struct tty_struct *tty) | |||
599 | ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED); | 544 | ch->asyncflags &= ~(ASYNC_NORMAL_ACTIVE | ASYNC_INITIALIZED); |
600 | spin_unlock_irqrestore(&epca_lock, flags); | 545 | spin_unlock_irqrestore(&epca_lock, flags); |
601 | wake_up_interruptible(&ch->open_wait); | 546 | wake_up_interruptible(&ch->open_wait); |
602 | } /* End if ch != NULL */ | 547 | } |
603 | 548 | } | |
604 | } /* End pc_hangup */ | ||
605 | |||
606 | /* ------------------ Begin pc_write ------------------------- */ | ||
607 | 549 | ||
608 | static int pc_write(struct tty_struct * tty, | 550 | static int pc_write(struct tty_struct *tty, |
609 | const unsigned char *buf, int bytesAvailable) | 551 | const unsigned char *buf, int bytesAvailable) |
610 | { /* Begin pc_write */ | 552 | { |
611 | unsigned int head, tail; | 553 | unsigned int head, tail; |
612 | int dataLen; | 554 | int dataLen; |
613 | int size; | 555 | int size; |
@@ -617,25 +559,23 @@ static int pc_write(struct tty_struct * tty, | |||
617 | int remain; | 559 | int remain; |
618 | struct board_chan __iomem *bc; | 560 | struct board_chan __iomem *bc; |
619 | 561 | ||
620 | /* ---------------------------------------------------------------- | 562 | /* |
621 | pc_write is primarily called directly by the kernel routine | 563 | * pc_write is primarily called directly by the kernel routine |
622 | tty_write (Though it can also be called by put_char) found in | 564 | * tty_write (Though it can also be called by put_char) found in |
623 | tty_io.c. pc_write is passed a line discipline buffer where | 565 | * tty_io.c. pc_write is passed a line discipline buffer where the data |
624 | the data to be written out is stored. The line discipline | 566 | * to be written out is stored. The line discipline implementation |
625 | implementation itself is done at the kernel level and is not | 567 | * itself is done at the kernel level and is not brought into the |
626 | brought into the driver. | 568 | * driver. |
627 | ------------------------------------------------------------------- */ | 569 | */ |
628 | |||
629 | /* --------------------------------------------------------- | ||
630 | verifyChannel returns the channel from the tty struct | ||
631 | if it is valid. This serves as a sanity check. | ||
632 | ------------------------------------------------------------- */ | ||
633 | 570 | ||
571 | /* | ||
572 | * verifyChannel returns the channel from the tty struct if it is | ||
573 | * valid. This serves as a sanity check. | ||
574 | */ | ||
634 | if ((ch = verifyChannel(tty)) == NULL) | 575 | if ((ch = verifyChannel(tty)) == NULL) |
635 | return 0; | 576 | return 0; |
636 | 577 | ||
637 | /* Make a pointer to the channel data structure found on the board. */ | 578 | /* Make a pointer to the channel data structure found on the board. */ |
638 | |||
639 | bc = ch->brdchan; | 579 | bc = ch->brdchan; |
640 | size = ch->txbufsize; | 580 | size = ch->txbufsize; |
641 | amountCopied = 0; | 581 | amountCopied = 0; |
@@ -650,37 +590,36 @@ static int pc_write(struct tty_struct * tty, | |||
650 | tail = readw(&bc->tout); | 590 | tail = readw(&bc->tout); |
651 | tail &= (size - 1); | 591 | tail &= (size - 1); |
652 | 592 | ||
653 | /* If head >= tail, head has not wrapped around. */ | 593 | if (head >= tail) { |
654 | if (head >= tail) { /* Begin head has not wrapped */ | 594 | /* head has not wrapped */ |
655 | /* --------------------------------------------------------------- | 595 | /* |
656 | remain (much like dataLen above) represents the total amount of | 596 | * remain (much like dataLen above) represents the total amount |
657 | space available on the card for data. Here dataLen represents | 597 | * of space available on the card for data. Here dataLen |
658 | the space existing between the head pointer and the end of | 598 | * represents the space existing between the head pointer and |
659 | buffer. This is important because a memcpy cannot be told to | 599 | * the end of buffer. This is important because a memcpy cannot |
660 | automatically wrap around when it hits the buffer end. | 600 | * be told to automatically wrap around when it hits the buffer |
661 | ------------------------------------------------------------------ */ | 601 | * end. |
602 | */ | ||
662 | dataLen = size - head; | 603 | dataLen = size - head; |
663 | remain = size - (head - tail) - 1; | 604 | remain = size - (head - tail) - 1; |
664 | } else { /* Begin head has wrapped around */ | 605 | } else { |
665 | 606 | /* head has wrapped around */ | |
666 | remain = tail - head - 1; | 607 | remain = tail - head - 1; |
667 | dataLen = remain; | 608 | dataLen = remain; |
668 | 609 | } | |
669 | } /* End head has wrapped around */ | 610 | /* |
670 | /* ------------------------------------------------------------------- | 611 | * Check the space on the card. If we have more data than space; reduce |
671 | Check the space on the card. If we have more data than | 612 | * the amount of data to fit the space. |
672 | space; reduce the amount of data to fit the space. | 613 | */ |
673 | ---------------------------------------------------------------------- */ | ||
674 | bytesAvailable = min(remain, bytesAvailable); | 614 | bytesAvailable = min(remain, bytesAvailable); |
675 | txwinon(ch); | 615 | txwinon(ch); |
676 | while (bytesAvailable > 0) | 616 | while (bytesAvailable > 0) { |
677 | { /* Begin while there is data to copy onto card */ | 617 | /* there is data to copy onto card */ |
678 | |||
679 | /* ----------------------------------------------------------------- | ||
680 | If head is not wrapped, the below will make sure the first | ||
681 | data copy fills to the end of card buffer. | ||
682 | ------------------------------------------------------------------- */ | ||
683 | 618 | ||
619 | /* | ||
620 | * If head is not wrapped, the below will make sure the first | ||
621 | * data copy fills to the end of card buffer. | ||
622 | */ | ||
684 | dataLen = min(bytesAvailable, dataLen); | 623 | dataLen = min(bytesAvailable, dataLen); |
685 | memcpy_toio(ch->txptr + head, buf, dataLen); | 624 | memcpy_toio(ch->txptr + head, buf, dataLen); |
686 | buf += dataLen; | 625 | buf += dataLen; |
@@ -692,7 +631,7 @@ static int pc_write(struct tty_struct * tty, | |||
692 | head = 0; | 631 | head = 0; |
693 | dataLen = tail; | 632 | dataLen = tail; |
694 | } | 633 | } |
695 | } /* End while there is data to copy onto card */ | 634 | } |
696 | ch->statusflags |= TXBUSY; | 635 | ch->statusflags |= TXBUSY; |
697 | globalwinon(ch); | 636 | globalwinon(ch); |
698 | writew(head, &bc->tin); | 637 | writew(head, &bc->tin); |
@@ -703,22 +642,16 @@ static int pc_write(struct tty_struct * tty, | |||
703 | } | 642 | } |
704 | memoff(ch); | 643 | memoff(ch); |
705 | spin_unlock_irqrestore(&epca_lock, flags); | 644 | spin_unlock_irqrestore(&epca_lock, flags); |
706 | return(amountCopied); | 645 | return amountCopied; |
707 | 646 | } | |
708 | } /* End pc_write */ | ||
709 | |||
710 | /* ------------------ Begin pc_put_char ------------------------- */ | ||
711 | 647 | ||
712 | static void pc_put_char(struct tty_struct *tty, unsigned char c) | 648 | static void pc_put_char(struct tty_struct *tty, unsigned char c) |
713 | { /* Begin pc_put_char */ | 649 | { |
714 | pc_write(tty, &c, 1); | 650 | pc_write(tty, &c, 1); |
715 | } /* End pc_put_char */ | 651 | } |
716 | |||
717 | /* ------------------ Begin pc_write_room ------------------------- */ | ||
718 | 652 | ||
719 | static int pc_write_room(struct tty_struct *tty) | 653 | static int pc_write_room(struct tty_struct *tty) |
720 | { /* Begin pc_write_room */ | 654 | { |
721 | |||
722 | int remain; | 655 | int remain; |
723 | struct channel *ch; | 656 | struct channel *ch; |
724 | unsigned long flags; | 657 | unsigned long flags; |
@@ -727,11 +660,10 @@ static int pc_write_room(struct tty_struct *tty) | |||
727 | 660 | ||
728 | remain = 0; | 661 | remain = 0; |
729 | 662 | ||
730 | /* --------------------------------------------------------- | 663 | /* |
731 | verifyChannel returns the channel from the tty struct | 664 | * verifyChannel returns the channel from the tty struct if it is |
732 | if it is valid. This serves as a sanity check. | 665 | * valid. This serves as a sanity check. |
733 | ------------------------------------------------------------- */ | 666 | */ |
734 | |||
735 | if ((ch = verifyChannel(tty)) != NULL) { | 667 | if ((ch = verifyChannel(tty)) != NULL) { |
736 | spin_lock_irqsave(&epca_lock, flags); | 668 | spin_lock_irqsave(&epca_lock, flags); |
737 | globalwinon(ch); | 669 | globalwinon(ch); |
@@ -757,14 +689,10 @@ static int pc_write_room(struct tty_struct *tty) | |||
757 | } | 689 | } |
758 | /* Return how much room is left on card */ | 690 | /* Return how much room is left on card */ |
759 | return remain; | 691 | return remain; |
760 | 692 | } | |
761 | } /* End pc_write_room */ | ||
762 | |||
763 | /* ------------------ Begin pc_chars_in_buffer ---------------------- */ | ||
764 | 693 | ||
765 | static int pc_chars_in_buffer(struct tty_struct *tty) | 694 | static int pc_chars_in_buffer(struct tty_struct *tty) |
766 | { /* Begin pc_chars_in_buffer */ | 695 | { |
767 | |||
768 | int chars; | 696 | int chars; |
769 | unsigned int ctail, head, tail; | 697 | unsigned int ctail, head, tail; |
770 | int remain; | 698 | int remain; |
@@ -772,13 +700,12 @@ static int pc_chars_in_buffer(struct tty_struct *tty) | |||
772 | struct channel *ch; | 700 | struct channel *ch; |
773 | struct board_chan __iomem *bc; | 701 | struct board_chan __iomem *bc; |
774 | 702 | ||
775 | /* --------------------------------------------------------- | 703 | /* |
776 | verifyChannel returns the channel from the tty struct | 704 | * verifyChannel returns the channel from the tty struct if it is |
777 | if it is valid. This serves as a sanity check. | 705 | * valid. This serves as a sanity check. |
778 | ------------------------------------------------------------- */ | 706 | */ |
779 | |||
780 | if ((ch = verifyChannel(tty)) == NULL) | 707 | if ((ch = verifyChannel(tty)) == NULL) |
781 | return(0); | 708 | return 0; |
782 | 709 | ||
783 | spin_lock_irqsave(&epca_lock, flags); | 710 | spin_lock_irqsave(&epca_lock, flags); |
784 | globalwinon(ch); | 711 | globalwinon(ch); |
@@ -793,45 +720,40 @@ static int pc_chars_in_buffer(struct tty_struct *tty) | |||
793 | else { /* Begin if some space on the card has been used */ | 720 | else { /* Begin if some space on the card has been used */ |
794 | head = readw(&bc->tin) & (ch->txbufsize - 1); | 721 | head = readw(&bc->tin) & (ch->txbufsize - 1); |
795 | tail &= (ch->txbufsize - 1); | 722 | tail &= (ch->txbufsize - 1); |
796 | /* -------------------------------------------------------------- | 723 | /* |
797 | The logic here is basically opposite of the above pc_write_room | 724 | * The logic here is basically opposite of the above |
798 | here we are finding the amount of bytes in the buffer filled. | 725 | * pc_write_room here we are finding the amount of bytes in the |
799 | Not the amount of bytes empty. | 726 | * buffer filled. Not the amount of bytes empty. |
800 | ------------------------------------------------------------------- */ | 727 | */ |
801 | if ((remain = tail - head - 1) < 0 ) | 728 | if ((remain = tail - head - 1) < 0 ) |
802 | remain += ch->txbufsize; | 729 | remain += ch->txbufsize; |
803 | chars = (int)(ch->txbufsize - remain); | 730 | chars = (int)(ch->txbufsize - remain); |
804 | /* ------------------------------------------------------------- | 731 | /* |
805 | Make it possible to wakeup anything waiting for output | 732 | * Make it possible to wakeup anything waiting for output in |
806 | in tty_ioctl.c, etc. | 733 | * tty_ioctl.c, etc. |
807 | 734 | * | |
808 | If not already set. Setup an event to indicate when the | 735 | * If not already set. Setup an event to indicate when the |
809 | transmit buffer empties | 736 | * transmit buffer empties. |
810 | ----------------------------------------------------------------- */ | 737 | */ |
811 | if (!(ch->statusflags & EMPTYWAIT)) | 738 | if (!(ch->statusflags & EMPTYWAIT)) |
812 | setup_empty_event(tty,ch); | 739 | setup_empty_event(tty,ch); |
813 | |||
814 | } /* End if some space on the card has been used */ | 740 | } /* End if some space on the card has been used */ |
815 | memoff(ch); | 741 | memoff(ch); |
816 | spin_unlock_irqrestore(&epca_lock, flags); | 742 | spin_unlock_irqrestore(&epca_lock, flags); |
817 | /* Return number of characters residing on card. */ | 743 | /* Return number of characters residing on card. */ |
818 | return(chars); | 744 | return chars; |
819 | 745 | } | |
820 | } /* End pc_chars_in_buffer */ | ||
821 | |||
822 | /* ------------------ Begin pc_flush_buffer ---------------------- */ | ||
823 | 746 | ||
824 | static void pc_flush_buffer(struct tty_struct *tty) | 747 | static void pc_flush_buffer(struct tty_struct *tty) |
825 | { /* Begin pc_flush_buffer */ | 748 | { |
826 | |||
827 | unsigned int tail; | 749 | unsigned int tail; |
828 | unsigned long flags; | 750 | unsigned long flags; |
829 | struct channel *ch; | 751 | struct channel *ch; |
830 | struct board_chan __iomem *bc; | 752 | struct board_chan __iomem *bc; |
831 | /* --------------------------------------------------------- | 753 | /* |
832 | verifyChannel returns the channel from the tty struct | 754 | * verifyChannel returns the channel from the tty struct if it is |
833 | if it is valid. This serves as a sanity check. | 755 | * valid. This serves as a sanity check. |
834 | ------------------------------------------------------------- */ | 756 | */ |
835 | if ((ch = verifyChannel(tty)) == NULL) | 757 | if ((ch = verifyChannel(tty)) == NULL) |
836 | return; | 758 | return; |
837 | 759 | ||
@@ -844,51 +766,47 @@ static void pc_flush_buffer(struct tty_struct *tty) | |||
844 | memoff(ch); | 766 | memoff(ch); |
845 | spin_unlock_irqrestore(&epca_lock, flags); | 767 | spin_unlock_irqrestore(&epca_lock, flags); |
846 | tty_wakeup(tty); | 768 | tty_wakeup(tty); |
847 | } /* End pc_flush_buffer */ | 769 | } |
848 | |||
849 | /* ------------------ Begin pc_flush_chars ---------------------- */ | ||
850 | 770 | ||
851 | static void pc_flush_chars(struct tty_struct *tty) | 771 | static void pc_flush_chars(struct tty_struct *tty) |
852 | { /* Begin pc_flush_chars */ | 772 | { |
853 | struct channel * ch; | 773 | struct channel *ch; |
854 | /* --------------------------------------------------------- | 774 | /* |
855 | verifyChannel returns the channel from the tty struct | 775 | * verifyChannel returns the channel from the tty struct if it is |
856 | if it is valid. This serves as a sanity check. | 776 | * valid. This serves as a sanity check. |
857 | ------------------------------------------------------------- */ | 777 | */ |
858 | if ((ch = verifyChannel(tty)) != NULL) { | 778 | if ((ch = verifyChannel(tty)) != NULL) { |
859 | unsigned long flags; | 779 | unsigned long flags; |
860 | spin_lock_irqsave(&epca_lock, flags); | 780 | spin_lock_irqsave(&epca_lock, flags); |
861 | /* ---------------------------------------------------------------- | 781 | /* |
862 | If not already set and the transmitter is busy setup an event | 782 | * If not already set and the transmitter is busy setup an |
863 | to indicate when the transmit empties. | 783 | * event to indicate when the transmit empties. |
864 | ------------------------------------------------------------------- */ | 784 | */ |
865 | if ((ch->statusflags & TXBUSY) && !(ch->statusflags & EMPTYWAIT)) | 785 | if ((ch->statusflags & TXBUSY) && !(ch->statusflags & EMPTYWAIT)) |
866 | setup_empty_event(tty,ch); | 786 | setup_empty_event(tty,ch); |
867 | spin_unlock_irqrestore(&epca_lock, flags); | 787 | spin_unlock_irqrestore(&epca_lock, flags); |
868 | } | 788 | } |
869 | } /* End pc_flush_chars */ | 789 | } |
870 | |||
871 | /* ------------------ Begin block_til_ready ---------------------- */ | ||
872 | 790 | ||
873 | static int block_til_ready(struct tty_struct *tty, | 791 | static int block_til_ready(struct tty_struct *tty, |
874 | struct file *filp, struct channel *ch) | 792 | struct file *filp, struct channel *ch) |
875 | { /* Begin block_til_ready */ | 793 | { |
876 | DECLARE_WAITQUEUE(wait,current); | 794 | DECLARE_WAITQUEUE(wait,current); |
877 | int retval, do_clocal = 0; | 795 | int retval, do_clocal = 0; |
878 | unsigned long flags; | 796 | unsigned long flags; |
879 | 797 | ||
880 | if (tty_hung_up_p(filp)) { | 798 | if (tty_hung_up_p(filp)) { |
881 | if (ch->asyncflags & ASYNC_HUP_NOTIFY) | 799 | if (ch->asyncflags & ASYNC_HUP_NOTIFY) |
882 | retval = -EAGAIN; | 800 | retval = -EAGAIN; |
883 | else | 801 | else |
884 | retval = -ERESTARTSYS; | 802 | retval = -ERESTARTSYS; |
885 | return(retval); | 803 | return retval; |
886 | } | 804 | } |
887 | 805 | ||
888 | /* ----------------------------------------------------------------- | 806 | /* |
889 | If the device is in the middle of being closed, then block | 807 | * If the device is in the middle of being closed, then block until |
890 | until it's done, and then try again. | 808 | * it's done, and then try again. |
891 | -------------------------------------------------------------------- */ | 809 | */ |
892 | if (ch->asyncflags & ASYNC_CLOSING) { | 810 | if (ch->asyncflags & ASYNC_CLOSING) { |
893 | interruptible_sleep_on(&ch->close_wait); | 811 | interruptible_sleep_on(&ch->close_wait); |
894 | 812 | ||
@@ -899,17 +817,17 @@ static int block_til_ready(struct tty_struct *tty, | |||
899 | } | 817 | } |
900 | 818 | ||
901 | if (filp->f_flags & O_NONBLOCK) { | 819 | if (filp->f_flags & O_NONBLOCK) { |
902 | /* ----------------------------------------------------------------- | 820 | /* |
903 | If non-blocking mode is set, then make the check up front | 821 | * If non-blocking mode is set, then make the check up front |
904 | and then exit. | 822 | * and then exit. |
905 | -------------------------------------------------------------------- */ | 823 | */ |
906 | ch->asyncflags |= ASYNC_NORMAL_ACTIVE; | 824 | ch->asyncflags |= ASYNC_NORMAL_ACTIVE; |
907 | return 0; | 825 | return 0; |
908 | } | 826 | } |
909 | if (tty->termios->c_cflag & CLOCAL) | 827 | if (tty->termios->c_cflag & CLOCAL) |
910 | do_clocal = 1; | 828 | do_clocal = 1; |
911 | /* Block waiting for the carrier detect and the line to become free */ | 829 | /* Block waiting for the carrier detect and the line to become free */ |
912 | 830 | ||
913 | retval = 0; | 831 | retval = 0; |
914 | add_wait_queue(&ch->open_wait, &wait); | 832 | add_wait_queue(&ch->open_wait, &wait); |
915 | 833 | ||
@@ -918,19 +836,18 @@ static int block_til_ready(struct tty_struct *tty, | |||
918 | if (!tty_hung_up_p(filp)) | 836 | if (!tty_hung_up_p(filp)) |
919 | ch->count--; | 837 | ch->count--; |
920 | ch->blocked_open++; | 838 | ch->blocked_open++; |
921 | while(1) | 839 | while (1) { |
922 | { /* Begin forever while */ | ||
923 | set_current_state(TASK_INTERRUPTIBLE); | 840 | set_current_state(TASK_INTERRUPTIBLE); |
924 | if (tty_hung_up_p(filp) || | 841 | if (tty_hung_up_p(filp) || |
925 | !(ch->asyncflags & ASYNC_INITIALIZED)) | 842 | !(ch->asyncflags & ASYNC_INITIALIZED)) |
926 | { | 843 | { |
927 | if (ch->asyncflags & ASYNC_HUP_NOTIFY) | 844 | if (ch->asyncflags & ASYNC_HUP_NOTIFY) |
928 | retval = -EAGAIN; | 845 | retval = -EAGAIN; |
929 | else | 846 | else |
930 | retval = -ERESTARTSYS; | 847 | retval = -ERESTARTSYS; |
931 | break; | 848 | break; |
932 | } | 849 | } |
933 | if (!(ch->asyncflags & ASYNC_CLOSING) && | 850 | if (!(ch->asyncflags & ASYNC_CLOSING) && |
934 | (do_clocal || (ch->imodem & ch->dcd))) | 851 | (do_clocal || (ch->imodem & ch->dcd))) |
935 | break; | 852 | break; |
936 | if (signal_pending(current)) { | 853 | if (signal_pending(current)) { |
@@ -938,16 +855,15 @@ static int block_til_ready(struct tty_struct *tty, | |||
938 | break; | 855 | break; |
939 | } | 856 | } |
940 | spin_unlock_irqrestore(&epca_lock, flags); | 857 | spin_unlock_irqrestore(&epca_lock, flags); |
941 | /* --------------------------------------------------------------- | 858 | /* |
942 | Allow someone else to be scheduled. We will occasionally go | 859 | * Allow someone else to be scheduled. We will occasionally go |
943 | through this loop until one of the above conditions change. | 860 | * through this loop until one of the above conditions change. |
944 | The below schedule call will allow other processes to enter and | 861 | * The below schedule call will allow other processes to enter |
945 | prevent this loop from hogging the cpu. | 862 | * and prevent this loop from hogging the cpu. |
946 | ------------------------------------------------------------------ */ | 863 | */ |
947 | schedule(); | 864 | schedule(); |
948 | spin_lock_irqsave(&epca_lock, flags); | 865 | spin_lock_irqsave(&epca_lock, flags); |
949 | 866 | } | |
950 | } /* End forever while */ | ||
951 | 867 | ||
952 | __set_current_state(TASK_RUNNING); | 868 | __set_current_state(TASK_RUNNING); |
953 | remove_wait_queue(&ch->open_wait, &wait); | 869 | remove_wait_queue(&ch->open_wait, &wait); |
@@ -962,13 +878,10 @@ static int block_til_ready(struct tty_struct *tty, | |||
962 | 878 | ||
963 | ch->asyncflags |= ASYNC_NORMAL_ACTIVE; | 879 | ch->asyncflags |= ASYNC_NORMAL_ACTIVE; |
964 | return 0; | 880 | return 0; |
965 | } /* End block_til_ready */ | 881 | } |
966 | |||
967 | /* ------------------ Begin pc_open ---------------------- */ | ||
968 | 882 | ||
969 | static int pc_open(struct tty_struct *tty, struct file * filp) | 883 | static int pc_open(struct tty_struct *tty, struct file * filp) |
970 | { /* Begin pc_open */ | 884 | { |
971 | |||
972 | struct channel *ch; | 885 | struct channel *ch; |
973 | unsigned long flags; | 886 | unsigned long flags; |
974 | int line, retval, boardnum; | 887 | int line, retval, boardnum; |
@@ -984,12 +897,11 @@ static int pc_open(struct tty_struct *tty, struct file * filp) | |||
984 | 897 | ||
985 | /* Check status of board configured in system. */ | 898 | /* Check status of board configured in system. */ |
986 | 899 | ||
987 | /* ----------------------------------------------------------------- | 900 | /* |
988 | I check to see if the epca_setup routine detected an user error. | 901 | * I check to see if the epca_setup routine detected an user error. It |
989 | It might be better to put this in pc_init, but for the moment it | 902 | * might be better to put this in pc_init, but for the moment it goes |
990 | goes here. | 903 | * here. |
991 | ---------------------------------------------------------------------- */ | 904 | */ |
992 | |||
993 | if (invalid_lilo_config) { | 905 | if (invalid_lilo_config) { |
994 | if (setup_error_code & INVALID_BOARD_TYPE) | 906 | if (setup_error_code & INVALID_BOARD_TYPE) |
995 | printk(KERN_ERR "epca: pc_open: Invalid board type specified in kernel options.\n"); | 907 | printk(KERN_ERR "epca: pc_open: Invalid board type specified in kernel options.\n"); |
@@ -1010,49 +922,48 @@ static int pc_open(struct tty_struct *tty, struct file * filp) | |||
1010 | tty->driver_data = NULL; /* Mark this device as 'down' */ | 922 | tty->driver_data = NULL; /* Mark this device as 'down' */ |
1011 | return(-ENODEV); | 923 | return(-ENODEV); |
1012 | } | 924 | } |
1013 | 925 | ||
1014 | if ((bc = ch->brdchan) == 0) { | 926 | if ((bc = ch->brdchan) == 0) { |
1015 | tty->driver_data = NULL; | 927 | tty->driver_data = NULL; |
1016 | return -ENODEV; | 928 | return -ENODEV; |
1017 | } | 929 | } |
1018 | 930 | ||
1019 | spin_lock_irqsave(&epca_lock, flags); | 931 | spin_lock_irqsave(&epca_lock, flags); |
1020 | /* ------------------------------------------------------------------ | 932 | /* |
1021 | Every time a channel is opened, increment a counter. This is | 933 | * Every time a channel is opened, increment a counter. This is |
1022 | necessary because we do not wish to flush and shutdown the channel | 934 | * necessary because we do not wish to flush and shutdown the channel |
1023 | until the last app holding the channel open, closes it. | 935 | * until the last app holding the channel open, closes it. |
1024 | --------------------------------------------------------------------- */ | 936 | */ |
1025 | ch->count++; | 937 | ch->count++; |
1026 | /* ---------------------------------------------------------------- | 938 | /* |
1027 | Set a kernel structures pointer to our local channel | 939 | * Set a kernel structures pointer to our local channel structure. This |
1028 | structure. This way we can get to it when passed only | 940 | * way we can get to it when passed only a tty struct. |
1029 | a tty struct. | 941 | */ |
1030 | ------------------------------------------------------------------ */ | ||
1031 | tty->driver_data = ch; | 942 | tty->driver_data = ch; |
1032 | /* ---------------------------------------------------------------- | 943 | /* |
1033 | If this is the first time the channel has been opened, initialize | 944 | * If this is the first time the channel has been opened, initialize |
1034 | the tty->termios struct otherwise let pc_close handle it. | 945 | * the tty->termios struct otherwise let pc_close handle it. |
1035 | -------------------------------------------------------------------- */ | 946 | */ |
1036 | globalwinon(ch); | 947 | globalwinon(ch); |
1037 | ch->statusflags = 0; | 948 | ch->statusflags = 0; |
1038 | 949 | ||
1039 | /* Save boards current modem status */ | 950 | /* Save boards current modem status */ |
1040 | ch->imodem = readb(&bc->mstat); | 951 | ch->imodem = readb(&bc->mstat); |
1041 | 952 | ||
1042 | /* ---------------------------------------------------------------- | 953 | /* |
1043 | Set receive head and tail ptrs to each other. This indicates | 954 | * Set receive head and tail ptrs to each other. This indicates no data |
1044 | no data available to read. | 955 | * available to read. |
1045 | ----------------------------------------------------------------- */ | 956 | */ |
1046 | head = readw(&bc->rin); | 957 | head = readw(&bc->rin); |
1047 | writew(head, &bc->rout); | 958 | writew(head, &bc->rout); |
1048 | 959 | ||
1049 | /* Set the channels associated tty structure */ | 960 | /* Set the channels associated tty structure */ |
1050 | ch->tty = tty; | 961 | ch->tty = tty; |
1051 | 962 | ||
1052 | /* ----------------------------------------------------------------- | 963 | /* |
1053 | The below routine generally sets up parity, baud, flow control | 964 | * The below routine generally sets up parity, baud, flow control |
1054 | issues, etc.... It effect both control flags and input flags. | 965 | * issues, etc.... It effect both control flags and input flags. |
1055 | -------------------------------------------------------------------- */ | 966 | */ |
1056 | epcaparam(tty,ch); | 967 | epcaparam(tty,ch); |
1057 | ch->asyncflags |= ASYNC_INITIALIZED; | 968 | ch->asyncflags |= ASYNC_INITIALIZED; |
1058 | memoff(ch); | 969 | memoff(ch); |
@@ -1061,10 +972,10 @@ static int pc_open(struct tty_struct *tty, struct file * filp) | |||
1061 | retval = block_til_ready(tty, filp, ch); | 972 | retval = block_til_ready(tty, filp, ch); |
1062 | if (retval) | 973 | if (retval) |
1063 | return retval; | 974 | return retval; |
1064 | /* ------------------------------------------------------------- | 975 | /* |
1065 | Set this again in case a hangup set it to zero while this | 976 | * Set this again in case a hangup set it to zero while this open() was |
1066 | open() was waiting for the line... | 977 | * waiting for the line... |
1067 | --------------------------------------------------------------- */ | 978 | */ |
1068 | spin_lock_irqsave(&epca_lock, flags); | 979 | spin_lock_irqsave(&epca_lock, flags); |
1069 | ch->tty = tty; | 980 | ch->tty = tty; |
1070 | globalwinon(ch); | 981 | globalwinon(ch); |
@@ -1073,13 +984,12 @@ static int pc_open(struct tty_struct *tty, struct file * filp) | |||
1073 | memoff(ch); | 984 | memoff(ch); |
1074 | spin_unlock_irqrestore(&epca_lock, flags); | 985 | spin_unlock_irqrestore(&epca_lock, flags); |
1075 | return 0; | 986 | return 0; |
1076 | } /* End pc_open */ | 987 | } |
1077 | 988 | ||
1078 | static int __init epca_module_init(void) | 989 | static int __init epca_module_init(void) |
1079 | { /* Begin init_module */ | 990 | { |
1080 | return pc_init(); | 991 | return pc_init(); |
1081 | } | 992 | } |
1082 | |||
1083 | module_init(epca_module_init); | 993 | module_init(epca_module_init); |
1084 | 994 | ||
1085 | static struct pci_driver epca_driver; | 995 | static struct pci_driver epca_driver; |
@@ -1092,8 +1002,7 @@ static void __exit epca_module_exit(void) | |||
1092 | 1002 | ||
1093 | del_timer_sync(&epca_timer); | 1003 | del_timer_sync(&epca_timer); |
1094 | 1004 | ||
1095 | if ((tty_unregister_driver(pc_driver)) || | 1005 | if (tty_unregister_driver(pc_driver) || tty_unregister_driver(pc_info)) |
1096 | (tty_unregister_driver(pc_info))) | ||
1097 | { | 1006 | { |
1098 | printk(KERN_WARNING "epca: cleanup_module failed to un-register tty driver\n"); | 1007 | printk(KERN_WARNING "epca: cleanup_module failed to un-register tty driver\n"); |
1099 | return; | 1008 | return; |
@@ -1101,23 +1010,20 @@ static void __exit epca_module_exit(void) | |||
1101 | put_tty_driver(pc_driver); | 1010 | put_tty_driver(pc_driver); |
1102 | put_tty_driver(pc_info); | 1011 | put_tty_driver(pc_info); |
1103 | 1012 | ||
1104 | for (crd = 0; crd < num_cards; crd++) { /* Begin for each card */ | 1013 | for (crd = 0; crd < num_cards; crd++) { |
1105 | bd = &boards[crd]; | 1014 | bd = &boards[crd]; |
1106 | if (!bd) | 1015 | if (!bd) { /* sanity check */ |
1107 | { /* Begin sanity check */ | ||
1108 | printk(KERN_ERR "<Error> - Digi : cleanup_module failed\n"); | 1016 | printk(KERN_ERR "<Error> - Digi : cleanup_module failed\n"); |
1109 | return; | 1017 | return; |
1110 | } /* End sanity check */ | 1018 | } |
1111 | ch = card_ptr[crd]; | 1019 | ch = card_ptr[crd]; |
1112 | for (count = 0; count < bd->numports; count++, ch++) | 1020 | for (count = 0; count < bd->numports; count++, ch++) { |
1113 | { /* Begin for each port */ | ||
1114 | if (ch && ch->tty) | 1021 | if (ch && ch->tty) |
1115 | tty_hangup(ch->tty); | 1022 | tty_hangup(ch->tty); |
1116 | } /* End for each port */ | 1023 | } |
1117 | } /* End for each card */ | 1024 | } |
1118 | pci_unregister_driver (&epca_driver); | 1025 | pci_unregister_driver(&epca_driver); |
1119 | } | 1026 | } |
1120 | |||
1121 | module_exit(epca_module_exit); | 1027 | module_exit(epca_module_exit); |
1122 | 1028 | ||
1123 | static const struct tty_operations pc_ops = { | 1029 | static const struct tty_operations pc_ops = { |
@@ -1148,10 +1054,8 @@ static struct tty_operations info_ops = { | |||
1148 | .ioctl = info_ioctl, | 1054 | .ioctl = info_ioctl, |
1149 | }; | 1055 | }; |
1150 | 1056 | ||
1151 | /* ------------------ Begin pc_init ---------------------- */ | ||
1152 | |||
1153 | static int __init pc_init(void) | 1057 | static int __init pc_init(void) |
1154 | { /* Begin pc_init */ | 1058 | { |
1155 | int crd; | 1059 | int crd; |
1156 | struct board_info *bd; | 1060 | struct board_info *bd; |
1157 | unsigned char board_id = 0; | 1061 | unsigned char board_id = 0; |
@@ -1169,63 +1073,57 @@ static int __init pc_init(void) | |||
1169 | if (!pc_info) | 1073 | if (!pc_info) |
1170 | goto out2; | 1074 | goto out2; |
1171 | 1075 | ||
1172 | /* ----------------------------------------------------------------------- | 1076 | /* |
1173 | If epca_setup has not been ran by LILO set num_cards to defaults; copy | 1077 | * If epca_setup has not been ran by LILO set num_cards to defaults; |
1174 | board structure defined by digiConfig into drivers board structure. | 1078 | * copy board structure defined by digiConfig into drivers board |
1175 | Note : If LILO has ran epca_setup then epca_setup will handle defining | 1079 | * structure. Note : If LILO has ran epca_setup then epca_setup will |
1176 | num_cards as well as copying the data into the board structure. | 1080 | * handle defining num_cards as well as copying the data into the board |
1177 | -------------------------------------------------------------------------- */ | 1081 | * structure. |
1178 | if (!liloconfig) { /* Begin driver has been configured via. epcaconfig */ | 1082 | */ |
1179 | 1083 | if (!liloconfig) { | |
1084 | /* driver has been configured via. epcaconfig */ | ||
1180 | nbdevs = NBDEVS; | 1085 | nbdevs = NBDEVS; |
1181 | num_cards = NUMCARDS; | 1086 | num_cards = NUMCARDS; |
1182 | memcpy((void *)&boards, (void *)&static_boards, | 1087 | memcpy(&boards, &static_boards, |
1183 | (sizeof(struct board_info) * NUMCARDS)); | 1088 | sizeof(struct board_info) * NUMCARDS); |
1184 | } /* End driver has been configured via. epcaconfig */ | 1089 | } |
1185 | |||
1186 | /* ----------------------------------------------------------------- | ||
1187 | Note : If lilo was used to configure the driver and the | ||
1188 | ignore epcaconfig option was choosen (digiepca=2) then | ||
1189 | nbdevs and num_cards will equal 0 at this point. This is | ||
1190 | okay; PCI cards will still be picked up if detected. | ||
1191 | --------------------------------------------------------------------- */ | ||
1192 | |||
1193 | /* ----------------------------------------------------------- | ||
1194 | Set up interrupt, we will worry about memory allocation in | ||
1195 | post_fep_init. | ||
1196 | --------------------------------------------------------------- */ | ||
1197 | 1090 | ||
1091 | /* | ||
1092 | * Note : If lilo was used to configure the driver and the ignore | ||
1093 | * epcaconfig option was choosen (digiepca=2) then nbdevs and num_cards | ||
1094 | * will equal 0 at this point. This is okay; PCI cards will still be | ||
1095 | * picked up if detected. | ||
1096 | */ | ||
1198 | 1097 | ||
1098 | /* | ||
1099 | * Set up interrupt, we will worry about memory allocation in | ||
1100 | * post_fep_init. | ||
1101 | */ | ||
1199 | printk(KERN_INFO "DIGI epca driver version %s loaded.\n",VERSION); | 1102 | printk(KERN_INFO "DIGI epca driver version %s loaded.\n",VERSION); |
1200 | 1103 | ||
1201 | /* ------------------------------------------------------------------ | 1104 | /* |
1202 | NOTE : This code assumes that the number of ports found in | 1105 | * NOTE : This code assumes that the number of ports found in the |
1203 | the boards array is correct. This could be wrong if | 1106 | * boards array is correct. This could be wrong if the card in question |
1204 | the card in question is PCI (And therefore has no ports | 1107 | * is PCI (And therefore has no ports entry in the boards structure.) |
1205 | entry in the boards structure.) The rest of the | 1108 | * The rest of the information will be valid for PCI because the |
1206 | information will be valid for PCI because the beginning | 1109 | * beginning of pc_init scans for PCI and determines i/o and base |
1207 | of pc_init scans for PCI and determines i/o and base | 1110 | * memory addresses. I am not sure if it is possible to read the number |
1208 | memory addresses. I am not sure if it is possible to | 1111 | * of ports supported by the card prior to it being booted (Since that |
1209 | read the number of ports supported by the card prior to | 1112 | * is the state it is in when pc_init is run). Because it is not |
1210 | it being booted (Since that is the state it is in when | 1113 | * possible to query the number of supported ports until after the card |
1211 | pc_init is run). Because it is not possible to query the | 1114 | * has booted; we are required to calculate the card_ptrs as the card |
1212 | number of supported ports until after the card has booted; | 1115 | * is initialized (Inside post_fep_init). The negative thing about this |
1213 | we are required to calculate the card_ptrs as the card is | 1116 | * approach is that digiDload's call to GET_INFO will have a bad port |
1214 | is initialized (Inside post_fep_init). The negative thing | 1117 | * value. (Since this is called prior to post_fep_init.) |
1215 | about this approach is that digiDload's call to GET_INFO | 1118 | */ |
1216 | will have a bad port value. (Since this is called prior | ||
1217 | to post_fep_init.) | ||
1218 | |||
1219 | --------------------------------------------------------------------- */ | ||
1220 | |||
1221 | pci_boards_found = 0; | 1119 | pci_boards_found = 0; |
1222 | if(num_cards < MAXBOARDS) | 1120 | if (num_cards < MAXBOARDS) |
1223 | pci_boards_found += init_PCI(); | 1121 | pci_boards_found += init_PCI(); |
1224 | num_cards += pci_boards_found; | 1122 | num_cards += pci_boards_found; |
1225 | 1123 | ||
1226 | pc_driver->owner = THIS_MODULE; | 1124 | pc_driver->owner = THIS_MODULE; |
1227 | pc_driver->name = "ttyD"; | 1125 | pc_driver->name = "ttyD"; |
1228 | pc_driver->major = DIGI_MAJOR; | 1126 | pc_driver->major = DIGI_MAJOR; |
1229 | pc_driver->minor_start = 0; | 1127 | pc_driver->minor_start = 0; |
1230 | pc_driver->type = TTY_DRIVER_TYPE_SERIAL; | 1128 | pc_driver->type = TTY_DRIVER_TYPE_SERIAL; |
1231 | pc_driver->subtype = SERIAL_TYPE_NORMAL; | 1129 | pc_driver->subtype = SERIAL_TYPE_NORMAL; |
@@ -1256,120 +1154,108 @@ static int __init pc_init(void) | |||
1256 | tty_set_operations(pc_info, &info_ops); | 1154 | tty_set_operations(pc_info, &info_ops); |
1257 | 1155 | ||
1258 | 1156 | ||
1259 | for (crd = 0; crd < num_cards; crd++) | 1157 | for (crd = 0; crd < num_cards; crd++) { |
1260 | { /* Begin for each card */ | 1158 | /* |
1261 | 1159 | * This is where the appropriate memory handlers for the | |
1262 | /* ------------------------------------------------------------------ | 1160 | * hardware is set. Everything at runtime blindly jumps through |
1263 | This is where the appropriate memory handlers for the hardware is | 1161 | * these vectors. |
1264 | set. Everything at runtime blindly jumps through these vectors. | 1162 | */ |
1265 | ---------------------------------------------------------------------- */ | ||
1266 | 1163 | ||
1267 | /* defined in epcaconfig.h */ | 1164 | /* defined in epcaconfig.h */ |
1268 | bd = &boards[crd]; | 1165 | bd = &boards[crd]; |
1269 | 1166 | ||
1270 | switch (bd->type) | 1167 | switch (bd->type) { |
1271 | { /* Begin switch on bd->type {board type} */ | 1168 | case PCXEM: |
1272 | case PCXEM: | 1169 | case EISAXEM: |
1273 | case EISAXEM: | 1170 | bd->memwinon = pcxem_memwinon; |
1274 | bd->memwinon = pcxem_memwinon ; | 1171 | bd->memwinoff = pcxem_memwinoff; |
1275 | bd->memwinoff = pcxem_memwinoff ; | 1172 | bd->globalwinon = pcxem_globalwinon; |
1276 | bd->globalwinon = pcxem_globalwinon ; | 1173 | bd->txwinon = pcxem_txwinon; |
1277 | bd->txwinon = pcxem_txwinon ; | 1174 | bd->rxwinon = pcxem_rxwinon; |
1278 | bd->rxwinon = pcxem_rxwinon ; | 1175 | bd->memoff = pcxem_memoff; |
1279 | bd->memoff = pcxem_memoff ; | 1176 | bd->assertgwinon = dummy_assertgwinon; |
1280 | bd->assertgwinon = dummy_assertgwinon; | 1177 | bd->assertmemoff = dummy_assertmemoff; |
1281 | bd->assertmemoff = dummy_assertmemoff; | ||
1282 | break; | ||
1283 | |||
1284 | case PCIXEM: | ||
1285 | case PCIXRJ: | ||
1286 | case PCIXR: | ||
1287 | bd->memwinon = dummy_memwinon; | ||
1288 | bd->memwinoff = dummy_memwinoff; | ||
1289 | bd->globalwinon = dummy_globalwinon; | ||
1290 | bd->txwinon = dummy_txwinon; | ||
1291 | bd->rxwinon = dummy_rxwinon; | ||
1292 | bd->memoff = dummy_memoff; | ||
1293 | bd->assertgwinon = dummy_assertgwinon; | ||
1294 | bd->assertmemoff = dummy_assertmemoff; | ||
1295 | break; | ||
1296 | |||
1297 | case PCXE: | ||
1298 | case PCXEVE: | ||
1299 | |||
1300 | bd->memwinon = pcxe_memwinon; | ||
1301 | bd->memwinoff = pcxe_memwinoff; | ||
1302 | bd->globalwinon = pcxe_globalwinon; | ||
1303 | bd->txwinon = pcxe_txwinon; | ||
1304 | bd->rxwinon = pcxe_rxwinon; | ||
1305 | bd->memoff = pcxe_memoff; | ||
1306 | bd->assertgwinon = dummy_assertgwinon; | ||
1307 | bd->assertmemoff = dummy_assertmemoff; | ||
1308 | break; | ||
1309 | |||
1310 | case PCXI: | ||
1311 | case PC64XE: | ||
1312 | |||
1313 | bd->memwinon = pcxi_memwinon; | ||
1314 | bd->memwinoff = pcxi_memwinoff; | ||
1315 | bd->globalwinon = pcxi_globalwinon; | ||
1316 | bd->txwinon = pcxi_txwinon; | ||
1317 | bd->rxwinon = pcxi_rxwinon; | ||
1318 | bd->memoff = pcxi_memoff; | ||
1319 | bd->assertgwinon = pcxi_assertgwinon; | ||
1320 | bd->assertmemoff = pcxi_assertmemoff; | ||
1321 | break; | ||
1322 | |||
1323 | default: | ||
1324 | break; | ||
1325 | |||
1326 | } /* End switch on bd->type */ | ||
1327 | |||
1328 | /* --------------------------------------------------------------- | ||
1329 | Some cards need a memory segment to be defined for use in | ||
1330 | transmit and receive windowing operations. These boards | ||
1331 | are listed in the below switch. In the case of the XI the | ||
1332 | amount of memory on the board is variable so the memory_seg | ||
1333 | is also variable. This code determines what they segment | ||
1334 | should be. | ||
1335 | ----------------------------------------------------------------- */ | ||
1336 | |||
1337 | switch (bd->type) | ||
1338 | { /* Begin switch on bd->type {board type} */ | ||
1339 | |||
1340 | case PCXE: | ||
1341 | case PCXEVE: | ||
1342 | case PC64XE: | ||
1343 | bd->memory_seg = 0xf000; | ||
1344 | break; | 1178 | break; |
1345 | 1179 | ||
1346 | case PCXI: | 1180 | case PCIXEM: |
1347 | board_id = inb((int)bd->port); | 1181 | case PCIXRJ: |
1348 | if ((board_id & 0x1) == 0x1) | 1182 | case PCIXR: |
1349 | { /* Begin it's an XI card */ | 1183 | bd->memwinon = dummy_memwinon; |
1350 | 1184 | bd->memwinoff = dummy_memwinoff; | |
1351 | /* Is it a 64K board */ | 1185 | bd->globalwinon = dummy_globalwinon; |
1352 | if ((board_id & 0x30) == 0) | 1186 | bd->txwinon = dummy_txwinon; |
1353 | bd->memory_seg = 0xf000; | 1187 | bd->rxwinon = dummy_rxwinon; |
1354 | 1188 | bd->memoff = dummy_memoff; | |
1355 | /* Is it a 128K board */ | 1189 | bd->assertgwinon = dummy_assertgwinon; |
1356 | if ((board_id & 0x30) == 0x10) | 1190 | bd->assertmemoff = dummy_assertmemoff; |
1357 | bd->memory_seg = 0xe000; | 1191 | break; |
1358 | 1192 | ||
1359 | /* Is is a 256K board */ | 1193 | case PCXE: |
1360 | if ((board_id & 0x30) == 0x20) | 1194 | case PCXEVE: |
1361 | bd->memory_seg = 0xc000; | 1195 | bd->memwinon = pcxe_memwinon; |
1196 | bd->memwinoff = pcxe_memwinoff; | ||
1197 | bd->globalwinon = pcxe_globalwinon; | ||
1198 | bd->txwinon = pcxe_txwinon; | ||
1199 | bd->rxwinon = pcxe_rxwinon; | ||
1200 | bd->memoff = pcxe_memoff; | ||
1201 | bd->assertgwinon = dummy_assertgwinon; | ||
1202 | bd->assertmemoff = dummy_assertmemoff; | ||
1203 | break; | ||
1362 | 1204 | ||
1363 | /* Is it a 512K board */ | 1205 | case PCXI: |
1364 | if ((board_id & 0x30) == 0x30) | 1206 | case PC64XE: |
1365 | bd->memory_seg = 0x8000; | 1207 | bd->memwinon = pcxi_memwinon; |
1208 | bd->memwinoff = pcxi_memwinoff; | ||
1209 | bd->globalwinon = pcxi_globalwinon; | ||
1210 | bd->txwinon = pcxi_txwinon; | ||
1211 | bd->rxwinon = pcxi_rxwinon; | ||
1212 | bd->memoff = pcxi_memoff; | ||
1213 | bd->assertgwinon = pcxi_assertgwinon; | ||
1214 | bd->assertmemoff = pcxi_assertmemoff; | ||
1215 | break; | ||
1366 | 1216 | ||
1367 | } else printk(KERN_ERR "epca: Board at 0x%x doesn't appear to be an XI\n",(int)bd->port); | 1217 | default: |
1368 | break; | 1218 | break; |
1219 | } | ||
1369 | 1220 | ||
1370 | } /* End switch on bd->type */ | 1221 | /* |
1222 | * Some cards need a memory segment to be defined for use in | ||
1223 | * transmit and receive windowing operations. These boards are | ||
1224 | * listed in the below switch. In the case of the XI the amount | ||
1225 | * of memory on the board is variable so the memory_seg is also | ||
1226 | * variable. This code determines what they segment should be. | ||
1227 | */ | ||
1228 | switch (bd->type) { | ||
1229 | case PCXE: | ||
1230 | case PCXEVE: | ||
1231 | case PC64XE: | ||
1232 | bd->memory_seg = 0xf000; | ||
1233 | break; | ||
1371 | 1234 | ||
1372 | } /* End for each card */ | 1235 | case PCXI: |
1236 | board_id = inb((int)bd->port); | ||
1237 | if ((board_id & 0x1) == 0x1) { | ||
1238 | /* it's an XI card */ | ||
1239 | /* Is it a 64K board */ | ||
1240 | if ((board_id & 0x30) == 0) | ||
1241 | bd->memory_seg = 0xf000; | ||
1242 | |||
1243 | /* Is it a 128K board */ | ||
1244 | if ((board_id & 0x30) == 0x10) | ||
1245 | bd->memory_seg = 0xe000; | ||
1246 | |||
1247 | /* Is is a 256K board */ | ||
1248 | if ((board_id & 0x30) == 0x20) | ||
1249 | bd->memory_seg = 0xc000; | ||
1250 | |||
1251 | /* Is it a 512K board */ | ||
1252 | if ((board_id & 0x30) == 0x30) | ||
1253 | bd->memory_seg = 0x8000; | ||
1254 | } else | ||
1255 | printk(KERN_ERR "epca: Board at 0x%x doesn't appear to be an XI\n",(int)bd->port); | ||
1256 | break; | ||
1257 | } | ||
1258 | } | ||
1373 | 1259 | ||
1374 | err = tty_register_driver(pc_driver); | 1260 | err = tty_register_driver(pc_driver); |
1375 | if (err) { | 1261 | if (err) { |
@@ -1383,10 +1269,7 @@ static int __init pc_init(void) | |||
1383 | goto out4; | 1269 | goto out4; |
1384 | } | 1270 | } |
1385 | 1271 | ||
1386 | /* ------------------------------------------------------------------- | 1272 | /* Start up the poller to check for events on all enabled boards */ |
1387 | Start up the poller to check for events on all enabled boards | ||
1388 | ---------------------------------------------------------------------- */ | ||
1389 | |||
1390 | init_timer(&epca_timer); | 1273 | init_timer(&epca_timer); |
1391 | epca_timer.function = epcapoll; | 1274 | epca_timer.function = epcapoll; |
1392 | mod_timer(&epca_timer, jiffies + HZ/25); | 1275 | mod_timer(&epca_timer, jiffies + HZ/25); |
@@ -1400,51 +1283,47 @@ out2: | |||
1400 | put_tty_driver(pc_driver); | 1283 | put_tty_driver(pc_driver); |
1401 | out1: | 1284 | out1: |
1402 | return err; | 1285 | return err; |
1403 | 1286 | } | |
1404 | } /* End pc_init */ | ||
1405 | |||
1406 | /* ------------------ Begin post_fep_init ---------------------- */ | ||
1407 | 1287 | ||
1408 | static void post_fep_init(unsigned int crd) | 1288 | static void post_fep_init(unsigned int crd) |
1409 | { /* Begin post_fep_init */ | 1289 | { |
1410 | |||
1411 | int i; | 1290 | int i; |
1412 | void __iomem *memaddr; | 1291 | void __iomem *memaddr; |
1413 | struct global_data __iomem *gd; | 1292 | struct global_data __iomem *gd; |
1414 | struct board_info *bd; | 1293 | struct board_info *bd; |
1415 | struct board_chan __iomem *bc; | 1294 | struct board_chan __iomem *bc; |
1416 | struct channel *ch; | 1295 | struct channel *ch; |
1417 | int shrinkmem = 0, lowwater ; | 1296 | int shrinkmem = 0, lowwater; |
1418 | |||
1419 | /* ------------------------------------------------------------- | ||
1420 | This call is made by the user via. the ioctl call DIGI_INIT. | ||
1421 | It is responsible for setting up all the card specific stuff. | ||
1422 | ---------------------------------------------------------------- */ | ||
1423 | bd = &boards[crd]; | ||
1424 | 1297 | ||
1425 | /* ----------------------------------------------------------------- | 1298 | /* |
1426 | If this is a PCI board, get the port info. Remember PCI cards | 1299 | * This call is made by the user via. the ioctl call DIGI_INIT. It is |
1427 | do not have entries into the epcaconfig.h file, so we can't get | 1300 | * responsible for setting up all the card specific stuff. |
1428 | the number of ports from it. Unfortunetly, this means that anyone | 1301 | */ |
1429 | doing a DIGI_GETINFO before the board has booted will get an invalid | 1302 | bd = &boards[crd]; |
1430 | number of ports returned (It should return 0). Calls to DIGI_GETINFO | ||
1431 | after DIGI_INIT has been called will return the proper values. | ||
1432 | ------------------------------------------------------------------- */ | ||
1433 | 1303 | ||
1304 | /* | ||
1305 | * If this is a PCI board, get the port info. Remember PCI cards do not | ||
1306 | * have entries into the epcaconfig.h file, so we can't get the number | ||
1307 | * of ports from it. Unfortunetly, this means that anyone doing a | ||
1308 | * DIGI_GETINFO before the board has booted will get an invalid number | ||
1309 | * of ports returned (It should return 0). Calls to DIGI_GETINFO after | ||
1310 | * DIGI_INIT has been called will return the proper values. | ||
1311 | */ | ||
1434 | if (bd->type >= PCIXEM) { /* Begin get PCI number of ports */ | 1312 | if (bd->type >= PCIXEM) { /* Begin get PCI number of ports */ |
1435 | /* -------------------------------------------------------------------- | 1313 | /* |
1436 | Below we use XEMPORTS as a memory offset regardless of which PCI | 1314 | * Below we use XEMPORTS as a memory offset regardless of which |
1437 | card it is. This is because all of the supported PCI cards have | 1315 | * PCI card it is. This is because all of the supported PCI |
1438 | the same memory offset for the channel data. This will have to be | 1316 | * cards have the same memory offset for the channel data. This |
1439 | changed if we ever develop a PCI/XE card. NOTE : The FEP manual | 1317 | * will have to be changed if we ever develop a PCI/XE card. |
1440 | states that the port offset is 0xC22 as opposed to 0xC02. This is | 1318 | * NOTE : The FEP manual states that the port offset is 0xC22 |
1441 | only true for PC/XE, and PC/XI cards; not for the XEM, or CX series. | 1319 | * as opposed to 0xC02. This is only true for PC/XE, and PC/XI |
1442 | On the PCI cards the number of ports is determined by reading a | 1320 | * cards; not for the XEM, or CX series. On the PCI cards the |
1443 | ID PROM located in the box attached to the card. The card can then | 1321 | * number of ports is determined by reading a ID PROM located |
1444 | determine the index the id to determine the number of ports available. | 1322 | * in the box attached to the card. The card can then determine |
1445 | (FYI - The id should be located at 0x1ac (And may use up to 4 bytes | 1323 | * the index the id to determine the number of ports available. |
1446 | if the box in question is a XEM or CX)). | 1324 | * (FYI - The id should be located at 0x1ac (And may use up to |
1447 | ------------------------------------------------------------------------ */ | 1325 | * 4 bytes if the box in question is a XEM or CX)). |
1326 | */ | ||
1448 | /* PCI cards are already remapped at this point ISA are not */ | 1327 | /* PCI cards are already remapped at this point ISA are not */ |
1449 | bd->numports = readw(bd->re_map_membase + XEMPORTS); | 1328 | bd->numports = readw(bd->re_map_membase + XEMPORTS); |
1450 | epcaassert(bd->numports <= 64,"PCI returned a invalid number of ports"); | 1329 | epcaassert(bd->numports <= 64,"PCI returned a invalid number of ports"); |
@@ -1465,95 +1344,87 @@ static void post_fep_init(unsigned int crd) | |||
1465 | 1344 | ||
1466 | memaddr = bd->re_map_membase; | 1345 | memaddr = bd->re_map_membase; |
1467 | 1346 | ||
1468 | /* ----------------------------------------------------------------- | 1347 | /* |
1469 | The below assignment will set bc to point at the BEGINING of | 1348 | * The below assignment will set bc to point at the BEGINING of the |
1470 | the cards channel structures. For 1 card there will be between | 1349 | * cards channel structures. For 1 card there will be between 8 and 64 |
1471 | 8 and 64 of these structures. | 1350 | * of these structures. |
1472 | -------------------------------------------------------------------- */ | 1351 | */ |
1473 | |||
1474 | bc = memaddr + CHANSTRUCT; | 1352 | bc = memaddr + CHANSTRUCT; |
1475 | 1353 | ||
1476 | /* ------------------------------------------------------------------- | 1354 | /* |
1477 | The below assignment will set gd to point at the BEGINING of | 1355 | * The below assignment will set gd to point at the BEGINING of global |
1478 | global memory address 0xc00. The first data in that global | 1356 | * memory address 0xc00. The first data in that global memory actually |
1479 | memory actually starts at address 0xc1a. The command in | 1357 | * starts at address 0xc1a. The command in pointer begins at 0xd10. |
1480 | pointer begins at 0xd10. | 1358 | */ |
1481 | ---------------------------------------------------------------------- */ | ||
1482 | |||
1483 | gd = memaddr + GLOBAL; | 1359 | gd = memaddr + GLOBAL; |
1484 | 1360 | ||
1485 | /* -------------------------------------------------------------------- | 1361 | /* |
1486 | XEPORTS (address 0xc22) points at the number of channels the | 1362 | * XEPORTS (address 0xc22) points at the number of channels the card |
1487 | card supports. (For 64XE, XI, XEM, and XR use 0xc02) | 1363 | * supports. (For 64XE, XI, XEM, and XR use 0xc02) |
1488 | ----------------------------------------------------------------------- */ | 1364 | */ |
1489 | |||
1490 | if ((bd->type == PCXEVE || bd->type == PCXE) && (readw(memaddr + XEPORTS) < 3)) | 1365 | if ((bd->type == PCXEVE || bd->type == PCXE) && (readw(memaddr + XEPORTS) < 3)) |
1491 | shrinkmem = 1; | 1366 | shrinkmem = 1; |
1492 | if (bd->type < PCIXEM) | 1367 | if (bd->type < PCIXEM) |
1493 | if (!request_region((int)bd->port, 4, board_desc[bd->type])) | 1368 | if (!request_region((int)bd->port, 4, board_desc[bd->type])) |
1494 | return; | 1369 | return; |
1495 | memwinon(bd, 0); | 1370 | memwinon(bd, 0); |
1496 | 1371 | ||
1497 | /* -------------------------------------------------------------------- | 1372 | /* |
1498 | Remember ch is the main drivers channels structure, while bc is | 1373 | * Remember ch is the main drivers channels structure, while bc is the |
1499 | the cards channel structure. | 1374 | * cards channel structure. |
1500 | ------------------------------------------------------------------------ */ | 1375 | */ |
1501 | 1376 | for (i = 0; i < bd->numports; i++, ch++, bc++) { | |
1502 | /* For every port on the card do ..... */ | ||
1503 | |||
1504 | for (i = 0; i < bd->numports; i++, ch++, bc++) { /* Begin for each port */ | ||
1505 | unsigned long flags; | 1377 | unsigned long flags; |
1506 | u16 tseg, rseg; | 1378 | u16 tseg, rseg; |
1507 | 1379 | ||
1508 | ch->brdchan = bc; | 1380 | ch->brdchan = bc; |
1509 | ch->mailbox = gd; | 1381 | ch->mailbox = gd; |
1510 | INIT_WORK(&ch->tqueue, do_softint); | 1382 | INIT_WORK(&ch->tqueue, do_softint); |
1511 | ch->board = &boards[crd]; | 1383 | ch->board = &boards[crd]; |
1512 | 1384 | ||
1513 | spin_lock_irqsave(&epca_lock, flags); | 1385 | spin_lock_irqsave(&epca_lock, flags); |
1514 | switch (bd->type) { | 1386 | switch (bd->type) { |
1515 | /* ---------------------------------------------------------------- | 1387 | /* |
1516 | Since some of the boards use different bitmaps for their | 1388 | * Since some of the boards use different bitmaps for |
1517 | control signals we cannot hard code these values and retain | 1389 | * their control signals we cannot hard code these |
1518 | portability. We virtualize this data here. | 1390 | * values and retain portability. We virtualize this |
1519 | ------------------------------------------------------------------- */ | 1391 | * data here. |
1520 | case EISAXEM: | 1392 | */ |
1521 | case PCXEM: | 1393 | case EISAXEM: |
1522 | case PCIXEM: | 1394 | case PCXEM: |
1523 | case PCIXRJ: | 1395 | case PCIXEM: |
1524 | case PCIXR: | 1396 | case PCIXRJ: |
1525 | ch->m_rts = 0x02 ; | 1397 | case PCIXR: |
1526 | ch->m_dcd = 0x80 ; | 1398 | ch->m_rts = 0x02; |
1527 | ch->m_dsr = 0x20 ; | 1399 | ch->m_dcd = 0x80; |
1528 | ch->m_cts = 0x10 ; | 1400 | ch->m_dsr = 0x20; |
1529 | ch->m_ri = 0x40 ; | 1401 | ch->m_cts = 0x10; |
1530 | ch->m_dtr = 0x01 ; | 1402 | ch->m_ri = 0x40; |
1531 | break; | 1403 | ch->m_dtr = 0x01; |
1532 | 1404 | break; | |
1533 | case PCXE: | 1405 | |
1534 | case PCXEVE: | 1406 | case PCXE: |
1535 | case PCXI: | 1407 | case PCXEVE: |
1536 | case PC64XE: | 1408 | case PCXI: |
1537 | ch->m_rts = 0x02 ; | 1409 | case PC64XE: |
1538 | ch->m_dcd = 0x08 ; | 1410 | ch->m_rts = 0x02; |
1539 | ch->m_dsr = 0x10 ; | 1411 | ch->m_dcd = 0x08; |
1540 | ch->m_cts = 0x20 ; | 1412 | ch->m_dsr = 0x10; |
1541 | ch->m_ri = 0x40 ; | 1413 | ch->m_cts = 0x20; |
1542 | ch->m_dtr = 0x80 ; | 1414 | ch->m_ri = 0x40; |
1543 | break; | 1415 | ch->m_dtr = 0x80; |
1544 | 1416 | break; | |
1545 | } /* End switch bd->type */ | 1417 | } |
1546 | 1418 | ||
1547 | if (boards[crd].altpin) { | 1419 | if (boards[crd].altpin) { |
1548 | ch->dsr = ch->m_dcd; | 1420 | ch->dsr = ch->m_dcd; |
1549 | ch->dcd = ch->m_dsr; | 1421 | ch->dcd = ch->m_dsr; |
1550 | ch->digiext.digi_flags |= DIGI_ALTPIN; | 1422 | ch->digiext.digi_flags |= DIGI_ALTPIN; |
1551 | } | 1423 | } else { |
1552 | else { | ||
1553 | ch->dcd = ch->m_dcd; | 1424 | ch->dcd = ch->m_dcd; |
1554 | ch->dsr = ch->m_dsr; | 1425 | ch->dsr = ch->m_dsr; |
1555 | } | 1426 | } |
1556 | 1427 | ||
1557 | ch->boardnum = crd; | 1428 | ch->boardnum = crd; |
1558 | ch->channelnum = i; | 1429 | ch->channelnum = i; |
1559 | ch->magic = EPCA_MAGIC; | 1430 | ch->magic = EPCA_MAGIC; |
@@ -1568,71 +1439,67 @@ static void post_fep_init(unsigned int crd) | |||
1568 | rseg = readw(&bc->rseg); | 1439 | rseg = readw(&bc->rseg); |
1569 | 1440 | ||
1570 | switch (bd->type) { | 1441 | switch (bd->type) { |
1442 | case PCIXEM: | ||
1443 | case PCIXRJ: | ||
1444 | case PCIXR: | ||
1445 | /* Cover all the 2MEG cards */ | ||
1446 | ch->txptr = memaddr + ((tseg << 4) & 0x1fffff); | ||
1447 | ch->rxptr = memaddr + ((rseg << 4) & 0x1fffff); | ||
1448 | ch->txwin = FEPWIN | (tseg >> 11); | ||
1449 | ch->rxwin = FEPWIN | (rseg >> 11); | ||
1450 | break; | ||
1571 | 1451 | ||
1572 | case PCIXEM: | 1452 | case PCXEM: |
1573 | case PCIXRJ: | 1453 | case EISAXEM: |
1574 | case PCIXR: | 1454 | /* Cover all the 32K windowed cards */ |
1575 | /* Cover all the 2MEG cards */ | 1455 | /* Mask equal to window size - 1 */ |
1576 | ch->txptr = memaddr + ((tseg << 4) & 0x1fffff); | 1456 | ch->txptr = memaddr + ((tseg << 4) & 0x7fff); |
1577 | ch->rxptr = memaddr + ((rseg << 4) & 0x1fffff); | 1457 | ch->rxptr = memaddr + ((rseg << 4) & 0x7fff); |
1578 | ch->txwin = FEPWIN | (tseg >> 11); | 1458 | ch->txwin = FEPWIN | (tseg >> 11); |
1579 | ch->rxwin = FEPWIN | (rseg >> 11); | 1459 | ch->rxwin = FEPWIN | (rseg >> 11); |
1580 | break; | 1460 | break; |
1581 | 1461 | ||
1582 | case PCXEM: | 1462 | case PCXEVE: |
1583 | case EISAXEM: | 1463 | case PCXE: |
1584 | /* Cover all the 32K windowed cards */ | 1464 | ch->txptr = memaddr + (((tseg - bd->memory_seg) << 4) & 0x1fff); |
1585 | /* Mask equal to window size - 1 */ | 1465 | ch->txwin = FEPWIN | ((tseg - bd->memory_seg) >> 9); |
1586 | ch->txptr = memaddr + ((tseg << 4) & 0x7fff); | 1466 | ch->rxptr = memaddr + (((rseg - bd->memory_seg) << 4) & 0x1fff); |
1587 | ch->rxptr = memaddr + ((rseg << 4) & 0x7fff); | 1467 | ch->rxwin = FEPWIN | ((rseg - bd->memory_seg) >>9 ); |
1588 | ch->txwin = FEPWIN | (tseg >> 11); | 1468 | break; |
1589 | ch->rxwin = FEPWIN | (rseg >> 11); | 1469 | |
1590 | break; | 1470 | case PCXI: |
1591 | 1471 | case PC64XE: | |
1592 | case PCXEVE: | 1472 | ch->txptr = memaddr + ((tseg - bd->memory_seg) << 4); |
1593 | case PCXE: | 1473 | ch->rxptr = memaddr + ((rseg - bd->memory_seg) << 4); |
1594 | ch->txptr = memaddr + (((tseg - bd->memory_seg) << 4) & 0x1fff); | 1474 | ch->txwin = ch->rxwin = 0; |
1595 | ch->txwin = FEPWIN | ((tseg - bd->memory_seg) >> 9); | 1475 | break; |
1596 | ch->rxptr = memaddr + (((rseg - bd->memory_seg) << 4) & 0x1fff); | 1476 | } |
1597 | ch->rxwin = FEPWIN | ((rseg - bd->memory_seg) >>9 ); | ||
1598 | break; | ||
1599 | |||
1600 | case PCXI: | ||
1601 | case PC64XE: | ||
1602 | ch->txptr = memaddr + ((tseg - bd->memory_seg) << 4); | ||
1603 | ch->rxptr = memaddr + ((rseg - bd->memory_seg) << 4); | ||
1604 | ch->txwin = ch->rxwin = 0; | ||
1605 | break; | ||
1606 | |||
1607 | } /* End switch bd->type */ | ||
1608 | 1477 | ||
1609 | ch->txbufhead = 0; | 1478 | ch->txbufhead = 0; |
1610 | ch->txbufsize = readw(&bc->tmax) + 1; | 1479 | ch->txbufsize = readw(&bc->tmax) + 1; |
1611 | 1480 | ||
1612 | ch->rxbufhead = 0; | 1481 | ch->rxbufhead = 0; |
1613 | ch->rxbufsize = readw(&bc->rmax) + 1; | 1482 | ch->rxbufsize = readw(&bc->rmax) + 1; |
1614 | 1483 | ||
1615 | lowwater = ch->txbufsize >= 2000 ? 1024 : (ch->txbufsize / 2); | 1484 | lowwater = ch->txbufsize >= 2000 ? 1024 : (ch->txbufsize / 2); |
1616 | 1485 | ||
1617 | /* Set transmitter low water mark */ | 1486 | /* Set transmitter low water mark */ |
1618 | fepcmd(ch, STXLWATER, lowwater, 0, 10, 0); | 1487 | fepcmd(ch, STXLWATER, lowwater, 0, 10, 0); |
1619 | 1488 | ||
1620 | /* Set receiver low water mark */ | 1489 | /* Set receiver low water mark */ |
1621 | |||
1622 | fepcmd(ch, SRXLWATER, (ch->rxbufsize / 4), 0, 10, 0); | 1490 | fepcmd(ch, SRXLWATER, (ch->rxbufsize / 4), 0, 10, 0); |
1623 | 1491 | ||
1624 | /* Set receiver high water mark */ | 1492 | /* Set receiver high water mark */ |
1625 | |||
1626 | fepcmd(ch, SRXHWATER, (3 * ch->rxbufsize / 4), 0, 10, 0); | 1493 | fepcmd(ch, SRXHWATER, (3 * ch->rxbufsize / 4), 0, 10, 0); |
1627 | 1494 | ||
1628 | writew(100, &bc->edelay); | 1495 | writew(100, &bc->edelay); |
1629 | writeb(1, &bc->idata); | 1496 | writeb(1, &bc->idata); |
1630 | 1497 | ||
1631 | ch->startc = readb(&bc->startc); | 1498 | ch->startc = readb(&bc->startc); |
1632 | ch->stopc = readb(&bc->stopc); | 1499 | ch->stopc = readb(&bc->stopc); |
1633 | ch->startca = readb(&bc->startca); | 1500 | ch->startca = readb(&bc->startca); |
1634 | ch->stopca = readb(&bc->stopca); | 1501 | ch->stopca = readb(&bc->stopca); |
1635 | 1502 | ||
1636 | ch->fepcflag = 0; | 1503 | ch->fepcflag = 0; |
1637 | ch->fepiflag = 0; | 1504 | ch->fepiflag = 0; |
1638 | ch->fepoflag = 0; | 1505 | ch->fepoflag = 0; |
@@ -1640,7 +1507,7 @@ static void post_fep_init(unsigned int crd) | |||
1640 | ch->fepstopc = 0; | 1507 | ch->fepstopc = 0; |
1641 | ch->fepstartca = 0; | 1508 | ch->fepstartca = 0; |
1642 | ch->fepstopca = 0; | 1509 | ch->fepstopca = 0; |
1643 | 1510 | ||
1644 | ch->close_delay = 50; | 1511 | ch->close_delay = 50; |
1645 | ch->count = 0; | 1512 | ch->count = 0; |
1646 | ch->blocked_open = 0; | 1513 | ch->blocked_open = 0; |
@@ -1648,80 +1515,66 @@ static void post_fep_init(unsigned int crd) | |||
1648 | init_waitqueue_head(&ch->close_wait); | 1515 | init_waitqueue_head(&ch->close_wait); |
1649 | 1516 | ||
1650 | spin_unlock_irqrestore(&epca_lock, flags); | 1517 | spin_unlock_irqrestore(&epca_lock, flags); |
1651 | } /* End for each port */ | 1518 | } |
1652 | 1519 | ||
1653 | printk(KERN_INFO | 1520 | printk(KERN_INFO |
1654 | "Digi PC/Xx Driver V%s: %s I/O = 0x%lx Mem = 0x%lx Ports = %d\n", | 1521 | "Digi PC/Xx Driver V%s: %s I/O = 0x%lx Mem = 0x%lx Ports = %d\n", |
1655 | VERSION, board_desc[bd->type], (long)bd->port, (long)bd->membase, bd->numports); | 1522 | VERSION, board_desc[bd->type], (long)bd->port, (long)bd->membase, bd->numports); |
1656 | memwinoff(bd, 0); | 1523 | memwinoff(bd, 0); |
1657 | 1524 | } | |
1658 | } /* End post_fep_init */ | ||
1659 | |||
1660 | /* --------------------- Begin epcapoll ------------------------ */ | ||
1661 | 1525 | ||
1662 | static void epcapoll(unsigned long ignored) | 1526 | static void epcapoll(unsigned long ignored) |
1663 | { /* Begin epcapoll */ | 1527 | { |
1664 | |||
1665 | unsigned long flags; | 1528 | unsigned long flags; |
1666 | int crd; | 1529 | int crd; |
1667 | volatile unsigned int head, tail; | 1530 | volatile unsigned int head, tail; |
1668 | struct channel *ch; | 1531 | struct channel *ch; |
1669 | struct board_info *bd; | 1532 | struct board_info *bd; |
1670 | 1533 | ||
1671 | /* ------------------------------------------------------------------- | 1534 | /* |
1672 | This routine is called upon every timer interrupt. Even though | 1535 | * This routine is called upon every timer interrupt. Even though the |
1673 | the Digi series cards are capable of generating interrupts this | 1536 | * Digi series cards are capable of generating interrupts this method |
1674 | method of non-looping polling is more efficient. This routine | 1537 | * of non-looping polling is more efficient. This routine checks for |
1675 | checks for card generated events (Such as receive data, are transmit | 1538 | * card generated events (Such as receive data, are transmit buffer |
1676 | buffer empty) and acts on those events. | 1539 | * empty) and acts on those events. |
1677 | ----------------------------------------------------------------------- */ | 1540 | */ |
1678 | 1541 | for (crd = 0; crd < num_cards; crd++) { | |
1679 | for (crd = 0; crd < num_cards; crd++) | ||
1680 | { /* Begin for each card */ | ||
1681 | |||
1682 | bd = &boards[crd]; | 1542 | bd = &boards[crd]; |
1683 | ch = card_ptr[crd]; | 1543 | ch = card_ptr[crd]; |
1684 | 1544 | ||
1685 | if ((bd->status == DISABLED) || digi_poller_inhibited) | 1545 | if ((bd->status == DISABLED) || digi_poller_inhibited) |
1686 | continue; /* Begin loop next interation */ | 1546 | continue; |
1687 | |||
1688 | /* ----------------------------------------------------------- | ||
1689 | assertmemoff is not needed here; indeed it is an empty subroutine. | ||
1690 | It is being kept because future boards may need this as well as | ||
1691 | some legacy boards. | ||
1692 | ---------------------------------------------------------------- */ | ||
1693 | 1547 | ||
1548 | /* | ||
1549 | * assertmemoff is not needed here; indeed it is an empty | ||
1550 | * subroutine. It is being kept because future boards may need | ||
1551 | * this as well as some legacy boards. | ||
1552 | */ | ||
1694 | spin_lock_irqsave(&epca_lock, flags); | 1553 | spin_lock_irqsave(&epca_lock, flags); |
1695 | 1554 | ||
1696 | assertmemoff(ch); | 1555 | assertmemoff(ch); |
1697 | 1556 | ||
1698 | globalwinon(ch); | 1557 | globalwinon(ch); |
1699 | 1558 | ||
1700 | /* --------------------------------------------------------------- | 1559 | /* |
1701 | In this case head and tail actually refer to the event queue not | 1560 | * In this case head and tail actually refer to the event queue |
1702 | the transmit or receive queue. | 1561 | * not the transmit or receive queue. |
1703 | ------------------------------------------------------------------- */ | 1562 | */ |
1704 | |||
1705 | head = readw(&ch->mailbox->ein); | 1563 | head = readw(&ch->mailbox->ein); |
1706 | tail = readw(&ch->mailbox->eout); | 1564 | tail = readw(&ch->mailbox->eout); |
1707 | |||
1708 | /* If head isn't equal to tail we have an event */ | ||
1709 | 1565 | ||
1566 | /* If head isn't equal to tail we have an event */ | ||
1710 | if (head != tail) | 1567 | if (head != tail) |
1711 | doevent(crd); | 1568 | doevent(crd); |
1712 | memoff(ch); | 1569 | memoff(ch); |
1713 | 1570 | ||
1714 | spin_unlock_irqrestore(&epca_lock, flags); | 1571 | spin_unlock_irqrestore(&epca_lock, flags); |
1715 | |||
1716 | } /* End for each card */ | 1572 | } /* End for each card */ |
1717 | mod_timer(&epca_timer, jiffies + (HZ / 25)); | 1573 | mod_timer(&epca_timer, jiffies + (HZ / 25)); |
1718 | } /* End epcapoll */ | 1574 | } |
1719 | |||
1720 | /* --------------------- Begin doevent ------------------------ */ | ||
1721 | 1575 | ||
1722 | static void doevent(int crd) | 1576 | static void doevent(int crd) |
1723 | { /* Begin doevent */ | 1577 | { |
1724 | |||
1725 | void __iomem *eventbuf; | 1578 | void __iomem *eventbuf; |
1726 | struct channel *ch, *chan0; | 1579 | struct channel *ch, *chan0; |
1727 | static struct tty_struct *tty; | 1580 | static struct tty_struct *tty; |
@@ -1731,28 +1584,28 @@ static void doevent(int crd) | |||
1731 | int event, channel; | 1584 | int event, channel; |
1732 | int mstat, lstat; | 1585 | int mstat, lstat; |
1733 | 1586 | ||
1734 | /* ------------------------------------------------------------------- | 1587 | /* |
1735 | This subroutine is called by epcapoll when an event is detected | 1588 | * This subroutine is called by epcapoll when an event is detected |
1736 | in the event queue. This routine responds to those events. | 1589 | * in the event queue. This routine responds to those events. |
1737 | --------------------------------------------------------------------- */ | 1590 | */ |
1738 | bd = &boards[crd]; | 1591 | bd = &boards[crd]; |
1739 | 1592 | ||
1740 | chan0 = card_ptr[crd]; | 1593 | chan0 = card_ptr[crd]; |
1741 | epcaassert(chan0 <= &digi_channels[nbdevs - 1], "ch out of range"); | 1594 | epcaassert(chan0 <= &digi_channels[nbdevs - 1], "ch out of range"); |
1742 | assertgwinon(chan0); | 1595 | assertgwinon(chan0); |
1743 | while ((tail = readw(&chan0->mailbox->eout)) != (head = readw(&chan0->mailbox->ein))) | 1596 | while ((tail = readw(&chan0->mailbox->eout)) != (head = readw(&chan0->mailbox->ein))) { /* Begin while something in event queue */ |
1744 | { /* Begin while something in event queue */ | ||
1745 | assertgwinon(chan0); | 1597 | assertgwinon(chan0); |
1746 | eventbuf = bd->re_map_membase + tail + ISTART; | 1598 | eventbuf = bd->re_map_membase + tail + ISTART; |
1747 | /* Get the channel the event occurred on */ | 1599 | /* Get the channel the event occurred on */ |
1748 | channel = readb(eventbuf); | 1600 | channel = readb(eventbuf); |
1749 | /* Get the actual event code that occurred */ | 1601 | /* Get the actual event code that occurred */ |
1750 | event = readb(eventbuf + 1); | 1602 | event = readb(eventbuf + 1); |
1751 | /* ---------------------------------------------------------------- | 1603 | /* |
1752 | The two assignments below get the current modem status (mstat) | 1604 | * The two assignments below get the current modem status |
1753 | and the previous modem status (lstat). These are useful becuase | 1605 | * (mstat) and the previous modem status (lstat). These are |
1754 | an event could signal a change in modem signals itself. | 1606 | * useful becuase an event could signal a change in modem |
1755 | ------------------------------------------------------------------- */ | 1607 | * signals itself. |
1608 | */ | ||
1756 | mstat = readb(eventbuf + 2); | 1609 | mstat = readb(eventbuf + 2); |
1757 | lstat = readb(eventbuf + 3); | 1610 | lstat = readb(eventbuf + 3); |
1758 | 1611 | ||
@@ -1772,37 +1625,36 @@ static void doevent(int crd) | |||
1772 | assertgwinon(ch); | 1625 | assertgwinon(ch); |
1773 | } /* End DATA_IND */ | 1626 | } /* End DATA_IND */ |
1774 | /* else *//* Fix for DCD transition missed bug */ | 1627 | /* else *//* Fix for DCD transition missed bug */ |
1775 | if (event & MODEMCHG_IND) { /* Begin MODEMCHG_IND */ | 1628 | if (event & MODEMCHG_IND) { |
1776 | /* A modem signal change has been indicated */ | 1629 | /* A modem signal change has been indicated */ |
1777 | ch->imodem = mstat; | 1630 | ch->imodem = mstat; |
1778 | if (ch->asyncflags & ASYNC_CHECK_CD) { | 1631 | if (ch->asyncflags & ASYNC_CHECK_CD) { |
1779 | if (mstat & ch->dcd) /* We are now receiving dcd */ | 1632 | if (mstat & ch->dcd) /* We are now receiving dcd */ |
1780 | wake_up_interruptible(&ch->open_wait); | 1633 | wake_up_interruptible(&ch->open_wait); |
1781 | else | 1634 | else |
1782 | pc_sched_event(ch, EPCA_EVENT_HANGUP); /* No dcd; hangup */ | 1635 | pc_sched_event(ch, EPCA_EVENT_HANGUP); /* No dcd; hangup */ |
1783 | } | 1636 | } |
1784 | } /* End MODEMCHG_IND */ | 1637 | } |
1785 | tty = ch->tty; | 1638 | tty = ch->tty; |
1786 | if (tty) { /* Begin if valid tty */ | 1639 | if (tty) { |
1787 | if (event & BREAK_IND) { /* Begin if BREAK_IND */ | 1640 | if (event & BREAK_IND) { |
1788 | /* A break has been indicated */ | 1641 | /* A break has been indicated */ |
1789 | tty_insert_flip_char(tty, 0, TTY_BREAK); | 1642 | tty_insert_flip_char(tty, 0, TTY_BREAK); |
1790 | tty_schedule_flip(tty); | 1643 | tty_schedule_flip(tty); |
1791 | } else if (event & LOWTX_IND) { /* Begin LOWTX_IND */ | 1644 | } else if (event & LOWTX_IND) { |
1792 | if (ch->statusflags & LOWWAIT) | 1645 | if (ch->statusflags & LOWWAIT) { |
1793 | { /* Begin if LOWWAIT */ | ||
1794 | ch->statusflags &= ~LOWWAIT; | 1646 | ch->statusflags &= ~LOWWAIT; |
1795 | tty_wakeup(tty); | 1647 | tty_wakeup(tty); |
1796 | } /* End if LOWWAIT */ | 1648 | } |
1797 | } else if (event & EMPTYTX_IND) { /* Begin EMPTYTX_IND */ | 1649 | } else if (event & EMPTYTX_IND) { |
1798 | /* This event is generated by setup_empty_event */ | 1650 | /* This event is generated by setup_empty_event */ |
1799 | ch->statusflags &= ~TXBUSY; | 1651 | ch->statusflags &= ~TXBUSY; |
1800 | if (ch->statusflags & EMPTYWAIT) { /* Begin if EMPTYWAIT */ | 1652 | if (ch->statusflags & EMPTYWAIT) { |
1801 | ch->statusflags &= ~EMPTYWAIT; | 1653 | ch->statusflags &= ~EMPTYWAIT; |
1802 | tty_wakeup(tty); | 1654 | tty_wakeup(tty); |
1803 | } /* End if EMPTYWAIT */ | 1655 | } |
1804 | } /* End EMPTYTX_IND */ | 1656 | } |
1805 | } /* End if valid tty */ | 1657 | } |
1806 | next: | 1658 | next: |
1807 | globalwinon(ch); | 1659 | globalwinon(ch); |
1808 | BUG_ON(!bc); | 1660 | BUG_ON(!bc); |
@@ -1810,13 +1662,11 @@ static void doevent(int crd) | |||
1810 | writew((tail + 4) & (IMAX - ISTART - 4), &chan0->mailbox->eout); | 1662 | writew((tail + 4) & (IMAX - ISTART - 4), &chan0->mailbox->eout); |
1811 | globalwinon(chan0); | 1663 | globalwinon(chan0); |
1812 | } /* End while something in event queue */ | 1664 | } /* End while something in event queue */ |
1813 | } /* End doevent */ | 1665 | } |
1814 | |||
1815 | /* --------------------- Begin fepcmd ------------------------ */ | ||
1816 | 1666 | ||
1817 | static void fepcmd(struct channel *ch, int cmd, int word_or_byte, | 1667 | static void fepcmd(struct channel *ch, int cmd, int word_or_byte, |
1818 | int byte2, int ncmds, int bytecmd) | 1668 | int byte2, int ncmds, int bytecmd) |
1819 | { /* Begin fepcmd */ | 1669 | { |
1820 | unchar __iomem *memaddr; | 1670 | unchar __iomem *memaddr; |
1821 | unsigned int head, cmdTail, cmdStart, cmdMax; | 1671 | unsigned int head, cmdTail, cmdStart, cmdMax; |
1822 | long count; | 1672 | long count; |
@@ -1831,11 +1681,11 @@ static void fepcmd(struct channel *ch, int cmd, int word_or_byte, | |||
1831 | head = readw(&ch->mailbox->cin); | 1681 | head = readw(&ch->mailbox->cin); |
1832 | /* cmdStart is a base address */ | 1682 | /* cmdStart is a base address */ |
1833 | cmdStart = readw(&ch->mailbox->cstart); | 1683 | cmdStart = readw(&ch->mailbox->cstart); |
1834 | /* ------------------------------------------------------------------ | 1684 | /* |
1835 | We do the addition below because we do not want a max pointer | 1685 | * We do the addition below because we do not want a max pointer |
1836 | relative to cmdStart. We want a max pointer that points at the | 1686 | * relative to cmdStart. We want a max pointer that points at the |
1837 | physical end of the command queue. | 1687 | * physical end of the command queue. |
1838 | -------------------------------------------------------------------- */ | 1688 | */ |
1839 | cmdMax = (cmdStart + 4 + readw(&ch->mailbox->cmax)); | 1689 | cmdMax = (cmdStart + 4 + readw(&ch->mailbox->cmax)); |
1840 | memaddr = ch->board->re_map_membase; | 1690 | memaddr = ch->board->re_map_membase; |
1841 | 1691 | ||
@@ -1860,7 +1710,7 @@ static void fepcmd(struct channel *ch, int cmd, int word_or_byte, | |||
1860 | writew(head, &ch->mailbox->cin); | 1710 | writew(head, &ch->mailbox->cin); |
1861 | count = FEPTIMEOUT; | 1711 | count = FEPTIMEOUT; |
1862 | 1712 | ||
1863 | for (;;) { /* Begin forever loop */ | 1713 | for (;;) { |
1864 | count--; | 1714 | count--; |
1865 | if (count == 0) { | 1715 | if (count == 0) { |
1866 | printk(KERN_ERR "<Error> - Fep not responding in fepcmd()\n"); | 1716 | printk(KERN_ERR "<Error> - Fep not responding in fepcmd()\n"); |
@@ -1869,26 +1719,23 @@ static void fepcmd(struct channel *ch, int cmd, int word_or_byte, | |||
1869 | head = readw(&ch->mailbox->cin); | 1719 | head = readw(&ch->mailbox->cin); |
1870 | cmdTail = readw(&ch->mailbox->cout); | 1720 | cmdTail = readw(&ch->mailbox->cout); |
1871 | n = (head - cmdTail) & (cmdMax - cmdStart - 4); | 1721 | n = (head - cmdTail) & (cmdMax - cmdStart - 4); |
1872 | /* ---------------------------------------------------------- | 1722 | /* |
1873 | Basically this will break when the FEP acknowledges the | 1723 | * Basically this will break when the FEP acknowledges the |
1874 | command by incrementing cmdTail (Making it equal to head). | 1724 | * command by incrementing cmdTail (Making it equal to head). |
1875 | ------------------------------------------------------------- */ | 1725 | */ |
1876 | if (n <= ncmds * (sizeof(short) * 4)) | 1726 | if (n <= ncmds * (sizeof(short) * 4)) |
1877 | break; /* Well nearly forever :-) */ | 1727 | break; |
1878 | } /* End forever loop */ | 1728 | } |
1879 | } /* End fepcmd */ | 1729 | } |
1880 | |||
1881 | /* --------------------------------------------------------------------- | ||
1882 | Digi products use fields in their channels structures that are very | ||
1883 | similar to the c_cflag and c_iflag fields typically found in UNIX | ||
1884 | termios structures. The below three routines allow mappings | ||
1885 | between these hardware "flags" and their respective Linux flags. | ||
1886 | ------------------------------------------------------------------------- */ | ||
1887 | |||
1888 | /* --------------------- Begin termios2digi_h -------------------- */ | ||
1889 | 1730 | ||
1731 | /* | ||
1732 | * Digi products use fields in their channels structures that are very similar | ||
1733 | * to the c_cflag and c_iflag fields typically found in UNIX termios | ||
1734 | * structures. The below three routines allow mappings between these hardware | ||
1735 | * "flags" and their respective Linux flags. | ||
1736 | */ | ||
1890 | static unsigned termios2digi_h(struct channel *ch, unsigned cflag) | 1737 | static unsigned termios2digi_h(struct channel *ch, unsigned cflag) |
1891 | { /* Begin termios2digi_h */ | 1738 | { |
1892 | unsigned res = 0; | 1739 | unsigned res = 0; |
1893 | 1740 | ||
1894 | if (cflag & CRTSCTS) { | 1741 | if (cflag & CRTSCTS) { |
@@ -1918,86 +1765,73 @@ static unsigned termios2digi_h(struct channel *ch, unsigned cflag) | |||
1918 | ch->digiext.digi_flags |= CTSPACE; | 1765 | ch->digiext.digi_flags |= CTSPACE; |
1919 | 1766 | ||
1920 | return res; | 1767 | return res; |
1768 | } | ||
1921 | 1769 | ||
1922 | } /* End termios2digi_h */ | ||
1923 | |||
1924 | /* --------------------- Begin termios2digi_i -------------------- */ | ||
1925 | static unsigned termios2digi_i(struct channel *ch, unsigned iflag) | 1770 | static unsigned termios2digi_i(struct channel *ch, unsigned iflag) |
1926 | { /* Begin termios2digi_i */ | 1771 | { |
1927 | 1772 | unsigned res = iflag & (IGNBRK | BRKINT | IGNPAR | PARMRK | | |
1928 | unsigned res = iflag & (IGNBRK | BRKINT | IGNPAR | PARMRK | | ||
1929 | INPCK | ISTRIP|IXON|IXANY|IXOFF); | 1773 | INPCK | ISTRIP|IXON|IXANY|IXOFF); |
1930 | if (ch->digiext.digi_flags & DIGI_AIXON) | 1774 | if (ch->digiext.digi_flags & DIGI_AIXON) |
1931 | res |= IAIXON; | 1775 | res |= IAIXON; |
1932 | return res; | 1776 | return res; |
1933 | 1777 | } | |
1934 | } /* End termios2digi_i */ | ||
1935 | |||
1936 | /* --------------------- Begin termios2digi_c -------------------- */ | ||
1937 | 1778 | ||
1938 | static unsigned termios2digi_c(struct channel *ch, unsigned cflag) | 1779 | static unsigned termios2digi_c(struct channel *ch, unsigned cflag) |
1939 | { /* Begin termios2digi_c */ | 1780 | { |
1940 | |||
1941 | unsigned res = 0; | 1781 | unsigned res = 0; |
1942 | if (cflag & CBAUDEX) { /* Begin detected CBAUDEX */ | 1782 | if (cflag & CBAUDEX) { |
1943 | ch->digiext.digi_flags |= DIGI_FAST; | 1783 | ch->digiext.digi_flags |= DIGI_FAST; |
1944 | /* ------------------------------------------------------------- | 1784 | /* |
1945 | HUPCL bit is used by FEP to indicate fast baud | 1785 | * HUPCL bit is used by FEP to indicate fast baud table is to |
1946 | table is to be used. | 1786 | * be used. |
1947 | ----------------------------------------------------------------- */ | 1787 | */ |
1948 | res |= FEP_HUPCL; | 1788 | res |= FEP_HUPCL; |
1949 | } /* End detected CBAUDEX */ | 1789 | } else |
1950 | else ch->digiext.digi_flags &= ~DIGI_FAST; | 1790 | ch->digiext.digi_flags &= ~DIGI_FAST; |
1951 | /* ------------------------------------------------------------------- | 1791 | /* |
1952 | CBAUD has bit position 0x1000 set these days to indicate Linux | 1792 | * CBAUD has bit position 0x1000 set these days to indicate Linux |
1953 | baud rate remap. Digi hardware can't handle the bit assignment. | 1793 | * baud rate remap. Digi hardware can't handle the bit assignment. |
1954 | (We use a different bit assignment for high speed.). Clear this | 1794 | * (We use a different bit assignment for high speed.). Clear this |
1955 | bit out. | 1795 | * bit out. |
1956 | ---------------------------------------------------------------------- */ | 1796 | */ |
1957 | res |= cflag & ((CBAUD ^ CBAUDEX) | PARODD | PARENB | CSTOPB | CSIZE); | 1797 | res |= cflag & ((CBAUD ^ CBAUDEX) | PARODD | PARENB | CSTOPB | CSIZE); |
1958 | /* ------------------------------------------------------------- | 1798 | /* |
1959 | This gets a little confusing. The Digi cards have their own | 1799 | * This gets a little confusing. The Digi cards have their own |
1960 | representation of c_cflags controling baud rate. For the most | 1800 | * representation of c_cflags controling baud rate. For the most part |
1961 | part this is identical to the Linux implementation. However; | 1801 | * this is identical to the Linux implementation. However; Digi |
1962 | Digi supports one rate (76800) that Linux doesn't. This means | 1802 | * supports one rate (76800) that Linux doesn't. This means that the |
1963 | that the c_cflag entry that would normally mean 76800 for Digi | 1803 | * c_cflag entry that would normally mean 76800 for Digi actually means |
1964 | actually means 115200 under Linux. Without the below mapping, | 1804 | * 115200 under Linux. Without the below mapping, a stty 115200 would |
1965 | a stty 115200 would only drive the board at 76800. Since | 1805 | * only drive the board at 76800. Since the rate 230400 is also found |
1966 | the rate 230400 is also found after 76800, the same problem afflicts | 1806 | * after 76800, the same problem afflicts us when we choose a rate of |
1967 | us when we choose a rate of 230400. Without the below modificiation | 1807 | * 230400. Without the below modificiation stty 230400 would actually |
1968 | stty 230400 would actually give us 115200. | 1808 | * give us 115200. |
1969 | 1809 | * | |
1970 | There are two additional differences. The Linux value for CLOCAL | 1810 | * There are two additional differences. The Linux value for CLOCAL |
1971 | (0x800; 0004000) has no meaning to the Digi hardware. Also in | 1811 | * (0x800; 0004000) has no meaning to the Digi hardware. Also in later |
1972 | later releases of Linux; the CBAUD define has CBAUDEX (0x1000; | 1812 | * releases of Linux; the CBAUD define has CBAUDEX (0x1000; 0010000) |
1973 | 0010000) ored into it (CBAUD = 0x100f as opposed to 0xf). CBAUDEX | 1813 | * ored into it (CBAUD = 0x100f as opposed to 0xf). CBAUDEX should be |
1974 | should be checked for a screened out prior to termios2digi_c | 1814 | * checked for a screened out prior to termios2digi_c returning. Since |
1975 | returning. Since CLOCAL isn't used by the board this can be | 1815 | * CLOCAL isn't used by the board this can be ignored as long as the |
1976 | ignored as long as the returned value is used only by Digi hardware. | 1816 | * returned value is used only by Digi hardware. |
1977 | ----------------------------------------------------------------- */ | 1817 | */ |
1978 | if (cflag & CBAUDEX) { | 1818 | if (cflag & CBAUDEX) { |
1979 | /* ------------------------------------------------------------- | 1819 | /* |
1980 | The below code is trying to guarantee that only baud rates | 1820 | * The below code is trying to guarantee that only baud rates |
1981 | 115200 and 230400 are remapped. We use exclusive or because | 1821 | * 115200 and 230400 are remapped. We use exclusive or because |
1982 | the various baud rates share common bit positions and therefore | 1822 | * the various baud rates share common bit positions and |
1983 | can't be tested for easily. | 1823 | * therefore can't be tested for easily. |
1984 | ----------------------------------------------------------------- */ | 1824 | */ |
1985 | 1825 | if ((!((cflag & 0x7) ^ (B115200 & ~CBAUDEX))) || | |
1986 | |||
1987 | if ((!((cflag & 0x7) ^ (B115200 & ~CBAUDEX))) || | ||
1988 | (!((cflag & 0x7) ^ (B230400 & ~CBAUDEX)))) | 1826 | (!((cflag & 0x7) ^ (B230400 & ~CBAUDEX)))) |
1989 | res += 1; | 1827 | res += 1; |
1990 | } | 1828 | } |
1991 | return res; | 1829 | return res; |
1992 | 1830 | } | |
1993 | } /* End termios2digi_c */ | ||
1994 | |||
1995 | /* --------------------- Begin epcaparam ----------------------- */ | ||
1996 | 1831 | ||
1997 | /* Caller must hold the locks */ | 1832 | /* Caller must hold the locks */ |
1998 | static void epcaparam(struct tty_struct *tty, struct channel *ch) | 1833 | static void epcaparam(struct tty_struct *tty, struct channel *ch) |
1999 | { /* Begin epcaparam */ | 1834 | { |
2000 | |||
2001 | unsigned int cmdHead; | 1835 | unsigned int cmdHead; |
2002 | struct ktermios *ts; | 1836 | struct ktermios *ts; |
2003 | struct board_chan __iomem *bc; | 1837 | struct board_chan __iomem *bc; |
@@ -2013,28 +1847,29 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch) | |||
2013 | writew(cmdHead, &bc->rout); | 1847 | writew(cmdHead, &bc->rout); |
2014 | cmdHead = readw(&bc->tin); | 1848 | cmdHead = readw(&bc->tin); |
2015 | /* Changing baud in mid-stream transmission can be wonderful */ | 1849 | /* Changing baud in mid-stream transmission can be wonderful */ |
2016 | /* --------------------------------------------------------------- | 1850 | /* |
2017 | Flush current transmit buffer by setting cmdTail pointer (tout) | 1851 | * Flush current transmit buffer by setting cmdTail pointer |
2018 | to cmdHead pointer (tin). Hopefully the transmit buffer is empty. | 1852 | * (tout) to cmdHead pointer (tin). Hopefully the transmit |
2019 | ----------------------------------------------------------------- */ | 1853 | * buffer is empty. |
1854 | */ | ||
2020 | fepcmd(ch, STOUT, (unsigned) cmdHead, 0, 0, 0); | 1855 | fepcmd(ch, STOUT, (unsigned) cmdHead, 0, 0, 0); |
2021 | mval = 0; | 1856 | mval = 0; |
2022 | } else { /* Begin CBAUD not detected */ | 1857 | } else { /* Begin CBAUD not detected */ |
2023 | /* ------------------------------------------------------------------- | 1858 | /* |
2024 | c_cflags have changed but that change had nothing to do with BAUD. | 1859 | * c_cflags have changed but that change had nothing to do with |
2025 | Propagate the change to the card. | 1860 | * BAUD. Propagate the change to the card. |
2026 | ---------------------------------------------------------------------- */ | 1861 | */ |
2027 | cflag = termios2digi_c(ch, ts->c_cflag); | 1862 | cflag = termios2digi_c(ch, ts->c_cflag); |
2028 | if (cflag != ch->fepcflag) { | 1863 | if (cflag != ch->fepcflag) { |
2029 | ch->fepcflag = cflag; | 1864 | ch->fepcflag = cflag; |
2030 | /* Set baud rate, char size, stop bits, parity */ | 1865 | /* Set baud rate, char size, stop bits, parity */ |
2031 | fepcmd(ch, SETCTRLFLAGS, (unsigned) cflag, 0, 0, 0); | 1866 | fepcmd(ch, SETCTRLFLAGS, (unsigned) cflag, 0, 0, 0); |
2032 | } | 1867 | } |
2033 | /* ---------------------------------------------------------------- | 1868 | /* |
2034 | If the user has not forced CLOCAL and if the device is not a | 1869 | * If the user has not forced CLOCAL and if the device is not a |
2035 | CALLOUT device (Which is always CLOCAL) we set flags such that | 1870 | * CALLOUT device (Which is always CLOCAL) we set flags such |
2036 | the driver will wait on carrier detect. | 1871 | * that the driver will wait on carrier detect. |
2037 | ------------------------------------------------------------------- */ | 1872 | */ |
2038 | if (ts->c_cflag & CLOCAL) | 1873 | if (ts->c_cflag & CLOCAL) |
2039 | ch->asyncflags &= ~ASYNC_CHECK_CD; | 1874 | ch->asyncflags &= ~ASYNC_CHECK_CD; |
2040 | else | 1875 | else |
@@ -2045,19 +1880,19 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch) | |||
2045 | /* Check input mode flags */ | 1880 | /* Check input mode flags */ |
2046 | if (iflag != ch->fepiflag) { | 1881 | if (iflag != ch->fepiflag) { |
2047 | ch->fepiflag = iflag; | 1882 | ch->fepiflag = iflag; |
2048 | /* --------------------------------------------------------------- | 1883 | /* |
2049 | Command sets channels iflag structure on the board. Such things | 1884 | * Command sets channels iflag structure on the board. Such |
2050 | as input soft flow control, handling of parity errors, and | 1885 | * things as input soft flow control, handling of parity |
2051 | break handling are all set here. | 1886 | * errors, and break handling are all set here. |
2052 | ------------------------------------------------------------------- */ | 1887 | */ |
2053 | /* break handling, parity handling, input stripping, flow control chars */ | 1888 | /* break handling, parity handling, input stripping, flow control chars */ |
2054 | fepcmd(ch, SETIFLAGS, (unsigned int) ch->fepiflag, 0, 0, 0); | 1889 | fepcmd(ch, SETIFLAGS, (unsigned int) ch->fepiflag, 0, 0, 0); |
2055 | } | 1890 | } |
2056 | /* --------------------------------------------------------------- | 1891 | /* |
2057 | Set the board mint value for this channel. This will cause hardware | 1892 | * Set the board mint value for this channel. This will cause hardware |
2058 | events to be generated each time the DCD signal (Described in mint) | 1893 | * events to be generated each time the DCD signal (Described in mint) |
2059 | changes. | 1894 | * changes. |
2060 | ------------------------------------------------------------------- */ | 1895 | */ |
2061 | writeb(ch->dcd, &bc->mint); | 1896 | writeb(ch->dcd, &bc->mint); |
2062 | if ((ts->c_cflag & CLOCAL) || (ch->digiext.digi_flags & DIGI_FORCEDCD)) | 1897 | if ((ts->c_cflag & CLOCAL) || (ch->digiext.digi_flags & DIGI_FORCEDCD)) |
2063 | if (ch->digiext.digi_flags & DIGI_FORCEDCD) | 1898 | if (ch->digiext.digi_flags & DIGI_FORCEDCD) |
@@ -2066,23 +1901,23 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch) | |||
2066 | hflow = termios2digi_h(ch, ts->c_cflag); | 1901 | hflow = termios2digi_h(ch, ts->c_cflag); |
2067 | if (hflow != ch->hflow) { | 1902 | if (hflow != ch->hflow) { |
2068 | ch->hflow = hflow; | 1903 | ch->hflow = hflow; |
2069 | /* -------------------------------------------------------------- | 1904 | /* |
2070 | Hard flow control has been selected but the board is not | 1905 | * Hard flow control has been selected but the board is not |
2071 | using it. Activate hard flow control now. | 1906 | * using it. Activate hard flow control now. |
2072 | ----------------------------------------------------------------- */ | 1907 | */ |
2073 | fepcmd(ch, SETHFLOW, hflow, 0xff, 0, 1); | 1908 | fepcmd(ch, SETHFLOW, hflow, 0xff, 0, 1); |
2074 | } | 1909 | } |
2075 | mval ^= ch->modemfake & (mval ^ ch->modem); | 1910 | mval ^= ch->modemfake & (mval ^ ch->modem); |
2076 | 1911 | ||
2077 | if (ch->omodem ^ mval) { | 1912 | if (ch->omodem ^ mval) { |
2078 | ch->omodem = mval; | 1913 | ch->omodem = mval; |
2079 | /* -------------------------------------------------------------- | 1914 | /* |
2080 | The below command sets the DTR and RTS mstat structure. If | 1915 | * The below command sets the DTR and RTS mstat structure. If |
2081 | hard flow control is NOT active these changes will drive the | 1916 | * hard flow control is NOT active these changes will drive the |
2082 | output of the actual DTR and RTS lines. If hard flow control | 1917 | * output of the actual DTR and RTS lines. If hard flow control |
2083 | is active, the changes will be saved in the mstat structure and | 1918 | * is active, the changes will be saved in the mstat structure |
2084 | only asserted when hard flow control is turned off. | 1919 | * and only asserted when hard flow control is turned off. |
2085 | ----------------------------------------------------------------- */ | 1920 | */ |
2086 | 1921 | ||
2087 | /* First reset DTR & RTS; then set them */ | 1922 | /* First reset DTR & RTS; then set them */ |
2088 | fepcmd(ch, SETMODEM, 0, ((ch->m_dtr)|(ch->m_rts)), 0, 1); | 1923 | fepcmd(ch, SETMODEM, 0, ((ch->m_dtr)|(ch->m_rts)), 0, 1); |
@@ -2091,28 +1926,26 @@ static void epcaparam(struct tty_struct *tty, struct channel *ch) | |||
2091 | if (ch->startc != ch->fepstartc || ch->stopc != ch->fepstopc) { | 1926 | if (ch->startc != ch->fepstartc || ch->stopc != ch->fepstopc) { |
2092 | ch->fepstartc = ch->startc; | 1927 | ch->fepstartc = ch->startc; |
2093 | ch->fepstopc = ch->stopc; | 1928 | ch->fepstopc = ch->stopc; |
2094 | /* ------------------------------------------------------------ | 1929 | /* |
2095 | The XON / XOFF characters have changed; propagate these | 1930 | * The XON / XOFF characters have changed; propagate these |
2096 | changes to the card. | 1931 | * changes to the card. |
2097 | --------------------------------------------------------------- */ | 1932 | */ |
2098 | fepcmd(ch, SONOFFC, ch->fepstartc, ch->fepstopc, 0, 1); | 1933 | fepcmd(ch, SONOFFC, ch->fepstartc, ch->fepstopc, 0, 1); |
2099 | } | 1934 | } |
2100 | if (ch->startca != ch->fepstartca || ch->stopca != ch->fepstopca) { | 1935 | if (ch->startca != ch->fepstartca || ch->stopca != ch->fepstopca) { |
2101 | ch->fepstartca = ch->startca; | 1936 | ch->fepstartca = ch->startca; |
2102 | ch->fepstopca = ch->stopca; | 1937 | ch->fepstopca = ch->stopca; |
2103 | /* --------------------------------------------------------------- | 1938 | /* |
2104 | Similar to the above, this time the auxilarly XON / XOFF | 1939 | * Similar to the above, this time the auxilarly XON / XOFF |
2105 | characters have changed; propagate these changes to the card. | 1940 | * characters have changed; propagate these changes to the card. |
2106 | ------------------------------------------------------------------ */ | 1941 | */ |
2107 | fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1); | 1942 | fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1); |
2108 | } | 1943 | } |
2109 | } /* End epcaparam */ | 1944 | } |
2110 | 1945 | ||
2111 | /* --------------------- Begin receive_data ----------------------- */ | ||
2112 | /* Caller holds lock */ | 1946 | /* Caller holds lock */ |
2113 | static void receive_data(struct channel *ch) | 1947 | static void receive_data(struct channel *ch) |
2114 | { /* Begin receive_data */ | 1948 | { |
2115 | |||
2116 | unchar *rptr; | 1949 | unchar *rptr; |
2117 | struct ktermios *ts = NULL; | 1950 | struct ktermios *ts = NULL; |
2118 | struct tty_struct *tty; | 1951 | struct tty_struct *tty; |
@@ -2121,11 +1954,10 @@ static void receive_data(struct channel *ch) | |||
2121 | unsigned int tail, head; | 1954 | unsigned int tail, head; |
2122 | unsigned int wrapmask; | 1955 | unsigned int wrapmask; |
2123 | 1956 | ||
2124 | /* --------------------------------------------------------------- | 1957 | /* |
2125 | This routine is called by doint when a receive data event | 1958 | * This routine is called by doint when a receive data event has taken |
2126 | has taken place. | 1959 | * place. |
2127 | ------------------------------------------------------------------- */ | 1960 | */ |
2128 | |||
2129 | globalwinon(ch); | 1961 | globalwinon(ch); |
2130 | if (ch->statusflags & RXSTOPPED) | 1962 | if (ch->statusflags & RXSTOPPED) |
2131 | return; | 1963 | return; |
@@ -2136,10 +1968,10 @@ static void receive_data(struct channel *ch) | |||
2136 | BUG_ON(!bc); | 1968 | BUG_ON(!bc); |
2137 | wrapmask = ch->rxbufsize - 1; | 1969 | wrapmask = ch->rxbufsize - 1; |
2138 | 1970 | ||
2139 | /* --------------------------------------------------------------------- | 1971 | /* |
2140 | Get the head and tail pointers to the receiver queue. Wrap the | 1972 | * Get the head and tail pointers to the receiver queue. Wrap the head |
2141 | head pointer if it has reached the end of the buffer. | 1973 | * pointer if it has reached the end of the buffer. |
2142 | ------------------------------------------------------------------------ */ | 1974 | */ |
2143 | head = readw(&bc->rin); | 1975 | head = readw(&bc->rin); |
2144 | head &= wrapmask; | 1976 | head &= wrapmask; |
2145 | tail = readw(&bc->rout) & wrapmask; | 1977 | tail = readw(&bc->rout) & wrapmask; |
@@ -2148,10 +1980,7 @@ static void receive_data(struct channel *ch) | |||
2148 | if (bytesAvailable == 0) | 1980 | if (bytesAvailable == 0) |
2149 | return; | 1981 | return; |
2150 | 1982 | ||
2151 | /* ------------------------------------------------------------------ | 1983 | /* If CREAD bit is off or device not open, set TX tail to head */ |
2152 | If CREAD bit is off or device not open, set TX tail to head | ||
2153 | --------------------------------------------------------------------- */ | ||
2154 | |||
2155 | if (!tty || !ts || !(ts->c_cflag & CREAD)) { | 1984 | if (!tty || !ts || !(ts->c_cflag & CREAD)) { |
2156 | writew(head, &bc->rout); | 1985 | writew(head, &bc->rout); |
2157 | return; | 1986 | return; |
@@ -2168,22 +1997,20 @@ static void receive_data(struct channel *ch) | |||
2168 | rxwinon(ch); | 1997 | rxwinon(ch); |
2169 | while (bytesAvailable > 0) { /* Begin while there is data on the card */ | 1998 | while (bytesAvailable > 0) { /* Begin while there is data on the card */ |
2170 | wrapgap = (head >= tail) ? head - tail : ch->rxbufsize - tail; | 1999 | wrapgap = (head >= tail) ? head - tail : ch->rxbufsize - tail; |
2171 | /* --------------------------------------------------------------- | 2000 | /* |
2172 | Even if head has wrapped around only report the amount of | 2001 | * Even if head has wrapped around only report the amount of |
2173 | data to be equal to the size - tail. Remember memcpy can't | 2002 | * data to be equal to the size - tail. Remember memcpy can't |
2174 | automaticly wrap around the receive buffer. | 2003 | * automaticly wrap around the receive buffer. |
2175 | ----------------------------------------------------------------- */ | 2004 | */ |
2176 | dataToRead = (wrapgap < bytesAvailable) ? wrapgap : bytesAvailable; | 2005 | dataToRead = (wrapgap < bytesAvailable) ? wrapgap : bytesAvailable; |
2177 | /* -------------------------------------------------------------- | 2006 | /* Make sure we don't overflow the buffer */ |
2178 | Make sure we don't overflow the buffer | ||
2179 | ----------------------------------------------------------------- */ | ||
2180 | dataToRead = tty_prepare_flip_string(tty, &rptr, dataToRead); | 2007 | dataToRead = tty_prepare_flip_string(tty, &rptr, dataToRead); |
2181 | if (dataToRead == 0) | 2008 | if (dataToRead == 0) |
2182 | break; | 2009 | break; |
2183 | /* --------------------------------------------------------------- | 2010 | /* |
2184 | Move data read from our card into the line disciplines buffer | 2011 | * Move data read from our card into the line disciplines |
2185 | for translation if necessary. | 2012 | * buffer for translation if necessary. |
2186 | ------------------------------------------------------------------ */ | 2013 | */ |
2187 | memcpy_fromio(rptr, ch->rxptr + tail, dataToRead); | 2014 | memcpy_fromio(rptr, ch->rxptr + tail, dataToRead); |
2188 | tail = (tail + dataToRead) & wrapmask; | 2015 | tail = (tail + dataToRead) & wrapmask; |
2189 | bytesAvailable -= dataToRead; | 2016 | bytesAvailable -= dataToRead; |
@@ -2191,28 +2018,26 @@ static void receive_data(struct channel *ch) | |||
2191 | globalwinon(ch); | 2018 | globalwinon(ch); |
2192 | writew(tail, &bc->rout); | 2019 | writew(tail, &bc->rout); |
2193 | /* Must be called with global data */ | 2020 | /* Must be called with global data */ |
2194 | tty_schedule_flip(ch->tty); | 2021 | tty_schedule_flip(ch->tty); |
2195 | return; | 2022 | } |
2196 | } /* End receive_data */ | ||
2197 | 2023 | ||
2198 | static int info_ioctl(struct tty_struct *tty, struct file * file, | 2024 | static int info_ioctl(struct tty_struct *tty, struct file *file, |
2199 | unsigned int cmd, unsigned long arg) | 2025 | unsigned int cmd, unsigned long arg) |
2200 | { | 2026 | { |
2201 | switch (cmd) | 2027 | switch (cmd) { |
2202 | { /* Begin switch cmd */ | 2028 | case DIGI_GETINFO: |
2203 | case DIGI_GETINFO: | 2029 | { |
2204 | { /* Begin case DIGI_GETINFO */ | 2030 | struct digi_info di; |
2205 | struct digi_info di ; | ||
2206 | int brd; | 2031 | int brd; |
2207 | 2032 | ||
2208 | if(get_user(brd, (unsigned int __user *)arg)) | 2033 | if (get_user(brd, (unsigned int __user *)arg)) |
2209 | return -EFAULT; | 2034 | return -EFAULT; |
2210 | if (brd < 0 || brd >= num_cards || num_cards == 0) | 2035 | if (brd < 0 || brd >= num_cards || num_cards == 0) |
2211 | return -ENODEV; | 2036 | return -ENODEV; |
2212 | 2037 | ||
2213 | memset(&di, 0, sizeof(di)); | 2038 | memset(&di, 0, sizeof(di)); |
2214 | 2039 | ||
2215 | di.board = brd ; | 2040 | di.board = brd; |
2216 | di.status = boards[brd].status; | 2041 | di.status = boards[brd].status; |
2217 | di.type = boards[brd].type ; | 2042 | di.type = boards[brd].type ; |
2218 | di.numports = boards[brd].numports ; | 2043 | di.numports = boards[brd].numports ; |
@@ -2220,45 +2045,44 @@ static int info_ioctl(struct tty_struct *tty, struct file * file, | |||
2220 | di.port = (unsigned char *)boards[brd].port ; | 2045 | di.port = (unsigned char *)boards[brd].port ; |
2221 | di.membase = (unsigned char *)boards[brd].membase ; | 2046 | di.membase = (unsigned char *)boards[brd].membase ; |
2222 | 2047 | ||
2223 | if (copy_to_user((void __user *)arg, &di, sizeof (di))) | 2048 | if (copy_to_user((void __user *)arg, &di, sizeof(di))) |
2224 | return -EFAULT; | 2049 | return -EFAULT; |
2225 | break; | 2050 | break; |
2226 | 2051 | ||
2227 | } /* End case DIGI_GETINFO */ | 2052 | } |
2228 | |||
2229 | case DIGI_POLLER: | ||
2230 | { /* Begin case DIGI_POLLER */ | ||
2231 | 2053 | ||
2232 | int brd = arg & 0xff000000 >> 16 ; | 2054 | case DIGI_POLLER: |
2233 | unsigned char state = arg & 0xff ; | 2055 | { |
2056 | int brd = arg & 0xff000000 >> 16; | ||
2057 | unsigned char state = arg & 0xff; | ||
2234 | 2058 | ||
2235 | if (brd < 0 || brd >= num_cards) { | 2059 | if (brd < 0 || brd >= num_cards) { |
2236 | printk(KERN_ERR "epca: DIGI POLLER : brd not valid!\n"); | 2060 | printk(KERN_ERR "epca: DIGI POLLER : brd not valid!\n"); |
2237 | return (-ENODEV); | 2061 | return -ENODEV; |
2238 | } | 2062 | } |
2239 | digi_poller_inhibited = state ; | 2063 | digi_poller_inhibited = state; |
2240 | break ; | 2064 | break; |
2241 | } /* End case DIGI_POLLER */ | 2065 | } |
2242 | 2066 | ||
2243 | case DIGI_INIT: | 2067 | case DIGI_INIT: |
2244 | { /* Begin case DIGI_INIT */ | 2068 | { |
2245 | /* ------------------------------------------------------------ | 2069 | /* |
2246 | This call is made by the apps to complete the initilization | 2070 | * This call is made by the apps to complete the |
2247 | of the board(s). This routine is responsible for setting | 2071 | * initilization of the board(s). This routine is |
2248 | the card to its initial state and setting the drivers control | 2072 | * responsible for setting the card to its initial |
2249 | fields to the sutianle settings for the card in question. | 2073 | * state and setting the drivers control fields to the |
2250 | ---------------------------------------------------------------- */ | 2074 | * sutianle settings for the card in question. |
2251 | int crd ; | 2075 | */ |
2252 | for (crd = 0; crd < num_cards; crd++) | 2076 | int crd; |
2253 | post_fep_init (crd); | 2077 | for (crd = 0; crd < num_cards; crd++) |
2254 | break ; | 2078 | post_fep_init(crd); |
2255 | } /* End case DIGI_INIT */ | 2079 | break; |
2256 | default: | 2080 | } |
2257 | return -ENOTTY; | 2081 | default: |
2258 | } /* End switch cmd */ | 2082 | return -ENOTTY; |
2259 | return (0) ; | 2083 | } |
2084 | return 0; | ||
2260 | } | 2085 | } |
2261 | /* --------------------- Begin pc_ioctl ----------------------- */ | ||
2262 | 2086 | ||
2263 | static int pc_tiocmget(struct tty_struct *tty, struct file *file) | 2087 | static int pc_tiocmget(struct tty_struct *tty, struct file *file) |
2264 | { | 2088 | { |
@@ -2304,9 +2128,9 @@ static int pc_tiocmset(struct tty_struct *tty, struct file *file, | |||
2304 | 2128 | ||
2305 | spin_lock_irqsave(&epca_lock, flags); | 2129 | spin_lock_irqsave(&epca_lock, flags); |
2306 | /* | 2130 | /* |
2307 | * I think this modemfake stuff is broken. It doesn't | 2131 | * I think this modemfake stuff is broken. It doesn't correctly reflect |
2308 | * correctly reflect the behaviour desired by the TIOCM* | 2132 | * the behaviour desired by the TIOCM* ioctls. Therefore this is |
2309 | * ioctls. Therefore this is probably broken. | 2133 | * probably broken. |
2310 | */ | 2134 | */ |
2311 | if (set & TIOCM_RTS) { | 2135 | if (set & TIOCM_RTS) { |
2312 | ch->modemfake |= ch->m_rts; | 2136 | ch->modemfake |= ch->m_rts; |
@@ -2325,10 +2149,10 @@ static int pc_tiocmset(struct tty_struct *tty, struct file *file, | |||
2325 | ch->modem &= ~ch->m_dtr; | 2149 | ch->modem &= ~ch->m_dtr; |
2326 | } | 2150 | } |
2327 | globalwinon(ch); | 2151 | globalwinon(ch); |
2328 | /* -------------------------------------------------------------- | 2152 | /* |
2329 | The below routine generally sets up parity, baud, flow control | 2153 | * The below routine generally sets up parity, baud, flow control |
2330 | issues, etc.... It effect both control flags and input flags. | 2154 | * issues, etc.... It effect both control flags and input flags. |
2331 | ------------------------------------------------------------------ */ | 2155 | */ |
2332 | epcaparam(tty,ch); | 2156 | epcaparam(tty,ch); |
2333 | memoff(ch); | 2157 | memoff(ch); |
2334 | spin_unlock_irqrestore(&epca_lock, flags); | 2158 | spin_unlock_irqrestore(&epca_lock, flags); |
@@ -2337,8 +2161,7 @@ static int pc_tiocmset(struct tty_struct *tty, struct file *file, | |||
2337 | 2161 | ||
2338 | static int pc_ioctl(struct tty_struct *tty, struct file * file, | 2162 | static int pc_ioctl(struct tty_struct *tty, struct file * file, |
2339 | unsigned int cmd, unsigned long arg) | 2163 | unsigned int cmd, unsigned long arg) |
2340 | { /* Begin pc_ioctl */ | 2164 | { |
2341 | |||
2342 | digiflow_t dflow; | 2165 | digiflow_t dflow; |
2343 | int retval; | 2166 | int retval; |
2344 | unsigned long flags; | 2167 | unsigned long flags; |
@@ -2347,49 +2170,47 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file, | |||
2347 | struct board_chan __iomem *bc; | 2170 | struct board_chan __iomem *bc; |
2348 | struct channel *ch = (struct channel *) tty->driver_data; | 2171 | struct channel *ch = (struct channel *) tty->driver_data; |
2349 | void __user *argp = (void __user *)arg; | 2172 | void __user *argp = (void __user *)arg; |
2350 | 2173 | ||
2351 | if (ch) | 2174 | if (ch) |
2352 | bc = ch->brdchan; | 2175 | bc = ch->brdchan; |
2353 | else | 2176 | else |
2354 | return -EINVAL; | 2177 | return -EINVAL; |
2355 | 2178 | ||
2356 | /* ------------------------------------------------------------------- | 2179 | /* |
2357 | For POSIX compliance we need to add more ioctls. See tty_ioctl.c | 2180 | * For POSIX compliance we need to add more ioctls. See tty_ioctl.c in |
2358 | in /usr/src/linux/drivers/char for a good example. In particular | 2181 | * /usr/src/linux/drivers/char for a good example. In particular think |
2359 | think about adding TCSETAF, TCSETAW, TCSETA, TCSETSF, TCSETSW, TCSETS. | 2182 | * about adding TCSETAF, TCSETAW, TCSETA, TCSETSF, TCSETSW, TCSETS. |
2360 | ---------------------------------------------------------------------- */ | 2183 | */ |
2361 | 2184 | switch (cmd) { | |
2362 | switch (cmd) | 2185 | case TCSBRK: /* SVID version: non-zero arg --> no break */ |
2363 | { /* Begin switch cmd */ | 2186 | retval = tty_check_change(tty); |
2364 | case TCSBRK: /* SVID version: non-zero arg --> no break */ | 2187 | if (retval) |
2365 | retval = tty_check_change(tty); | 2188 | return retval; |
2366 | if (retval) | 2189 | /* Setup an event to indicate when the transmit buffer empties */ |
2367 | return retval; | 2190 | spin_lock_irqsave(&epca_lock, flags); |
2368 | /* Setup an event to indicate when the transmit buffer empties */ | 2191 | setup_empty_event(tty,ch); |
2369 | spin_lock_irqsave(&epca_lock, flags); | 2192 | spin_unlock_irqrestore(&epca_lock, flags); |
2370 | setup_empty_event(tty,ch); | 2193 | tty_wait_until_sent(tty, 0); |
2371 | spin_unlock_irqrestore(&epca_lock, flags); | 2194 | if (!arg) |
2372 | tty_wait_until_sent(tty, 0); | 2195 | digi_send_break(ch, HZ / 4); /* 1/4 second */ |
2373 | if (!arg) | 2196 | return 0; |
2374 | digi_send_break(ch, HZ/4); /* 1/4 second */ | 2197 | case TCSBRKP: /* support for POSIX tcsendbreak() */ |
2375 | return 0; | 2198 | retval = tty_check_change(tty); |
2376 | case TCSBRKP: /* support for POSIX tcsendbreak() */ | 2199 | if (retval) |
2377 | retval = tty_check_change(tty); | 2200 | return retval; |
2378 | if (retval) | ||
2379 | return retval; | ||
2380 | 2201 | ||
2381 | /* Setup an event to indicate when the transmit buffer empties */ | 2202 | /* Setup an event to indicate when the transmit buffer empties */ |
2382 | spin_lock_irqsave(&epca_lock, flags); | 2203 | spin_lock_irqsave(&epca_lock, flags); |
2383 | setup_empty_event(tty,ch); | 2204 | setup_empty_event(tty,ch); |
2384 | spin_unlock_irqrestore(&epca_lock, flags); | 2205 | spin_unlock_irqrestore(&epca_lock, flags); |
2385 | tty_wait_until_sent(tty, 0); | 2206 | tty_wait_until_sent(tty, 0); |
2386 | digi_send_break(ch, arg ? arg*(HZ/10) : HZ/4); | 2207 | digi_send_break(ch, arg ? arg*(HZ/10) : HZ/4); |
2387 | return 0; | 2208 | return 0; |
2388 | case TIOCGSOFTCAR: | 2209 | case TIOCGSOFTCAR: |
2389 | if (put_user(C_CLOCAL(tty)?1:0, (unsigned long __user *)arg)) | 2210 | if (put_user(C_CLOCAL(tty)?1:0, (unsigned long __user *)arg)) |
2390 | return -EFAULT; | 2211 | return -EFAULT; |
2391 | return 0; | 2212 | return 0; |
2392 | case TIOCSSOFTCAR: | 2213 | case TIOCSSOFTCAR: |
2393 | { | 2214 | { |
2394 | unsigned int value; | 2215 | unsigned int value; |
2395 | 2216 | ||
@@ -2400,144 +2221,141 @@ static int pc_ioctl(struct tty_struct *tty, struct file * file, | |||
2400 | (value ? CLOCAL : 0)); | 2221 | (value ? CLOCAL : 0)); |
2401 | return 0; | 2222 | return 0; |
2402 | } | 2223 | } |
2403 | case TIOCMODG: | 2224 | case TIOCMODG: |
2404 | mflag = pc_tiocmget(tty, file); | 2225 | mflag = pc_tiocmget(tty, file); |
2405 | if (put_user(mflag, (unsigned long __user *)argp)) | 2226 | if (put_user(mflag, (unsigned long __user *)argp)) |
2406 | return -EFAULT; | 2227 | return -EFAULT; |
2407 | break; | 2228 | break; |
2408 | case TIOCMODS: | 2229 | case TIOCMODS: |
2409 | if (get_user(mstat, (unsigned __user *)argp)) | 2230 | if (get_user(mstat, (unsigned __user *)argp)) |
2410 | return -EFAULT; | 2231 | return -EFAULT; |
2411 | return pc_tiocmset(tty, file, mstat, ~mstat); | 2232 | return pc_tiocmset(tty, file, mstat, ~mstat); |
2412 | case TIOCSDTR: | 2233 | case TIOCSDTR: |
2413 | spin_lock_irqsave(&epca_lock, flags); | 2234 | spin_lock_irqsave(&epca_lock, flags); |
2414 | ch->omodem |= ch->m_dtr; | 2235 | ch->omodem |= ch->m_dtr; |
2415 | globalwinon(ch); | 2236 | globalwinon(ch); |
2416 | fepcmd(ch, SETMODEM, ch->m_dtr, 0, 10, 1); | 2237 | fepcmd(ch, SETMODEM, ch->m_dtr, 0, 10, 1); |
2417 | memoff(ch); | 2238 | memoff(ch); |
2418 | spin_unlock_irqrestore(&epca_lock, flags); | 2239 | spin_unlock_irqrestore(&epca_lock, flags); |
2419 | break; | 2240 | break; |
2420 | 2241 | ||
2421 | case TIOCCDTR: | 2242 | case TIOCCDTR: |
2243 | spin_lock_irqsave(&epca_lock, flags); | ||
2244 | ch->omodem &= ~ch->m_dtr; | ||
2245 | globalwinon(ch); | ||
2246 | fepcmd(ch, SETMODEM, 0, ch->m_dtr, 10, 1); | ||
2247 | memoff(ch); | ||
2248 | spin_unlock_irqrestore(&epca_lock, flags); | ||
2249 | break; | ||
2250 | case DIGI_GETA: | ||
2251 | if (copy_to_user(argp, &ch->digiext, sizeof(digi_t))) | ||
2252 | return -EFAULT; | ||
2253 | break; | ||
2254 | case DIGI_SETAW: | ||
2255 | case DIGI_SETAF: | ||
2256 | if (cmd == DIGI_SETAW) { | ||
2257 | /* Setup an event to indicate when the transmit buffer empties */ | ||
2422 | spin_lock_irqsave(&epca_lock, flags); | 2258 | spin_lock_irqsave(&epca_lock, flags); |
2423 | ch->omodem &= ~ch->m_dtr; | 2259 | setup_empty_event(tty,ch); |
2424 | globalwinon(ch); | ||
2425 | fepcmd(ch, SETMODEM, 0, ch->m_dtr, 10, 1); | ||
2426 | memoff(ch); | ||
2427 | spin_unlock_irqrestore(&epca_lock, flags); | 2260 | spin_unlock_irqrestore(&epca_lock, flags); |
2428 | break; | 2261 | tty_wait_until_sent(tty, 0); |
2429 | case DIGI_GETA: | 2262 | } else { |
2430 | if (copy_to_user(argp, &ch->digiext, sizeof(digi_t))) | 2263 | /* ldisc lock already held in ioctl */ |
2431 | return -EFAULT; | 2264 | if (tty->ldisc.flush_buffer) |
2432 | break; | 2265 | tty->ldisc.flush_buffer(tty); |
2433 | case DIGI_SETAW: | 2266 | } |
2434 | case DIGI_SETAF: | 2267 | /* Fall Thru */ |
2435 | if (cmd == DIGI_SETAW) { | 2268 | case DIGI_SETA: |
2436 | /* Setup an event to indicate when the transmit buffer empties */ | 2269 | if (copy_from_user(&ch->digiext, argp, sizeof(digi_t))) |
2437 | spin_lock_irqsave(&epca_lock, flags); | 2270 | return -EFAULT; |
2438 | setup_empty_event(tty,ch); | 2271 | |
2439 | spin_unlock_irqrestore(&epca_lock, flags); | 2272 | if (ch->digiext.digi_flags & DIGI_ALTPIN) { |
2440 | tty_wait_until_sent(tty, 0); | 2273 | ch->dcd = ch->m_dsr; |
2441 | } else { | 2274 | ch->dsr = ch->m_dcd; |
2442 | /* ldisc lock already held in ioctl */ | 2275 | } else { |
2443 | if (tty->ldisc.flush_buffer) | 2276 | ch->dcd = ch->m_dcd; |
2444 | tty->ldisc.flush_buffer(tty); | 2277 | ch->dsr = ch->m_dsr; |
2445 | } | ||
2446 | /* Fall Thru */ | ||
2447 | case DIGI_SETA: | ||
2448 | if (copy_from_user(&ch->digiext, argp, sizeof(digi_t))) | ||
2449 | return -EFAULT; | ||
2450 | |||
2451 | if (ch->digiext.digi_flags & DIGI_ALTPIN) { | ||
2452 | ch->dcd = ch->m_dsr; | ||
2453 | ch->dsr = ch->m_dcd; | ||
2454 | } else { | ||
2455 | ch->dcd = ch->m_dcd; | ||
2456 | ch->dsr = ch->m_dsr; | ||
2457 | } | 2278 | } |
2458 | |||
2459 | spin_lock_irqsave(&epca_lock, flags); | ||
2460 | globalwinon(ch); | ||
2461 | 2279 | ||
2462 | /* ----------------------------------------------------------------- | 2280 | spin_lock_irqsave(&epca_lock, flags); |
2463 | The below routine generally sets up parity, baud, flow control | 2281 | globalwinon(ch); |
2464 | issues, etc.... It effect both control flags and input flags. | ||
2465 | ------------------------------------------------------------------- */ | ||
2466 | 2282 | ||
2467 | epcaparam(tty,ch); | 2283 | /* |
2468 | memoff(ch); | 2284 | * The below routine generally sets up parity, baud, flow |
2469 | spin_unlock_irqrestore(&epca_lock, flags); | 2285 | * control issues, etc.... It effect both control flags and |
2470 | break; | 2286 | * input flags. |
2287 | */ | ||
2288 | epcaparam(tty,ch); | ||
2289 | memoff(ch); | ||
2290 | spin_unlock_irqrestore(&epca_lock, flags); | ||
2291 | break; | ||
2292 | |||
2293 | case DIGI_GETFLOW: | ||
2294 | case DIGI_GETAFLOW: | ||
2295 | spin_lock_irqsave(&epca_lock, flags); | ||
2296 | globalwinon(ch); | ||
2297 | if (cmd == DIGI_GETFLOW) { | ||
2298 | dflow.startc = readb(&bc->startc); | ||
2299 | dflow.stopc = readb(&bc->stopc); | ||
2300 | } else { | ||
2301 | dflow.startc = readb(&bc->startca); | ||
2302 | dflow.stopc = readb(&bc->stopca); | ||
2303 | } | ||
2304 | memoff(ch); | ||
2305 | spin_unlock_irqrestore(&epca_lock, flags); | ||
2306 | |||
2307 | if (copy_to_user(argp, &dflow, sizeof(dflow))) | ||
2308 | return -EFAULT; | ||
2309 | break; | ||
2310 | |||
2311 | case DIGI_SETAFLOW: | ||
2312 | case DIGI_SETFLOW: | ||
2313 | if (cmd == DIGI_SETFLOW) { | ||
2314 | startc = ch->startc; | ||
2315 | stopc = ch->stopc; | ||
2316 | } else { | ||
2317 | startc = ch->startca; | ||
2318 | stopc = ch->stopca; | ||
2319 | } | ||
2320 | |||
2321 | if (copy_from_user(&dflow, argp, sizeof(dflow))) | ||
2322 | return -EFAULT; | ||
2471 | 2323 | ||
2472 | case DIGI_GETFLOW: | 2324 | if (dflow.startc != startc || dflow.stopc != stopc) { /* Begin if setflow toggled */ |
2473 | case DIGI_GETAFLOW: | ||
2474 | spin_lock_irqsave(&epca_lock, flags); | 2325 | spin_lock_irqsave(&epca_lock, flags); |
2475 | globalwinon(ch); | 2326 | globalwinon(ch); |
2476 | if (cmd == DIGI_GETFLOW) { | ||
2477 | dflow.startc = readb(&bc->startc); | ||
2478 | dflow.stopc = readb(&bc->stopc); | ||
2479 | } else { | ||
2480 | dflow.startc = readb(&bc->startca); | ||
2481 | dflow.stopc = readb(&bc->stopca); | ||
2482 | } | ||
2483 | memoff(ch); | ||
2484 | spin_unlock_irqrestore(&epca_lock, flags); | ||
2485 | 2327 | ||
2486 | if (copy_to_user(argp, &dflow, sizeof(dflow))) | ||
2487 | return -EFAULT; | ||
2488 | break; | ||
2489 | |||
2490 | case DIGI_SETAFLOW: | ||
2491 | case DIGI_SETFLOW: | ||
2492 | if (cmd == DIGI_SETFLOW) { | 2328 | if (cmd == DIGI_SETFLOW) { |
2493 | startc = ch->startc; | 2329 | ch->fepstartc = ch->startc = dflow.startc; |
2494 | stopc = ch->stopc; | 2330 | ch->fepstopc = ch->stopc = dflow.stopc; |
2331 | fepcmd(ch, SONOFFC, ch->fepstartc, ch->fepstopc, 0, 1); | ||
2495 | } else { | 2332 | } else { |
2496 | startc = ch->startca; | 2333 | ch->fepstartca = ch->startca = dflow.startc; |
2497 | stopc = ch->stopca; | 2334 | ch->fepstopca = ch->stopca = dflow.stopc; |
2335 | fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1); | ||
2498 | } | 2336 | } |
2499 | 2337 | ||
2500 | if (copy_from_user(&dflow, argp, sizeof(dflow))) | 2338 | if (ch->statusflags & TXSTOPPED) |
2501 | return -EFAULT; | 2339 | pc_start(tty); |
2502 | 2340 | ||
2503 | if (dflow.startc != startc || dflow.stopc != stopc) { /* Begin if setflow toggled */ | 2341 | memoff(ch); |
2504 | spin_lock_irqsave(&epca_lock, flags); | 2342 | spin_unlock_irqrestore(&epca_lock, flags); |
2505 | globalwinon(ch); | 2343 | } /* End if setflow toggled */ |
2506 | 2344 | break; | |
2507 | if (cmd == DIGI_SETFLOW) { | 2345 | default: |
2508 | ch->fepstartc = ch->startc = dflow.startc; | 2346 | return -ENOIOCTLCMD; |
2509 | ch->fepstopc = ch->stopc = dflow.stopc; | 2347 | } |
2510 | fepcmd(ch, SONOFFC, ch->fepstartc, ch->fepstopc, 0, 1); | ||
2511 | } else { | ||
2512 | ch->fepstartca = ch->startca = dflow.startc; | ||
2513 | ch->fepstopca = ch->stopca = dflow.stopc; | ||
2514 | fepcmd(ch, SAUXONOFFC, ch->fepstartca, ch->fepstopca, 0, 1); | ||
2515 | } | ||
2516 | |||
2517 | if (ch->statusflags & TXSTOPPED) | ||
2518 | pc_start(tty); | ||
2519 | |||
2520 | memoff(ch); | ||
2521 | spin_unlock_irqrestore(&epca_lock, flags); | ||
2522 | } /* End if setflow toggled */ | ||
2523 | break; | ||
2524 | default: | ||
2525 | return -ENOIOCTLCMD; | ||
2526 | } /* End switch cmd */ | ||
2527 | return 0; | 2348 | return 0; |
2528 | } /* End pc_ioctl */ | 2349 | } |
2529 | |||
2530 | /* --------------------- Begin pc_set_termios ----------------------- */ | ||
2531 | 2350 | ||
2532 | static void pc_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | 2351 | static void pc_set_termios(struct tty_struct *tty, struct ktermios *old_termios) |
2533 | { /* Begin pc_set_termios */ | 2352 | { |
2534 | |||
2535 | struct channel *ch; | 2353 | struct channel *ch; |
2536 | unsigned long flags; | 2354 | unsigned long flags; |
2537 | /* --------------------------------------------------------- | 2355 | /* |
2538 | verifyChannel returns the channel from the tty struct | 2356 | * verifyChannel returns the channel from the tty struct if it is |
2539 | if it is valid. This serves as a sanity check. | 2357 | * valid. This serves as a sanity check. |
2540 | ------------------------------------------------------------- */ | 2358 | */ |
2541 | if ((ch = verifyChannel(tty)) != NULL) { /* Begin if channel valid */ | 2359 | if ((ch = verifyChannel(tty)) != NULL) { /* Begin if channel valid */ |
2542 | spin_lock_irqsave(&epca_lock, flags); | 2360 | spin_lock_irqsave(&epca_lock, flags); |
2543 | globalwinon(ch); | 2361 | globalwinon(ch); |
@@ -2554,47 +2372,40 @@ static void pc_set_termios(struct tty_struct *tty, struct ktermios *old_termios) | |||
2554 | wake_up_interruptible(&ch->open_wait); | 2372 | wake_up_interruptible(&ch->open_wait); |
2555 | 2373 | ||
2556 | } /* End if channel valid */ | 2374 | } /* End if channel valid */ |
2557 | 2375 | } | |
2558 | } /* End pc_set_termios */ | ||
2559 | |||
2560 | /* --------------------- Begin do_softint ----------------------- */ | ||
2561 | 2376 | ||
2562 | static void do_softint(struct work_struct *work) | 2377 | static void do_softint(struct work_struct *work) |
2563 | { /* Begin do_softint */ | 2378 | { |
2564 | struct channel *ch = container_of(work, struct channel, tqueue); | 2379 | struct channel *ch = container_of(work, struct channel, tqueue); |
2565 | /* Called in response to a modem change event */ | 2380 | /* Called in response to a modem change event */ |
2566 | if (ch && ch->magic == EPCA_MAGIC) { /* Begin EPCA_MAGIC */ | 2381 | if (ch && ch->magic == EPCA_MAGIC) { |
2567 | struct tty_struct *tty = ch->tty; | 2382 | struct tty_struct *tty = ch->tty; |
2568 | 2383 | ||
2569 | if (tty && tty->driver_data) { | 2384 | if (tty && tty->driver_data) { |
2570 | if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) { /* Begin if clear_bit */ | 2385 | if (test_and_clear_bit(EPCA_EVENT_HANGUP, &ch->event)) { |
2571 | tty_hangup(tty); /* FIXME: module removal race here - AKPM */ | 2386 | tty_hangup(tty); /* FIXME: module removal race here - AKPM */ |
2572 | wake_up_interruptible(&ch->open_wait); | 2387 | wake_up_interruptible(&ch->open_wait); |
2573 | ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE; | 2388 | ch->asyncflags &= ~ASYNC_NORMAL_ACTIVE; |
2574 | } /* End if clear_bit */ | 2389 | } |
2575 | } | 2390 | } |
2576 | } /* End EPCA_MAGIC */ | 2391 | } |
2577 | } /* End do_softint */ | 2392 | } |
2578 | |||
2579 | /* ------------------------------------------------------------ | ||
2580 | pc_stop and pc_start provide software flow control to the | ||
2581 | routine and the pc_ioctl routine. | ||
2582 | ---------------------------------------------------------------- */ | ||
2583 | |||
2584 | /* --------------------- Begin pc_stop ----------------------- */ | ||
2585 | 2393 | ||
2394 | /* | ||
2395 | * pc_stop and pc_start provide software flow control to the routine and the | ||
2396 | * pc_ioctl routine. | ||
2397 | */ | ||
2586 | static void pc_stop(struct tty_struct *tty) | 2398 | static void pc_stop(struct tty_struct *tty) |
2587 | { /* Begin pc_stop */ | 2399 | { |
2588 | |||
2589 | struct channel *ch; | 2400 | struct channel *ch; |
2590 | unsigned long flags; | 2401 | unsigned long flags; |
2591 | /* --------------------------------------------------------- | 2402 | /* |
2592 | verifyChannel returns the channel from the tty struct | 2403 | * verifyChannel returns the channel from the tty struct if it is |
2593 | if it is valid. This serves as a sanity check. | 2404 | * valid. This serves as a sanity check. |
2594 | ------------------------------------------------------------- */ | 2405 | */ |
2595 | if ((ch = verifyChannel(tty)) != NULL) { /* Begin if valid channel */ | 2406 | if ((ch = verifyChannel(tty)) != NULL) { |
2596 | spin_lock_irqsave(&epca_lock, flags); | 2407 | spin_lock_irqsave(&epca_lock, flags); |
2597 | if ((ch->statusflags & TXSTOPPED) == 0) { /* Begin if transmit stop requested */ | 2408 | if ((ch->statusflags & TXSTOPPED) == 0) { /* Begin if transmit stop requested */ |
2598 | globalwinon(ch); | 2409 | globalwinon(ch); |
2599 | /* STOP transmitting now !! */ | 2410 | /* STOP transmitting now !! */ |
2600 | fepcmd(ch, PAUSETX, 0, 0, 0, 0); | 2411 | fepcmd(ch, PAUSETX, 0, 0, 0, 0); |
@@ -2602,19 +2413,17 @@ static void pc_stop(struct tty_struct *tty) | |||
2602 | memoff(ch); | 2413 | memoff(ch); |
2603 | } /* End if transmit stop requested */ | 2414 | } /* End if transmit stop requested */ |
2604 | spin_unlock_irqrestore(&epca_lock, flags); | 2415 | spin_unlock_irqrestore(&epca_lock, flags); |
2605 | } /* End if valid channel */ | 2416 | } |
2606 | } /* End pc_stop */ | 2417 | } |
2607 | |||
2608 | /* --------------------- Begin pc_start ----------------------- */ | ||
2609 | 2418 | ||
2610 | static void pc_start(struct tty_struct *tty) | 2419 | static void pc_start(struct tty_struct *tty) |
2611 | { /* Begin pc_start */ | 2420 | { |
2612 | struct channel *ch; | 2421 | struct channel *ch; |
2613 | /* --------------------------------------------------------- | 2422 | /* |
2614 | verifyChannel returns the channel from the tty struct | 2423 | * verifyChannel returns the channel from the tty struct if it is |
2615 | if it is valid. This serves as a sanity check. | 2424 | * valid. This serves as a sanity check. |
2616 | ------------------------------------------------------------- */ | 2425 | */ |
2617 | if ((ch = verifyChannel(tty)) != NULL) { /* Begin if channel valid */ | 2426 | if ((ch = verifyChannel(tty)) != NULL) { |
2618 | unsigned long flags; | 2427 | unsigned long flags; |
2619 | spin_lock_irqsave(&epca_lock, flags); | 2428 | spin_lock_irqsave(&epca_lock, flags); |
2620 | /* Just in case output was resumed because of a change in Digi-flow */ | 2429 | /* Just in case output was resumed because of a change in Digi-flow */ |
@@ -2630,28 +2439,25 @@ static void pc_start(struct tty_struct *tty) | |||
2630 | memoff(ch); | 2439 | memoff(ch); |
2631 | } /* End transmit resume requested */ | 2440 | } /* End transmit resume requested */ |
2632 | spin_unlock_irqrestore(&epca_lock, flags); | 2441 | spin_unlock_irqrestore(&epca_lock, flags); |
2633 | } /* End if channel valid */ | 2442 | } |
2634 | } /* End pc_start */ | 2443 | } |
2635 | 2444 | ||
2636 | /* ------------------------------------------------------------------ | 2445 | /* |
2637 | The below routines pc_throttle and pc_unthrottle are used | 2446 | * The below routines pc_throttle and pc_unthrottle are used to slow (And |
2638 | to slow (And resume) the receipt of data into the kernels | 2447 | * resume) the receipt of data into the kernels receive buffers. The exact |
2639 | receive buffers. The exact occurrence of this depends on the | 2448 | * occurrence of this depends on the size of the kernels receive buffer and |
2640 | size of the kernels receive buffer and what the 'watermarks' | 2449 | * what the 'watermarks' are set to for that buffer. See the n_ttys.c file for |
2641 | are set to for that buffer. See the n_ttys.c file for more | 2450 | * more details. |
2642 | details. | 2451 | */ |
2643 | ______________________________________________________________________ */ | 2452 | static void pc_throttle(struct tty_struct *tty) |
2644 | /* --------------------- Begin throttle ----------------------- */ | 2453 | { |
2645 | |||
2646 | static void pc_throttle(struct tty_struct * tty) | ||
2647 | { /* Begin pc_throttle */ | ||
2648 | struct channel *ch; | 2454 | struct channel *ch; |
2649 | unsigned long flags; | 2455 | unsigned long flags; |
2650 | /* --------------------------------------------------------- | 2456 | /* |
2651 | verifyChannel returns the channel from the tty struct | 2457 | * verifyChannel returns the channel from the tty struct if it is |
2652 | if it is valid. This serves as a sanity check. | 2458 | * valid. This serves as a sanity check. |
2653 | ------------------------------------------------------------- */ | 2459 | */ |
2654 | if ((ch = verifyChannel(tty)) != NULL) { /* Begin if channel valid */ | 2460 | if ((ch = verifyChannel(tty)) != NULL) { |
2655 | spin_lock_irqsave(&epca_lock, flags); | 2461 | spin_lock_irqsave(&epca_lock, flags); |
2656 | if ((ch->statusflags & RXSTOPPED) == 0) { | 2462 | if ((ch->statusflags & RXSTOPPED) == 0) { |
2657 | globalwinon(ch); | 2463 | globalwinon(ch); |
@@ -2660,20 +2466,18 @@ static void pc_throttle(struct tty_struct * tty) | |||
2660 | memoff(ch); | 2466 | memoff(ch); |
2661 | } | 2467 | } |
2662 | spin_unlock_irqrestore(&epca_lock, flags); | 2468 | spin_unlock_irqrestore(&epca_lock, flags); |
2663 | } /* End if channel valid */ | 2469 | } |
2664 | } /* End pc_throttle */ | 2470 | } |
2665 | |||
2666 | /* --------------------- Begin unthrottle ----------------------- */ | ||
2667 | 2471 | ||
2668 | static void pc_unthrottle(struct tty_struct *tty) | 2472 | static void pc_unthrottle(struct tty_struct *tty) |
2669 | { /* Begin pc_unthrottle */ | 2473 | { |
2670 | struct channel *ch; | 2474 | struct channel *ch; |
2671 | unsigned long flags; | 2475 | unsigned long flags; |
2672 | /* --------------------------------------------------------- | 2476 | /* |
2673 | verifyChannel returns the channel from the tty struct | 2477 | * verifyChannel returns the channel from the tty struct if it is |
2674 | if it is valid. This serves as a sanity check. | 2478 | * valid. This serves as a sanity check. |
2675 | ------------------------------------------------------------- */ | 2479 | */ |
2676 | if ((ch = verifyChannel(tty)) != NULL) { /* Begin if channel valid */ | 2480 | if ((ch = verifyChannel(tty)) != NULL) { |
2677 | /* Just in case output was resumed because of a change in Digi-flow */ | 2481 | /* Just in case output was resumed because of a change in Digi-flow */ |
2678 | spin_lock_irqsave(&epca_lock, flags); | 2482 | spin_lock_irqsave(&epca_lock, flags); |
2679 | if (ch->statusflags & RXSTOPPED) { | 2483 | if (ch->statusflags & RXSTOPPED) { |
@@ -2683,151 +2487,143 @@ static void pc_unthrottle(struct tty_struct *tty) | |||
2683 | memoff(ch); | 2487 | memoff(ch); |
2684 | } | 2488 | } |
2685 | spin_unlock_irqrestore(&epca_lock, flags); | 2489 | spin_unlock_irqrestore(&epca_lock, flags); |
2686 | } /* End if channel valid */ | 2490 | } |
2687 | } /* End pc_unthrottle */ | 2491 | } |
2688 | |||
2689 | /* --------------------- Begin digi_send_break ----------------------- */ | ||
2690 | 2492 | ||
2691 | void digi_send_break(struct channel *ch, int msec) | 2493 | void digi_send_break(struct channel *ch, int msec) |
2692 | { /* Begin digi_send_break */ | 2494 | { |
2693 | unsigned long flags; | 2495 | unsigned long flags; |
2694 | 2496 | ||
2695 | spin_lock_irqsave(&epca_lock, flags); | 2497 | spin_lock_irqsave(&epca_lock, flags); |
2696 | globalwinon(ch); | 2498 | globalwinon(ch); |
2697 | /* -------------------------------------------------------------------- | 2499 | /* |
2698 | Maybe I should send an infinite break here, schedule() for | 2500 | * Maybe I should send an infinite break here, schedule() for msec |
2699 | msec amount of time, and then stop the break. This way, | 2501 | * amount of time, and then stop the break. This way, the user can't |
2700 | the user can't screw up the FEP by causing digi_send_break() | 2502 | * screw up the FEP by causing digi_send_break() to be called (i.e. via |
2701 | to be called (i.e. via an ioctl()) more than once in msec amount | 2503 | * an ioctl()) more than once in msec amount of time. |
2702 | of time. Try this for now... | 2504 | * Try this for now... |
2703 | ------------------------------------------------------------------------ */ | 2505 | */ |
2704 | fepcmd(ch, SENDBREAK, msec, 0, 10, 0); | 2506 | fepcmd(ch, SENDBREAK, msec, 0, 10, 0); |
2705 | memoff(ch); | 2507 | memoff(ch); |
2706 | spin_unlock_irqrestore(&epca_lock, flags); | 2508 | spin_unlock_irqrestore(&epca_lock, flags); |
2707 | } /* End digi_send_break */ | 2509 | } |
2708 | |||
2709 | /* --------------------- Begin setup_empty_event ----------------------- */ | ||
2710 | 2510 | ||
2711 | /* Caller MUST hold the lock */ | 2511 | /* Caller MUST hold the lock */ |
2712 | |||
2713 | static void setup_empty_event(struct tty_struct *tty, struct channel *ch) | 2512 | static void setup_empty_event(struct tty_struct *tty, struct channel *ch) |
2714 | { /* Begin setup_empty_event */ | 2513 | { |
2715 | |||
2716 | struct board_chan __iomem *bc = ch->brdchan; | 2514 | struct board_chan __iomem *bc = ch->brdchan; |
2717 | 2515 | ||
2718 | globalwinon(ch); | 2516 | globalwinon(ch); |
2719 | ch->statusflags |= EMPTYWAIT; | 2517 | ch->statusflags |= EMPTYWAIT; |
2720 | /* ------------------------------------------------------------------ | 2518 | /* |
2721 | When set the iempty flag request a event to be generated when the | 2519 | * When set the iempty flag request a event to be generated when the |
2722 | transmit buffer is empty (If there is no BREAK in progress). | 2520 | * transmit buffer is empty (If there is no BREAK in progress). |
2723 | --------------------------------------------------------------------- */ | 2521 | */ |
2724 | writeb(1, &bc->iempty); | 2522 | writeb(1, &bc->iempty); |
2725 | memoff(ch); | 2523 | memoff(ch); |
2726 | } /* End setup_empty_event */ | 2524 | } |
2727 | 2525 | ||
2728 | /* ---------------------- Begin epca_setup -------------------------- */ | ||
2729 | void epca_setup(char *str, int *ints) | 2526 | void epca_setup(char *str, int *ints) |
2730 | { /* Begin epca_setup */ | 2527 | { |
2731 | struct board_info board; | 2528 | struct board_info board; |
2732 | int index, loop, last; | 2529 | int index, loop, last; |
2733 | char *temp, *t2; | 2530 | char *temp, *t2; |
2734 | unsigned len; | 2531 | unsigned len; |
2735 | 2532 | ||
2736 | /* ---------------------------------------------------------------------- | 2533 | /* |
2737 | If this routine looks a little strange it is because it is only called | 2534 | * If this routine looks a little strange it is because it is only |
2738 | if a LILO append command is given to boot the kernel with parameters. | 2535 | * called if a LILO append command is given to boot the kernel with |
2739 | In this way, we can provide the user a method of changing his board | 2536 | * parameters. In this way, we can provide the user a method of |
2740 | configuration without rebuilding the kernel. | 2537 | * changing his board configuration without rebuilding the kernel. |
2741 | ----------------------------------------------------------------------- */ | 2538 | */ |
2742 | if (!liloconfig) | 2539 | if (!liloconfig) |
2743 | liloconfig = 1; | 2540 | liloconfig = 1; |
2744 | 2541 | ||
2745 | memset(&board, 0, sizeof(board)); | 2542 | memset(&board, 0, sizeof(board)); |
2746 | 2543 | ||
2747 | /* Assume the data is int first, later we can change it */ | 2544 | /* Assume the data is int first, later we can change it */ |
2748 | /* I think that array position 0 of ints holds the number of args */ | 2545 | /* I think that array position 0 of ints holds the number of args */ |
2749 | for (last = 0, index = 1; index <= ints[0]; index++) | 2546 | for (last = 0, index = 1; index <= ints[0]; index++) |
2750 | switch(index) | 2547 | switch (index) { /* Begin parse switch */ |
2751 | { /* Begin parse switch */ | 2548 | case 1: |
2752 | case 1: | 2549 | board.status = ints[index]; |
2753 | board.status = ints[index]; | 2550 | /* |
2754 | /* --------------------------------------------------------- | 2551 | * We check for 2 (As opposed to 1; because 2 is a flag |
2755 | We check for 2 (As opposed to 1; because 2 is a flag | 2552 | * instructing the driver to ignore epcaconfig.) For |
2756 | instructing the driver to ignore epcaconfig.) For this | 2553 | * this reason we check for 2. |
2757 | reason we check for 2. | 2554 | */ |
2758 | ------------------------------------------------------------ */ | 2555 | if (board.status == 2) { /* Begin ignore epcaconfig as well as lilo cmd line */ |
2759 | if (board.status == 2) { /* Begin ignore epcaconfig as well as lilo cmd line */ | 2556 | nbdevs = 0; |
2760 | nbdevs = 0; | 2557 | num_cards = 0; |
2761 | num_cards = 0; | 2558 | return; |
2762 | return; | 2559 | } /* End ignore epcaconfig as well as lilo cmd line */ |
2763 | } /* End ignore epcaconfig as well as lilo cmd line */ | 2560 | |
2764 | 2561 | if (board.status > 2) { | |
2765 | if (board.status > 2) { | 2562 | printk(KERN_ERR "epca_setup: Invalid board status 0x%x\n", board.status); |
2766 | printk(KERN_ERR "epca_setup: Invalid board status 0x%x\n", board.status); | 2563 | invalid_lilo_config = 1; |
2767 | invalid_lilo_config = 1; | 2564 | setup_error_code |= INVALID_BOARD_STATUS; |
2768 | setup_error_code |= INVALID_BOARD_STATUS; | 2565 | return; |
2769 | return; | 2566 | } |
2770 | } | 2567 | last = index; |
2771 | last = index; | 2568 | break; |
2772 | break; | 2569 | case 2: |
2773 | case 2: | 2570 | board.type = ints[index]; |
2774 | board.type = ints[index]; | 2571 | if (board.type >= PCIXEM) { |
2775 | if (board.type >= PCIXEM) { | 2572 | printk(KERN_ERR "epca_setup: Invalid board type 0x%x\n", board.type); |
2776 | printk(KERN_ERR "epca_setup: Invalid board type 0x%x\n", board.type); | 2573 | invalid_lilo_config = 1; |
2777 | invalid_lilo_config = 1; | 2574 | setup_error_code |= INVALID_BOARD_TYPE; |
2778 | setup_error_code |= INVALID_BOARD_TYPE; | 2575 | return; |
2779 | return; | 2576 | } |
2780 | } | 2577 | last = index; |
2781 | last = index; | 2578 | break; |
2782 | break; | 2579 | case 3: |
2783 | case 3: | 2580 | board.altpin = ints[index]; |
2784 | board.altpin = ints[index]; | 2581 | if (board.altpin > 1) { |
2785 | if (board.altpin > 1) { | 2582 | printk(KERN_ERR "epca_setup: Invalid board altpin 0x%x\n", board.altpin); |
2786 | printk(KERN_ERR "epca_setup: Invalid board altpin 0x%x\n", board.altpin); | 2583 | invalid_lilo_config = 1; |
2787 | invalid_lilo_config = 1; | 2584 | setup_error_code |= INVALID_ALTPIN; |
2788 | setup_error_code |= INVALID_ALTPIN; | 2585 | return; |
2789 | return; | 2586 | } |
2790 | } | 2587 | last = index; |
2791 | last = index; | 2588 | break; |
2792 | break; | 2589 | |
2793 | 2590 | case 4: | |
2794 | case 4: | 2591 | board.numports = ints[index]; |
2795 | board.numports = ints[index]; | 2592 | if (board.numports < 2 || board.numports > 256) { |
2796 | if (board.numports < 2 || board.numports > 256) { | 2593 | printk(KERN_ERR "epca_setup: Invalid board numports 0x%x\n", board.numports); |
2797 | printk(KERN_ERR "epca_setup: Invalid board numports 0x%x\n", board.numports); | 2594 | invalid_lilo_config = 1; |
2798 | invalid_lilo_config = 1; | 2595 | setup_error_code |= INVALID_NUM_PORTS; |
2799 | setup_error_code |= INVALID_NUM_PORTS; | 2596 | return; |
2800 | return; | 2597 | } |
2801 | } | 2598 | nbdevs += board.numports; |
2802 | nbdevs += board.numports; | 2599 | last = index; |
2803 | last = index; | 2600 | break; |
2804 | break; | ||
2805 | |||
2806 | case 5: | ||
2807 | board.port = ints[index]; | ||
2808 | if (ints[index] <= 0) { | ||
2809 | printk(KERN_ERR "epca_setup: Invalid io port 0x%x\n", (unsigned int)board.port); | ||
2810 | invalid_lilo_config = 1; | ||
2811 | setup_error_code |= INVALID_PORT_BASE; | ||
2812 | return; | ||
2813 | } | ||
2814 | last = index; | ||
2815 | break; | ||
2816 | |||
2817 | case 6: | ||
2818 | board.membase = ints[index]; | ||
2819 | if (ints[index] <= 0) { | ||
2820 | printk(KERN_ERR "epca_setup: Invalid memory base 0x%x\n",(unsigned int)board.membase); | ||
2821 | invalid_lilo_config = 1; | ||
2822 | setup_error_code |= INVALID_MEM_BASE; | ||
2823 | return; | ||
2824 | } | ||
2825 | last = index; | ||
2826 | break; | ||
2827 | 2601 | ||
2828 | default: | 2602 | case 5: |
2829 | printk(KERN_ERR "<Error> - epca_setup: Too many integer parms\n"); | 2603 | board.port = ints[index]; |
2604 | if (ints[index] <= 0) { | ||
2605 | printk(KERN_ERR "epca_setup: Invalid io port 0x%x\n", (unsigned int)board.port); | ||
2606 | invalid_lilo_config = 1; | ||
2607 | setup_error_code |= INVALID_PORT_BASE; | ||
2830 | return; | 2608 | return; |
2609 | } | ||
2610 | last = index; | ||
2611 | break; | ||
2612 | |||
2613 | case 6: | ||
2614 | board.membase = ints[index]; | ||
2615 | if (ints[index] <= 0) { | ||
2616 | printk(KERN_ERR "epca_setup: Invalid memory base 0x%x\n",(unsigned int)board.membase); | ||
2617 | invalid_lilo_config = 1; | ||
2618 | setup_error_code |= INVALID_MEM_BASE; | ||
2619 | return; | ||
2620 | } | ||
2621 | last = index; | ||
2622 | break; | ||
2623 | |||
2624 | default: | ||
2625 | printk(KERN_ERR "<Error> - epca_setup: Too many integer parms\n"); | ||
2626 | return; | ||
2831 | 2627 | ||
2832 | } /* End parse switch */ | 2628 | } /* End parse switch */ |
2833 | 2629 | ||
@@ -2844,120 +2640,121 @@ void epca_setup(char *str, int *ints) | |||
2844 | /* Set index to the number of args + 1 */ | 2640 | /* Set index to the number of args + 1 */ |
2845 | index = last + 1; | 2641 | index = last + 1; |
2846 | 2642 | ||
2847 | switch(index) | 2643 | switch (index) { |
2848 | { | 2644 | case 1: |
2849 | case 1: | 2645 | len = strlen(str); |
2850 | len = strlen(str); | 2646 | if (strncmp("Disable", str, len) == 0) |
2851 | if (strncmp("Disable", str, len) == 0) | 2647 | board.status = 0; |
2852 | board.status = 0; | 2648 | else if (strncmp("Enable", str, len) == 0) |
2853 | else if (strncmp("Enable", str, len) == 0) | 2649 | board.status = 1; |
2854 | board.status = 1; | 2650 | else { |
2855 | else { | 2651 | printk(KERN_ERR "epca_setup: Invalid status %s\n", str); |
2856 | printk(KERN_ERR "epca_setup: Invalid status %s\n", str); | 2652 | invalid_lilo_config = 1; |
2857 | invalid_lilo_config = 1; | 2653 | setup_error_code |= INVALID_BOARD_STATUS; |
2858 | setup_error_code |= INVALID_BOARD_STATUS; | 2654 | return; |
2859 | return; | 2655 | } |
2860 | } | 2656 | last = index; |
2861 | last = index; | 2657 | break; |
2862 | break; | ||
2863 | |||
2864 | case 2: | ||
2865 | for(loop = 0; loop < EPCA_NUM_TYPES; loop++) | ||
2866 | if (strcmp(board_desc[loop], str) == 0) | ||
2867 | break; | ||
2868 | /* --------------------------------------------------------------- | ||
2869 | If the index incremented above refers to a legitamate board | ||
2870 | type set it here. | ||
2871 | ------------------------------------------------------------------*/ | ||
2872 | if (index < EPCA_NUM_TYPES) | ||
2873 | board.type = loop; | ||
2874 | else { | ||
2875 | printk(KERN_ERR "epca_setup: Invalid board type: %s\n", str); | ||
2876 | invalid_lilo_config = 1; | ||
2877 | setup_error_code |= INVALID_BOARD_TYPE; | ||
2878 | return; | ||
2879 | } | ||
2880 | last = index; | ||
2881 | break; | ||
2882 | |||
2883 | case 3: | ||
2884 | len = strlen(str); | ||
2885 | if (strncmp("Disable", str, len) == 0) | ||
2886 | board.altpin = 0; | ||
2887 | else if (strncmp("Enable", str, len) == 0) | ||
2888 | board.altpin = 1; | ||
2889 | else { | ||
2890 | printk(KERN_ERR "epca_setup: Invalid altpin %s\n", str); | ||
2891 | invalid_lilo_config = 1; | ||
2892 | setup_error_code |= INVALID_ALTPIN; | ||
2893 | return; | ||
2894 | } | ||
2895 | last = index; | ||
2896 | break; | ||
2897 | |||
2898 | case 4: | ||
2899 | t2 = str; | ||
2900 | while (isdigit(*t2)) | ||
2901 | t2++; | ||
2902 | |||
2903 | if (*t2) { | ||
2904 | printk(KERN_ERR "epca_setup: Invalid port count %s\n", str); | ||
2905 | invalid_lilo_config = 1; | ||
2906 | setup_error_code |= INVALID_NUM_PORTS; | ||
2907 | return; | ||
2908 | } | ||
2909 | 2658 | ||
2910 | /* ------------------------------------------------------------ | 2659 | case 2: |
2911 | There is not a man page for simple_strtoul but the code can be | 2660 | for (loop = 0; loop < EPCA_NUM_TYPES; loop++) |
2912 | found in vsprintf.c. The first argument is the string to | 2661 | if (strcmp(board_desc[loop], str) == 0) |
2913 | translate (To an unsigned long obviously), the second argument | 2662 | break; |
2914 | can be the address of any character variable or a NULL. If a | 2663 | /* |
2915 | variable is given, the end pointer of the string will be stored | 2664 | * If the index incremented above refers to a |
2916 | in that variable; if a NULL is given the end pointer will | 2665 | * legitamate board type set it here. |
2917 | not be returned. The last argument is the base to use. If | 2666 | */ |
2918 | a 0 is indicated, the routine will attempt to determine the | 2667 | if (index < EPCA_NUM_TYPES) |
2919 | proper base by looking at the values prefix (A '0' for octal, | 2668 | board.type = loop; |
2920 | a 'x' for hex, etc ... If a value is given it will use that | 2669 | else { |
2921 | value as the base. | 2670 | printk(KERN_ERR "epca_setup: Invalid board type: %s\n", str); |
2922 | ---------------------------------------------------------------- */ | 2671 | invalid_lilo_config = 1; |
2923 | board.numports = simple_strtoul(str, NULL, 0); | 2672 | setup_error_code |= INVALID_BOARD_TYPE; |
2924 | nbdevs += board.numports; | 2673 | return; |
2925 | last = index; | 2674 | } |
2926 | break; | 2675 | last = index; |
2927 | 2676 | break; | |
2928 | case 5: | ||
2929 | t2 = str; | ||
2930 | while (isxdigit(*t2)) | ||
2931 | t2++; | ||
2932 | |||
2933 | if (*t2) { | ||
2934 | printk(KERN_ERR "epca_setup: Invalid i/o address %s\n", str); | ||
2935 | invalid_lilo_config = 1; | ||
2936 | setup_error_code |= INVALID_PORT_BASE; | ||
2937 | return; | ||
2938 | } | ||
2939 | 2677 | ||
2940 | board.port = simple_strtoul(str, NULL, 16); | 2678 | case 3: |
2941 | last = index; | 2679 | len = strlen(str); |
2942 | break; | 2680 | if (strncmp("Disable", str, len) == 0) |
2681 | board.altpin = 0; | ||
2682 | else if (strncmp("Enable", str, len) == 0) | ||
2683 | board.altpin = 1; | ||
2684 | else { | ||
2685 | printk(KERN_ERR "epca_setup: Invalid altpin %s\n", str); | ||
2686 | invalid_lilo_config = 1; | ||
2687 | setup_error_code |= INVALID_ALTPIN; | ||
2688 | return; | ||
2689 | } | ||
2690 | last = index; | ||
2691 | break; | ||
2943 | 2692 | ||
2944 | case 6: | 2693 | case 4: |
2945 | t2 = str; | 2694 | t2 = str; |
2946 | while (isxdigit(*t2)) | 2695 | while (isdigit(*t2)) |
2947 | t2++; | 2696 | t2++; |
2948 | 2697 | ||
2949 | if (*t2) { | 2698 | if (*t2) { |
2950 | printk(KERN_ERR "epca_setup: Invalid memory base %s\n",str); | 2699 | printk(KERN_ERR "epca_setup: Invalid port count %s\n", str); |
2951 | invalid_lilo_config = 1; | 2700 | invalid_lilo_config = 1; |
2952 | setup_error_code |= INVALID_MEM_BASE; | 2701 | setup_error_code |= INVALID_NUM_PORTS; |
2953 | return; | 2702 | return; |
2954 | } | 2703 | } |
2955 | board.membase = simple_strtoul(str, NULL, 16); | 2704 | |
2956 | last = index; | 2705 | /* |
2957 | break; | 2706 | * There is not a man page for simple_strtoul but the |
2958 | default: | 2707 | * code can be found in vsprintf.c. The first argument |
2959 | printk(KERN_ERR "epca: Too many string parms\n"); | 2708 | * is the string to translate (To an unsigned long |
2709 | * obviously), the second argument can be the address | ||
2710 | * of any character variable or a NULL. If a variable | ||
2711 | * is given, the end pointer of the string will be | ||
2712 | * stored in that variable; if a NULL is given the end | ||
2713 | * pointer will not be returned. The last argument is | ||
2714 | * the base to use. If a 0 is indicated, the routine | ||
2715 | * will attempt to determine the proper base by looking | ||
2716 | * at the values prefix (A '0' for octal, a 'x' for | ||
2717 | * hex, etc ... If a value is given it will use that | ||
2718 | * value as the base. | ||
2719 | */ | ||
2720 | board.numports = simple_strtoul(str, NULL, 0); | ||
2721 | nbdevs += board.numports; | ||
2722 | last = index; | ||
2723 | break; | ||
2724 | |||
2725 | case 5: | ||
2726 | t2 = str; | ||
2727 | while (isxdigit(*t2)) | ||
2728 | t2++; | ||
2729 | |||
2730 | if (*t2) { | ||
2731 | printk(KERN_ERR "epca_setup: Invalid i/o address %s\n", str); | ||
2732 | invalid_lilo_config = 1; | ||
2733 | setup_error_code |= INVALID_PORT_BASE; | ||
2734 | return; | ||
2735 | } | ||
2736 | |||
2737 | board.port = simple_strtoul(str, NULL, 16); | ||
2738 | last = index; | ||
2739 | break; | ||
2740 | |||
2741 | case 6: | ||
2742 | t2 = str; | ||
2743 | while (isxdigit(*t2)) | ||
2744 | t2++; | ||
2745 | |||
2746 | if (*t2) { | ||
2747 | printk(KERN_ERR "epca_setup: Invalid memory base %s\n",str); | ||
2748 | invalid_lilo_config = 1; | ||
2749 | setup_error_code |= INVALID_MEM_BASE; | ||
2960 | return; | 2750 | return; |
2751 | } | ||
2752 | board.membase = simple_strtoul(str, NULL, 16); | ||
2753 | last = index; | ||
2754 | break; | ||
2755 | default: | ||
2756 | printk(KERN_ERR "epca: Too many string parms\n"); | ||
2757 | return; | ||
2961 | } | 2758 | } |
2962 | str = temp; | 2759 | str = temp; |
2963 | } /* End while there is a string arg */ | 2760 | } /* End while there is a string arg */ |
@@ -2966,19 +2763,16 @@ void epca_setup(char *str, int *ints) | |||
2966 | printk(KERN_ERR "epca: Insufficient parms specified\n"); | 2763 | printk(KERN_ERR "epca: Insufficient parms specified\n"); |
2967 | return; | 2764 | return; |
2968 | } | 2765 | } |
2969 | 2766 | ||
2970 | /* I should REALLY validate the stuff here */ | 2767 | /* I should REALLY validate the stuff here */ |
2971 | /* Copies our local copy of board into boards */ | 2768 | /* Copies our local copy of board into boards */ |
2972 | memcpy((void *)&boards[num_cards],(void *)&board, sizeof(board)); | 2769 | memcpy((void *)&boards[num_cards],(void *)&board, sizeof(board)); |
2973 | /* Does this get called once per lilo arg are what ? */ | 2770 | /* Does this get called once per lilo arg are what ? */ |
2974 | printk(KERN_INFO "PC/Xx: Added board %i, %s %i ports at 0x%4.4X base 0x%6.6X\n", | 2771 | printk(KERN_INFO "PC/Xx: Added board %i, %s %i ports at 0x%4.4X base 0x%6.6X\n", |
2975 | num_cards, board_desc[board.type], | 2772 | num_cards, board_desc[board.type], |
2976 | board.numports, (int)board.port, (unsigned int) board.membase); | 2773 | board.numports, (int)board.port, (unsigned int) board.membase); |
2977 | num_cards++; | 2774 | num_cards++; |
2978 | } /* End epca_setup */ | 2775 | } |
2979 | |||
2980 | |||
2981 | /* ------------------------ Begin init_PCI --------------------------- */ | ||
2982 | 2776 | ||
2983 | enum epic_board_types { | 2777 | enum epic_board_types { |
2984 | brd_xr = 0, | 2778 | brd_xr = 0, |
@@ -2987,7 +2781,6 @@ enum epic_board_types { | |||
2987 | brd_xrj, | 2781 | brd_xrj, |
2988 | }; | 2782 | }; |
2989 | 2783 | ||
2990 | |||
2991 | /* indexed directly by epic_board_types enum */ | 2784 | /* indexed directly by epic_board_types enum */ |
2992 | static struct { | 2785 | static struct { |
2993 | unsigned char board_type; | 2786 | unsigned char board_type; |
@@ -2999,7 +2792,7 @@ static struct { | |||
2999 | { PCIXRJ, 2, }, | 2792 | { PCIXRJ, 2, }, |
3000 | }; | 2793 | }; |
3001 | 2794 | ||
3002 | static int __devinit epca_init_one (struct pci_dev *pdev, | 2795 | static int __devinit epca_init_one(struct pci_dev *pdev, |
3003 | const struct pci_device_id *ent) | 2796 | const struct pci_device_id *ent) |
3004 | { | 2797 | { |
3005 | static int board_num = -1; | 2798 | static int board_num = -1; |
@@ -3013,7 +2806,7 @@ static int __devinit epca_init_one (struct pci_dev *pdev, | |||
3013 | board_idx = board_num + num_cards; | 2806 | board_idx = board_num + num_cards; |
3014 | if (board_idx >= MAXBOARDS) | 2807 | if (board_idx >= MAXBOARDS) |
3015 | goto err_out; | 2808 | goto err_out; |
3016 | 2809 | ||
3017 | addr = pci_resource_start (pdev, epca_info_tbl[info_idx].bar_idx); | 2810 | addr = pci_resource_start (pdev, epca_info_tbl[info_idx].bar_idx); |
3018 | if (!addr) { | 2811 | if (!addr) { |
3019 | printk (KERN_ERR PFX "PCI region #%d not available (size 0)\n", | 2812 | printk (KERN_ERR PFX "PCI region #%d not available (size 0)\n", |
@@ -3053,15 +2846,15 @@ static int __devinit epca_init_one (struct pci_dev *pdev, | |||
3053 | goto err_out_free_memregion; | 2846 | goto err_out_free_memregion; |
3054 | } | 2847 | } |
3055 | 2848 | ||
3056 | /* -------------------------------------------------------------- | 2849 | /* |
3057 | I don't know what the below does, but the hardware guys say | 2850 | * I don't know what the below does, but the hardware guys say its |
3058 | its required on everything except PLX (In this case XRJ). | 2851 | * required on everything except PLX (In this case XRJ). |
3059 | ---------------------------------------------------------------- */ | 2852 | */ |
3060 | if (info_idx != brd_xrj) { | 2853 | if (info_idx != brd_xrj) { |
3061 | pci_write_config_byte(pdev, 0x40, 0); | 2854 | pci_write_config_byte(pdev, 0x40, 0); |
3062 | pci_write_config_byte(pdev, 0x46, 0); | 2855 | pci_write_config_byte(pdev, 0x46, 0); |
3063 | } | 2856 | } |
3064 | 2857 | ||
3065 | return 0; | 2858 | return 0; |
3066 | 2859 | ||
3067 | err_out_free_memregion: | 2860 | err_out_free_memregion: |
@@ -3086,7 +2879,7 @@ static struct pci_device_id epca_pci_tbl[] = { | |||
3086 | MODULE_DEVICE_TABLE(pci, epca_pci_tbl); | 2879 | MODULE_DEVICE_TABLE(pci, epca_pci_tbl); |
3087 | 2880 | ||
3088 | int __init init_PCI (void) | 2881 | int __init init_PCI (void) |
3089 | { /* Begin init_PCI */ | 2882 | { |
3090 | memset (&epca_driver, 0, sizeof (epca_driver)); | 2883 | memset (&epca_driver, 0, sizeof (epca_driver)); |
3091 | epca_driver.name = "epca"; | 2884 | epca_driver.name = "epca"; |
3092 | epca_driver.id_table = epca_pci_tbl; | 2885 | epca_driver.id_table = epca_pci_tbl; |
diff --git a/drivers/char/hvc_console.c b/drivers/char/hvc_console.c index 83c1151ec7a2..8252f8668538 100644 --- a/drivers/char/hvc_console.c +++ b/drivers/char/hvc_console.c | |||
@@ -69,6 +69,8 @@ static struct task_struct *hvc_task; | |||
69 | /* Picks up late kicks after list walk but before schedule() */ | 69 | /* Picks up late kicks after list walk but before schedule() */ |
70 | static int hvc_kicked; | 70 | static int hvc_kicked; |
71 | 71 | ||
72 | static int hvc_init(void); | ||
73 | |||
72 | #ifdef CONFIG_MAGIC_SYSRQ | 74 | #ifdef CONFIG_MAGIC_SYSRQ |
73 | static int sysrq_pressed; | 75 | static int sysrq_pressed; |
74 | #endif | 76 | #endif |
@@ -754,6 +756,13 @@ struct hvc_struct __devinit *hvc_alloc(uint32_t vtermno, int irq, | |||
754 | struct hvc_struct *hp; | 756 | struct hvc_struct *hp; |
755 | int i; | 757 | int i; |
756 | 758 | ||
759 | /* We wait until a driver actually comes along */ | ||
760 | if (!hvc_driver) { | ||
761 | int err = hvc_init(); | ||
762 | if (err) | ||
763 | return ERR_PTR(err); | ||
764 | } | ||
765 | |||
757 | hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, | 766 | hp = kmalloc(ALIGN(sizeof(*hp), sizeof(long)) + outbuf_size, |
758 | GFP_KERNEL); | 767 | GFP_KERNEL); |
759 | if (!hp) | 768 | if (!hp) |
@@ -829,16 +838,18 @@ int __devexit hvc_remove(struct hvc_struct *hp) | |||
829 | return 0; | 838 | return 0; |
830 | } | 839 | } |
831 | 840 | ||
832 | /* Driver initialization. Follow console initialization. This is where the TTY | 841 | /* Driver initialization: called as soon as someone uses hvc_alloc(). */ |
833 | * interfaces start to become available. */ | 842 | static int hvc_init(void) |
834 | static int __init hvc_init(void) | ||
835 | { | 843 | { |
836 | struct tty_driver *drv; | 844 | struct tty_driver *drv; |
845 | int err; | ||
837 | 846 | ||
838 | /* We need more than hvc_count adapters due to hotplug additions. */ | 847 | /* We need more than hvc_count adapters due to hotplug additions. */ |
839 | drv = alloc_tty_driver(HVC_ALLOC_TTY_ADAPTERS); | 848 | drv = alloc_tty_driver(HVC_ALLOC_TTY_ADAPTERS); |
840 | if (!drv) | 849 | if (!drv) { |
841 | return -ENOMEM; | 850 | err = -ENOMEM; |
851 | goto out; | ||
852 | } | ||
842 | 853 | ||
843 | drv->owner = THIS_MODULE; | 854 | drv->owner = THIS_MODULE; |
844 | drv->driver_name = "hvc"; | 855 | drv->driver_name = "hvc"; |
@@ -854,30 +865,43 @@ static int __init hvc_init(void) | |||
854 | * added later. */ | 865 | * added later. */ |
855 | hvc_task = kthread_run(khvcd, NULL, "khvcd"); | 866 | hvc_task = kthread_run(khvcd, NULL, "khvcd"); |
856 | if (IS_ERR(hvc_task)) { | 867 | if (IS_ERR(hvc_task)) { |
857 | panic("Couldn't create kthread for console.\n"); | 868 | printk(KERN_ERR "Couldn't create kthread for console.\n"); |
858 | put_tty_driver(drv); | 869 | err = PTR_ERR(hvc_task); |
859 | return -EIO; | 870 | goto put_tty; |
860 | } | 871 | } |
861 | 872 | ||
862 | if (tty_register_driver(drv)) | 873 | err = tty_register_driver(drv); |
863 | panic("Couldn't register hvc console driver\n"); | 874 | if (err) { |
875 | printk(KERN_ERR "Couldn't register hvc console driver\n"); | ||
876 | goto stop_thread; | ||
877 | } | ||
864 | 878 | ||
879 | /* FIXME: This mb() seems completely random. Remove it. */ | ||
865 | mb(); | 880 | mb(); |
866 | hvc_driver = drv; | 881 | hvc_driver = drv; |
867 | return 0; | 882 | return 0; |
883 | |||
884 | put_tty: | ||
885 | put_tty_driver(hvc_driver); | ||
886 | stop_thread: | ||
887 | kthread_stop(hvc_task); | ||
888 | hvc_task = NULL; | ||
889 | out: | ||
890 | return err; | ||
868 | } | 891 | } |
869 | module_init(hvc_init); | ||
870 | 892 | ||
871 | /* This isn't particularly necessary due to this being a console driver | 893 | /* This isn't particularly necessary due to this being a console driver |
872 | * but it is nice to be thorough. | 894 | * but it is nice to be thorough. |
873 | */ | 895 | */ |
874 | static void __exit hvc_exit(void) | 896 | static void __exit hvc_exit(void) |
875 | { | 897 | { |
876 | kthread_stop(hvc_task); | 898 | if (hvc_driver) { |
899 | kthread_stop(hvc_task); | ||
877 | 900 | ||
878 | tty_unregister_driver(hvc_driver); | 901 | tty_unregister_driver(hvc_driver); |
879 | /* return tty_struct instances allocated in hvc_init(). */ | 902 | /* return tty_struct instances allocated in hvc_init(). */ |
880 | put_tty_driver(hvc_driver); | 903 | put_tty_driver(hvc_driver); |
881 | unregister_console(&hvc_con_driver); | 904 | unregister_console(&hvc_con_driver); |
905 | } | ||
882 | } | 906 | } |
883 | module_exit(hvc_exit); | 907 | module_exit(hvc_exit); |
diff --git a/drivers/char/ip2/ip2main.c b/drivers/char/ip2/ip2main.c index bd94d5f9e62b..2124dce38f2b 100644 --- a/drivers/char/ip2/ip2main.c +++ b/drivers/char/ip2/ip2main.c | |||
@@ -619,11 +619,7 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | |||
619 | ip2config.irq[i] = pci_dev_i->irq; | 619 | ip2config.irq[i] = pci_dev_i->irq; |
620 | } else { // ann error | 620 | } else { // ann error |
621 | ip2config.addr[i] = 0; | 621 | ip2config.addr[i] = 0; |
622 | if (status == PCIBIOS_DEVICE_NOT_FOUND) { | 622 | printk(KERN_ERR "IP2: PCI board %d not found\n", i); |
623 | printk( KERN_ERR "IP2: PCI board %d not found\n", i ); | ||
624 | } else { | ||
625 | printk( KERN_ERR "IP2: PCI error 0x%x \n", status ); | ||
626 | } | ||
627 | } | 623 | } |
628 | } | 624 | } |
629 | #else | 625 | #else |
@@ -646,10 +642,9 @@ ip2_loadmain(int *iop, int *irqp, unsigned char *firmware, int firmsize) | |||
646 | 642 | ||
647 | for ( i = 0; i < IP2_MAX_BOARDS; ++i ) { | 643 | for ( i = 0; i < IP2_MAX_BOARDS; ++i ) { |
648 | if ( ip2config.addr[i] ) { | 644 | if ( ip2config.addr[i] ) { |
649 | pB = kmalloc( sizeof(i2eBordStr), GFP_KERNEL); | 645 | pB = kzalloc(sizeof(i2eBordStr), GFP_KERNEL); |
650 | if ( pB != NULL ) { | 646 | if (pB) { |
651 | i2BoardPtrTable[i] = pB; | 647 | i2BoardPtrTable[i] = pB; |
652 | memset( pB, 0, sizeof(i2eBordStr) ); | ||
653 | iiSetAddress( pB, ip2config.addr[i], ii2DelayTimer ); | 648 | iiSetAddress( pB, ip2config.addr[i], ii2DelayTimer ); |
654 | iiReset( pB ); | 649 | iiReset( pB ); |
655 | } else { | 650 | } else { |
diff --git a/drivers/char/ipmi/ipmi_msghandler.c b/drivers/char/ipmi/ipmi_msghandler.c index 6a01dd9e43f8..8435fba73daf 100644 --- a/drivers/char/ipmi/ipmi_msghandler.c +++ b/drivers/char/ipmi/ipmi_msghandler.c | |||
@@ -4136,7 +4136,7 @@ static __exit void cleanup_ipmi(void) | |||
4136 | del_timer_sync(&ipmi_timer); | 4136 | del_timer_sync(&ipmi_timer); |
4137 | 4137 | ||
4138 | #ifdef CONFIG_PROC_FS | 4138 | #ifdef CONFIG_PROC_FS |
4139 | remove_proc_entry(proc_ipmi_root->name, &proc_root); | 4139 | remove_proc_entry(proc_ipmi_root->name, NULL); |
4140 | #endif /* CONFIG_PROC_FS */ | 4140 | #endif /* CONFIG_PROC_FS */ |
4141 | 4141 | ||
4142 | driver_unregister(&ipmidriver); | 4142 | driver_unregister(&ipmidriver); |
diff --git a/drivers/char/keyboard.c b/drivers/char/keyboard.c index d95f316afb5a..212276affa1f 100644 --- a/drivers/char/keyboard.c +++ b/drivers/char/keyboard.c | |||
@@ -38,6 +38,7 @@ | |||
38 | #include <linux/kbd_kern.h> | 38 | #include <linux/kbd_kern.h> |
39 | #include <linux/kbd_diacr.h> | 39 | #include <linux/kbd_diacr.h> |
40 | #include <linux/vt_kern.h> | 40 | #include <linux/vt_kern.h> |
41 | #include <linux/consolemap.h> | ||
41 | #include <linux/sysrq.h> | 42 | #include <linux/sysrq.h> |
42 | #include <linux/input.h> | 43 | #include <linux/input.h> |
43 | #include <linux/reboot.h> | 44 | #include <linux/reboot.h> |
@@ -403,9 +404,12 @@ static unsigned int handle_diacr(struct vc_data *vc, unsigned int ch) | |||
403 | return d; | 404 | return d; |
404 | 405 | ||
405 | if (kbd->kbdmode == VC_UNICODE) | 406 | if (kbd->kbdmode == VC_UNICODE) |
406 | to_utf8(vc, conv_8bit_to_uni(d)); | 407 | to_utf8(vc, d); |
407 | else if (d < 0x100) | 408 | else { |
408 | put_queue(vc, d); | 409 | int c = conv_uni_to_8bit(d); |
410 | if (c != -1) | ||
411 | put_queue(vc, c); | ||
412 | } | ||
409 | 413 | ||
410 | return ch; | 414 | return ch; |
411 | } | 415 | } |
@@ -417,9 +421,12 @@ static void fn_enter(struct vc_data *vc) | |||
417 | { | 421 | { |
418 | if (diacr) { | 422 | if (diacr) { |
419 | if (kbd->kbdmode == VC_UNICODE) | 423 | if (kbd->kbdmode == VC_UNICODE) |
420 | to_utf8(vc, conv_8bit_to_uni(diacr)); | 424 | to_utf8(vc, diacr); |
421 | else if (diacr < 0x100) | 425 | else { |
422 | put_queue(vc, diacr); | 426 | int c = conv_uni_to_8bit(diacr); |
427 | if (c != -1) | ||
428 | put_queue(vc, c); | ||
429 | } | ||
423 | diacr = 0; | 430 | diacr = 0; |
424 | } | 431 | } |
425 | put_queue(vc, 13); | 432 | put_queue(vc, 13); |
@@ -627,9 +634,12 @@ static void k_unicode(struct vc_data *vc, unsigned int value, char up_flag) | |||
627 | return; | 634 | return; |
628 | } | 635 | } |
629 | if (kbd->kbdmode == VC_UNICODE) | 636 | if (kbd->kbdmode == VC_UNICODE) |
630 | to_utf8(vc, conv_8bit_to_uni(value)); | 637 | to_utf8(vc, value); |
631 | else if (value < 0x100) | 638 | else { |
632 | put_queue(vc, value); | 639 | int c = conv_uni_to_8bit(value); |
640 | if (c != -1) | ||
641 | put_queue(vc, c); | ||
642 | } | ||
633 | } | 643 | } |
634 | 644 | ||
635 | /* | 645 | /* |
@@ -646,7 +656,12 @@ static void k_deadunicode(struct vc_data *vc, unsigned int value, char up_flag) | |||
646 | 656 | ||
647 | static void k_self(struct vc_data *vc, unsigned char value, char up_flag) | 657 | static void k_self(struct vc_data *vc, unsigned char value, char up_flag) |
648 | { | 658 | { |
649 | k_unicode(vc, value, up_flag); | 659 | unsigned int uni; |
660 | if (kbd->kbdmode == VC_UNICODE) | ||
661 | uni = value; | ||
662 | else | ||
663 | uni = conv_8bit_to_uni(value); | ||
664 | k_unicode(vc, uni, up_flag); | ||
650 | } | 665 | } |
651 | 666 | ||
652 | static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag) | 667 | static void k_dead2(struct vc_data *vc, unsigned char value, char up_flag) |
@@ -1366,7 +1381,7 @@ int __init kbd_init(void) | |||
1366 | kbd_table[i].lockstate = KBD_DEFLOCK; | 1381 | kbd_table[i].lockstate = KBD_DEFLOCK; |
1367 | kbd_table[i].slockstate = 0; | 1382 | kbd_table[i].slockstate = 0; |
1368 | kbd_table[i].modeflags = KBD_DEFMODE; | 1383 | kbd_table[i].modeflags = KBD_DEFMODE; |
1369 | kbd_table[i].kbdmode = VC_XLATE; | 1384 | kbd_table[i].kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE; |
1370 | } | 1385 | } |
1371 | 1386 | ||
1372 | error = input_register_handler(&kbd_handler); | 1387 | error = input_register_handler(&kbd_handler); |
diff --git a/drivers/char/lp.c b/drivers/char/lp.c index c59e2a0996cc..81674d7c56c7 100644 --- a/drivers/char/lp.c +++ b/drivers/char/lp.c | |||
@@ -144,7 +144,7 @@ static unsigned int lp_count = 0; | |||
144 | static struct class *lp_class; | 144 | static struct class *lp_class; |
145 | 145 | ||
146 | #ifdef CONFIG_LP_CONSOLE | 146 | #ifdef CONFIG_LP_CONSOLE |
147 | static struct parport *console_registered; // initially NULL | 147 | static struct parport *console_registered; |
148 | #endif /* CONFIG_LP_CONSOLE */ | 148 | #endif /* CONFIG_LP_CONSOLE */ |
149 | 149 | ||
150 | #undef LP_DEBUG | 150 | #undef LP_DEBUG |
@@ -749,8 +749,8 @@ static struct console lpcons = { | |||
749 | /* --- initialisation code ------------------------------------- */ | 749 | /* --- initialisation code ------------------------------------- */ |
750 | 750 | ||
751 | static int parport_nr[LP_NO] = { [0 ... LP_NO-1] = LP_PARPORT_UNSPEC }; | 751 | static int parport_nr[LP_NO] = { [0 ... LP_NO-1] = LP_PARPORT_UNSPEC }; |
752 | static char *parport[LP_NO] = { NULL, }; | 752 | static char *parport[LP_NO]; |
753 | static int reset = 0; | 753 | static int reset; |
754 | 754 | ||
755 | module_param_array(parport, charp, NULL, 0); | 755 | module_param_array(parport, charp, NULL, 0); |
756 | module_param(reset, bool, 0); | 756 | module_param(reset, bool, 0); |
@@ -758,10 +758,10 @@ module_param(reset, bool, 0); | |||
758 | #ifndef MODULE | 758 | #ifndef MODULE |
759 | static int __init lp_setup (char *str) | 759 | static int __init lp_setup (char *str) |
760 | { | 760 | { |
761 | static int parport_ptr; // initially zero | 761 | static int parport_ptr; |
762 | int x; | 762 | int x; |
763 | 763 | ||
764 | if (get_option (&str, &x)) { | 764 | if (get_option(&str, &x)) { |
765 | if (x == 0) { | 765 | if (x == 0) { |
766 | /* disable driver on "lp=" or "lp=0" */ | 766 | /* disable driver on "lp=" or "lp=0" */ |
767 | parport_nr[0] = LP_PARPORT_OFF; | 767 | parport_nr[0] = LP_PARPORT_OFF; |
@@ -807,7 +807,7 @@ static int lp_register(int nr, struct parport *port) | |||
807 | #ifdef CONFIG_LP_CONSOLE | 807 | #ifdef CONFIG_LP_CONSOLE |
808 | if (!nr) { | 808 | if (!nr) { |
809 | if (port->modes & PARPORT_MODE_SAFEININT) { | 809 | if (port->modes & PARPORT_MODE_SAFEININT) { |
810 | register_console (&lpcons); | 810 | register_console(&lpcons); |
811 | console_registered = port; | 811 | console_registered = port; |
812 | printk (KERN_INFO "lp%d: console ready\n", CONSOLE_LP); | 812 | printk (KERN_INFO "lp%d: console ready\n", CONSOLE_LP); |
813 | } else | 813 | } else |
@@ -823,8 +823,7 @@ static void lp_attach (struct parport *port) | |||
823 | { | 823 | { |
824 | unsigned int i; | 824 | unsigned int i; |
825 | 825 | ||
826 | switch (parport_nr[0]) | 826 | switch (parport_nr[0]) { |
827 | { | ||
828 | case LP_PARPORT_UNSPEC: | 827 | case LP_PARPORT_UNSPEC: |
829 | case LP_PARPORT_AUTO: | 828 | case LP_PARPORT_AUTO: |
830 | if (parport_nr[0] == LP_PARPORT_AUTO && | 829 | if (parport_nr[0] == LP_PARPORT_AUTO && |
@@ -855,7 +854,7 @@ static void lp_detach (struct parport *port) | |||
855 | /* Write this some day. */ | 854 | /* Write this some day. */ |
856 | #ifdef CONFIG_LP_CONSOLE | 855 | #ifdef CONFIG_LP_CONSOLE |
857 | if (console_registered == port) { | 856 | if (console_registered == port) { |
858 | unregister_console (&lpcons); | 857 | unregister_console(&lpcons); |
859 | console_registered = NULL; | 858 | console_registered = NULL; |
860 | } | 859 | } |
861 | #endif /* CONFIG_LP_CONSOLE */ | 860 | #endif /* CONFIG_LP_CONSOLE */ |
diff --git a/drivers/char/mbcs.c b/drivers/char/mbcs.c index 7ee5d9444926..3c5802ae1716 100644 --- a/drivers/char/mbcs.c +++ b/drivers/char/mbcs.c | |||
@@ -22,7 +22,6 @@ | |||
22 | #include <linux/delay.h> | 22 | #include <linux/delay.h> |
23 | #include <linux/device.h> | 23 | #include <linux/device.h> |
24 | #include <linux/mm.h> | 24 | #include <linux/mm.h> |
25 | #include <linux/fs.h> | ||
26 | #include <linux/uio.h> | 25 | #include <linux/uio.h> |
27 | #include <asm/io.h> | 26 | #include <asm/io.h> |
28 | #include <asm/uaccess.h> | 27 | #include <asm/uaccess.h> |
diff --git a/drivers/char/mem.c b/drivers/char/mem.c index 64551ab6be03..0e937f64a789 100644 --- a/drivers/char/mem.c +++ b/drivers/char/mem.c | |||
@@ -893,6 +893,11 @@ static struct class *mem_class; | |||
893 | static int __init chr_dev_init(void) | 893 | static int __init chr_dev_init(void) |
894 | { | 894 | { |
895 | int i; | 895 | int i; |
896 | int err; | ||
897 | |||
898 | err = bdi_init(&zero_bdi); | ||
899 | if (err) | ||
900 | return err; | ||
896 | 901 | ||
897 | if (register_chrdev(MEM_MAJOR,"mem",&memory_fops)) | 902 | if (register_chrdev(MEM_MAJOR,"mem",&memory_fops)) |
898 | printk("unable to get major %d for memory devs\n", MEM_MAJOR); | 903 | printk("unable to get major %d for memory devs\n", MEM_MAJOR); |
diff --git a/drivers/char/mxser.h b/drivers/char/mxser.h index 9fe28497eae9..1f4aa45ec004 100644 --- a/drivers/char/mxser.h +++ b/drivers/char/mxser.h | |||
@@ -30,8 +30,7 @@ | |||
30 | 30 | ||
31 | #define TTY_THRESHOLD_THROTTLE 128 | 31 | #define TTY_THRESHOLD_THROTTLE 128 |
32 | 32 | ||
33 | #define LO_WATER (TTY_FLIPBUF_SIZE) | 33 | #define HI_WATER 768 |
34 | #define HI_WATER (TTY_FLIPBUF_SIZE*2*3/4) | ||
35 | 34 | ||
36 | // added by James. 03-11-2004. | 35 | // added by James. 03-11-2004. |
37 | #define MOXA_SDS_GETICOUNTER (MOXA + 68) | 36 | #define MOXA_SDS_GETICOUNTER (MOXA + 68) |
diff --git a/drivers/char/n_hdlc.c b/drivers/char/n_hdlc.c index e8332f305d72..82bcfb9c839a 100644 --- a/drivers/char/n_hdlc.c +++ b/drivers/char/n_hdlc.c | |||
@@ -229,7 +229,7 @@ static void n_hdlc_release(struct n_hdlc *n_hdlc) | |||
229 | wake_up_interruptible (&tty->read_wait); | 229 | wake_up_interruptible (&tty->read_wait); |
230 | wake_up_interruptible (&tty->write_wait); | 230 | wake_up_interruptible (&tty->write_wait); |
231 | 231 | ||
232 | if (tty != NULL && tty->disc_data == n_hdlc) | 232 | if (tty->disc_data == n_hdlc) |
233 | tty->disc_data = NULL; /* Break the tty->n_hdlc link */ | 233 | tty->disc_data = NULL; /* Break the tty->n_hdlc link */ |
234 | 234 | ||
235 | /* Release transmit and receive buffers */ | 235 | /* Release transmit and receive buffers */ |
diff --git a/drivers/char/ppdev.c b/drivers/char/ppdev.c index 84ac64fc48a1..efe2f5c55b91 100644 --- a/drivers/char/ppdev.c +++ b/drivers/char/ppdev.c | |||
@@ -66,7 +66,6 @@ | |||
66 | #include <linux/poll.h> | 66 | #include <linux/poll.h> |
67 | #include <linux/major.h> | 67 | #include <linux/major.h> |
68 | #include <linux/ppdev.h> | 68 | #include <linux/ppdev.h> |
69 | #include <linux/device.h> | ||
70 | #include <asm/uaccess.h> | 69 | #include <asm/uaccess.h> |
71 | 70 | ||
72 | #define PP_VERSION "ppdev: user-space parallel port driver" | 71 | #define PP_VERSION "ppdev: user-space parallel port driver" |
diff --git a/drivers/char/synclink.c b/drivers/char/synclink.c index fdc256b380b8..905d1f51a7bf 100644 --- a/drivers/char/synclink.c +++ b/drivers/char/synclink.c | |||
@@ -81,13 +81,9 @@ | |||
81 | #include <linux/mm.h> | 81 | #include <linux/mm.h> |
82 | #include <linux/slab.h> | 82 | #include <linux/slab.h> |
83 | #include <linux/delay.h> | 83 | #include <linux/delay.h> |
84 | |||
85 | #include <linux/netdevice.h> | 84 | #include <linux/netdevice.h> |
86 | |||
87 | #include <linux/vmalloc.h> | 85 | #include <linux/vmalloc.h> |
88 | #include <linux/init.h> | 86 | #include <linux/init.h> |
89 | |||
90 | #include <linux/delay.h> | ||
91 | #include <linux/ioctl.h> | 87 | #include <linux/ioctl.h> |
92 | 88 | ||
93 | #include <asm/system.h> | 89 | #include <asm/system.h> |
diff --git a/drivers/char/sysrq.c b/drivers/char/sysrq.c index 39cc318011ea..78d14935f2b8 100644 --- a/drivers/char/sysrq.c +++ b/drivers/char/sysrq.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/kexec.h> | 36 | #include <linux/kexec.h> |
37 | #include <linux/irq.h> | 37 | #include <linux/irq.h> |
38 | #include <linux/hrtimer.h> | 38 | #include <linux/hrtimer.h> |
39 | #include <linux/oom.h> | ||
39 | 40 | ||
40 | #include <asm/ptrace.h> | 41 | #include <asm/ptrace.h> |
41 | #include <asm/irq_regs.h> | 42 | #include <asm/irq_regs.h> |
@@ -107,12 +108,12 @@ static void sysrq_handle_unraw(int key, struct tty_struct *tty) | |||
107 | struct kbd_struct *kbd = &kbd_table[fg_console]; | 108 | struct kbd_struct *kbd = &kbd_table[fg_console]; |
108 | 109 | ||
109 | if (kbd) | 110 | if (kbd) |
110 | kbd->kbdmode = VC_XLATE; | 111 | kbd->kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE; |
111 | } | 112 | } |
112 | static struct sysrq_key_op sysrq_unraw_op = { | 113 | static struct sysrq_key_op sysrq_unraw_op = { |
113 | .handler = sysrq_handle_unraw, | 114 | .handler = sysrq_handle_unraw, |
114 | .help_msg = "unRaw", | 115 | .help_msg = "unRaw", |
115 | .action_msg = "Keyboard mode set to XLATE", | 116 | .action_msg = "Keyboard mode set to system default", |
116 | .enable_mask = SYSRQ_ENABLE_KEYBOARD, | 117 | .enable_mask = SYSRQ_ENABLE_KEYBOARD, |
117 | }; | 118 | }; |
118 | #else | 119 | #else |
diff --git a/drivers/char/tpm/tpm_tis.c b/drivers/char/tpm/tpm_tis.c index 23fa18a6654c..a8e808461377 100644 --- a/drivers/char/tpm/tpm_tis.c +++ b/drivers/char/tpm/tpm_tis.c | |||
@@ -435,17 +435,12 @@ module_param(interrupts, bool, 0444); | |||
435 | MODULE_PARM_DESC(interrupts, "Enable interrupts"); | 435 | MODULE_PARM_DESC(interrupts, "Enable interrupts"); |
436 | 436 | ||
437 | static int tpm_tis_init(struct device *dev, resource_size_t start, | 437 | static int tpm_tis_init(struct device *dev, resource_size_t start, |
438 | resource_size_t len) | 438 | resource_size_t len, unsigned int irq) |
439 | { | 439 | { |
440 | u32 vendor, intfcaps, intmask; | 440 | u32 vendor, intfcaps, intmask; |
441 | int rc, i; | 441 | int rc, i; |
442 | struct tpm_chip *chip; | 442 | struct tpm_chip *chip; |
443 | 443 | ||
444 | if (!start) | ||
445 | start = TIS_MEM_BASE; | ||
446 | if (!len) | ||
447 | len = TIS_MEM_LEN; | ||
448 | |||
449 | if (!(chip = tpm_register_hardware(dev, &tpm_tis))) | 444 | if (!(chip = tpm_register_hardware(dev, &tpm_tis))) |
450 | return -ENODEV; | 445 | return -ENODEV; |
451 | 446 | ||
@@ -512,7 +507,9 @@ static int tpm_tis_init(struct device *dev, resource_size_t start, | |||
512 | iowrite32(intmask, | 507 | iowrite32(intmask, |
513 | chip->vendor.iobase + | 508 | chip->vendor.iobase + |
514 | TPM_INT_ENABLE(chip->vendor.locality)); | 509 | TPM_INT_ENABLE(chip->vendor.locality)); |
515 | if (interrupts) { | 510 | if (interrupts) |
511 | chip->vendor.irq = irq; | ||
512 | if (interrupts && !chip->vendor.irq) { | ||
516 | chip->vendor.irq = | 513 | chip->vendor.irq = |
517 | ioread8(chip->vendor.iobase + | 514 | ioread8(chip->vendor.iobase + |
518 | TPM_INT_VECTOR(chip->vendor.locality)); | 515 | TPM_INT_VECTOR(chip->vendor.locality)); |
@@ -597,10 +594,17 @@ static int __devinit tpm_tis_pnp_init(struct pnp_dev *pnp_dev, | |||
597 | const struct pnp_device_id *pnp_id) | 594 | const struct pnp_device_id *pnp_id) |
598 | { | 595 | { |
599 | resource_size_t start, len; | 596 | resource_size_t start, len; |
597 | unsigned int irq = 0; | ||
598 | |||
600 | start = pnp_mem_start(pnp_dev, 0); | 599 | start = pnp_mem_start(pnp_dev, 0); |
601 | len = pnp_mem_len(pnp_dev, 0); | 600 | len = pnp_mem_len(pnp_dev, 0); |
602 | 601 | ||
603 | return tpm_tis_init(&pnp_dev->dev, start, len); | 602 | if (pnp_irq_valid(pnp_dev, 0)) |
603 | irq = pnp_irq(pnp_dev, 0); | ||
604 | else | ||
605 | interrupts = 0; | ||
606 | |||
607 | return tpm_tis_init(&pnp_dev->dev, start, len, irq); | ||
604 | } | 608 | } |
605 | 609 | ||
606 | static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg) | 610 | static int tpm_tis_pnp_suspend(struct pnp_dev *dev, pm_message_t msg) |
@@ -660,7 +664,7 @@ static int __init init_tis(void) | |||
660 | return rc; | 664 | return rc; |
661 | if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0))) | 665 | if (IS_ERR(pdev=platform_device_register_simple("tpm_tis", -1, NULL, 0))) |
662 | return PTR_ERR(pdev); | 666 | return PTR_ERR(pdev); |
663 | if((rc=tpm_tis_init(&pdev->dev, 0, 0)) != 0) { | 667 | if((rc=tpm_tis_init(&pdev->dev, TIS_MEM_BASE, TIS_MEM_LEN, 0)) != 0) { |
664 | platform_device_unregister(pdev); | 668 | platform_device_unregister(pdev); |
665 | driver_unregister(&tis_drv); | 669 | driver_unregister(&tis_drv); |
666 | } | 670 | } |
diff --git a/drivers/char/tty_ioctl.c b/drivers/char/tty_ioctl.c index 3ee73cf64bd2..745d552620bf 100644 --- a/drivers/char/tty_ioctl.c +++ b/drivers/char/tty_ioctl.c | |||
@@ -206,8 +206,6 @@ speed_t tty_termios_input_baud_rate(struct ktermios *termios) | |||
206 | 206 | ||
207 | EXPORT_SYMBOL(tty_termios_input_baud_rate); | 207 | EXPORT_SYMBOL(tty_termios_input_baud_rate); |
208 | 208 | ||
209 | #ifdef BOTHER | ||
210 | |||
211 | /** | 209 | /** |
212 | * tty_termios_encode_baud_rate | 210 | * tty_termios_encode_baud_rate |
213 | * @termios: ktermios structure holding user requested state | 211 | * @termios: ktermios structure holding user requested state |
@@ -225,6 +223,9 @@ EXPORT_SYMBOL(tty_termios_input_baud_rate); | |||
225 | * | 223 | * |
226 | * Locking: Caller should hold termios lock. This is already held | 224 | * Locking: Caller should hold termios lock. This is already held |
227 | * when calling this function from the driver termios handler. | 225 | * when calling this function from the driver termios handler. |
226 | * | ||
227 | * The ifdefs deal with platforms whose owners have yet to update them | ||
228 | * and will all go away once this is done. | ||
228 | */ | 229 | */ |
229 | 230 | ||
230 | void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud) | 231 | void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed_t obaud) |
@@ -234,9 +235,13 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed | |||
234 | int iclose = ibaud/50, oclose = obaud/50; | 235 | int iclose = ibaud/50, oclose = obaud/50; |
235 | int ibinput = 0; | 236 | int ibinput = 0; |
236 | 237 | ||
238 | if (obaud == 0) /* CD dropped */ | ||
239 | ibaud = 0; /* Clear ibaud to be sure */ | ||
240 | |||
237 | termios->c_ispeed = ibaud; | 241 | termios->c_ispeed = ibaud; |
238 | termios->c_ospeed = obaud; | 242 | termios->c_ospeed = obaud; |
239 | 243 | ||
244 | #ifdef BOTHER | ||
240 | /* If the user asked for a precise weird speed give a precise weird | 245 | /* If the user asked for a precise weird speed give a precise weird |
241 | answer. If they asked for a Bfoo speed they many have problems | 246 | answer. If they asked for a Bfoo speed they many have problems |
242 | digesting non-exact replies so fuzz a bit */ | 247 | digesting non-exact replies so fuzz a bit */ |
@@ -247,32 +252,60 @@ void tty_termios_encode_baud_rate(struct ktermios *termios, speed_t ibaud, speed | |||
247 | iclose = 0; | 252 | iclose = 0; |
248 | if ((termios->c_cflag >> IBSHIFT) & CBAUD) | 253 | if ((termios->c_cflag >> IBSHIFT) & CBAUD) |
249 | ibinput = 1; /* An input speed was specified */ | 254 | ibinput = 1; /* An input speed was specified */ |
250 | 255 | #endif | |
251 | termios->c_cflag &= ~CBAUD; | 256 | termios->c_cflag &= ~CBAUD; |
252 | 257 | ||
258 | /* | ||
259 | * Our goal is to find a close match to the standard baud rate | ||
260 | * returned. Walk the baud rate table and if we get a very close | ||
261 | * match then report back the speed as a POSIX Bxxxx value by | ||
262 | * preference | ||
263 | */ | ||
264 | |||
253 | do { | 265 | do { |
254 | if (obaud - oclose >= baud_table[i] && obaud + oclose <= baud_table[i]) { | 266 | if (obaud - oclose >= baud_table[i] && obaud + oclose <= baud_table[i]) { |
255 | termios->c_cflag |= baud_bits[i]; | 267 | termios->c_cflag |= baud_bits[i]; |
256 | ofound = i; | 268 | ofound = i; |
257 | } | 269 | } |
258 | if (ibaud - iclose >= baud_table[i] && ibaud + iclose <= baud_table[i]) { | 270 | if (ibaud - iclose >= baud_table[i] && ibaud + iclose <= baud_table[i]) { |
259 | /* For the case input == output don't set IBAUD bits if the user didn't do so */ | 271 | if (ofound == i && !ibinput) |
260 | if (ofound != i || ibinput) | 272 | ifound = i; |
273 | #ifdef IBSHIFT | ||
274 | else { | ||
275 | ifound = i; | ||
261 | termios->c_cflag |= (baud_bits[i] << IBSHIFT); | 276 | termios->c_cflag |= (baud_bits[i] << IBSHIFT); |
262 | ifound = i; | 277 | } |
278 | #endif | ||
263 | } | 279 | } |
264 | } while (++i < n_baud_table); | 280 | } while (++i < n_baud_table); |
281 | |||
282 | /* | ||
283 | * If we found no match then use BOTHER if provided or warn | ||
284 | * the user their platform maintainer needs to wake up if not. | ||
285 | */ | ||
286 | #ifdef BOTHER | ||
265 | if (ofound == -1) | 287 | if (ofound == -1) |
266 | termios->c_cflag |= BOTHER; | 288 | termios->c_cflag |= BOTHER; |
267 | /* Set exact input bits only if the input and output differ or the | 289 | /* Set exact input bits only if the input and output differ or the |
268 | user already did */ | 290 | user already did */ |
269 | if (ifound == -1 && (ibaud != obaud || ibinput)) | 291 | if (ifound == -1 && (ibaud != obaud || ibinput)) |
270 | termios->c_cflag |= (BOTHER << IBSHIFT); | 292 | termios->c_cflag |= (BOTHER << IBSHIFT); |
293 | #else | ||
294 | if (ifound == -1 || ofound == -1) { | ||
295 | static int warned; | ||
296 | if (!warned++) | ||
297 | printk(KERN_WARNING "tty: Unable to return correct " | ||
298 | "speed data as your architecture needs updating.\n"); | ||
299 | } | ||
300 | #endif | ||
271 | } | 301 | } |
272 | |||
273 | EXPORT_SYMBOL_GPL(tty_termios_encode_baud_rate); | 302 | EXPORT_SYMBOL_GPL(tty_termios_encode_baud_rate); |
274 | 303 | ||
275 | #endif | 304 | void tty_encode_baud_rate(struct tty_struct *tty, speed_t ibaud, speed_t obaud) |
305 | { | ||
306 | tty_termios_encode_baud_rate(tty->termios, ibaud, obaud); | ||
307 | } | ||
308 | EXPORT_SYMBOL_GPL(tty_encode_baud_rate); | ||
276 | 309 | ||
277 | /** | 310 | /** |
278 | * tty_get_baud_rate - get tty bit rates | 311 | * tty_get_baud_rate - get tty bit rates |
@@ -304,6 +337,29 @@ speed_t tty_get_baud_rate(struct tty_struct *tty) | |||
304 | EXPORT_SYMBOL(tty_get_baud_rate); | 337 | EXPORT_SYMBOL(tty_get_baud_rate); |
305 | 338 | ||
306 | /** | 339 | /** |
340 | * tty_termios_copy_hw - copy hardware settings | ||
341 | * @new: New termios | ||
342 | * @old: Old termios | ||
343 | * | ||
344 | * Propogate the hardware specific terminal setting bits from | ||
345 | * the old termios structure to the new one. This is used in cases | ||
346 | * where the hardware does not support reconfiguration or as a helper | ||
347 | * in some cases where only minimal reconfiguration is supported | ||
348 | */ | ||
349 | |||
350 | void tty_termios_copy_hw(struct ktermios *new, struct ktermios *old) | ||
351 | { | ||
352 | /* The bits a dumb device handles in software. Smart devices need | ||
353 | to always provide a set_termios method */ | ||
354 | new->c_cflag &= HUPCL | CREAD | CLOCAL; | ||
355 | new->c_cflag |= old->c_cflag & ~(HUPCL | CREAD | CLOCAL); | ||
356 | new->c_ispeed = old->c_ispeed; | ||
357 | new->c_ospeed = old->c_ospeed; | ||
358 | } | ||
359 | |||
360 | EXPORT_SYMBOL(tty_termios_copy_hw); | ||
361 | |||
362 | /** | ||
307 | * change_termios - update termios values | 363 | * change_termios - update termios values |
308 | * @tty: tty to update | 364 | * @tty: tty to update |
309 | * @new_termios: desired new value | 365 | * @new_termios: desired new value |
@@ -340,13 +396,12 @@ static void change_termios(struct tty_struct * tty, struct ktermios * new_termio | |||
340 | tty->erasing = 0; | 396 | tty->erasing = 0; |
341 | } | 397 | } |
342 | 398 | ||
343 | 399 | /* This bit should be in the ldisc code */ | |
344 | if (canon_change && !L_ICANON(tty) && tty->read_cnt) | 400 | if (canon_change && !L_ICANON(tty) && tty->read_cnt) |
345 | /* Get characters left over from canonical mode. */ | 401 | /* Get characters left over from canonical mode. */ |
346 | wake_up_interruptible(&tty->read_wait); | 402 | wake_up_interruptible(&tty->read_wait); |
347 | 403 | ||
348 | /* See if packet mode change of state. */ | 404 | /* See if packet mode change of state. */ |
349 | |||
350 | if (tty->link && tty->link->packet) { | 405 | if (tty->link && tty->link->packet) { |
351 | int old_flow = ((old_termios.c_iflag & IXON) && | 406 | int old_flow = ((old_termios.c_iflag & IXON) && |
352 | (old_termios.c_cc[VSTOP] == '\023') && | 407 | (old_termios.c_cc[VSTOP] == '\023') && |
@@ -366,6 +421,8 @@ static void change_termios(struct tty_struct * tty, struct ktermios * new_termio | |||
366 | 421 | ||
367 | if (tty->driver->set_termios) | 422 | if (tty->driver->set_termios) |
368 | (*tty->driver->set_termios)(tty, &old_termios); | 423 | (*tty->driver->set_termios)(tty, &old_termios); |
424 | else | ||
425 | tty_termios_copy_hw(tty->termios, &old_termios); | ||
369 | 426 | ||
370 | ld = tty_ldisc_ref(tty); | 427 | ld = tty_ldisc_ref(tty); |
371 | if (ld != NULL) { | 428 | if (ld != NULL) { |
@@ -440,6 +497,11 @@ static int set_termios(struct tty_struct * tty, void __user *arg, int opt) | |||
440 | } | 497 | } |
441 | 498 | ||
442 | change_termios(tty, &tmp_termios); | 499 | change_termios(tty, &tmp_termios); |
500 | |||
501 | /* FIXME: Arguably if tmp_termios == tty->termios AND the | ||
502 | actual requested termios was not tmp_termios then we may | ||
503 | want to return an error as no user requested change has | ||
504 | succeeded */ | ||
443 | return 0; | 505 | return 0; |
444 | } | 506 | } |
445 | 507 | ||
diff --git a/drivers/char/vt.c b/drivers/char/vt.c index 0d56f8fc105c..645ad9808982 100644 --- a/drivers/char/vt.c +++ b/drivers/char/vt.c | |||
@@ -158,7 +158,11 @@ static void blank_screen_t(unsigned long dummy); | |||
158 | static void set_palette(struct vc_data *vc); | 158 | static void set_palette(struct vc_data *vc); |
159 | 159 | ||
160 | static int printable; /* Is console ready for printing? */ | 160 | static int printable; /* Is console ready for printing? */ |
161 | static int default_utf8; | 161 | #ifdef CONFIG_VT_UNICODE |
162 | int default_utf8 = 1; | ||
163 | #else | ||
164 | int default_utf8; | ||
165 | #endif | ||
162 | module_param(default_utf8, int, S_IRUGO | S_IWUSR); | 166 | module_param(default_utf8, int, S_IRUGO | S_IWUSR); |
163 | 167 | ||
164 | /* | 168 | /* |
diff --git a/drivers/char/vt_ioctl.c b/drivers/char/vt_ioctl.c index f69a8258095c..e6f89e8b9258 100644 --- a/drivers/char/vt_ioctl.c +++ b/drivers/char/vt_ioctl.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include <linux/major.h> | 23 | #include <linux/major.h> |
24 | #include <linux/fs.h> | 24 | #include <linux/fs.h> |
25 | #include <linux/console.h> | 25 | #include <linux/console.h> |
26 | #include <linux/consolemap.h> | ||
26 | #include <linux/signal.h> | 27 | #include <linux/signal.h> |
27 | #include <linux/timex.h> | 28 | #include <linux/timex.h> |
28 | 29 | ||
@@ -582,10 +583,27 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
582 | case KDGKBDIACR: | 583 | case KDGKBDIACR: |
583 | { | 584 | { |
584 | struct kbdiacrs __user *a = up; | 585 | struct kbdiacrs __user *a = up; |
586 | struct kbdiacr diacr; | ||
587 | int i; | ||
585 | 588 | ||
586 | if (put_user(accent_table_size, &a->kb_cnt)) | 589 | if (put_user(accent_table_size, &a->kb_cnt)) |
587 | return -EFAULT; | 590 | return -EFAULT; |
588 | if (copy_to_user(a->kbdiacr, accent_table, accent_table_size*sizeof(struct kbdiacr))) | 591 | for (i = 0; i < accent_table_size; i++) { |
592 | diacr.diacr = conv_uni_to_8bit(accent_table[i].diacr); | ||
593 | diacr.base = conv_uni_to_8bit(accent_table[i].base); | ||
594 | diacr.result = conv_uni_to_8bit(accent_table[i].result); | ||
595 | if (copy_to_user(a->kbdiacr + i, &diacr, sizeof(struct kbdiacr))) | ||
596 | return -EFAULT; | ||
597 | } | ||
598 | return 0; | ||
599 | } | ||
600 | case KDGKBDIACRUC: | ||
601 | { | ||
602 | struct kbdiacrsuc __user *a = up; | ||
603 | |||
604 | if (put_user(accent_table_size, &a->kb_cnt)) | ||
605 | return -EFAULT; | ||
606 | if (copy_to_user(a->kbdiacruc, accent_table, accent_table_size*sizeof(struct kbdiacruc))) | ||
589 | return -EFAULT; | 607 | return -EFAULT; |
590 | return 0; | 608 | return 0; |
591 | } | 609 | } |
@@ -593,6 +611,30 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
593 | case KDSKBDIACR: | 611 | case KDSKBDIACR: |
594 | { | 612 | { |
595 | struct kbdiacrs __user *a = up; | 613 | struct kbdiacrs __user *a = up; |
614 | struct kbdiacr diacr; | ||
615 | unsigned int ct; | ||
616 | int i; | ||
617 | |||
618 | if (!perm) | ||
619 | return -EPERM; | ||
620 | if (get_user(ct,&a->kb_cnt)) | ||
621 | return -EFAULT; | ||
622 | if (ct >= MAX_DIACR) | ||
623 | return -EINVAL; | ||
624 | accent_table_size = ct; | ||
625 | for (i = 0; i < ct; i++) { | ||
626 | if (copy_from_user(&diacr, a->kbdiacr + i, sizeof(struct kbdiacr))) | ||
627 | return -EFAULT; | ||
628 | accent_table[i].diacr = conv_8bit_to_uni(diacr.diacr); | ||
629 | accent_table[i].base = conv_8bit_to_uni(diacr.base); | ||
630 | accent_table[i].result = conv_8bit_to_uni(diacr.result); | ||
631 | } | ||
632 | return 0; | ||
633 | } | ||
634 | |||
635 | case KDSKBDIACRUC: | ||
636 | { | ||
637 | struct kbdiacrsuc __user *a = up; | ||
596 | unsigned int ct; | 638 | unsigned int ct; |
597 | 639 | ||
598 | if (!perm) | 640 | if (!perm) |
@@ -602,7 +644,7 @@ int vt_ioctl(struct tty_struct *tty, struct file * file, | |||
602 | if (ct >= MAX_DIACR) | 644 | if (ct >= MAX_DIACR) |
603 | return -EINVAL; | 645 | return -EINVAL; |
604 | accent_table_size = ct; | 646 | accent_table_size = ct; |
605 | if (copy_from_user(accent_table, a->kbdiacr, ct*sizeof(struct kbdiacr))) | 647 | if (copy_from_user(accent_table, a->kbdiacruc, ct*sizeof(struct kbdiacruc))) |
606 | return -EFAULT; | 648 | return -EFAULT; |
607 | return 0; | 649 | return 0; |
608 | } | 650 | } |
@@ -1083,7 +1125,7 @@ int vt_waitactive(int vt) | |||
1083 | void reset_vc(struct vc_data *vc) | 1125 | void reset_vc(struct vc_data *vc) |
1084 | { | 1126 | { |
1085 | vc->vc_mode = KD_TEXT; | 1127 | vc->vc_mode = KD_TEXT; |
1086 | kbd_table[vc->vc_num].kbdmode = VC_XLATE; | 1128 | kbd_table[vc->vc_num].kbdmode = default_utf8 ? VC_UNICODE : VC_XLATE; |
1087 | vc->vt_mode.mode = VT_AUTO; | 1129 | vc->vt_mode.mode = VT_AUTO; |
1088 | vc->vt_mode.waitv = 0; | 1130 | vc->vt_mode.waitv = 0; |
1089 | vc->vt_mode.relsig = 0; | 1131 | vc->vt_mode.relsig = 0; |
diff --git a/drivers/dma/iop-adma.c b/drivers/dma/iop-adma.c index 5a1d426744d6..e5c62b75f36f 100644 --- a/drivers/dma/iop-adma.c +++ b/drivers/dma/iop-adma.c | |||
@@ -1446,21 +1446,20 @@ static struct platform_driver iop_adma_driver = { | |||
1446 | 1446 | ||
1447 | static int __init iop_adma_init (void) | 1447 | static int __init iop_adma_init (void) |
1448 | { | 1448 | { |
1449 | /* it's currently unsafe to unload this module */ | ||
1450 | /* if forced, worst case is that rmmod hangs */ | ||
1451 | __unsafe(THIS_MODULE); | ||
1452 | |||
1453 | return platform_driver_register(&iop_adma_driver); | 1449 | return platform_driver_register(&iop_adma_driver); |
1454 | } | 1450 | } |
1455 | 1451 | ||
1452 | /* it's currently unsafe to unload this module */ | ||
1453 | #if 0 | ||
1456 | static void __exit iop_adma_exit (void) | 1454 | static void __exit iop_adma_exit (void) |
1457 | { | 1455 | { |
1458 | platform_driver_unregister(&iop_adma_driver); | 1456 | platform_driver_unregister(&iop_adma_driver); |
1459 | return; | 1457 | return; |
1460 | } | 1458 | } |
1459 | module_exit(iop_adma_exit); | ||
1460 | #endif | ||
1461 | 1461 | ||
1462 | module_init(iop_adma_init); | 1462 | module_init(iop_adma_init); |
1463 | module_exit(iop_adma_exit); | ||
1464 | 1463 | ||
1465 | MODULE_AUTHOR("Intel Corporation"); | 1464 | MODULE_AUTHOR("Intel Corporation"); |
1466 | MODULE_DESCRIPTION("IOP ADMA Engine Driver"); | 1465 | MODULE_DESCRIPTION("IOP ADMA Engine Driver"); |
diff --git a/drivers/i2c/chips/menelaus.c b/drivers/i2c/chips/menelaus.c index d9c92c5e0077..66436bae11ac 100644 --- a/drivers/i2c/chips/menelaus.c +++ b/drivers/i2c/chips/menelaus.c | |||
@@ -49,8 +49,6 @@ | |||
49 | 49 | ||
50 | #define DRIVER_NAME "menelaus" | 50 | #define DRIVER_NAME "menelaus" |
51 | 51 | ||
52 | #define pr_err(fmt, arg...) printk(KERN_ERR DRIVER_NAME ": ", ## arg); | ||
53 | |||
54 | #define MENELAUS_I2C_ADDRESS 0x72 | 52 | #define MENELAUS_I2C_ADDRESS 0x72 |
55 | 53 | ||
56 | #define MENELAUS_REV 0x01 | 54 | #define MENELAUS_REV 0x01 |
@@ -155,7 +153,7 @@ static int menelaus_write_reg(int reg, u8 value) | |||
155 | int val = i2c_smbus_write_byte_data(the_menelaus->client, reg, value); | 153 | int val = i2c_smbus_write_byte_data(the_menelaus->client, reg, value); |
156 | 154 | ||
157 | if (val < 0) { | 155 | if (val < 0) { |
158 | pr_err("write error"); | 156 | pr_err(DRIVER_NAME ": write error"); |
159 | return val; | 157 | return val; |
160 | } | 158 | } |
161 | 159 | ||
@@ -167,7 +165,7 @@ static int menelaus_read_reg(int reg) | |||
167 | int val = i2c_smbus_read_byte_data(the_menelaus->client, reg); | 165 | int val = i2c_smbus_read_byte_data(the_menelaus->client, reg); |
168 | 166 | ||
169 | if (val < 0) | 167 | if (val < 0) |
170 | pr_err("read error"); | 168 | pr_err(DRIVER_NAME ": read error"); |
171 | 169 | ||
172 | return val; | 170 | return val; |
173 | } | 171 | } |
@@ -1177,7 +1175,7 @@ static int menelaus_probe(struct i2c_client *client) | |||
1177 | /* If a true probe check the device */ | 1175 | /* If a true probe check the device */ |
1178 | rev = menelaus_read_reg(MENELAUS_REV); | 1176 | rev = menelaus_read_reg(MENELAUS_REV); |
1179 | if (rev < 0) { | 1177 | if (rev < 0) { |
1180 | pr_err("device not found"); | 1178 | pr_err(DRIVER_NAME ": device not found"); |
1181 | err = -ENODEV; | 1179 | err = -ENODEV; |
1182 | goto fail1; | 1180 | goto fail1; |
1183 | } | 1181 | } |
@@ -1258,7 +1256,7 @@ static int __init menelaus_init(void) | |||
1258 | 1256 | ||
1259 | res = i2c_add_driver(&menelaus_i2c_driver); | 1257 | res = i2c_add_driver(&menelaus_i2c_driver); |
1260 | if (res < 0) { | 1258 | if (res < 0) { |
1261 | pr_err("driver registration failed\n"); | 1259 | pr_err(DRIVER_NAME ": driver registration failed\n"); |
1262 | return res; | 1260 | return res; |
1263 | } | 1261 | } |
1264 | 1262 | ||
diff --git a/drivers/infiniband/hw/ehca/ehca_classes.h b/drivers/infiniband/hw/ehca/ehca_classes.h index 0f7a55d35ea7..3f2d68cff764 100644 --- a/drivers/infiniband/hw/ehca/ehca_classes.h +++ b/drivers/infiniband/hw/ehca/ehca_classes.h | |||
@@ -107,7 +107,7 @@ struct ehca_sport { | |||
107 | 107 | ||
108 | struct ehca_shca { | 108 | struct ehca_shca { |
109 | struct ib_device ib_device; | 109 | struct ib_device ib_device; |
110 | struct ibmebus_dev *ibmebus_dev; | 110 | struct of_device *ofdev; |
111 | u8 num_ports; | 111 | u8 num_ports; |
112 | int hw_level; | 112 | int hw_level; |
113 | struct list_head shca_list; | 113 | struct list_head shca_list; |
diff --git a/drivers/infiniband/hw/ehca/ehca_eq.c b/drivers/infiniband/hw/ehca/ehca_eq.c index 1d41faa7a337..b4ac617a70e6 100644 --- a/drivers/infiniband/hw/ehca/ehca_eq.c +++ b/drivers/infiniband/hw/ehca/ehca_eq.c | |||
@@ -123,7 +123,7 @@ int ehca_create_eq(struct ehca_shca *shca, | |||
123 | 123 | ||
124 | /* register interrupt handlers and initialize work queues */ | 124 | /* register interrupt handlers and initialize work queues */ |
125 | if (type == EHCA_EQ) { | 125 | if (type == EHCA_EQ) { |
126 | ret = ibmebus_request_irq(NULL, eq->ist, ehca_interrupt_eq, | 126 | ret = ibmebus_request_irq(eq->ist, ehca_interrupt_eq, |
127 | IRQF_DISABLED, "ehca_eq", | 127 | IRQF_DISABLED, "ehca_eq", |
128 | (void *)shca); | 128 | (void *)shca); |
129 | if (ret < 0) | 129 | if (ret < 0) |
@@ -131,7 +131,7 @@ int ehca_create_eq(struct ehca_shca *shca, | |||
131 | 131 | ||
132 | tasklet_init(&eq->interrupt_task, ehca_tasklet_eq, (long)shca); | 132 | tasklet_init(&eq->interrupt_task, ehca_tasklet_eq, (long)shca); |
133 | } else if (type == EHCA_NEQ) { | 133 | } else if (type == EHCA_NEQ) { |
134 | ret = ibmebus_request_irq(NULL, eq->ist, ehca_interrupt_neq, | 134 | ret = ibmebus_request_irq(eq->ist, ehca_interrupt_neq, |
135 | IRQF_DISABLED, "ehca_neq", | 135 | IRQF_DISABLED, "ehca_neq", |
136 | (void *)shca); | 136 | (void *)shca); |
137 | if (ret < 0) | 137 | if (ret < 0) |
@@ -171,7 +171,7 @@ int ehca_destroy_eq(struct ehca_shca *shca, struct ehca_eq *eq) | |||
171 | u64 h_ret; | 171 | u64 h_ret; |
172 | 172 | ||
173 | spin_lock_irqsave(&eq->spinlock, flags); | 173 | spin_lock_irqsave(&eq->spinlock, flags); |
174 | ibmebus_free_irq(NULL, eq->ist, (void *)shca); | 174 | ibmebus_free_irq(eq->ist, (void *)shca); |
175 | 175 | ||
176 | h_ret = hipz_h_destroy_eq(shca->ipz_hca_handle, eq); | 176 | h_ret = hipz_h_destroy_eq(shca->ipz_hca_handle, eq); |
177 | 177 | ||
diff --git a/drivers/infiniband/hw/ehca/ehca_main.c b/drivers/infiniband/hw/ehca/ehca_main.c index 403467f66fe6..a3409fdb307c 100644 --- a/drivers/infiniband/hw/ehca/ehca_main.c +++ b/drivers/infiniband/hw/ehca/ehca_main.c | |||
@@ -404,7 +404,7 @@ int ehca_init_device(struct ehca_shca *shca) | |||
404 | shca->ib_device.node_type = RDMA_NODE_IB_CA; | 404 | shca->ib_device.node_type = RDMA_NODE_IB_CA; |
405 | shca->ib_device.phys_port_cnt = shca->num_ports; | 405 | shca->ib_device.phys_port_cnt = shca->num_ports; |
406 | shca->ib_device.num_comp_vectors = 1; | 406 | shca->ib_device.num_comp_vectors = 1; |
407 | shca->ib_device.dma_device = &shca->ibmebus_dev->ofdev.dev; | 407 | shca->ib_device.dma_device = &shca->ofdev->dev; |
408 | shca->ib_device.query_device = ehca_query_device; | 408 | shca->ib_device.query_device = ehca_query_device; |
409 | shca->ib_device.query_port = ehca_query_port; | 409 | shca->ib_device.query_port = ehca_query_port; |
410 | shca->ib_device.query_gid = ehca_query_gid; | 410 | shca->ib_device.query_gid = ehca_query_gid; |
@@ -658,7 +658,7 @@ static struct attribute_group ehca_dev_attr_grp = { | |||
658 | .attrs = ehca_dev_attrs | 658 | .attrs = ehca_dev_attrs |
659 | }; | 659 | }; |
660 | 660 | ||
661 | static int __devinit ehca_probe(struct ibmebus_dev *dev, | 661 | static int __devinit ehca_probe(struct of_device *dev, |
662 | const struct of_device_id *id) | 662 | const struct of_device_id *id) |
663 | { | 663 | { |
664 | struct ehca_shca *shca; | 664 | struct ehca_shca *shca; |
@@ -666,16 +666,16 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev, | |||
666 | struct ib_pd *ibpd; | 666 | struct ib_pd *ibpd; |
667 | int ret; | 667 | int ret; |
668 | 668 | ||
669 | handle = of_get_property(dev->ofdev.node, "ibm,hca-handle", NULL); | 669 | handle = of_get_property(dev->node, "ibm,hca-handle", NULL); |
670 | if (!handle) { | 670 | if (!handle) { |
671 | ehca_gen_err("Cannot get eHCA handle for adapter: %s.", | 671 | ehca_gen_err("Cannot get eHCA handle for adapter: %s.", |
672 | dev->ofdev.node->full_name); | 672 | dev->node->full_name); |
673 | return -ENODEV; | 673 | return -ENODEV; |
674 | } | 674 | } |
675 | 675 | ||
676 | if (!(*handle)) { | 676 | if (!(*handle)) { |
677 | ehca_gen_err("Wrong eHCA handle for adapter: %s.", | 677 | ehca_gen_err("Wrong eHCA handle for adapter: %s.", |
678 | dev->ofdev.node->full_name); | 678 | dev->node->full_name); |
679 | return -ENODEV; | 679 | return -ENODEV; |
680 | } | 680 | } |
681 | 681 | ||
@@ -686,9 +686,9 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev, | |||
686 | } | 686 | } |
687 | mutex_init(&shca->modify_mutex); | 687 | mutex_init(&shca->modify_mutex); |
688 | 688 | ||
689 | shca->ibmebus_dev = dev; | 689 | shca->ofdev = dev; |
690 | shca->ipz_hca_handle.handle = *handle; | 690 | shca->ipz_hca_handle.handle = *handle; |
691 | dev->ofdev.dev.driver_data = shca; | 691 | dev->dev.driver_data = shca; |
692 | 692 | ||
693 | ret = ehca_sense_attributes(shca); | 693 | ret = ehca_sense_attributes(shca); |
694 | if (ret < 0) { | 694 | if (ret < 0) { |
@@ -764,7 +764,7 @@ static int __devinit ehca_probe(struct ibmebus_dev *dev, | |||
764 | } | 764 | } |
765 | } | 765 | } |
766 | 766 | ||
767 | ret = sysfs_create_group(&dev->ofdev.dev.kobj, &ehca_dev_attr_grp); | 767 | ret = sysfs_create_group(&dev->dev.kobj, &ehca_dev_attr_grp); |
768 | if (ret) /* only complain; we can live without attributes */ | 768 | if (ret) /* only complain; we can live without attributes */ |
769 | ehca_err(&shca->ib_device, | 769 | ehca_err(&shca->ib_device, |
770 | "Cannot create device attributes ret=%d", ret); | 770 | "Cannot create device attributes ret=%d", ret); |
@@ -814,12 +814,12 @@ probe1: | |||
814 | return -EINVAL; | 814 | return -EINVAL; |
815 | } | 815 | } |
816 | 816 | ||
817 | static int __devexit ehca_remove(struct ibmebus_dev *dev) | 817 | static int __devexit ehca_remove(struct of_device *dev) |
818 | { | 818 | { |
819 | struct ehca_shca *shca = dev->ofdev.dev.driver_data; | 819 | struct ehca_shca *shca = dev->dev.driver_data; |
820 | int ret; | 820 | int ret; |
821 | 821 | ||
822 | sysfs_remove_group(&dev->ofdev.dev.kobj, &ehca_dev_attr_grp); | 822 | sysfs_remove_group(&dev->dev.kobj, &ehca_dev_attr_grp); |
823 | 823 | ||
824 | if (ehca_open_aqp1 == 1) { | 824 | if (ehca_open_aqp1 == 1) { |
825 | int i; | 825 | int i; |
@@ -870,11 +870,11 @@ static struct of_device_id ehca_device_table[] = | |||
870 | {}, | 870 | {}, |
871 | }; | 871 | }; |
872 | 872 | ||
873 | static struct ibmebus_driver ehca_driver = { | 873 | static struct of_platform_driver ehca_driver = { |
874 | .name = "ehca", | 874 | .name = "ehca", |
875 | .id_table = ehca_device_table, | 875 | .match_table = ehca_device_table, |
876 | .probe = ehca_probe, | 876 | .probe = ehca_probe, |
877 | .remove = ehca_remove, | 877 | .remove = ehca_remove, |
878 | }; | 878 | }; |
879 | 879 | ||
880 | void ehca_poll_eqs(unsigned long data) | 880 | void ehca_poll_eqs(unsigned long data) |
diff --git a/drivers/lguest/lguest.c b/drivers/lguest/lguest.c index ee1c6d05c3d3..4a579c840301 100644 --- a/drivers/lguest/lguest.c +++ b/drivers/lguest/lguest.c | |||
@@ -893,7 +893,9 @@ static __init char *lguest_memory_setup(void) | |||
893 | 893 | ||
894 | /* The Linux bootloader header contains an "e820" memory map: the | 894 | /* The Linux bootloader header contains an "e820" memory map: the |
895 | * Launcher populated the first entry with our memory limit. */ | 895 | * Launcher populated the first entry with our memory limit. */ |
896 | add_memory_region(E820_MAP->addr, E820_MAP->size, E820_MAP->type); | 896 | add_memory_region(boot_params.e820_map[0].addr, |
897 | boot_params.e820_map[0].size, | ||
898 | boot_params.e820_map[0].type); | ||
897 | 899 | ||
898 | /* This string is for the boot messages. */ | 900 | /* This string is for the boot messages. */ |
899 | return "LGUEST"; | 901 | return "LGUEST"; |
diff --git a/drivers/md/md.c b/drivers/md/md.c index 0dc563d76b39..c059ae6f37e5 100644 --- a/drivers/md/md.c +++ b/drivers/md/md.c | |||
@@ -2714,7 +2714,7 @@ action_show(mddev_t *mddev, char *page) | |||
2714 | { | 2714 | { |
2715 | char *type = "idle"; | 2715 | char *type = "idle"; |
2716 | if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || | 2716 | if (test_bit(MD_RECOVERY_RUNNING, &mddev->recovery) || |
2717 | test_bit(MD_RECOVERY_NEEDED, &mddev->recovery)) { | 2717 | (!mddev->ro && test_bit(MD_RECOVERY_NEEDED, &mddev->recovery))) { |
2718 | if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) | 2718 | if (test_bit(MD_RECOVERY_RESHAPE, &mddev->recovery)) |
2719 | type = "reshape"; | 2719 | type = "reshape"; |
2720 | else if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { | 2720 | else if (test_bit(MD_RECOVERY_SYNC, &mddev->recovery)) { |
@@ -2833,6 +2833,12 @@ sync_max_store(mddev_t *mddev, const char *buf, size_t len) | |||
2833 | static struct md_sysfs_entry md_sync_max = | 2833 | static struct md_sysfs_entry md_sync_max = |
2834 | __ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store); | 2834 | __ATTR(sync_speed_max, S_IRUGO|S_IWUSR, sync_max_show, sync_max_store); |
2835 | 2835 | ||
2836 | static ssize_t | ||
2837 | degraded_show(mddev_t *mddev, char *page) | ||
2838 | { | ||
2839 | return sprintf(page, "%d\n", mddev->degraded); | ||
2840 | } | ||
2841 | static struct md_sysfs_entry md_degraded = __ATTR_RO(degraded); | ||
2836 | 2842 | ||
2837 | static ssize_t | 2843 | static ssize_t |
2838 | sync_speed_show(mddev_t *mddev, char *page) | 2844 | sync_speed_show(mddev_t *mddev, char *page) |
@@ -2976,6 +2982,7 @@ static struct attribute *md_redundancy_attrs[] = { | |||
2976 | &md_suspend_lo.attr, | 2982 | &md_suspend_lo.attr, |
2977 | &md_suspend_hi.attr, | 2983 | &md_suspend_hi.attr, |
2978 | &md_bitmap.attr, | 2984 | &md_bitmap.attr, |
2985 | &md_degraded.attr, | ||
2979 | NULL, | 2986 | NULL, |
2980 | }; | 2987 | }; |
2981 | static struct attribute_group md_redundancy_group = { | 2988 | static struct attribute_group md_redundancy_group = { |
@@ -5770,26 +5777,47 @@ static int __init md_init(void) | |||
5770 | * Searches all registered partitions for autorun RAID arrays | 5777 | * Searches all registered partitions for autorun RAID arrays |
5771 | * at boot time. | 5778 | * at boot time. |
5772 | */ | 5779 | */ |
5773 | static dev_t detected_devices[128]; | 5780 | |
5774 | static int dev_cnt; | 5781 | static LIST_HEAD(all_detected_devices); |
5782 | struct detected_devices_node { | ||
5783 | struct list_head list; | ||
5784 | dev_t dev; | ||
5785 | }; | ||
5775 | 5786 | ||
5776 | void md_autodetect_dev(dev_t dev) | 5787 | void md_autodetect_dev(dev_t dev) |
5777 | { | 5788 | { |
5778 | if (dev_cnt >= 0 && dev_cnt < 127) | 5789 | struct detected_devices_node *node_detected_dev; |
5779 | detected_devices[dev_cnt++] = dev; | 5790 | |
5791 | node_detected_dev = kzalloc(sizeof(*node_detected_dev), GFP_KERNEL); | ||
5792 | if (node_detected_dev) { | ||
5793 | node_detected_dev->dev = dev; | ||
5794 | list_add_tail(&node_detected_dev->list, &all_detected_devices); | ||
5795 | } else { | ||
5796 | printk(KERN_CRIT "md: md_autodetect_dev: kzalloc failed" | ||
5797 | ", skipping dev(%d,%d)\n", MAJOR(dev), MINOR(dev)); | ||
5798 | } | ||
5780 | } | 5799 | } |
5781 | 5800 | ||
5782 | 5801 | ||
5783 | static void autostart_arrays(int part) | 5802 | static void autostart_arrays(int part) |
5784 | { | 5803 | { |
5785 | mdk_rdev_t *rdev; | 5804 | mdk_rdev_t *rdev; |
5786 | int i; | 5805 | struct detected_devices_node *node_detected_dev; |
5806 | dev_t dev; | ||
5807 | int i_scanned, i_passed; | ||
5787 | 5808 | ||
5788 | printk(KERN_INFO "md: Autodetecting RAID arrays.\n"); | 5809 | i_scanned = 0; |
5810 | i_passed = 0; | ||
5789 | 5811 | ||
5790 | for (i = 0; i < dev_cnt; i++) { | 5812 | printk(KERN_INFO "md: Autodetecting RAID arrays.\n"); |
5791 | dev_t dev = detected_devices[i]; | ||
5792 | 5813 | ||
5814 | while (!list_empty(&all_detected_devices) && i_scanned < INT_MAX) { | ||
5815 | i_scanned++; | ||
5816 | node_detected_dev = list_entry(all_detected_devices.next, | ||
5817 | struct detected_devices_node, list); | ||
5818 | list_del(&node_detected_dev->list); | ||
5819 | dev = node_detected_dev->dev; | ||
5820 | kfree(node_detected_dev); | ||
5793 | rdev = md_import_device(dev,0, 90); | 5821 | rdev = md_import_device(dev,0, 90); |
5794 | if (IS_ERR(rdev)) | 5822 | if (IS_ERR(rdev)) |
5795 | continue; | 5823 | continue; |
@@ -5799,8 +5827,11 @@ static void autostart_arrays(int part) | |||
5799 | continue; | 5827 | continue; |
5800 | } | 5828 | } |
5801 | list_add(&rdev->same_set, &pending_raid_disks); | 5829 | list_add(&rdev->same_set, &pending_raid_disks); |
5830 | i_passed++; | ||
5802 | } | 5831 | } |
5803 | dev_cnt = 0; | 5832 | |
5833 | printk(KERN_INFO "md: Scanned %d and added %d devices.\n", | ||
5834 | i_scanned, i_passed); | ||
5804 | 5835 | ||
5805 | autorun_devices(part); | 5836 | autorun_devices(part); |
5806 | } | 5837 | } |
diff --git a/drivers/md/raid0.c b/drivers/md/raid0.c index e79e1a538d44..c111105fc2dc 100644 --- a/drivers/md/raid0.c +++ b/drivers/md/raid0.c | |||
@@ -472,7 +472,7 @@ bad_map: | |||
472 | bio_io_error(bio); | 472 | bio_io_error(bio); |
473 | return 0; | 473 | return 0; |
474 | } | 474 | } |
475 | 475 | ||
476 | static void raid0_status (struct seq_file *seq, mddev_t *mddev) | 476 | static void raid0_status (struct seq_file *seq, mddev_t *mddev) |
477 | { | 477 | { |
478 | #undef MD_DEBUG | 478 | #undef MD_DEBUG |
@@ -480,18 +480,18 @@ static void raid0_status (struct seq_file *seq, mddev_t *mddev) | |||
480 | int j, k, h; | 480 | int j, k, h; |
481 | char b[BDEVNAME_SIZE]; | 481 | char b[BDEVNAME_SIZE]; |
482 | raid0_conf_t *conf = mddev_to_conf(mddev); | 482 | raid0_conf_t *conf = mddev_to_conf(mddev); |
483 | 483 | ||
484 | h = 0; | 484 | h = 0; |
485 | for (j = 0; j < conf->nr_strip_zones; j++) { | 485 | for (j = 0; j < conf->nr_strip_zones; j++) { |
486 | seq_printf(seq, " z%d", j); | 486 | seq_printf(seq, " z%d", j); |
487 | if (conf->hash_table[h] == conf->strip_zone+j) | 487 | if (conf->hash_table[h] == conf->strip_zone+j) |
488 | seq_printf("(h%d)", h++); | 488 | seq_printf(seq, "(h%d)", h++); |
489 | seq_printf(seq, "=["); | 489 | seq_printf(seq, "=["); |
490 | for (k = 0; k < conf->strip_zone[j].nb_dev; k++) | 490 | for (k = 0; k < conf->strip_zone[j].nb_dev; k++) |
491 | seq_printf (seq, "%s/", bdevname( | 491 | seq_printf(seq, "%s/", bdevname( |
492 | conf->strip_zone[j].dev[k]->bdev,b)); | 492 | conf->strip_zone[j].dev[k]->bdev,b)); |
493 | 493 | ||
494 | seq_printf (seq, "] zo=%d do=%d s=%d\n", | 494 | seq_printf(seq, "] zo=%d do=%d s=%d\n", |
495 | conf->strip_zone[j].zone_offset, | 495 | conf->strip_zone[j].zone_offset, |
496 | conf->strip_zone[j].dev_offset, | 496 | conf->strip_zone[j].dev_offset, |
497 | conf->strip_zone[j].size); | 497 | conf->strip_zone[j].size); |
diff --git a/drivers/md/raid1.c b/drivers/md/raid1.c index 0bcefad82413..16775a0df7f6 100644 --- a/drivers/md/raid1.c +++ b/drivers/md/raid1.c | |||
@@ -1214,7 +1214,8 @@ static void sync_request_write(mddev_t *mddev, r1bio_t *r1_bio) | |||
1214 | j = 0; | 1214 | j = 0; |
1215 | if (j >= 0) | 1215 | if (j >= 0) |
1216 | mddev->resync_mismatches += r1_bio->sectors; | 1216 | mddev->resync_mismatches += r1_bio->sectors; |
1217 | if (j < 0 || test_bit(MD_RECOVERY_CHECK, &mddev->recovery)) { | 1217 | if (j < 0 || (test_bit(MD_RECOVERY_CHECK, &mddev->recovery) |
1218 | && test_bit(BIO_UPTODATE, &sbio->bi_flags))) { | ||
1218 | sbio->bi_end_io = NULL; | 1219 | sbio->bi_end_io = NULL; |
1219 | rdev_dec_pending(conf->mirrors[i].rdev, mddev); | 1220 | rdev_dec_pending(conf->mirrors[i].rdev, mddev); |
1220 | } else { | 1221 | } else { |
diff --git a/drivers/message/i2o/exec-osm.c b/drivers/message/i2o/exec-osm.c index 8c83ee3b0920..ce8f1a34ed21 100644 --- a/drivers/message/i2o/exec-osm.c +++ b/drivers/message/i2o/exec-osm.c | |||
@@ -41,8 +41,6 @@ | |||
41 | 41 | ||
42 | struct i2o_driver i2o_exec_driver; | 42 | struct i2o_driver i2o_exec_driver; |
43 | 43 | ||
44 | static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind); | ||
45 | |||
46 | /* global wait list for POST WAIT */ | 44 | /* global wait list for POST WAIT */ |
47 | static LIST_HEAD(i2o_exec_wait_list); | 45 | static LIST_HEAD(i2o_exec_wait_list); |
48 | 46 | ||
@@ -369,6 +367,53 @@ static int i2o_exec_remove(struct device *dev) | |||
369 | return 0; | 367 | return 0; |
370 | }; | 368 | }; |
371 | 369 | ||
370 | #ifdef CONFIG_I2O_LCT_NOTIFY_ON_CHANGES | ||
371 | /** | ||
372 | * i2o_exec_lct_notify - Send a asynchronus LCT NOTIFY request | ||
373 | * @c: I2O controller to which the request should be send | ||
374 | * @change_ind: change indicator | ||
375 | * | ||
376 | * This function sends a LCT NOTIFY request to the I2O controller with | ||
377 | * the change indicator change_ind. If the change_ind == 0 the controller | ||
378 | * replies immediately after the request. If change_ind > 0 the reply is | ||
379 | * send after change indicator of the LCT is > change_ind. | ||
380 | */ | ||
381 | static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind) | ||
382 | { | ||
383 | i2o_status_block *sb = c->status_block.virt; | ||
384 | struct device *dev; | ||
385 | struct i2o_message *msg; | ||
386 | |||
387 | mutex_lock(&c->lct_lock); | ||
388 | |||
389 | dev = &c->pdev->dev; | ||
390 | |||
391 | if (i2o_dma_realloc | ||
392 | (dev, &c->dlct, le32_to_cpu(sb->expected_lct_size), GFP_KERNEL)) | ||
393 | return -ENOMEM; | ||
394 | |||
395 | msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET); | ||
396 | if (IS_ERR(msg)) | ||
397 | return PTR_ERR(msg); | ||
398 | |||
399 | msg->u.head[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6); | ||
400 | msg->u.head[1] = cpu_to_le32(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 | | ||
401 | ADAPTER_TID); | ||
402 | msg->u.s.icntxt = cpu_to_le32(i2o_exec_driver.context); | ||
403 | msg->u.s.tcntxt = cpu_to_le32(0x00000000); | ||
404 | msg->body[0] = cpu_to_le32(0xffffffff); | ||
405 | msg->body[1] = cpu_to_le32(change_ind); | ||
406 | msg->body[2] = cpu_to_le32(0xd0000000 | c->dlct.len); | ||
407 | msg->body[3] = cpu_to_le32(c->dlct.phys); | ||
408 | |||
409 | i2o_msg_post(c, msg); | ||
410 | |||
411 | mutex_unlock(&c->lct_lock); | ||
412 | |||
413 | return 0; | ||
414 | } | ||
415 | #endif | ||
416 | |||
372 | /** | 417 | /** |
373 | * i2o_exec_lct_modified - Called on LCT NOTIFY reply | 418 | * i2o_exec_lct_modified - Called on LCT NOTIFY reply |
374 | * @_work: work struct for a specific controller | 419 | * @_work: work struct for a specific controller |
@@ -525,51 +570,6 @@ int i2o_exec_lct_get(struct i2o_controller *c) | |||
525 | return rc; | 570 | return rc; |
526 | } | 571 | } |
527 | 572 | ||
528 | /** | ||
529 | * i2o_exec_lct_notify - Send a asynchronus LCT NOTIFY request | ||
530 | * @c: I2O controller to which the request should be send | ||
531 | * @change_ind: change indicator | ||
532 | * | ||
533 | * This function sends a LCT NOTIFY request to the I2O controller with | ||
534 | * the change indicator change_ind. If the change_ind == 0 the controller | ||
535 | * replies immediately after the request. If change_ind > 0 the reply is | ||
536 | * send after change indicator of the LCT is > change_ind. | ||
537 | */ | ||
538 | static int i2o_exec_lct_notify(struct i2o_controller *c, u32 change_ind) | ||
539 | { | ||
540 | i2o_status_block *sb = c->status_block.virt; | ||
541 | struct device *dev; | ||
542 | struct i2o_message *msg; | ||
543 | |||
544 | mutex_lock(&c->lct_lock); | ||
545 | |||
546 | dev = &c->pdev->dev; | ||
547 | |||
548 | if (i2o_dma_realloc | ||
549 | (dev, &c->dlct, le32_to_cpu(sb->expected_lct_size), GFP_KERNEL)) | ||
550 | return -ENOMEM; | ||
551 | |||
552 | msg = i2o_msg_get_wait(c, I2O_TIMEOUT_MESSAGE_GET); | ||
553 | if (IS_ERR(msg)) | ||
554 | return PTR_ERR(msg); | ||
555 | |||
556 | msg->u.head[0] = cpu_to_le32(EIGHT_WORD_MSG_SIZE | SGL_OFFSET_6); | ||
557 | msg->u.head[1] = cpu_to_le32(I2O_CMD_LCT_NOTIFY << 24 | HOST_TID << 12 | | ||
558 | ADAPTER_TID); | ||
559 | msg->u.s.icntxt = cpu_to_le32(i2o_exec_driver.context); | ||
560 | msg->u.s.tcntxt = cpu_to_le32(0x00000000); | ||
561 | msg->body[0] = cpu_to_le32(0xffffffff); | ||
562 | msg->body[1] = cpu_to_le32(change_ind); | ||
563 | msg->body[2] = cpu_to_le32(0xd0000000 | c->dlct.len); | ||
564 | msg->body[3] = cpu_to_le32(c->dlct.phys); | ||
565 | |||
566 | i2o_msg_post(c, msg); | ||
567 | |||
568 | mutex_unlock(&c->lct_lock); | ||
569 | |||
570 | return 0; | ||
571 | }; | ||
572 | |||
573 | /* Exec OSM driver struct */ | 573 | /* Exec OSM driver struct */ |
574 | struct i2o_driver i2o_exec_driver = { | 574 | struct i2o_driver i2o_exec_driver = { |
575 | .name = OSM_NAME, | 575 | .name = OSM_NAME, |
diff --git a/drivers/misc/Kconfig b/drivers/misc/Kconfig index 73e248fb2ff1..346c44eff95e 100644 --- a/drivers/misc/Kconfig +++ b/drivers/misc/Kconfig | |||
@@ -203,4 +203,16 @@ config THINKPAD_ACPI_BAY | |||
203 | If you are not sure, say Y here. | 203 | If you are not sure, say Y here. |
204 | 204 | ||
205 | 205 | ||
206 | config ATMEL_SSC | ||
207 | tristate "Device driver for Atmel SSC peripheral" | ||
208 | depends on AVR32 || ARCH_AT91 | ||
209 | ---help--- | ||
210 | This option enables device driver support for Atmel Syncronized | ||
211 | Serial Communication peripheral (SSC). | ||
212 | |||
213 | The SSC peripheral supports a wide variety of serial frame based | ||
214 | communications, i.e. I2S, SPI, etc. | ||
215 | |||
216 | If unsure, say N. | ||
217 | |||
206 | endif # MISC_DEVICES | 218 | endif # MISC_DEVICES |
diff --git a/drivers/misc/Makefile b/drivers/misc/Makefile index b5ce0e3dba86..a24c61475c2f 100644 --- a/drivers/misc/Makefile +++ b/drivers/misc/Makefile | |||
@@ -7,6 +7,7 @@ obj-$(CONFIG_IBM_ASM) += ibmasm/ | |||
7 | obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/ | 7 | obj-$(CONFIG_HDPU_FEATURES) += hdpuftrs/ |
8 | obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o | 8 | obj-$(CONFIG_MSI_LAPTOP) += msi-laptop.o |
9 | obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o | 9 | obj-$(CONFIG_ASUS_LAPTOP) += asus-laptop.o |
10 | obj-$(CONFIG_ATMEL_SSC) += atmel-ssc.o | ||
10 | obj-$(CONFIG_LKDTM) += lkdtm.o | 11 | obj-$(CONFIG_LKDTM) += lkdtm.o |
11 | obj-$(CONFIG_TIFM_CORE) += tifm_core.o | 12 | obj-$(CONFIG_TIFM_CORE) += tifm_core.o |
12 | obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o | 13 | obj-$(CONFIG_TIFM_7XX1) += tifm_7xx1.o |
diff --git a/drivers/misc/atmel-ssc.c b/drivers/misc/atmel-ssc.c new file mode 100644 index 000000000000..058ccac700d0 --- /dev/null +++ b/drivers/misc/atmel-ssc.c | |||
@@ -0,0 +1,174 @@ | |||
1 | /* | ||
2 | * Atmel SSC driver | ||
3 | * | ||
4 | * Copyright (C) 2007 Atmel Corporation | ||
5 | * | ||
6 | * This program is free software; you can redistribute it and/or modify | ||
7 | * it under the terms of the GNU General Public License version 2 as | ||
8 | * published by the Free Software Foundation. | ||
9 | */ | ||
10 | |||
11 | #include <linux/platform_device.h> | ||
12 | #include <linux/list.h> | ||
13 | #include <linux/clk.h> | ||
14 | #include <linux/err.h> | ||
15 | #include <linux/io.h> | ||
16 | #include <linux/list.h> | ||
17 | #include <linux/spinlock.h> | ||
18 | #include <linux/atmel-ssc.h> | ||
19 | |||
20 | /* Serialize access to ssc_list and user count */ | ||
21 | static DEFINE_SPINLOCK(user_lock); | ||
22 | static LIST_HEAD(ssc_list); | ||
23 | |||
24 | struct ssc_device *ssc_request(unsigned int ssc_num) | ||
25 | { | ||
26 | int ssc_valid = 0; | ||
27 | struct ssc_device *ssc; | ||
28 | |||
29 | spin_lock(&user_lock); | ||
30 | list_for_each_entry(ssc, &ssc_list, list) { | ||
31 | if (ssc->pdev->id == ssc_num) { | ||
32 | ssc_valid = 1; | ||
33 | break; | ||
34 | } | ||
35 | } | ||
36 | |||
37 | if (!ssc_valid) { | ||
38 | spin_unlock(&user_lock); | ||
39 | dev_dbg(&ssc->pdev->dev, "could not find requested device\n"); | ||
40 | return ERR_PTR(-ENODEV); | ||
41 | } | ||
42 | |||
43 | if (ssc->user) { | ||
44 | spin_unlock(&user_lock); | ||
45 | dev_dbg(&ssc->pdev->dev, "module busy\n"); | ||
46 | return ERR_PTR(-EBUSY); | ||
47 | } | ||
48 | ssc->user++; | ||
49 | spin_unlock(&user_lock); | ||
50 | |||
51 | clk_enable(ssc->clk); | ||
52 | |||
53 | return ssc; | ||
54 | } | ||
55 | EXPORT_SYMBOL(ssc_request); | ||
56 | |||
57 | void ssc_free(struct ssc_device *ssc) | ||
58 | { | ||
59 | spin_lock(&user_lock); | ||
60 | if (ssc->user) { | ||
61 | ssc->user--; | ||
62 | clk_disable(ssc->clk); | ||
63 | } else { | ||
64 | dev_dbg(&ssc->pdev->dev, "device already free\n"); | ||
65 | } | ||
66 | spin_unlock(&user_lock); | ||
67 | } | ||
68 | EXPORT_SYMBOL(ssc_free); | ||
69 | |||
70 | static int __init ssc_probe(struct platform_device *pdev) | ||
71 | { | ||
72 | int retval = 0; | ||
73 | struct resource *regs; | ||
74 | struct ssc_device *ssc; | ||
75 | |||
76 | ssc = kzalloc(sizeof(struct ssc_device), GFP_KERNEL); | ||
77 | if (!ssc) { | ||
78 | dev_dbg(&pdev->dev, "out of memory\n"); | ||
79 | retval = -ENOMEM; | ||
80 | goto out; | ||
81 | } | ||
82 | |||
83 | regs = platform_get_resource(pdev, IORESOURCE_MEM, 0); | ||
84 | if (!regs) { | ||
85 | dev_dbg(&pdev->dev, "no mmio resource defined\n"); | ||
86 | retval = -ENXIO; | ||
87 | goto out_free; | ||
88 | } | ||
89 | |||
90 | ssc->clk = clk_get(&pdev->dev, "pclk"); | ||
91 | if (IS_ERR(ssc->clk)) { | ||
92 | dev_dbg(&pdev->dev, "no pclk clock defined\n"); | ||
93 | retval = -ENXIO; | ||
94 | goto out_free; | ||
95 | } | ||
96 | |||
97 | ssc->pdev = pdev; | ||
98 | ssc->regs = ioremap(regs->start, regs->end - regs->start + 1); | ||
99 | if (!ssc->regs) { | ||
100 | dev_dbg(&pdev->dev, "ioremap failed\n"); | ||
101 | retval = -EINVAL; | ||
102 | goto out_clk; | ||
103 | } | ||
104 | |||
105 | /* disable all interrupts */ | ||
106 | clk_enable(ssc->clk); | ||
107 | ssc_writel(ssc->regs, IDR, ~0UL); | ||
108 | ssc_readl(ssc->regs, SR); | ||
109 | clk_disable(ssc->clk); | ||
110 | |||
111 | ssc->irq = platform_get_irq(pdev, 0); | ||
112 | if (!ssc->irq) { | ||
113 | dev_dbg(&pdev->dev, "could not get irq\n"); | ||
114 | retval = -ENXIO; | ||
115 | goto out_unmap; | ||
116 | } | ||
117 | |||
118 | spin_lock(&user_lock); | ||
119 | list_add_tail(&ssc->list, &ssc_list); | ||
120 | spin_unlock(&user_lock); | ||
121 | |||
122 | platform_set_drvdata(pdev, ssc); | ||
123 | |||
124 | dev_info(&pdev->dev, "Atmel SSC device at 0x%p (irq %d)\n", | ||
125 | ssc->regs, ssc->irq); | ||
126 | |||
127 | goto out; | ||
128 | |||
129 | out_unmap: | ||
130 | iounmap(ssc->regs); | ||
131 | out_clk: | ||
132 | clk_put(ssc->clk); | ||
133 | out_free: | ||
134 | kfree(ssc); | ||
135 | out: | ||
136 | return retval; | ||
137 | } | ||
138 | |||
139 | static int __devexit ssc_remove(struct platform_device *pdev) | ||
140 | { | ||
141 | struct ssc_device *ssc = platform_get_drvdata(pdev); | ||
142 | |||
143 | spin_lock(&user_lock); | ||
144 | iounmap(ssc->regs); | ||
145 | clk_put(ssc->clk); | ||
146 | list_del(&ssc->list); | ||
147 | kfree(ssc); | ||
148 | spin_unlock(&user_lock); | ||
149 | |||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static struct platform_driver ssc_driver = { | ||
154 | .remove = __devexit_p(ssc_remove), | ||
155 | .driver = { | ||
156 | .name = "ssc", | ||
157 | }, | ||
158 | }; | ||
159 | |||
160 | static int __init ssc_init(void) | ||
161 | { | ||
162 | return platform_driver_probe(&ssc_driver, ssc_probe); | ||
163 | } | ||
164 | module_init(ssc_init); | ||
165 | |||
166 | static void __exit ssc_exit(void) | ||
167 | { | ||
168 | platform_driver_unregister(&ssc_driver); | ||
169 | } | ||
170 | module_exit(ssc_exit); | ||
171 | |||
172 | MODULE_AUTHOR("Hans-Christian Egtvedt <hcegtvedt@atmel.com>"); | ||
173 | MODULE_DESCRIPTION("SSC driver for Atmel AVR32 and AT91"); | ||
174 | MODULE_LICENSE("GPL"); | ||
diff --git a/drivers/mtd/ubi/eba.c b/drivers/mtd/ubi/eba.c index 1297732f4db9..880fa3690352 100644 --- a/drivers/mtd/ubi/eba.c +++ b/drivers/mtd/ubi/eba.c | |||
@@ -933,8 +933,7 @@ write_error: | |||
933 | * @cache: the lock tree entry slab cache | 933 | * @cache: the lock tree entry slab cache |
934 | * @flags: constructor flags | 934 | * @flags: constructor flags |
935 | */ | 935 | */ |
936 | static void ltree_entry_ctor(void *obj, struct kmem_cache *cache, | 936 | static void ltree_entry_ctor(struct kmem_cache *cache, void *obj) |
937 | unsigned long flags) | ||
938 | { | 937 | { |
939 | struct ltree_entry *le = obj; | 938 | struct ltree_entry *le = obj; |
940 | 939 | ||
diff --git a/drivers/net/ehea/ehea.h b/drivers/net/ehea/ehea.h index ac21526b6de8..b557bb44a36f 100644 --- a/drivers/net/ehea/ehea.h +++ b/drivers/net/ehea/ehea.h | |||
@@ -388,7 +388,7 @@ struct ehea_port_res { | |||
388 | #define EHEA_MAX_PORTS 16 | 388 | #define EHEA_MAX_PORTS 16 |
389 | struct ehea_adapter { | 389 | struct ehea_adapter { |
390 | u64 handle; | 390 | u64 handle; |
391 | struct ibmebus_dev *ebus_dev; | 391 | struct of_device *ofdev; |
392 | struct ehea_port *port[EHEA_MAX_PORTS]; | 392 | struct ehea_port *port[EHEA_MAX_PORTS]; |
393 | struct ehea_eq *neq; /* notification event queue */ | 393 | struct ehea_eq *neq; /* notification event queue */ |
394 | struct tasklet_struct neq_tasklet; | 394 | struct tasklet_struct neq_tasklet; |
diff --git a/drivers/net/ehea/ehea_main.c b/drivers/net/ehea/ehea_main.c index 2ba57e6ace4d..fe5ffac7ac57 100644 --- a/drivers/net/ehea/ehea_main.c +++ b/drivers/net/ehea/ehea_main.c | |||
@@ -98,10 +98,10 @@ struct work_struct ehea_rereg_mr_task; | |||
98 | 98 | ||
99 | struct semaphore dlpar_mem_lock; | 99 | struct semaphore dlpar_mem_lock; |
100 | 100 | ||
101 | static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, | 101 | static int __devinit ehea_probe_adapter(struct of_device *dev, |
102 | const struct of_device_id *id); | 102 | const struct of_device_id *id); |
103 | 103 | ||
104 | static int __devexit ehea_remove(struct ibmebus_dev *dev); | 104 | static int __devexit ehea_remove(struct of_device *dev); |
105 | 105 | ||
106 | static struct of_device_id ehea_device_table[] = { | 106 | static struct of_device_id ehea_device_table[] = { |
107 | { | 107 | { |
@@ -111,9 +111,9 @@ static struct of_device_id ehea_device_table[] = { | |||
111 | {}, | 111 | {}, |
112 | }; | 112 | }; |
113 | 113 | ||
114 | static struct ibmebus_driver ehea_driver = { | 114 | static struct of_platform_driver ehea_driver = { |
115 | .name = "ehea", | 115 | .name = "ehea", |
116 | .id_table = ehea_device_table, | 116 | .match_table = ehea_device_table, |
117 | .probe = ehea_probe_adapter, | 117 | .probe = ehea_probe_adapter, |
118 | .remove = ehea_remove, | 118 | .remove = ehea_remove, |
119 | }; | 119 | }; |
@@ -1044,7 +1044,7 @@ static int ehea_reg_interrupts(struct net_device *dev) | |||
1044 | snprintf(port->int_aff_name, EHEA_IRQ_NAME_SIZE - 1, "%s-aff", | 1044 | snprintf(port->int_aff_name, EHEA_IRQ_NAME_SIZE - 1, "%s-aff", |
1045 | dev->name); | 1045 | dev->name); |
1046 | 1046 | ||
1047 | ret = ibmebus_request_irq(NULL, port->qp_eq->attr.ist1, | 1047 | ret = ibmebus_request_irq(port->qp_eq->attr.ist1, |
1048 | ehea_qp_aff_irq_handler, | 1048 | ehea_qp_aff_irq_handler, |
1049 | IRQF_DISABLED, port->int_aff_name, port); | 1049 | IRQF_DISABLED, port->int_aff_name, port); |
1050 | if (ret) { | 1050 | if (ret) { |
@@ -1062,7 +1062,7 @@ static int ehea_reg_interrupts(struct net_device *dev) | |||
1062 | pr = &port->port_res[i]; | 1062 | pr = &port->port_res[i]; |
1063 | snprintf(pr->int_send_name, EHEA_IRQ_NAME_SIZE - 1, | 1063 | snprintf(pr->int_send_name, EHEA_IRQ_NAME_SIZE - 1, |
1064 | "%s-queue%d", dev->name, i); | 1064 | "%s-queue%d", dev->name, i); |
1065 | ret = ibmebus_request_irq(NULL, pr->eq->attr.ist1, | 1065 | ret = ibmebus_request_irq(pr->eq->attr.ist1, |
1066 | ehea_recv_irq_handler, | 1066 | ehea_recv_irq_handler, |
1067 | IRQF_DISABLED, pr->int_send_name, | 1067 | IRQF_DISABLED, pr->int_send_name, |
1068 | pr); | 1068 | pr); |
@@ -1083,11 +1083,11 @@ out: | |||
1083 | out_free_req: | 1083 | out_free_req: |
1084 | while (--i >= 0) { | 1084 | while (--i >= 0) { |
1085 | u32 ist = port->port_res[i].eq->attr.ist1; | 1085 | u32 ist = port->port_res[i].eq->attr.ist1; |
1086 | ibmebus_free_irq(NULL, ist, &port->port_res[i]); | 1086 | ibmebus_free_irq(ist, &port->port_res[i]); |
1087 | } | 1087 | } |
1088 | 1088 | ||
1089 | out_free_qpeq: | 1089 | out_free_qpeq: |
1090 | ibmebus_free_irq(NULL, port->qp_eq->attr.ist1, port); | 1090 | ibmebus_free_irq(port->qp_eq->attr.ist1, port); |
1091 | i = port->num_def_qps; | 1091 | i = port->num_def_qps; |
1092 | 1092 | ||
1093 | goto out; | 1093 | goto out; |
@@ -1104,14 +1104,14 @@ static void ehea_free_interrupts(struct net_device *dev) | |||
1104 | 1104 | ||
1105 | for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { | 1105 | for (i = 0; i < port->num_def_qps + port->num_add_tx_qps; i++) { |
1106 | pr = &port->port_res[i]; | 1106 | pr = &port->port_res[i]; |
1107 | ibmebus_free_irq(NULL, pr->eq->attr.ist1, pr); | 1107 | ibmebus_free_irq(pr->eq->attr.ist1, pr); |
1108 | if (netif_msg_intr(port)) | 1108 | if (netif_msg_intr(port)) |
1109 | ehea_info("free send irq for res %d with handle 0x%X", | 1109 | ehea_info("free send irq for res %d with handle 0x%X", |
1110 | i, pr->eq->attr.ist1); | 1110 | i, pr->eq->attr.ist1); |
1111 | } | 1111 | } |
1112 | 1112 | ||
1113 | /* associated events */ | 1113 | /* associated events */ |
1114 | ibmebus_free_irq(NULL, port->qp_eq->attr.ist1, port); | 1114 | ibmebus_free_irq(port->qp_eq->attr.ist1, port); |
1115 | if (netif_msg_intr(port)) | 1115 | if (netif_msg_intr(port)) |
1116 | ehea_info("associated event interrupt for handle 0x%X freed", | 1116 | ehea_info("associated event interrupt for handle 0x%X freed", |
1117 | port->qp_eq->attr.ist1); | 1117 | port->qp_eq->attr.ist1); |
@@ -2832,7 +2832,7 @@ static struct device *ehea_register_port(struct ehea_port *port, | |||
2832 | int ret; | 2832 | int ret; |
2833 | 2833 | ||
2834 | port->ofdev.node = of_node_get(dn); | 2834 | port->ofdev.node = of_node_get(dn); |
2835 | port->ofdev.dev.parent = &port->adapter->ebus_dev->ofdev.dev; | 2835 | port->ofdev.dev.parent = &port->adapter->ofdev->dev; |
2836 | port->ofdev.dev.bus = &ibmebus_bus_type; | 2836 | port->ofdev.dev.bus = &ibmebus_bus_type; |
2837 | 2837 | ||
2838 | sprintf(port->ofdev.dev.bus_id, "port%d", port_name_cnt++); | 2838 | sprintf(port->ofdev.dev.bus_id, "port%d", port_name_cnt++); |
@@ -3011,7 +3011,7 @@ static int ehea_setup_ports(struct ehea_adapter *adapter) | |||
3011 | const u32 *dn_log_port_id; | 3011 | const u32 *dn_log_port_id; |
3012 | int i = 0; | 3012 | int i = 0; |
3013 | 3013 | ||
3014 | lhea_dn = adapter->ebus_dev->ofdev.node; | 3014 | lhea_dn = adapter->ofdev->node; |
3015 | while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { | 3015 | while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { |
3016 | 3016 | ||
3017 | dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no", | 3017 | dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no", |
@@ -3051,7 +3051,7 @@ static struct device_node *ehea_get_eth_dn(struct ehea_adapter *adapter, | |||
3051 | struct device_node *eth_dn = NULL; | 3051 | struct device_node *eth_dn = NULL; |
3052 | const u32 *dn_log_port_id; | 3052 | const u32 *dn_log_port_id; |
3053 | 3053 | ||
3054 | lhea_dn = adapter->ebus_dev->ofdev.node; | 3054 | lhea_dn = adapter->ofdev->node; |
3055 | while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { | 3055 | while ((eth_dn = of_get_next_child(lhea_dn, eth_dn))) { |
3056 | 3056 | ||
3057 | dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no", | 3057 | dn_log_port_id = of_get_property(eth_dn, "ibm,hea-port-no", |
@@ -3157,31 +3157,31 @@ static ssize_t ehea_remove_port(struct device *dev, | |||
3157 | static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port); | 3157 | static DEVICE_ATTR(probe_port, S_IWUSR, NULL, ehea_probe_port); |
3158 | static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port); | 3158 | static DEVICE_ATTR(remove_port, S_IWUSR, NULL, ehea_remove_port); |
3159 | 3159 | ||
3160 | int ehea_create_device_sysfs(struct ibmebus_dev *dev) | 3160 | int ehea_create_device_sysfs(struct of_device *dev) |
3161 | { | 3161 | { |
3162 | int ret = device_create_file(&dev->ofdev.dev, &dev_attr_probe_port); | 3162 | int ret = device_create_file(&dev->dev, &dev_attr_probe_port); |
3163 | if (ret) | 3163 | if (ret) |
3164 | goto out; | 3164 | goto out; |
3165 | 3165 | ||
3166 | ret = device_create_file(&dev->ofdev.dev, &dev_attr_remove_port); | 3166 | ret = device_create_file(&dev->dev, &dev_attr_remove_port); |
3167 | out: | 3167 | out: |
3168 | return ret; | 3168 | return ret; |
3169 | } | 3169 | } |
3170 | 3170 | ||
3171 | void ehea_remove_device_sysfs(struct ibmebus_dev *dev) | 3171 | void ehea_remove_device_sysfs(struct of_device *dev) |
3172 | { | 3172 | { |
3173 | device_remove_file(&dev->ofdev.dev, &dev_attr_probe_port); | 3173 | device_remove_file(&dev->dev, &dev_attr_probe_port); |
3174 | device_remove_file(&dev->ofdev.dev, &dev_attr_remove_port); | 3174 | device_remove_file(&dev->dev, &dev_attr_remove_port); |
3175 | } | 3175 | } |
3176 | 3176 | ||
3177 | static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, | 3177 | static int __devinit ehea_probe_adapter(struct of_device *dev, |
3178 | const struct of_device_id *id) | 3178 | const struct of_device_id *id) |
3179 | { | 3179 | { |
3180 | struct ehea_adapter *adapter; | 3180 | struct ehea_adapter *adapter; |
3181 | const u64 *adapter_handle; | 3181 | const u64 *adapter_handle; |
3182 | int ret; | 3182 | int ret; |
3183 | 3183 | ||
3184 | if (!dev || !dev->ofdev.node) { | 3184 | if (!dev || !dev->node) { |
3185 | ehea_error("Invalid ibmebus device probed"); | 3185 | ehea_error("Invalid ibmebus device probed"); |
3186 | return -EINVAL; | 3186 | return -EINVAL; |
3187 | } | 3187 | } |
@@ -3189,36 +3189,36 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, | |||
3189 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); | 3189 | adapter = kzalloc(sizeof(*adapter), GFP_KERNEL); |
3190 | if (!adapter) { | 3190 | if (!adapter) { |
3191 | ret = -ENOMEM; | 3191 | ret = -ENOMEM; |
3192 | dev_err(&dev->ofdev.dev, "no mem for ehea_adapter\n"); | 3192 | dev_err(&dev->dev, "no mem for ehea_adapter\n"); |
3193 | goto out; | 3193 | goto out; |
3194 | } | 3194 | } |
3195 | 3195 | ||
3196 | list_add(&adapter->list, &adapter_list); | 3196 | list_add(&adapter->list, &adapter_list); |
3197 | 3197 | ||
3198 | adapter->ebus_dev = dev; | 3198 | adapter->ofdev = dev; |
3199 | 3199 | ||
3200 | adapter_handle = of_get_property(dev->ofdev.node, "ibm,hea-handle", | 3200 | adapter_handle = of_get_property(dev->node, "ibm,hea-handle", |
3201 | NULL); | 3201 | NULL); |
3202 | if (adapter_handle) | 3202 | if (adapter_handle) |
3203 | adapter->handle = *adapter_handle; | 3203 | adapter->handle = *adapter_handle; |
3204 | 3204 | ||
3205 | if (!adapter->handle) { | 3205 | if (!adapter->handle) { |
3206 | dev_err(&dev->ofdev.dev, "failed getting handle for adapter" | 3206 | dev_err(&dev->dev, "failed getting handle for adapter" |
3207 | " '%s'\n", dev->ofdev.node->full_name); | 3207 | " '%s'\n", dev->node->full_name); |
3208 | ret = -ENODEV; | 3208 | ret = -ENODEV; |
3209 | goto out_free_ad; | 3209 | goto out_free_ad; |
3210 | } | 3210 | } |
3211 | 3211 | ||
3212 | adapter->pd = EHEA_PD_ID; | 3212 | adapter->pd = EHEA_PD_ID; |
3213 | 3213 | ||
3214 | dev->ofdev.dev.driver_data = adapter; | 3214 | dev->dev.driver_data = adapter; |
3215 | 3215 | ||
3216 | 3216 | ||
3217 | /* initialize adapter and ports */ | 3217 | /* initialize adapter and ports */ |
3218 | /* get adapter properties */ | 3218 | /* get adapter properties */ |
3219 | ret = ehea_sense_adapter_attr(adapter); | 3219 | ret = ehea_sense_adapter_attr(adapter); |
3220 | if (ret) { | 3220 | if (ret) { |
3221 | dev_err(&dev->ofdev.dev, "sense_adapter_attr failed: %d", ret); | 3221 | dev_err(&dev->dev, "sense_adapter_attr failed: %d", ret); |
3222 | goto out_free_ad; | 3222 | goto out_free_ad; |
3223 | } | 3223 | } |
3224 | 3224 | ||
@@ -3226,18 +3226,18 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, | |||
3226 | EHEA_NEQ, EHEA_MAX_ENTRIES_EQ, 1); | 3226 | EHEA_NEQ, EHEA_MAX_ENTRIES_EQ, 1); |
3227 | if (!adapter->neq) { | 3227 | if (!adapter->neq) { |
3228 | ret = -EIO; | 3228 | ret = -EIO; |
3229 | dev_err(&dev->ofdev.dev, "NEQ creation failed"); | 3229 | dev_err(&dev->dev, "NEQ creation failed"); |
3230 | goto out_free_ad; | 3230 | goto out_free_ad; |
3231 | } | 3231 | } |
3232 | 3232 | ||
3233 | tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet, | 3233 | tasklet_init(&adapter->neq_tasklet, ehea_neq_tasklet, |
3234 | (unsigned long)adapter); | 3234 | (unsigned long)adapter); |
3235 | 3235 | ||
3236 | ret = ibmebus_request_irq(NULL, adapter->neq->attr.ist1, | 3236 | ret = ibmebus_request_irq(adapter->neq->attr.ist1, |
3237 | ehea_interrupt_neq, IRQF_DISABLED, | 3237 | ehea_interrupt_neq, IRQF_DISABLED, |
3238 | "ehea_neq", adapter); | 3238 | "ehea_neq", adapter); |
3239 | if (ret) { | 3239 | if (ret) { |
3240 | dev_err(&dev->ofdev.dev, "requesting NEQ IRQ failed"); | 3240 | dev_err(&dev->dev, "requesting NEQ IRQ failed"); |
3241 | goto out_kill_eq; | 3241 | goto out_kill_eq; |
3242 | } | 3242 | } |
3243 | 3243 | ||
@@ -3247,7 +3247,7 @@ static int __devinit ehea_probe_adapter(struct ibmebus_dev *dev, | |||
3247 | 3247 | ||
3248 | ret = ehea_setup_ports(adapter); | 3248 | ret = ehea_setup_ports(adapter); |
3249 | if (ret) { | 3249 | if (ret) { |
3250 | dev_err(&dev->ofdev.dev, "setup_ports failed"); | 3250 | dev_err(&dev->dev, "setup_ports failed"); |
3251 | goto out_rem_dev_sysfs; | 3251 | goto out_rem_dev_sysfs; |
3252 | } | 3252 | } |
3253 | 3253 | ||
@@ -3258,7 +3258,7 @@ out_rem_dev_sysfs: | |||
3258 | ehea_remove_device_sysfs(dev); | 3258 | ehea_remove_device_sysfs(dev); |
3259 | 3259 | ||
3260 | out_free_irq: | 3260 | out_free_irq: |
3261 | ibmebus_free_irq(NULL, adapter->neq->attr.ist1, adapter); | 3261 | ibmebus_free_irq(adapter->neq->attr.ist1, adapter); |
3262 | 3262 | ||
3263 | out_kill_eq: | 3263 | out_kill_eq: |
3264 | ehea_destroy_eq(adapter->neq); | 3264 | ehea_destroy_eq(adapter->neq); |
@@ -3269,9 +3269,9 @@ out: | |||
3269 | return ret; | 3269 | return ret; |
3270 | } | 3270 | } |
3271 | 3271 | ||
3272 | static int __devexit ehea_remove(struct ibmebus_dev *dev) | 3272 | static int __devexit ehea_remove(struct of_device *dev) |
3273 | { | 3273 | { |
3274 | struct ehea_adapter *adapter = dev->ofdev.dev.driver_data; | 3274 | struct ehea_adapter *adapter = dev->dev.driver_data; |
3275 | int i; | 3275 | int i; |
3276 | 3276 | ||
3277 | for (i = 0; i < EHEA_MAX_PORTS; i++) | 3277 | for (i = 0; i < EHEA_MAX_PORTS; i++) |
@@ -3284,7 +3284,7 @@ static int __devexit ehea_remove(struct ibmebus_dev *dev) | |||
3284 | 3284 | ||
3285 | flush_scheduled_work(); | 3285 | flush_scheduled_work(); |
3286 | 3286 | ||
3287 | ibmebus_free_irq(NULL, adapter->neq->attr.ist1, adapter); | 3287 | ibmebus_free_irq(adapter->neq->attr.ist1, adapter); |
3288 | tasklet_kill(&adapter->neq_tasklet); | 3288 | tasklet_kill(&adapter->neq_tasklet); |
3289 | 3289 | ||
3290 | ehea_destroy_eq(adapter->neq); | 3290 | ehea_destroy_eq(adapter->neq); |
diff --git a/drivers/net/spider_net.h b/drivers/net/spider_net.h index a897beee7d5d..e1d05c0f47eb 100644 --- a/drivers/net/spider_net.h +++ b/drivers/net/spider_net.h | |||
@@ -494,7 +494,4 @@ struct spider_net_card { | |||
494 | struct spider_net_descr darray[0]; | 494 | struct spider_net_descr darray[0]; |
495 | }; | 495 | }; |
496 | 496 | ||
497 | #define pr_err(fmt,arg...) \ | ||
498 | printk(KERN_ERR fmt ,##arg) | ||
499 | |||
500 | #endif | 497 | #endif |
diff --git a/drivers/pcmcia/Kconfig b/drivers/pcmcia/Kconfig index f201bd673137..519b4ff79f7f 100644 --- a/drivers/pcmcia/Kconfig +++ b/drivers/pcmcia/Kconfig | |||
@@ -269,6 +269,13 @@ config AT91_CF | |||
269 | Say Y here to support the CompactFlash controller on AT91 chips. | 269 | Say Y here to support the CompactFlash controller on AT91 chips. |
270 | Or choose M to compile the driver as a module named "at91_cf". | 270 | Or choose M to compile the driver as a module named "at91_cf". |
271 | 271 | ||
272 | config ELECTRA_CF | ||
273 | tristate "Electra CompactFlash Controller" | ||
274 | depends on PCMCIA && PPC_PASEMI | ||
275 | help | ||
276 | Say Y here to support the CompactFlash controller on the | ||
277 | PA Semi Electra eval board. | ||
278 | |||
272 | config PCCARD_NONSTATIC | 279 | config PCCARD_NONSTATIC |
273 | tristate | 280 | tristate |
274 | 281 | ||
diff --git a/drivers/pcmcia/Makefile b/drivers/pcmcia/Makefile index dc7a4cb5d270..6f6478ba7174 100644 --- a/drivers/pcmcia/Makefile +++ b/drivers/pcmcia/Makefile | |||
@@ -37,6 +37,7 @@ obj-$(CONFIG_PCMCIA_VRC4171) += vrc4171_card.o | |||
37 | obj-$(CONFIG_PCMCIA_VRC4173) += vrc4173_cardu.o | 37 | obj-$(CONFIG_PCMCIA_VRC4173) += vrc4173_cardu.o |
38 | obj-$(CONFIG_OMAP_CF) += omap_cf.o | 38 | obj-$(CONFIG_OMAP_CF) += omap_cf.o |
39 | obj-$(CONFIG_AT91_CF) += at91_cf.o | 39 | obj-$(CONFIG_AT91_CF) += at91_cf.o |
40 | obj-$(CONFIG_ELECTRA_CF) += electra_cf.o | ||
40 | 41 | ||
41 | sa11xx_core-y += soc_common.o sa11xx_base.o | 42 | sa11xx_core-y += soc_common.o sa11xx_base.o |
42 | pxa2xx_core-y += soc_common.o pxa2xx_base.o | 43 | pxa2xx_core-y += soc_common.o pxa2xx_base.o |
diff --git a/drivers/pcmcia/electra_cf.c b/drivers/pcmcia/electra_cf.c new file mode 100644 index 000000000000..0a6cea1316b4 --- /dev/null +++ b/drivers/pcmcia/electra_cf.c | |||
@@ -0,0 +1,377 @@ | |||
1 | /* | ||
2 | * Copyright (C) 2007 PA Semi, Inc | ||
3 | * | ||
4 | * Maintained by: Olof Johansson <olof@lixom.net> | ||
5 | * | ||
6 | * Based on drivers/pcmcia/omap_cf.c | ||
7 | * | ||
8 | * This program is free software; you can redistribute it and/or modify | ||
9 | * it under the terms of the GNU General Public License as published by | ||
10 | * the Free Software Foundation; either version 2 of the License, or | ||
11 | * (at your option) any later version. | ||
12 | * | ||
13 | * This program is distributed in the hope that it will be useful, | ||
14 | * but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
15 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
16 | * GNU General Public License for more details. | ||
17 | * | ||
18 | * You should have received a copy of the GNU General Public License | ||
19 | * along with this program; if not, write to the Free Software | ||
20 | * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||
21 | */ | ||
22 | |||
23 | #include <linux/module.h> | ||
24 | #include <linux/kernel.h> | ||
25 | #include <linux/sched.h> | ||
26 | #include <linux/platform_device.h> | ||
27 | #include <linux/errno.h> | ||
28 | #include <linux/init.h> | ||
29 | #include <linux/delay.h> | ||
30 | #include <linux/interrupt.h> | ||
31 | #include <linux/vmalloc.h> | ||
32 | |||
33 | #include <pcmcia/ss.h> | ||
34 | #include <asm/of_platform.h> | ||
35 | |||
36 | static const char driver_name[] = "electra-cf"; | ||
37 | |||
38 | struct electra_cf_socket { | ||
39 | struct pcmcia_socket socket; | ||
40 | |||
41 | struct timer_list timer; | ||
42 | unsigned present:1; | ||
43 | unsigned active:1; | ||
44 | |||
45 | struct of_device *ofdev; | ||
46 | unsigned long mem_phys; | ||
47 | void __iomem * mem_base; | ||
48 | unsigned long mem_size; | ||
49 | void __iomem * io_virt; | ||
50 | unsigned int io_base; | ||
51 | unsigned int io_size; | ||
52 | u_int irq; | ||
53 | struct resource iomem; | ||
54 | void __iomem * gpio_base; | ||
55 | int gpio_detect; | ||
56 | int gpio_vsense; | ||
57 | int gpio_3v; | ||
58 | int gpio_5v; | ||
59 | }; | ||
60 | |||
61 | #define POLL_INTERVAL (2 * HZ) | ||
62 | |||
63 | |||
64 | static int electra_cf_present(struct electra_cf_socket *cf) | ||
65 | { | ||
66 | unsigned int gpio; | ||
67 | |||
68 | gpio = in_le32(cf->gpio_base+0x40); | ||
69 | return !(gpio & (1 << cf->gpio_detect)); | ||
70 | } | ||
71 | |||
72 | static int electra_cf_ss_init(struct pcmcia_socket *s) | ||
73 | { | ||
74 | return 0; | ||
75 | } | ||
76 | |||
77 | /* the timer is primarily to kick this socket's pccardd */ | ||
78 | static void electra_cf_timer(unsigned long _cf) | ||
79 | { | ||
80 | struct electra_cf_socket *cf = (void *) _cf; | ||
81 | int present = electra_cf_present(cf); | ||
82 | |||
83 | if (present != cf->present) { | ||
84 | cf->present = present; | ||
85 | pcmcia_parse_events(&cf->socket, SS_DETECT); | ||
86 | } | ||
87 | |||
88 | if (cf->active) | ||
89 | mod_timer(&cf->timer, jiffies + POLL_INTERVAL); | ||
90 | } | ||
91 | |||
92 | static irqreturn_t electra_cf_irq(int irq, void *_cf) | ||
93 | { | ||
94 | electra_cf_timer((unsigned long)_cf); | ||
95 | return IRQ_HANDLED; | ||
96 | } | ||
97 | |||
98 | static int electra_cf_get_status(struct pcmcia_socket *s, u_int *sp) | ||
99 | { | ||
100 | struct electra_cf_socket *cf; | ||
101 | |||
102 | if (!sp) | ||
103 | return -EINVAL; | ||
104 | |||
105 | cf = container_of(s, struct electra_cf_socket, socket); | ||
106 | |||
107 | /* NOTE CF is always 3VCARD */ | ||
108 | if (electra_cf_present(cf)) { | ||
109 | *sp = SS_READY | SS_DETECT | SS_POWERON | SS_3VCARD; | ||
110 | |||
111 | s->pci_irq = cf->irq; | ||
112 | } else | ||
113 | *sp = 0; | ||
114 | return 0; | ||
115 | } | ||
116 | |||
117 | static int electra_cf_set_socket(struct pcmcia_socket *sock, | ||
118 | struct socket_state_t *s) | ||
119 | { | ||
120 | unsigned int gpio; | ||
121 | unsigned int vcc; | ||
122 | struct electra_cf_socket *cf; | ||
123 | |||
124 | cf = container_of(sock, struct electra_cf_socket, socket); | ||
125 | |||
126 | /* "reset" means no power in our case */ | ||
127 | vcc = (s->flags & SS_RESET) ? 0 : s->Vcc; | ||
128 | |||
129 | switch (vcc) { | ||
130 | case 0: | ||
131 | gpio = 0; | ||
132 | break; | ||
133 | case 33: | ||
134 | gpio = (1 << cf->gpio_3v); | ||
135 | break; | ||
136 | case 5: | ||
137 | gpio = (1 << cf->gpio_5v); | ||
138 | break; | ||
139 | default: | ||
140 | return -EINVAL; | ||
141 | } | ||
142 | |||
143 | gpio |= 1 << (cf->gpio_3v + 16); /* enwr */ | ||
144 | gpio |= 1 << (cf->gpio_5v + 16); /* enwr */ | ||
145 | out_le32(cf->gpio_base+0x90, gpio); | ||
146 | |||
147 | pr_debug("%s: Vcc %d, io_irq %d, flags %04x csc %04x\n", | ||
148 | driver_name, s->Vcc, s->io_irq, s->flags, s->csc_mask); | ||
149 | |||
150 | return 0; | ||
151 | } | ||
152 | |||
153 | static int electra_cf_set_io_map(struct pcmcia_socket *s, | ||
154 | struct pccard_io_map *io) | ||
155 | { | ||
156 | return 0; | ||
157 | } | ||
158 | |||
159 | static int electra_cf_set_mem_map(struct pcmcia_socket *s, | ||
160 | struct pccard_mem_map *map) | ||
161 | { | ||
162 | struct electra_cf_socket *cf; | ||
163 | |||
164 | if (map->card_start) | ||
165 | return -EINVAL; | ||
166 | cf = container_of(s, struct electra_cf_socket, socket); | ||
167 | map->static_start = cf->mem_phys; | ||
168 | map->flags &= MAP_ACTIVE|MAP_ATTRIB; | ||
169 | if (!(map->flags & MAP_ATTRIB)) | ||
170 | map->static_start += 0x800; | ||
171 | return 0; | ||
172 | } | ||
173 | |||
174 | static struct pccard_operations electra_cf_ops = { | ||
175 | .init = electra_cf_ss_init, | ||
176 | .get_status = electra_cf_get_status, | ||
177 | .set_socket = electra_cf_set_socket, | ||
178 | .set_io_map = electra_cf_set_io_map, | ||
179 | .set_mem_map = electra_cf_set_mem_map, | ||
180 | }; | ||
181 | |||
182 | static int __devinit electra_cf_probe(struct of_device *ofdev, | ||
183 | const struct of_device_id *match) | ||
184 | { | ||
185 | struct device *device = &ofdev->dev; | ||
186 | struct device_node *np = ofdev->node; | ||
187 | struct electra_cf_socket *cf; | ||
188 | struct resource mem, io; | ||
189 | int status; | ||
190 | const unsigned int *prop; | ||
191 | int err; | ||
192 | struct vm_struct *area; | ||
193 | |||
194 | err = of_address_to_resource(np, 0, &mem); | ||
195 | if (err) | ||
196 | return -EINVAL; | ||
197 | |||
198 | err = of_address_to_resource(np, 1, &io); | ||
199 | if (err) | ||
200 | return -EINVAL; | ||
201 | |||
202 | cf = kzalloc(sizeof *cf, GFP_KERNEL); | ||
203 | if (!cf) | ||
204 | return -ENOMEM; | ||
205 | |||
206 | setup_timer(&cf->timer, electra_cf_timer, (unsigned long)cf); | ||
207 | cf->irq = NO_IRQ; | ||
208 | |||
209 | cf->ofdev = ofdev; | ||
210 | cf->mem_phys = mem.start; | ||
211 | cf->mem_size = PAGE_ALIGN(mem.end - mem.start); | ||
212 | cf->mem_base = ioremap(cf->mem_phys, cf->mem_size); | ||
213 | cf->io_size = PAGE_ALIGN(io.end - io.start); | ||
214 | |||
215 | area = __get_vm_area(cf->io_size, 0, PHB_IO_BASE, PHB_IO_END); | ||
216 | if (area == NULL) | ||
217 | return -ENOMEM; | ||
218 | |||
219 | cf->io_virt = (void __iomem *)(area->addr); | ||
220 | |||
221 | cf->gpio_base = ioremap(0xfc103000, 0x1000); | ||
222 | dev_set_drvdata(device, cf); | ||
223 | |||
224 | if (!cf->mem_base || !cf->io_virt || !cf->gpio_base || | ||
225 | (__ioremap_at(io.start, cf->io_virt, cf->io_size, | ||
226 | _PAGE_NO_CACHE | _PAGE_GUARDED) == NULL)) { | ||
227 | dev_err(device, "can't ioremap ranges\n"); | ||
228 | status = -ENOMEM; | ||
229 | goto fail1; | ||
230 | } | ||
231 | |||
232 | |||
233 | cf->io_base = (unsigned long)cf->io_virt - VMALLOC_END; | ||
234 | |||
235 | cf->iomem.start = (unsigned long)cf->mem_base; | ||
236 | cf->iomem.end = (unsigned long)cf->mem_base + (mem.end - mem.start); | ||
237 | cf->iomem.flags = IORESOURCE_MEM; | ||
238 | |||
239 | cf->irq = irq_of_parse_and_map(np, 0); | ||
240 | |||
241 | status = request_irq(cf->irq, electra_cf_irq, IRQF_SHARED, | ||
242 | driver_name, cf); | ||
243 | if (status < 0) { | ||
244 | dev_err(device, "request_irq failed\n"); | ||
245 | goto fail1; | ||
246 | } | ||
247 | |||
248 | cf->socket.pci_irq = cf->irq; | ||
249 | |||
250 | prop = of_get_property(np, "card-detect-gpio", NULL); | ||
251 | if (!prop) | ||
252 | goto fail1; | ||
253 | cf->gpio_detect = *prop; | ||
254 | |||
255 | prop = of_get_property(np, "card-vsense-gpio", NULL); | ||
256 | if (!prop) | ||
257 | goto fail1; | ||
258 | cf->gpio_vsense = *prop; | ||
259 | |||
260 | prop = of_get_property(np, "card-3v-gpio", NULL); | ||
261 | if (!prop) | ||
262 | goto fail1; | ||
263 | cf->gpio_3v = *prop; | ||
264 | |||
265 | prop = of_get_property(np, "card-5v-gpio", NULL); | ||
266 | if (!prop) | ||
267 | goto fail1; | ||
268 | cf->gpio_5v = *prop; | ||
269 | |||
270 | cf->socket.io_offset = cf->io_base; | ||
271 | |||
272 | /* reserve chip-select regions */ | ||
273 | if (!request_mem_region(cf->mem_phys, cf->mem_size, driver_name)) { | ||
274 | status = -ENXIO; | ||
275 | dev_err(device, "Can't claim memory region\n"); | ||
276 | goto fail1; | ||
277 | } | ||
278 | |||
279 | if (!request_region(cf->io_base, cf->io_size, driver_name)) { | ||
280 | status = -ENXIO; | ||
281 | dev_err(device, "Can't claim I/O region\n"); | ||
282 | goto fail2; | ||
283 | } | ||
284 | |||
285 | cf->socket.owner = THIS_MODULE; | ||
286 | cf->socket.dev.parent = &ofdev->dev; | ||
287 | cf->socket.ops = &electra_cf_ops; | ||
288 | cf->socket.resource_ops = &pccard_static_ops; | ||
289 | cf->socket.features = SS_CAP_PCCARD | SS_CAP_STATIC_MAP | | ||
290 | SS_CAP_MEM_ALIGN; | ||
291 | cf->socket.map_size = 0x800; | ||
292 | |||
293 | status = pcmcia_register_socket(&cf->socket); | ||
294 | if (status < 0) { | ||
295 | dev_err(device, "pcmcia_register_socket failed\n"); | ||
296 | goto fail3; | ||
297 | } | ||
298 | |||
299 | dev_info(device, "at mem 0x%lx io 0x%lx irq %d\n", | ||
300 | cf->mem_phys, io.start, cf->irq); | ||
301 | |||
302 | cf->active = 1; | ||
303 | electra_cf_timer((unsigned long)cf); | ||
304 | return 0; | ||
305 | |||
306 | fail3: | ||
307 | release_region(cf->io_base, cf->io_size); | ||
308 | fail2: | ||
309 | release_mem_region(cf->mem_phys, cf->mem_size); | ||
310 | fail1: | ||
311 | if (cf->irq != NO_IRQ) | ||
312 | free_irq(cf->irq, cf); | ||
313 | |||
314 | if (cf->io_virt) | ||
315 | __iounmap_at(cf->io_virt, cf->io_size); | ||
316 | if (cf->mem_base) | ||
317 | iounmap(cf->mem_base); | ||
318 | if (cf->gpio_base) | ||
319 | iounmap(cf->gpio_base); | ||
320 | device_init_wakeup(&ofdev->dev, 0); | ||
321 | kfree(cf); | ||
322 | return status; | ||
323 | |||
324 | } | ||
325 | |||
326 | static int __devexit electra_cf_remove(struct of_device *ofdev) | ||
327 | { | ||
328 | struct device *device = &ofdev->dev; | ||
329 | struct electra_cf_socket *cf; | ||
330 | |||
331 | cf = dev_get_drvdata(device); | ||
332 | |||
333 | cf->active = 0; | ||
334 | pcmcia_unregister_socket(&cf->socket); | ||
335 | free_irq(cf->irq, cf); | ||
336 | del_timer_sync(&cf->timer); | ||
337 | |||
338 | __iounmap_at(cf->io_virt, cf->io_size); | ||
339 | iounmap(cf->mem_base); | ||
340 | iounmap(cf->gpio_base); | ||
341 | release_mem_region(cf->mem_phys, cf->mem_size); | ||
342 | release_region(cf->io_base, cf->io_size); | ||
343 | |||
344 | kfree(cf); | ||
345 | |||
346 | return 0; | ||
347 | } | ||
348 | |||
349 | static struct of_device_id electra_cf_match[] = { | ||
350 | { | ||
351 | .compatible = "electra-cf", | ||
352 | }, | ||
353 | {}, | ||
354 | }; | ||
355 | |||
356 | static struct of_platform_driver electra_cf_driver = { | ||
357 | .name = (char *)driver_name, | ||
358 | .match_table = electra_cf_match, | ||
359 | .probe = electra_cf_probe, | ||
360 | .remove = electra_cf_remove, | ||
361 | }; | ||
362 | |||
363 | static int __init electra_cf_init(void) | ||
364 | { | ||
365 | return of_register_platform_driver(&electra_cf_driver); | ||
366 | } | ||
367 | module_init(electra_cf_init); | ||
368 | |||
369 | static void __exit electra_cf_exit(void) | ||
370 | { | ||
371 | of_unregister_platform_driver(&electra_cf_driver); | ||
372 | } | ||
373 | module_exit(electra_cf_exit); | ||
374 | |||
375 | MODULE_LICENSE("GPL"); | ||
376 | MODULE_AUTHOR ("Olof Johansson <olof@lixom.net>"); | ||
377 | MODULE_DESCRIPTION("PA Semi Electra CF driver"); | ||
diff --git a/drivers/pnp/Makefile b/drivers/pnp/Makefile index a381a92fd1b6..26f5abc9c3f7 100644 --- a/drivers/pnp/Makefile +++ b/drivers/pnp/Makefile | |||
@@ -7,3 +7,7 @@ obj-y := core.o card.o driver.o resource.o manager.o support.o interface.o quir | |||
7 | obj-$(CONFIG_PNPACPI) += pnpacpi/ | 7 | obj-$(CONFIG_PNPACPI) += pnpacpi/ |
8 | obj-$(CONFIG_PNPBIOS) += pnpbios/ | 8 | obj-$(CONFIG_PNPBIOS) += pnpbios/ |
9 | obj-$(CONFIG_ISAPNP) += isapnp/ | 9 | obj-$(CONFIG_ISAPNP) += isapnp/ |
10 | |||
11 | ifeq ($(CONFIG_PNP_DEBUG),y) | ||
12 | EXTRA_CFLAGS += -DDEBUG | ||
13 | endif | ||
diff --git a/drivers/pnp/card.c b/drivers/pnp/card.c index 6c0440c20e31..da1c9909eb44 100644 --- a/drivers/pnp/card.c +++ b/drivers/pnp/card.c | |||
@@ -104,10 +104,6 @@ int pnp_add_card_id(struct pnp_id *id, struct pnp_card *card) | |||
104 | { | 104 | { |
105 | struct pnp_id *ptr; | 105 | struct pnp_id *ptr; |
106 | 106 | ||
107 | if (!id) | ||
108 | return -EINVAL; | ||
109 | if (!card) | ||
110 | return -EINVAL; | ||
111 | id->next = NULL; | 107 | id->next = NULL; |
112 | ptr = card->id; | 108 | ptr = card->id; |
113 | while (ptr && ptr->next) | 109 | while (ptr && ptr->next) |
@@ -124,8 +120,6 @@ static void pnp_free_card_ids(struct pnp_card *card) | |||
124 | struct pnp_id *id; | 120 | struct pnp_id *id; |
125 | struct pnp_id *next; | 121 | struct pnp_id *next; |
126 | 122 | ||
127 | if (!card) | ||
128 | return; | ||
129 | id = card->id; | 123 | id = card->id; |
130 | while (id) { | 124 | while (id) { |
131 | next = id->next; | 125 | next = id->next; |
@@ -197,42 +191,39 @@ int pnp_add_card(struct pnp_card *card) | |||
197 | int error; | 191 | int error; |
198 | struct list_head *pos, *temp; | 192 | struct list_head *pos, *temp; |
199 | 193 | ||
200 | if (!card || !card->protocol) | ||
201 | return -EINVAL; | ||
202 | |||
203 | sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number, | 194 | sprintf(card->dev.bus_id, "%02x:%02x", card->protocol->number, |
204 | card->number); | 195 | card->number); |
205 | card->dev.parent = &card->protocol->dev; | 196 | card->dev.parent = &card->protocol->dev; |
206 | card->dev.bus = NULL; | 197 | card->dev.bus = NULL; |
207 | card->dev.release = &pnp_release_card; | 198 | card->dev.release = &pnp_release_card; |
208 | error = device_register(&card->dev); | 199 | error = device_register(&card->dev); |
200 | if (error) { | ||
201 | dev_err(&card->dev, "could not register (err=%d)\n", error); | ||
202 | return error; | ||
203 | } | ||
209 | 204 | ||
210 | if (error == 0) { | 205 | pnp_interface_attach_card(card); |
211 | pnp_interface_attach_card(card); | 206 | spin_lock(&pnp_lock); |
212 | spin_lock(&pnp_lock); | 207 | list_add_tail(&card->global_list, &pnp_cards); |
213 | list_add_tail(&card->global_list, &pnp_cards); | 208 | list_add_tail(&card->protocol_list, &card->protocol->cards); |
214 | list_add_tail(&card->protocol_list, &card->protocol->cards); | 209 | spin_unlock(&pnp_lock); |
215 | spin_unlock(&pnp_lock); | ||
216 | |||
217 | /* we wait until now to add devices in order to ensure the drivers | ||
218 | * will be able to use all of the related devices on the card | ||
219 | * without waiting any unresonable length of time */ | ||
220 | list_for_each(pos, &card->devices) { | ||
221 | struct pnp_dev *dev = card_to_pnp_dev(pos); | ||
222 | __pnp_add_device(dev); | ||
223 | } | ||
224 | 210 | ||
225 | /* match with card drivers */ | 211 | /* we wait until now to add devices in order to ensure the drivers |
226 | list_for_each_safe(pos, temp, &pnp_card_drivers) { | 212 | * will be able to use all of the related devices on the card |
227 | struct pnp_card_driver *drv = | 213 | * without waiting an unreasonable length of time */ |
228 | list_entry(pos, struct pnp_card_driver, | 214 | list_for_each(pos, &card->devices) { |
229 | global_list); | 215 | struct pnp_dev *dev = card_to_pnp_dev(pos); |
230 | card_probe(card, drv); | 216 | __pnp_add_device(dev); |
231 | } | 217 | } |
232 | } else | 218 | |
233 | pnp_err("sysfs failure, card '%s' will be unavailable", | 219 | /* match with card drivers */ |
234 | card->dev.bus_id); | 220 | list_for_each_safe(pos, temp, &pnp_card_drivers) { |
235 | return error; | 221 | struct pnp_card_driver *drv = |
222 | list_entry(pos, struct pnp_card_driver, | ||
223 | global_list); | ||
224 | card_probe(card, drv); | ||
225 | } | ||
226 | return 0; | ||
236 | } | 227 | } |
237 | 228 | ||
238 | /** | 229 | /** |
@@ -243,8 +234,6 @@ void pnp_remove_card(struct pnp_card *card) | |||
243 | { | 234 | { |
244 | struct list_head *pos, *temp; | 235 | struct list_head *pos, *temp; |
245 | 236 | ||
246 | if (!card) | ||
247 | return; | ||
248 | device_unregister(&card->dev); | 237 | device_unregister(&card->dev); |
249 | spin_lock(&pnp_lock); | 238 | spin_lock(&pnp_lock); |
250 | list_del(&card->global_list); | 239 | list_del(&card->global_list); |
@@ -263,8 +252,6 @@ void pnp_remove_card(struct pnp_card *card) | |||
263 | */ | 252 | */ |
264 | int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) | 253 | int pnp_add_card_device(struct pnp_card *card, struct pnp_dev *dev) |
265 | { | 254 | { |
266 | if (!card || !dev || !dev->protocol) | ||
267 | return -EINVAL; | ||
268 | dev->dev.parent = &card->dev; | 255 | dev->dev.parent = &card->dev; |
269 | dev->card_link = NULL; | 256 | dev->card_link = NULL; |
270 | snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%02x:%02x.%02x", | 257 | snprintf(dev->dev.bus_id, BUS_ID_SIZE, "%02x:%02x.%02x", |
@@ -304,14 +291,15 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, | |||
304 | struct pnp_card *card; | 291 | struct pnp_card *card; |
305 | 292 | ||
306 | if (!clink || !id) | 293 | if (!clink || !id) |
307 | goto done; | 294 | return NULL; |
295 | |||
308 | card = clink->card; | 296 | card = clink->card; |
309 | drv = clink->driver; | 297 | drv = clink->driver; |
310 | if (!from) { | 298 | if (!from) { |
311 | pos = card->devices.next; | 299 | pos = card->devices.next; |
312 | } else { | 300 | } else { |
313 | if (from->card != card) | 301 | if (from->card != card) |
314 | goto done; | 302 | return NULL; |
315 | pos = from->card_list.next; | 303 | pos = from->card_list.next; |
316 | } | 304 | } |
317 | while (pos != &card->devices) { | 305 | while (pos != &card->devices) { |
@@ -321,7 +309,6 @@ struct pnp_dev *pnp_request_card_device(struct pnp_card_link *clink, | |||
321 | pos = pos->next; | 309 | pos = pos->next; |
322 | } | 310 | } |
323 | 311 | ||
324 | done: | ||
325 | return NULL; | 312 | return NULL; |
326 | 313 | ||
327 | found: | 314 | found: |
@@ -348,8 +335,6 @@ void pnp_release_card_device(struct pnp_dev *dev) | |||
348 | { | 335 | { |
349 | struct pnp_card_driver *drv = dev->card_link->driver; | 336 | struct pnp_card_driver *drv = dev->card_link->driver; |
350 | 337 | ||
351 | if (!drv) | ||
352 | return; | ||
353 | drv->link.remove = &card_remove; | 338 | drv->link.remove = &card_remove; |
354 | device_release_driver(&dev->dev); | 339 | device_release_driver(&dev->dev); |
355 | drv->link.remove = &card_remove_first; | 340 | drv->link.remove = &card_remove_first; |
diff --git a/drivers/pnp/core.c b/drivers/pnp/core.c index d5964feb14de..7d366ca672d3 100644 --- a/drivers/pnp/core.c +++ b/drivers/pnp/core.c | |||
@@ -125,9 +125,11 @@ int __pnp_add_device(struct pnp_dev *dev) | |||
125 | spin_unlock(&pnp_lock); | 125 | spin_unlock(&pnp_lock); |
126 | 126 | ||
127 | ret = device_register(&dev->dev); | 127 | ret = device_register(&dev->dev); |
128 | if (ret == 0) | 128 | if (ret) |
129 | pnp_interface_attach_device(dev); | 129 | return ret; |
130 | return ret; | 130 | |
131 | pnp_interface_attach_device(dev); | ||
132 | return 0; | ||
131 | } | 133 | } |
132 | 134 | ||
133 | /* | 135 | /* |
@@ -138,12 +140,30 @@ int __pnp_add_device(struct pnp_dev *dev) | |||
138 | */ | 140 | */ |
139 | int pnp_add_device(struct pnp_dev *dev) | 141 | int pnp_add_device(struct pnp_dev *dev) |
140 | { | 142 | { |
143 | int ret; | ||
144 | |||
141 | if (dev->card) | 145 | if (dev->card) |
142 | return -EINVAL; | 146 | return -EINVAL; |
147 | |||
143 | dev->dev.parent = &dev->protocol->dev; | 148 | dev->dev.parent = &dev->protocol->dev; |
144 | sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, | 149 | sprintf(dev->dev.bus_id, "%02x:%02x", dev->protocol->number, |
145 | dev->number); | 150 | dev->number); |
146 | return __pnp_add_device(dev); | 151 | ret = __pnp_add_device(dev); |
152 | if (ret) | ||
153 | return ret; | ||
154 | |||
155 | #ifdef CONFIG_PNP_DEBUG | ||
156 | { | ||
157 | struct pnp_id *id; | ||
158 | |||
159 | dev_printk(KERN_DEBUG, &dev->dev, "%s device, IDs", | ||
160 | dev->protocol->name); | ||
161 | for (id = dev->id; id; id = id->next) | ||
162 | printk(" %s", id->id); | ||
163 | printk(" (%s)\n", dev->active ? "active" : "disabled"); | ||
164 | } | ||
165 | #endif | ||
166 | return 0; | ||
147 | } | 167 | } |
148 | 168 | ||
149 | void __pnp_remove_device(struct pnp_dev *dev) | 169 | void __pnp_remove_device(struct pnp_dev *dev) |
diff --git a/drivers/pnp/driver.c b/drivers/pnp/driver.c index 2fa64a6b25c8..a262762c5b88 100644 --- a/drivers/pnp/driver.c +++ b/drivers/pnp/driver.c | |||
@@ -86,9 +86,6 @@ static int pnp_device_probe(struct device *dev) | |||
86 | pnp_dev = to_pnp_dev(dev); | 86 | pnp_dev = to_pnp_dev(dev); |
87 | pnp_drv = to_pnp_driver(dev->driver); | 87 | pnp_drv = to_pnp_driver(dev->driver); |
88 | 88 | ||
89 | pnp_dbg("match found with the PnP device '%s' and the driver '%s'", | ||
90 | dev->bus_id, pnp_drv->name); | ||
91 | |||
92 | error = pnp_device_attach(pnp_dev); | 89 | error = pnp_device_attach(pnp_dev); |
93 | if (error < 0) | 90 | if (error < 0) |
94 | return error; | 91 | return error; |
@@ -116,6 +113,8 @@ static int pnp_device_probe(struct device *dev) | |||
116 | error = 0; | 113 | error = 0; |
117 | } else | 114 | } else |
118 | goto fail; | 115 | goto fail; |
116 | |||
117 | dev_dbg(dev, "driver attached\n"); | ||
119 | return error; | 118 | return error; |
120 | 119 | ||
121 | fail: | 120 | fail: |
diff --git a/drivers/pnp/interface.c b/drivers/pnp/interface.c index e0ee28a88da3..31548044fdde 100644 --- a/drivers/pnp/interface.c +++ b/drivers/pnp/interface.c | |||
@@ -327,8 +327,7 @@ pnp_set_current_resources(struct device *dmdev, struct device_attribute *attr, | |||
327 | 327 | ||
328 | if (dev->status & PNP_ATTACHED) { | 328 | if (dev->status & PNP_ATTACHED) { |
329 | retval = -EBUSY; | 329 | retval = -EBUSY; |
330 | pnp_info("Device %s cannot be configured because it is in use.", | 330 | dev_info(&dev->dev, "in use; can't configure\n"); |
331 | dev->dev.bus_id); | ||
332 | goto done; | 331 | goto done; |
333 | } | 332 | } |
334 | 333 | ||
diff --git a/drivers/pnp/manager.c b/drivers/pnp/manager.c index ea3eac2404ca..c6b3d4e63ccc 100644 --- a/drivers/pnp/manager.c +++ b/drivers/pnp/manager.c | |||
@@ -22,8 +22,7 @@ static int pnp_assign_port(struct pnp_dev *dev, struct pnp_port *rule, int idx) | |||
22 | unsigned long *flags; | 22 | unsigned long *flags; |
23 | 23 | ||
24 | if (idx >= PNP_MAX_PORT) { | 24 | if (idx >= PNP_MAX_PORT) { |
25 | pnp_err | 25 | dev_err(&dev->dev, "too many I/O port resources\n"); |
26 | ("More than 4 ports is incompatible with pnp specifications."); | ||
27 | /* pretend we were successful so at least the manager won't try again */ | 26 | /* pretend we were successful so at least the manager won't try again */ |
28 | return 1; | 27 | return 1; |
29 | } | 28 | } |
@@ -64,8 +63,7 @@ static int pnp_assign_mem(struct pnp_dev *dev, struct pnp_mem *rule, int idx) | |||
64 | unsigned long *flags; | 63 | unsigned long *flags; |
65 | 64 | ||
66 | if (idx >= PNP_MAX_MEM) { | 65 | if (idx >= PNP_MAX_MEM) { |
67 | pnp_err | 66 | dev_err(&dev->dev, "too many memory resources\n"); |
68 | ("More than 8 mems is incompatible with pnp specifications."); | ||
69 | /* pretend we were successful so at least the manager won't try again */ | 67 | /* pretend we were successful so at least the manager won't try again */ |
70 | return 1; | 68 | return 1; |
71 | } | 69 | } |
@@ -122,8 +120,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx) | |||
122 | }; | 120 | }; |
123 | 121 | ||
124 | if (idx >= PNP_MAX_IRQ) { | 122 | if (idx >= PNP_MAX_IRQ) { |
125 | pnp_err | 123 | dev_err(&dev->dev, "too many IRQ resources\n"); |
126 | ("More than 2 irqs is incompatible with pnp specifications."); | ||
127 | /* pretend we were successful so at least the manager won't try again */ | 124 | /* pretend we were successful so at least the manager won't try again */ |
128 | return 1; | 125 | return 1; |
129 | } | 126 | } |
@@ -161,7 +158,7 @@ static int pnp_assign_irq(struct pnp_dev *dev, struct pnp_irq *rule, int idx) | |||
161 | return 0; | 158 | return 0; |
162 | } | 159 | } |
163 | 160 | ||
164 | static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) | 161 | static void pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) |
165 | { | 162 | { |
166 | resource_size_t *start, *end; | 163 | resource_size_t *start, *end; |
167 | unsigned long *flags; | 164 | unsigned long *flags; |
@@ -173,15 +170,13 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) | |||
173 | }; | 170 | }; |
174 | 171 | ||
175 | if (idx >= PNP_MAX_DMA) { | 172 | if (idx >= PNP_MAX_DMA) { |
176 | pnp_err | 173 | dev_err(&dev->dev, "too many DMA resources\n"); |
177 | ("More than 2 dmas is incompatible with pnp specifications."); | 174 | return; |
178 | /* pretend we were successful so at least the manager won't try again */ | ||
179 | return 1; | ||
180 | } | 175 | } |
181 | 176 | ||
182 | /* check if this resource has been manually set, if so skip */ | 177 | /* check if this resource has been manually set, if so skip */ |
183 | if (!(dev->res.dma_resource[idx].flags & IORESOURCE_AUTO)) | 178 | if (!(dev->res.dma_resource[idx].flags & IORESOURCE_AUTO)) |
184 | return 1; | 179 | return; |
185 | 180 | ||
186 | start = &dev->res.dma_resource[idx].start; | 181 | start = &dev->res.dma_resource[idx].start; |
187 | end = &dev->res.dma_resource[idx].end; | 182 | end = &dev->res.dma_resource[idx].end; |
@@ -191,19 +186,17 @@ static int pnp_assign_dma(struct pnp_dev *dev, struct pnp_dma *rule, int idx) | |||
191 | *flags |= rule->flags | IORESOURCE_DMA; | 186 | *flags |= rule->flags | IORESOURCE_DMA; |
192 | *flags &= ~IORESOURCE_UNSET; | 187 | *flags &= ~IORESOURCE_UNSET; |
193 | 188 | ||
194 | if (!rule->map) { | ||
195 | *flags |= IORESOURCE_DISABLED; | ||
196 | return 1; /* skip disabled resource requests */ | ||
197 | } | ||
198 | |||
199 | for (i = 0; i < 8; i++) { | 189 | for (i = 0; i < 8; i++) { |
200 | if (rule->map & (1 << xtab[i])) { | 190 | if (rule->map & (1 << xtab[i])) { |
201 | *start = *end = xtab[i]; | 191 | *start = *end = xtab[i]; |
202 | if (pnp_check_dma(dev, idx)) | 192 | if (pnp_check_dma(dev, idx)) |
203 | return 1; | 193 | return; |
204 | } | 194 | } |
205 | } | 195 | } |
206 | return 0; | 196 | #ifdef MAX_DMA_CHANNELS |
197 | *start = *end = MAX_DMA_CHANNELS; | ||
198 | #endif | ||
199 | *flags |= IORESOURCE_UNSET | IORESOURCE_DISABLED; | ||
207 | } | 200 | } |
208 | 201 | ||
209 | /** | 202 | /** |
@@ -330,8 +323,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum) | |||
330 | irq = irq->next; | 323 | irq = irq->next; |
331 | } | 324 | } |
332 | while (dma) { | 325 | while (dma) { |
333 | if (!pnp_assign_dma(dev, dma, ndma)) | 326 | pnp_assign_dma(dev, dma, ndma); |
334 | goto fail; | ||
335 | ndma++; | 327 | ndma++; |
336 | dma = dma->next; | 328 | dma = dma->next; |
337 | } | 329 | } |
@@ -367,8 +359,7 @@ static int pnp_assign_resources(struct pnp_dev *dev, int depnum) | |||
367 | irq = irq->next; | 359 | irq = irq->next; |
368 | } | 360 | } |
369 | while (dma) { | 361 | while (dma) { |
370 | if (!pnp_assign_dma(dev, dma, ndma)) | 362 | pnp_assign_dma(dev, dma, ndma); |
371 | goto fail; | ||
372 | ndma++; | 363 | ndma++; |
373 | dma = dma->next; | 364 | dma = dma->next; |
374 | } | 365 | } |
@@ -447,8 +438,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev) | |||
447 | int i = 1; | 438 | int i = 1; |
448 | 439 | ||
449 | if (!pnp_can_configure(dev)) { | 440 | if (!pnp_can_configure(dev)) { |
450 | pnp_dbg("Device %s does not support resource configuration.", | 441 | dev_dbg(&dev->dev, "configuration not supported\n"); |
451 | dev->dev.bus_id); | ||
452 | return -ENODEV; | 442 | return -ENODEV; |
453 | } | 443 | } |
454 | 444 | ||
@@ -465,7 +455,7 @@ int pnp_auto_config_dev(struct pnp_dev *dev) | |||
465 | } while (dep); | 455 | } while (dep); |
466 | } | 456 | } |
467 | 457 | ||
468 | pnp_err("Unable to assign resources to device %s.", dev->dev.bus_id); | 458 | dev_err(&dev->dev, "unable to assign resources\n"); |
469 | return -EBUSY; | 459 | return -EBUSY; |
470 | } | 460 | } |
471 | 461 | ||
@@ -478,17 +468,16 @@ int pnp_auto_config_dev(struct pnp_dev *dev) | |||
478 | int pnp_start_dev(struct pnp_dev *dev) | 468 | int pnp_start_dev(struct pnp_dev *dev) |
479 | { | 469 | { |
480 | if (!pnp_can_write(dev)) { | 470 | if (!pnp_can_write(dev)) { |
481 | pnp_dbg("Device %s does not support activation.", | 471 | dev_dbg(&dev->dev, "activation not supported\n"); |
482 | dev->dev.bus_id); | ||
483 | return -EINVAL; | 472 | return -EINVAL; |
484 | } | 473 | } |
485 | 474 | ||
486 | if (dev->protocol->set(dev, &dev->res) < 0) { | 475 | if (dev->protocol->set(dev, &dev->res) < 0) { |
487 | pnp_err("Failed to activate device %s.", dev->dev.bus_id); | 476 | dev_err(&dev->dev, "activation failed\n"); |
488 | return -EIO; | 477 | return -EIO; |
489 | } | 478 | } |
490 | 479 | ||
491 | pnp_info("Device %s activated.", dev->dev.bus_id); | 480 | dev_info(&dev->dev, "activated\n"); |
492 | return 0; | 481 | return 0; |
493 | } | 482 | } |
494 | 483 | ||
@@ -501,16 +490,15 @@ int pnp_start_dev(struct pnp_dev *dev) | |||
501 | int pnp_stop_dev(struct pnp_dev *dev) | 490 | int pnp_stop_dev(struct pnp_dev *dev) |
502 | { | 491 | { |
503 | if (!pnp_can_disable(dev)) { | 492 | if (!pnp_can_disable(dev)) { |
504 | pnp_dbg("Device %s does not support disabling.", | 493 | dev_dbg(&dev->dev, "disabling not supported\n"); |
505 | dev->dev.bus_id); | ||
506 | return -EINVAL; | 494 | return -EINVAL; |
507 | } | 495 | } |
508 | if (dev->protocol->disable(dev) < 0) { | 496 | if (dev->protocol->disable(dev) < 0) { |
509 | pnp_err("Failed to disable device %s.", dev->dev.bus_id); | 497 | dev_err(&dev->dev, "disable failed\n"); |
510 | return -EIO; | 498 | return -EIO; |
511 | } | 499 | } |
512 | 500 | ||
513 | pnp_info("Device %s disabled.", dev->dev.bus_id); | 501 | dev_info(&dev->dev, "disabled\n"); |
514 | return 0; | 502 | return 0; |
515 | } | 503 | } |
516 | 504 | ||
diff --git a/drivers/pnp/pnpacpi/core.c b/drivers/pnp/pnpacpi/core.c index a5a372222d69..dada89906314 100644 --- a/drivers/pnp/pnpacpi/core.c +++ b/drivers/pnp/pnpacpi/core.c | |||
@@ -130,11 +130,16 @@ static int pnpacpi_disable_resources(struct pnp_dev *dev) | |||
130 | #ifdef CONFIG_ACPI_SLEEP | 130 | #ifdef CONFIG_ACPI_SLEEP |
131 | static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) | 131 | static int pnpacpi_suspend(struct pnp_dev *dev, pm_message_t state) |
132 | { | 132 | { |
133 | return acpi_bus_set_power((acpi_handle) dev->data, | 133 | int power_state; |
134 | acpi_pm_device_sleep_state(&dev->dev, | 134 | |
135 | device_may_wakeup | 135 | power_state = acpi_pm_device_sleep_state(&dev->dev, |
136 | (&dev->dev), | 136 | device_may_wakeup(&dev->dev), |
137 | NULL)); | 137 | NULL); |
138 | if (power_state < 0) | ||
139 | power_state = (state.event == PM_EVENT_ON) ? | ||
140 | ACPI_STATE_D0 : ACPI_STATE_D3; | ||
141 | |||
142 | return acpi_bus_set_power((acpi_handle) dev->data, power_state); | ||
138 | } | 143 | } |
139 | 144 | ||
140 | static int pnpacpi_resume(struct pnp_dev *dev) | 145 | static int pnpacpi_resume(struct pnp_dev *dev) |
@@ -166,7 +171,6 @@ static int __init pnpacpi_add_device(struct acpi_device *device) | |||
166 | is_exclusive_device(device)) | 171 | is_exclusive_device(device)) |
167 | return 0; | 172 | return 0; |
168 | 173 | ||
169 | pnp_dbg("ACPI device : hid %s", acpi_device_hid(device)); | ||
170 | dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL); | 174 | dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL); |
171 | if (!dev) { | 175 | if (!dev) { |
172 | pnp_err("Out of memory"); | 176 | pnp_err("Out of memory"); |
diff --git a/drivers/pnp/pnpacpi/rsparser.c b/drivers/pnp/pnpacpi/rsparser.c index 0e3b8d0ff06b..cd0a204d96d1 100644 --- a/drivers/pnp/pnpacpi/rsparser.c +++ b/drivers/pnp/pnpacpi/rsparser.c | |||
@@ -85,6 +85,16 @@ static void pnpacpi_parse_allocated_irqresource(struct pnp_resource_table *res, | |||
85 | if (i >= PNP_MAX_IRQ) | 85 | if (i >= PNP_MAX_IRQ) |
86 | return; | 86 | return; |
87 | 87 | ||
88 | #ifdef CONFIG_X86 | ||
89 | if (gsi < 16 && (triggering != ACPI_EDGE_SENSITIVE || | ||
90 | polarity != ACPI_ACTIVE_HIGH)) { | ||
91 | pnp_warn("BIOS BUG: legacy PNP IRQ %d should be edge trigger, " | ||
92 | "active high", gsi); | ||
93 | triggering = ACPI_EDGE_SENSITIVE; | ||
94 | polarity = ACPI_ACTIVE_HIGH; | ||
95 | } | ||
96 | #endif | ||
97 | |||
88 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag | 98 | res->irq_resource[i].flags = IORESOURCE_IRQ; // Also clears _UNSET flag |
89 | res->irq_resource[i].flags |= irq_flags(triggering, polarity); | 99 | res->irq_resource[i].flags |= irq_flags(triggering, polarity); |
90 | irq = acpi_register_gsi(gsi, triggering, polarity); | 100 | irq = acpi_register_gsi(gsi, triggering, polarity); |
diff --git a/drivers/pnp/pnpbios/core.c b/drivers/pnp/pnpbios/core.c index 4e9fd37cff35..e33e03f71084 100644 --- a/drivers/pnp/pnpbios/core.c +++ b/drivers/pnp/pnpbios/core.c | |||
@@ -315,25 +315,31 @@ struct pnp_protocol pnpbios_protocol = { | |||
315 | .disable = pnpbios_disable_resources, | 315 | .disable = pnpbios_disable_resources, |
316 | }; | 316 | }; |
317 | 317 | ||
318 | static int insert_device(struct pnp_dev *dev, struct pnp_bios_node *node) | 318 | static int insert_device(struct pnp_bios_node *node) |
319 | { | 319 | { |
320 | struct list_head *pos; | 320 | struct list_head *pos; |
321 | struct pnp_dev *pnp_dev; | 321 | struct pnp_dev *dev; |
322 | struct pnp_id *dev_id; | 322 | struct pnp_id *dev_id; |
323 | char id[8]; | 323 | char id[8]; |
324 | 324 | ||
325 | /* check if the device is already added */ | 325 | /* check if the device is already added */ |
326 | dev->number = node->handle; | ||
327 | list_for_each(pos, &pnpbios_protocol.devices) { | 326 | list_for_each(pos, &pnpbios_protocol.devices) { |
328 | pnp_dev = list_entry(pos, struct pnp_dev, protocol_list); | 327 | dev = list_entry(pos, struct pnp_dev, protocol_list); |
329 | if (dev->number == pnp_dev->number) | 328 | if (dev->number == node->handle) |
330 | return -1; | 329 | return -1; |
331 | } | 330 | } |
332 | 331 | ||
333 | /* set the initial values for the PnP device */ | 332 | dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL); |
333 | if (!dev) | ||
334 | return -1; | ||
335 | |||
334 | dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); | 336 | dev_id = kzalloc(sizeof(struct pnp_id), GFP_KERNEL); |
335 | if (!dev_id) | 337 | if (!dev_id) { |
338 | kfree(dev); | ||
336 | return -1; | 339 | return -1; |
340 | } | ||
341 | |||
342 | dev->number = node->handle; | ||
337 | pnpid32_to_pnpid(node->eisa_id, id); | 343 | pnpid32_to_pnpid(node->eisa_id, id); |
338 | memcpy(dev_id->id, id, 7); | 344 | memcpy(dev_id->id, id, 7); |
339 | pnp_add_id(dev_id, dev); | 345 | pnp_add_id(dev_id, dev); |
@@ -367,7 +373,6 @@ static void __init build_devlist(void) | |||
367 | unsigned int nodes_got = 0; | 373 | unsigned int nodes_got = 0; |
368 | unsigned int devs = 0; | 374 | unsigned int devs = 0; |
369 | struct pnp_bios_node *node; | 375 | struct pnp_bios_node *node; |
370 | struct pnp_dev *dev; | ||
371 | 376 | ||
372 | node = kzalloc(node_info.max_node_size, GFP_KERNEL); | 377 | node = kzalloc(node_info.max_node_size, GFP_KERNEL); |
373 | if (!node) | 378 | if (!node) |
@@ -388,12 +393,7 @@ static void __init build_devlist(void) | |||
388 | break; | 393 | break; |
389 | } | 394 | } |
390 | nodes_got++; | 395 | nodes_got++; |
391 | dev = kzalloc(sizeof(struct pnp_dev), GFP_KERNEL); | 396 | if (insert_device(node) == 0) |
392 | if (!dev) | ||
393 | break; | ||
394 | if (insert_device(dev, node) < 0) | ||
395 | kfree(dev); | ||
396 | else | ||
397 | devs++; | 397 | devs++; |
398 | if (nodenum <= thisnodenum) { | 398 | if (nodenum <= thisnodenum) { |
399 | printk(KERN_ERR | 399 | printk(KERN_ERR |
diff --git a/drivers/pnp/pnpbios/proc.c b/drivers/pnp/pnpbios/proc.c index 9d9841f24a85..bb19bc957bad 100644 --- a/drivers/pnp/pnpbios/proc.c +++ b/drivers/pnp/pnpbios/proc.c | |||
@@ -94,8 +94,9 @@ static int proc_read_escd(char *buf, char **start, off_t pos, | |||
94 | 94 | ||
95 | /* sanity check */ | 95 | /* sanity check */ |
96 | if (escd_size > MAX_SANE_ESCD_SIZE) { | 96 | if (escd_size > MAX_SANE_ESCD_SIZE) { |
97 | printk(KERN_ERR | 97 | printk(KERN_ERR "PnPBIOS: proc_read_escd: ESCD size reported by" |
98 | "PnPBIOS: proc_read_escd: ESCD size reported by BIOS read_escd call is too great\n"); | 98 | " BIOS read_escd call is too great\n"); |
99 | kfree(tmpbuf); | ||
99 | return -EFBIG; | 100 | return -EFBIG; |
100 | } | 101 | } |
101 | 102 | ||
diff --git a/drivers/pnp/quirks.c b/drivers/pnp/quirks.c index 6b0cf0c2a088..e903b8c2b1fa 100644 --- a/drivers/pnp/quirks.c +++ b/drivers/pnp/quirks.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include <linux/slab.h> | 17 | #include <linux/slab.h> |
18 | #include <linux/pnp.h> | 18 | #include <linux/pnp.h> |
19 | #include <linux/io.h> | 19 | #include <linux/io.h> |
20 | #include <linux/kallsyms.h> | ||
20 | #include "base.h" | 21 | #include "base.h" |
21 | 22 | ||
22 | static void quirk_awe32_resources(struct pnp_dev *dev) | 23 | static void quirk_awe32_resources(struct pnp_dev *dev) |
@@ -133,11 +134,18 @@ static struct pnp_fixup pnp_fixups[] = { | |||
133 | void pnp_fixup_device(struct pnp_dev *dev) | 134 | void pnp_fixup_device(struct pnp_dev *dev) |
134 | { | 135 | { |
135 | int i = 0; | 136 | int i = 0; |
137 | void (*quirk)(struct pnp_dev *); | ||
136 | 138 | ||
137 | while (*pnp_fixups[i].id) { | 139 | while (*pnp_fixups[i].id) { |
138 | if (compare_pnp_id(dev->id, pnp_fixups[i].id)) { | 140 | if (compare_pnp_id(dev->id, pnp_fixups[i].id)) { |
139 | pnp_dbg("Calling quirk for %s", dev->dev.bus_id); | 141 | quirk = pnp_fixups[i].quirk_function; |
140 | pnp_fixups[i].quirk_function(dev); | 142 | |
143 | #ifdef DEBUG | ||
144 | dev_dbg(&dev->dev, "calling quirk 0x%p", quirk); | ||
145 | print_fn_descriptor_symbol(": %s()\n", | ||
146 | (unsigned long) *quirk); | ||
147 | #endif | ||
148 | (*quirk)(dev); | ||
141 | } | 149 | } |
142 | i++; | 150 | i++; |
143 | } | 151 | } |
diff --git a/drivers/pnp/resource.c b/drivers/pnp/resource.c index 087fed18628f..41d73a5e9312 100644 --- a/drivers/pnp/resource.c +++ b/drivers/pnp/resource.c | |||
@@ -51,7 +51,7 @@ struct pnp_option *pnp_register_independent_option(struct pnp_dev *dev) | |||
51 | 51 | ||
52 | /* this should never happen but if it does we'll try to continue */ | 52 | /* this should never happen but if it does we'll try to continue */ |
53 | if (dev->independent) | 53 | if (dev->independent) |
54 | pnp_err("independent resource already registered"); | 54 | dev_err(&dev->dev, "independent resource already registered\n"); |
55 | dev->independent = option; | 55 | dev->independent = option; |
56 | return option; | 56 | return option; |
57 | } | 57 | } |
diff --git a/drivers/pnp/system.c b/drivers/pnp/system.c index a06f980b3ac9..55c4563986b3 100644 --- a/drivers/pnp/system.c +++ b/drivers/pnp/system.c | |||
@@ -22,36 +22,39 @@ static const struct pnp_device_id pnp_dev_table[] = { | |||
22 | {"", 0} | 22 | {"", 0} |
23 | }; | 23 | }; |
24 | 24 | ||
25 | static void reserve_range(const char *pnpid, resource_size_t start, | 25 | static void reserve_range(struct pnp_dev *dev, resource_size_t start, |
26 | resource_size_t end, int port) | 26 | resource_size_t end, int port) |
27 | { | 27 | { |
28 | struct resource *res; | ||
29 | char *regionid; | 28 | char *regionid; |
29 | const char *pnpid = dev->dev.bus_id; | ||
30 | struct resource *res; | ||
30 | 31 | ||
31 | regionid = kmalloc(16, GFP_KERNEL); | 32 | regionid = kmalloc(16, GFP_KERNEL); |
32 | if (regionid == NULL) | 33 | if (!regionid) |
33 | return; | 34 | return; |
35 | |||
34 | snprintf(regionid, 16, "pnp %s", pnpid); | 36 | snprintf(regionid, 16, "pnp %s", pnpid); |
35 | if (port) | 37 | if (port) |
36 | res = request_region(start, end - start + 1, regionid); | 38 | res = request_region(start, end - start + 1, regionid); |
37 | else | 39 | else |
38 | res = request_mem_region(start, end - start + 1, regionid); | 40 | res = request_mem_region(start, end - start + 1, regionid); |
39 | if (res == NULL) | 41 | if (res) |
40 | kfree(regionid); | ||
41 | else | ||
42 | res->flags &= ~IORESOURCE_BUSY; | 42 | res->flags &= ~IORESOURCE_BUSY; |
43 | else | ||
44 | kfree(regionid); | ||
45 | |||
43 | /* | 46 | /* |
44 | * Failures at this point are usually harmless. pci quirks for | 47 | * Failures at this point are usually harmless. pci quirks for |
45 | * example do reserve stuff they know about too, so we may well | 48 | * example do reserve stuff they know about too, so we may well |
46 | * have double reservations. | 49 | * have double reservations. |
47 | */ | 50 | */ |
48 | printk(KERN_INFO "pnp: %s: %s range 0x%llx-0x%llx %s reserved\n", | 51 | dev_info(&dev->dev, "%s range 0x%llx-0x%llx %s reserved\n", |
49 | pnpid, port ? "ioport" : "iomem", | 52 | port ? "ioport" : "iomem", |
50 | (unsigned long long)start, (unsigned long long)end, | 53 | (unsigned long long) start, (unsigned long long) end, |
51 | NULL != res ? "has been" : "could not be"); | 54 | res ? "has been" : "could not be"); |
52 | } | 55 | } |
53 | 56 | ||
54 | static void reserve_resources_of_dev(const struct pnp_dev *dev) | 57 | static void reserve_resources_of_dev(struct pnp_dev *dev) |
55 | { | 58 | { |
56 | int i; | 59 | int i; |
57 | 60 | ||
@@ -73,7 +76,7 @@ static void reserve_resources_of_dev(const struct pnp_dev *dev) | |||
73 | if (pnp_port_end(dev, i) < pnp_port_start(dev, i)) | 76 | if (pnp_port_end(dev, i) < pnp_port_start(dev, i)) |
74 | continue; /* invalid */ | 77 | continue; /* invalid */ |
75 | 78 | ||
76 | reserve_range(dev->dev.bus_id, pnp_port_start(dev, i), | 79 | reserve_range(dev, pnp_port_start(dev, i), |
77 | pnp_port_end(dev, i), 1); | 80 | pnp_port_end(dev, i), 1); |
78 | } | 81 | } |
79 | 82 | ||
@@ -81,7 +84,7 @@ static void reserve_resources_of_dev(const struct pnp_dev *dev) | |||
81 | if (!pnp_mem_valid(dev, i)) | 84 | if (!pnp_mem_valid(dev, i)) |
82 | continue; | 85 | continue; |
83 | 86 | ||
84 | reserve_range(dev->dev.bus_id, pnp_mem_start(dev, i), | 87 | reserve_range(dev, pnp_mem_start(dev, i), |
85 | pnp_mem_end(dev, i), 0); | 88 | pnp_mem_end(dev, i), 0); |
86 | } | 89 | } |
87 | } | 90 | } |
diff --git a/drivers/s390/char/defkeymap.c b/drivers/s390/char/defkeymap.c index 564baca01b7c..389346cda6c8 100644 --- a/drivers/s390/char/defkeymap.c +++ b/drivers/s390/char/defkeymap.c | |||
@@ -150,7 +150,7 @@ char *func_table[MAX_NR_FUNC] = { | |||
150 | NULL, | 150 | NULL, |
151 | }; | 151 | }; |
152 | 152 | ||
153 | struct kbdiacr accent_table[MAX_DIACR] = { | 153 | struct kbdiacruc accent_table[MAX_DIACR] = { |
154 | {'^', 'c', '\003'}, {'^', 'd', '\004'}, | 154 | {'^', 'c', '\003'}, {'^', 'd', '\004'}, |
155 | {'^', 'z', '\032'}, {'^', '\012', '\000'}, | 155 | {'^', 'z', '\032'}, {'^', '\012', '\000'}, |
156 | }; | 156 | }; |
diff --git a/drivers/s390/char/keyboard.c b/drivers/s390/char/keyboard.c index f62f9a4e8950..cee4d4e42429 100644 --- a/drivers/s390/char/keyboard.c +++ b/drivers/s390/char/keyboard.c | |||
@@ -11,6 +11,7 @@ | |||
11 | #include <linux/sched.h> | 11 | #include <linux/sched.h> |
12 | #include <linux/sysrq.h> | 12 | #include <linux/sysrq.h> |
13 | 13 | ||
14 | #include <linux/consolemap.h> | ||
14 | #include <linux/kbd_kern.h> | 15 | #include <linux/kbd_kern.h> |
15 | #include <linux/kbd_diacr.h> | 16 | #include <linux/kbd_diacr.h> |
16 | #include <asm/uaccess.h> | 17 | #include <asm/uaccess.h> |
@@ -82,11 +83,11 @@ kbd_alloc(void) { | |||
82 | if (!kbd->fn_handler) | 83 | if (!kbd->fn_handler) |
83 | goto out_func; | 84 | goto out_func; |
84 | kbd->accent_table = | 85 | kbd->accent_table = |
85 | kmalloc(sizeof(struct kbdiacr)*MAX_DIACR, GFP_KERNEL); | 86 | kmalloc(sizeof(struct kbdiacruc)*MAX_DIACR, GFP_KERNEL); |
86 | if (!kbd->accent_table) | 87 | if (!kbd->accent_table) |
87 | goto out_fn_handler; | 88 | goto out_fn_handler; |
88 | memcpy(kbd->accent_table, accent_table, | 89 | memcpy(kbd->accent_table, accent_table, |
89 | sizeof(struct kbdiacr)*MAX_DIACR); | 90 | sizeof(struct kbdiacruc)*MAX_DIACR); |
90 | kbd->accent_table_size = accent_table_size; | 91 | kbd->accent_table_size = accent_table_size; |
91 | return kbd; | 92 | return kbd; |
92 | 93 | ||
@@ -183,8 +184,8 @@ kbd_ebcasc(struct kbd_data *kbd, unsigned char *ebcasc) | |||
183 | * Otherwise, conclude that DIACR was not combining after all, | 184 | * Otherwise, conclude that DIACR was not combining after all, |
184 | * queue it and return CH. | 185 | * queue it and return CH. |
185 | */ | 186 | */ |
186 | static unsigned char | 187 | static unsigned int |
187 | handle_diacr(struct kbd_data *kbd, unsigned char ch) | 188 | handle_diacr(struct kbd_data *kbd, unsigned int ch) |
188 | { | 189 | { |
189 | int i, d; | 190 | int i, d; |
190 | 191 | ||
@@ -460,7 +461,6 @@ int | |||
460 | kbd_ioctl(struct kbd_data *kbd, struct file *file, | 461 | kbd_ioctl(struct kbd_data *kbd, struct file *file, |
461 | unsigned int cmd, unsigned long arg) | 462 | unsigned int cmd, unsigned long arg) |
462 | { | 463 | { |
463 | struct kbdiacrs __user *a; | ||
464 | void __user *argp; | 464 | void __user *argp; |
465 | int ct, perm; | 465 | int ct, perm; |
466 | 466 | ||
@@ -481,17 +481,40 @@ kbd_ioctl(struct kbd_data *kbd, struct file *file, | |||
481 | case KDSKBSENT: | 481 | case KDSKBSENT: |
482 | return do_kdgkb_ioctl(kbd, argp, cmd, perm); | 482 | return do_kdgkb_ioctl(kbd, argp, cmd, perm); |
483 | case KDGKBDIACR: | 483 | case KDGKBDIACR: |
484 | a = argp; | 484 | { |
485 | struct kbdiacrs __user *a = argp; | ||
486 | struct kbdiacr diacr; | ||
487 | int i; | ||
485 | 488 | ||
486 | if (put_user(kbd->accent_table_size, &a->kb_cnt)) | 489 | if (put_user(kbd->accent_table_size, &a->kb_cnt)) |
487 | return -EFAULT; | 490 | return -EFAULT; |
491 | for (i = 0; i < kbd->accent_table_size; i++) { | ||
492 | diacr.diacr = kbd->accent_table[i].diacr; | ||
493 | diacr.base = kbd->accent_table[i].base; | ||
494 | diacr.result = kbd->accent_table[i].result; | ||
495 | if (copy_to_user(a->kbdiacr + i, &diacr, sizeof(struct kbdiacr))) | ||
496 | return -EFAULT; | ||
497 | } | ||
498 | return 0; | ||
499 | } | ||
500 | case KDGKBDIACRUC: | ||
501 | { | ||
502 | struct kbdiacrsuc __user *a = argp; | ||
503 | |||
488 | ct = kbd->accent_table_size; | 504 | ct = kbd->accent_table_size; |
489 | if (copy_to_user(a->kbdiacr, kbd->accent_table, | 505 | if (put_user(ct, &a->kb_cnt)) |
490 | ct * sizeof(struct kbdiacr))) | 506 | return -EFAULT; |
507 | if (copy_to_user(a->kbdiacruc, kbd->accent_table, | ||
508 | ct * sizeof(struct kbdiacruc))) | ||
491 | return -EFAULT; | 509 | return -EFAULT; |
492 | return 0; | 510 | return 0; |
511 | } | ||
493 | case KDSKBDIACR: | 512 | case KDSKBDIACR: |
494 | a = argp; | 513 | { |
514 | struct kbdiacrs __user *a = argp; | ||
515 | struct kbdiacr diacr; | ||
516 | int i; | ||
517 | |||
495 | if (!perm) | 518 | if (!perm) |
496 | return -EPERM; | 519 | return -EPERM; |
497 | if (get_user(ct, &a->kb_cnt)) | 520 | if (get_user(ct, &a->kb_cnt)) |
@@ -499,10 +522,31 @@ kbd_ioctl(struct kbd_data *kbd, struct file *file, | |||
499 | if (ct >= MAX_DIACR) | 522 | if (ct >= MAX_DIACR) |
500 | return -EINVAL; | 523 | return -EINVAL; |
501 | kbd->accent_table_size = ct; | 524 | kbd->accent_table_size = ct; |
502 | if (copy_from_user(kbd->accent_table, a->kbdiacr, | 525 | for (i = 0; i < ct; i++) { |
503 | ct * sizeof(struct kbdiacr))) | 526 | if (copy_from_user(&diacr, a->kbdiacr + i, sizeof(struct kbdiacr))) |
527 | return -EFAULT; | ||
528 | kbd->accent_table[i].diacr = diacr.diacr; | ||
529 | kbd->accent_table[i].base = diacr.base; | ||
530 | kbd->accent_table[i].result = diacr.result; | ||
531 | } | ||
532 | return 0; | ||
533 | } | ||
534 | case KDSKBDIACRUC: | ||
535 | { | ||
536 | struct kbdiacrsuc __user *a = argp; | ||
537 | |||
538 | if (!perm) | ||
539 | return -EPERM; | ||
540 | if (get_user(ct, &a->kb_cnt)) | ||
541 | return -EFAULT; | ||
542 | if (ct >= MAX_DIACR) | ||
543 | return -EINVAL; | ||
544 | kbd->accent_table_size = ct; | ||
545 | if (copy_from_user(kbd->accent_table, a->kbdiacruc, | ||
546 | ct * sizeof(struct kbdiacruc))) | ||
504 | return -EFAULT; | 547 | return -EFAULT; |
505 | return 0; | 548 | return 0; |
549 | } | ||
506 | default: | 550 | default: |
507 | return -ENOIOCTLCMD; | 551 | return -ENOIOCTLCMD; |
508 | } | 552 | } |
diff --git a/drivers/s390/char/keyboard.h b/drivers/s390/char/keyboard.h index f7bf45c6bf0d..5ccfe9cf126d 100644 --- a/drivers/s390/char/keyboard.h +++ b/drivers/s390/char/keyboard.h | |||
@@ -25,9 +25,9 @@ struct kbd_data { | |||
25 | unsigned short **key_maps; | 25 | unsigned short **key_maps; |
26 | char **func_table; | 26 | char **func_table; |
27 | fn_handler_fn **fn_handler; | 27 | fn_handler_fn **fn_handler; |
28 | struct kbdiacr *accent_table; | 28 | struct kbdiacruc *accent_table; |
29 | unsigned int accent_table_size; | 29 | unsigned int accent_table_size; |
30 | unsigned char diacr; | 30 | unsigned int diacr; |
31 | unsigned short sysrq; | 31 | unsigned short sysrq; |
32 | }; | 32 | }; |
33 | 33 | ||
diff --git a/drivers/serial/jsm/jsm_tty.c b/drivers/serial/jsm/jsm_tty.c index 281f23a371b2..94ec66372508 100644 --- a/drivers/serial/jsm/jsm_tty.c +++ b/drivers/serial/jsm/jsm_tty.c | |||
@@ -500,13 +500,11 @@ void jsm_input(struct jsm_channel *ch) | |||
500 | { | 500 | { |
501 | struct jsm_board *bd; | 501 | struct jsm_board *bd; |
502 | struct tty_struct *tp; | 502 | struct tty_struct *tp; |
503 | struct tty_ldisc *ld; | ||
504 | u32 rmask; | 503 | u32 rmask; |
505 | u16 head; | 504 | u16 head; |
506 | u16 tail; | 505 | u16 tail; |
507 | int data_len; | 506 | int data_len; |
508 | unsigned long lock_flags; | 507 | unsigned long lock_flags; |
509 | int flip_len = 0; | ||
510 | int len = 0; | 508 | int len = 0; |
511 | int n = 0; | 509 | int n = 0; |
512 | int s = 0; | 510 | int s = 0; |
@@ -574,45 +572,13 @@ void jsm_input(struct jsm_channel *ch) | |||
574 | 572 | ||
575 | jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "start 2\n"); | 573 | jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "start 2\n"); |
576 | 574 | ||
577 | /* | 575 | if (data_len <= 0) { |
578 | * If the rxbuf is empty and we are not throttled, put as much | ||
579 | * as we can directly into the linux TTY buffer. | ||
580 | * | ||
581 | */ | ||
582 | flip_len = TTY_FLIPBUF_SIZE; | ||
583 | |||
584 | len = min(data_len, flip_len); | ||
585 | len = min(len, (N_TTY_BUF_SIZE - 1) - tp->read_cnt); | ||
586 | ld = tty_ldisc_ref(tp); | ||
587 | |||
588 | /* | ||
589 | * If we were unable to get a reference to the ld, | ||
590 | * don't flush our buffer, and act like the ld doesn't | ||
591 | * have any space to put the data right now. | ||
592 | */ | ||
593 | if (!ld) { | ||
594 | len = 0; | ||
595 | } else { | ||
596 | /* | ||
597 | * If ld doesn't have a pointer to a receive_buf function, | ||
598 | * flush the data, then act like the ld doesn't have any | ||
599 | * space to put the data right now. | ||
600 | */ | ||
601 | if (!ld->receive_buf) { | ||
602 | ch->ch_r_head = ch->ch_r_tail; | ||
603 | len = 0; | ||
604 | } | ||
605 | } | ||
606 | |||
607 | if (len <= 0) { | ||
608 | spin_unlock_irqrestore(&ch->ch_lock, lock_flags); | 576 | spin_unlock_irqrestore(&ch->ch_lock, lock_flags); |
609 | jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "jsm_input 1\n"); | 577 | jsm_printk(READ, INFO, &ch->ch_bd->pci_dev, "jsm_input 1\n"); |
610 | if (ld) | ||
611 | tty_ldisc_deref(ld); | ||
612 | return; | 578 | return; |
613 | } | 579 | } |
614 | 580 | ||
615 | len = tty_buffer_request_room(tp, len); | 581 | len = tty_buffer_request_room(tp, data_len); |
616 | n = len; | 582 | n = len; |
617 | 583 | ||
618 | /* | 584 | /* |
@@ -647,7 +613,7 @@ void jsm_input(struct jsm_channel *ch) | |||
647 | else if (*(ch->ch_equeue +tail +i) & UART_LSR_FE) | 613 | else if (*(ch->ch_equeue +tail +i) & UART_LSR_FE) |
648 | tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_FRAME); | 614 | tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_FRAME); |
649 | else | 615 | else |
650 | tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_NORMAL); | 616 | tty_insert_flip_char(tp, *(ch->ch_rqueue +tail +i), TTY_NORMAL); |
651 | } | 617 | } |
652 | } else { | 618 | } else { |
653 | tty_insert_flip_string(tp, ch->ch_rqueue + tail, s) ; | 619 | tty_insert_flip_string(tp, ch->ch_rqueue + tail, s) ; |
@@ -666,9 +632,6 @@ void jsm_input(struct jsm_channel *ch) | |||
666 | /* Tell the tty layer its okay to "eat" the data now */ | 632 | /* Tell the tty layer its okay to "eat" the data now */ |
667 | tty_flip_buffer_push(tp); | 633 | tty_flip_buffer_push(tp); |
668 | 634 | ||
669 | if (ld) | ||
670 | tty_ldisc_deref(ld); | ||
671 | |||
672 | jsm_printk(IOCTL, INFO, &ch->ch_bd->pci_dev, "finish\n"); | 635 | jsm_printk(IOCTL, INFO, &ch->ch_bd->pci_dev, "finish\n"); |
673 | } | 636 | } |
674 | 637 | ||
diff --git a/drivers/tc/.gitignore b/drivers/tc/.gitignore deleted file mode 100644 index acc0e1e6a650..000000000000 --- a/drivers/tc/.gitignore +++ /dev/null | |||
@@ -1 +0,0 @@ | |||
1 | lk201-map.c | ||
diff --git a/drivers/tc/Makefile b/drivers/tc/Makefile index c899246bd362..623b21063228 100644 --- a/drivers/tc/Makefile +++ b/drivers/tc/Makefile | |||
@@ -5,18 +5,3 @@ | |||
5 | # Object file lists. | 5 | # Object file lists. |
6 | 6 | ||
7 | obj-$(CONFIG_TC) += tc.o tc-driver.o | 7 | obj-$(CONFIG_TC) += tc.o tc-driver.o |
8 | obj-$(CONFIG_VT) += lk201.o lk201-map.o lk201-remap.o | ||
9 | |||
10 | $(obj)/lk201-map.o: $(obj)/lk201-map.c | ||
11 | |||
12 | # Uncomment if you're changing the keymap and have an appropriate | ||
13 | # loadkeys version for the map. By default, we'll use the shipped | ||
14 | # versions. | ||
15 | # GENERATE_KEYMAP := 1 | ||
16 | |||
17 | ifdef GENERATE_KEYMAP | ||
18 | |||
19 | $(obj)/lk201-map.c: $(obj)/%.c: $(src)/%.map | ||
20 | loadkeys --mktable $< > $@ | ||
21 | |||
22 | endif | ||
diff --git a/drivers/tc/lk201-map.c_shipped b/drivers/tc/lk201-map.c_shipped deleted file mode 100644 index a9df8f5bf62b..000000000000 --- a/drivers/tc/lk201-map.c_shipped +++ /dev/null | |||
@@ -1,265 +0,0 @@ | |||
1 | |||
2 | /* Do not edit this file! It was automatically generated by */ | ||
3 | /* loadkeys --mktable defkeymap.map > defkeymap.c */ | ||
4 | |||
5 | #include <linux/types.h> | ||
6 | #include <linux/keyboard.h> | ||
7 | #include <linux/kd.h> | ||
8 | |||
9 | u_short plain_map[NR_KEYS] = { | ||
10 | 0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, | ||
11 | 0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf11b, | ||
12 | 0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf060, 0xf031, 0xf032, | ||
13 | 0xf033, 0xf034, 0xf035, 0xf036, 0xf037, 0xf038, 0xf039, 0xf030, | ||
14 | 0xf02d, 0xf03d, 0xf07f, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200, | ||
15 | 0xf200, 0xf200, 0xf009, 0xfb71, 0xfb77, 0xfb65, 0xfb72, 0xfb74, | ||
16 | 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf05b, 0xf05d, 0xf201, | ||
17 | 0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702, | ||
18 | 0xf207, 0xfb61, 0xfb73, 0xfb64, 0xfb66, 0xfb67, 0xfb68, 0xfb6a, | ||
19 | 0xfb6b, 0xfb6c, 0xf03b, 0xf027, 0xf05c, 0xf603, 0xf304, 0xf305, | ||
20 | 0xf306, 0xf200, 0xf700, 0xf03e, 0xfb7a, 0xfb78, 0xfb63, 0xfb76, | ||
21 | 0xfb62, 0xfb6e, 0xfb6d, 0xf02c, 0xf02e, 0xf02f, 0xf200, 0xf601, | ||
22 | 0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703, | ||
23 | 0xf020, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200, | ||
24 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
25 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
26 | }; | ||
27 | |||
28 | static u_short shift_map[NR_KEYS] = { | ||
29 | 0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, | ||
30 | 0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf203, | ||
31 | 0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf07e, 0xf021, 0xf040, | ||
32 | 0xf023, 0xf024, 0xf025, 0xf05e, 0xf026, 0xf02a, 0xf028, 0xf029, | ||
33 | 0xf05f, 0xf02b, 0xf07f, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200, | ||
34 | 0xf200, 0xf200, 0xf009, 0xfb51, 0xfb57, 0xfb45, 0xfb52, 0xfb54, | ||
35 | 0xfb59, 0xfb55, 0xfb49, 0xfb4f, 0xfb50, 0xf07b, 0xf07d, 0xf201, | ||
36 | 0xf117, 0xf20b, 0xf20a, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702, | ||
37 | 0xf207, 0xfb41, 0xfb53, 0xfb44, 0xfb46, 0xfb47, 0xfb48, 0xfb4a, | ||
38 | 0xfb4b, 0xfb4c, 0xf03a, 0xf022, 0xf07c, 0xf603, 0xf304, 0xf305, | ||
39 | 0xf306, 0xf200, 0xf700, 0xf03c, 0xfb5a, 0xfb58, 0xfb43, 0xfb56, | ||
40 | 0xfb42, 0xfb4e, 0xfb4d, 0xf03c, 0xf03e, 0xf03f, 0xf200, 0xf601, | ||
41 | 0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703, | ||
42 | 0xf020, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200, | ||
43 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
44 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
45 | }; | ||
46 | |||
47 | static u_short altgr_map[NR_KEYS] = { | ||
48 | 0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, | ||
49 | 0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf202, | ||
50 | 0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf200, 0xf200, 0xf040, | ||
51 | 0xf200, 0xf024, 0xf200, 0xf200, 0xf07b, 0xf05b, 0xf05d, 0xf07d, | ||
52 | 0xf05c, 0xf200, 0xf200, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200, | ||
53 | 0xf200, 0xf200, 0xf200, 0xfb71, 0xfb77, 0xf918, 0xfb72, 0xfb74, | ||
54 | 0xfb79, 0xfb75, 0xfb69, 0xfb6f, 0xfb70, 0xf200, 0xf07e, 0xf201, | ||
55 | 0xf117, 0xf118, 0xf119, 0xf911, 0xf912, 0xf913, 0xf30b, 0xf702, | ||
56 | 0xf207, 0xf914, 0xfb73, 0xf917, 0xf919, 0xfb67, 0xfb68, 0xfb6a, | ||
57 | 0xfb6b, 0xfb6c, 0xf200, 0xf200, 0xf200, 0xf603, 0xf90e, 0xf90f, | ||
58 | 0xf910, 0xf200, 0xf700, 0xf200, 0xfb7a, 0xfb78, 0xf916, 0xfb76, | ||
59 | 0xf915, 0xfb6e, 0xfb6d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf601, | ||
60 | 0xf600, 0xf602, 0xf90b, 0xf90c, 0xf90d, 0xf30e, 0xf200, 0xf703, | ||
61 | 0xf200, 0xf200, 0xf200, 0xf90a, 0xf310, 0xf200, 0xf200, 0xf200, | ||
62 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
63 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
64 | }; | ||
65 | |||
66 | static u_short ctrl_map[NR_KEYS] = { | ||
67 | 0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, | ||
68 | 0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf204, | ||
69 | 0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf81b, 0xf200, 0xf000, | ||
70 | 0xf01b, 0xf01c, 0xf01d, 0xf01e, 0xf01f, 0xf07f, 0xf200, 0xf200, | ||
71 | 0xf01f, 0xf200, 0xf008, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200, | ||
72 | 0xf200, 0xf200, 0xf200, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, | ||
73 | 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf01b, 0xf01d, 0xf201, | ||
74 | 0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702, | ||
75 | 0xf207, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, | ||
76 | 0xf00b, 0xf00c, 0xf200, 0xf007, 0xf01c, 0xf603, 0xf304, 0xf305, | ||
77 | 0xf306, 0xf200, 0xf700, 0xf200, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
78 | 0xf002, 0xf00e, 0xf00d, 0xf200, 0xf20e, 0xf07f, 0xf200, 0xf601, | ||
79 | 0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703, | ||
80 | 0xf000, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200, | ||
81 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
82 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
83 | }; | ||
84 | |||
85 | static u_short shift_ctrl_map[NR_KEYS] = { | ||
86 | 0xf200, 0xf100, 0xf101, 0xf102, 0xf103, 0xf104, 0xf105, 0xf106, | ||
87 | 0xf107, 0xf108, 0xf109, 0xf10a, 0xf10b, 0xf10c, 0xf10d, 0xf200, | ||
88 | 0xf11c, 0xf110, 0xf111, 0xf112, 0xf113, 0xf200, 0xf200, 0xf000, | ||
89 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
90 | 0xf01f, 0xf200, 0xf200, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200, | ||
91 | 0xf200, 0xf200, 0xf200, 0xf011, 0xf017, 0xf005, 0xf012, 0xf014, | ||
92 | 0xf019, 0xf015, 0xf009, 0xf00f, 0xf010, 0xf200, 0xf200, 0xf201, | ||
93 | 0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702, | ||
94 | 0xf207, 0xf001, 0xf013, 0xf004, 0xf006, 0xf007, 0xf008, 0xf00a, | ||
95 | 0xf00b, 0xf00c, 0xf200, 0xf200, 0xf200, 0xf603, 0xf304, 0xf305, | ||
96 | 0xf306, 0xf200, 0xf700, 0xf200, 0xf01a, 0xf018, 0xf003, 0xf016, | ||
97 | 0xf002, 0xf00e, 0xf00d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf601, | ||
98 | 0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703, | ||
99 | 0xf200, 0xf200, 0xf200, 0xf300, 0xf310, 0xf200, 0xf200, 0xf200, | ||
100 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
101 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
102 | }; | ||
103 | |||
104 | static u_short alt_map[NR_KEYS] = { | ||
105 | 0xf200, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, | ||
106 | 0xf507, 0xf508, 0xf509, 0xf50a, 0xf50b, 0xf50c, 0xf50d, 0xf200, | ||
107 | 0xf11c, 0xf510, 0xf511, 0xf512, 0xf513, 0xf01b, 0xf831, 0xf832, | ||
108 | 0xf833, 0xf834, 0xf835, 0xf836, 0xf837, 0xf838, 0xf839, 0xf830, | ||
109 | 0xf82d, 0xf83d, 0xf87f, 0xf114, 0xf115, 0xf116, 0xf200, 0xf200, | ||
110 | 0xf200, 0xf200, 0xf809, 0xf871, 0xf877, 0xf865, 0xf872, 0xf874, | ||
111 | 0xf879, 0xf875, 0xf869, 0xf86f, 0xf870, 0xf85b, 0xf85d, 0xf80d, | ||
112 | 0xf117, 0xf118, 0xf119, 0xf907, 0xf908, 0xf909, 0xf30b, 0xf702, | ||
113 | 0xf207, 0xf861, 0xf873, 0xf864, 0xf866, 0xf867, 0xf868, 0xf86a, | ||
114 | 0xf86b, 0xf86c, 0xf83b, 0xf827, 0xf85c, 0xf603, 0xf904, 0xf905, | ||
115 | 0xf906, 0xf200, 0xf700, 0xf200, 0xf87a, 0xf878, 0xf863, 0xf876, | ||
116 | 0xf862, 0xf86e, 0xf86d, 0xf82c, 0xf82e, 0xf82f, 0xf200, 0xf210, | ||
117 | 0xf600, 0xf211, 0xf901, 0xf902, 0xf903, 0xf30e, 0xf200, 0xf703, | ||
118 | 0xf820, 0xf200, 0xf200, 0xf900, 0xf310, 0xf200, 0xf200, 0xf200, | ||
119 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
120 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
121 | }; | ||
122 | |||
123 | static u_short ctrl_alt_map[NR_KEYS] = { | ||
124 | 0xf200, 0xf500, 0xf501, 0xf502, 0xf503, 0xf504, 0xf505, 0xf506, | ||
125 | 0xf507, 0xf508, 0xf509, 0xf50a, 0xf50b, 0xf50c, 0xf50d, 0xf200, | ||
126 | 0xf11c, 0xf510, 0xf511, 0xf512, 0xf513, 0xf200, 0xf200, 0xf200, | ||
127 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
128 | 0xf200, 0xf200, 0xf200, 0xf114, 0xf115, 0xf20c, 0xf200, 0xf200, | ||
129 | 0xf200, 0xf200, 0xf200, 0xf811, 0xf817, 0xf805, 0xf812, 0xf814, | ||
130 | 0xf819, 0xf815, 0xf809, 0xf80f, 0xf810, 0xf200, 0xf200, 0xf201, | ||
131 | 0xf117, 0xf118, 0xf119, 0xf307, 0xf308, 0xf309, 0xf30b, 0xf702, | ||
132 | 0xf207, 0xf801, 0xf813, 0xf804, 0xf806, 0xf807, 0xf808, 0xf80a, | ||
133 | 0xf80b, 0xf80c, 0xf200, 0xf200, 0xf200, 0xf603, 0xf304, 0xf305, | ||
134 | 0xf306, 0xf200, 0xf700, 0xf200, 0xf81a, 0xf818, 0xf803, 0xf816, | ||
135 | 0xf802, 0xf80e, 0xf80d, 0xf200, 0xf200, 0xf200, 0xf200, 0xf601, | ||
136 | 0xf600, 0xf602, 0xf301, 0xf302, 0xf303, 0xf30e, 0xf200, 0xf703, | ||
137 | 0xf200, 0xf200, 0xf200, 0xf300, 0xf20c, 0xf200, 0xf200, 0xf200, | ||
138 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
139 | 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, 0xf200, | ||
140 | }; | ||
141 | |||
142 | ushort *key_maps[MAX_NR_KEYMAPS] = { | ||
143 | plain_map, shift_map, altgr_map, 0, | ||
144 | ctrl_map, shift_ctrl_map, 0, 0, | ||
145 | alt_map, 0, 0, 0, | ||
146 | ctrl_alt_map, 0 | ||
147 | }; | ||
148 | |||
149 | unsigned int keymap_count = 7; | ||
150 | |||
151 | |||
152 | /* | ||
153 | * Philosophy: most people do not define more strings, but they who do | ||
154 | * often want quite a lot of string space. So, we statically allocate | ||
155 | * the default and allocate dynamically in chunks of 512 bytes. | ||
156 | */ | ||
157 | |||
158 | char func_buf[] = { | ||
159 | '\033', '[', '[', 'A', 0, | ||
160 | '\033', '[', '[', 'B', 0, | ||
161 | '\033', '[', '[', 'C', 0, | ||
162 | '\033', '[', '[', 'D', 0, | ||
163 | '\033', '[', '[', 'E', 0, | ||
164 | '\033', '[', '1', '7', '~', 0, | ||
165 | '\033', '[', '1', '8', '~', 0, | ||
166 | '\033', '[', '1', '9', '~', 0, | ||
167 | '\033', '[', '2', '0', '~', 0, | ||
168 | '\033', '[', '2', '1', '~', 0, | ||
169 | '\033', '[', '2', '3', '~', 0, | ||
170 | '\033', '[', '2', '4', '~', 0, | ||
171 | '\033', '[', '2', '5', '~', 0, | ||
172 | '\033', '[', '2', '6', '~', 0, | ||
173 | '\033', '[', '2', '8', '~', 0, | ||
174 | '\033', '[', '2', '9', '~', 0, | ||
175 | '\033', '[', '3', '1', '~', 0, | ||
176 | '\033', '[', '3', '2', '~', 0, | ||
177 | '\033', '[', '3', '3', '~', 0, | ||
178 | '\033', '[', '3', '4', '~', 0, | ||
179 | '\033', '[', '1', '~', 0, | ||
180 | '\033', '[', '2', '~', 0, | ||
181 | '\033', '[', '3', '~', 0, | ||
182 | '\033', '[', '4', '~', 0, | ||
183 | '\033', '[', '5', '~', 0, | ||
184 | '\033', '[', '6', '~', 0, | ||
185 | '\033', '[', 'M', 0, | ||
186 | '\033', '[', 'P', 0, | ||
187 | }; | ||
188 | |||
189 | |||
190 | char *funcbufptr = func_buf; | ||
191 | int funcbufsize = sizeof(func_buf); | ||
192 | int funcbufleft = 0; /* space left */ | ||
193 | |||
194 | char *func_table[MAX_NR_FUNC] = { | ||
195 | func_buf + 0, | ||
196 | func_buf + 5, | ||
197 | func_buf + 10, | ||
198 | func_buf + 15, | ||
199 | func_buf + 20, | ||
200 | func_buf + 25, | ||
201 | func_buf + 31, | ||
202 | func_buf + 37, | ||
203 | func_buf + 43, | ||
204 | func_buf + 49, | ||
205 | func_buf + 55, | ||
206 | func_buf + 61, | ||
207 | func_buf + 67, | ||
208 | func_buf + 73, | ||
209 | func_buf + 79, | ||
210 | func_buf + 85, | ||
211 | func_buf + 91, | ||
212 | func_buf + 97, | ||
213 | func_buf + 103, | ||
214 | func_buf + 109, | ||
215 | func_buf + 115, | ||
216 | func_buf + 120, | ||
217 | func_buf + 125, | ||
218 | func_buf + 130, | ||
219 | func_buf + 135, | ||
220 | func_buf + 140, | ||
221 | func_buf + 145, | ||
222 | 0, | ||
223 | 0, | ||
224 | func_buf + 149, | ||
225 | 0, | ||
226 | }; | ||
227 | |||
228 | struct kbdiacr accent_table[MAX_DIACR] = { | ||
229 | {'`', 'A', 'À'}, {'`', 'a', 'à'}, | ||
230 | {'\'', 'A', 'Á'}, {'\'', 'a', 'á'}, | ||
231 | {'^', 'A', 'Â'}, {'^', 'a', 'â'}, | ||
232 | {'~', 'A', 'Ã'}, {'~', 'a', 'ã'}, | ||
233 | {'"', 'A', 'Ä'}, {'"', 'a', 'ä'}, | ||
234 | {'O', 'A', 'Å'}, {'o', 'a', 'å'}, | ||
235 | {'0', 'A', 'Å'}, {'0', 'a', 'å'}, | ||
236 | {'A', 'A', 'Å'}, {'a', 'a', 'å'}, | ||
237 | {'A', 'E', 'Æ'}, {'a', 'e', 'æ'}, | ||
238 | {',', 'C', 'Ç'}, {',', 'c', 'ç'}, | ||
239 | {'`', 'E', 'È'}, {'`', 'e', 'è'}, | ||
240 | {'\'', 'E', 'É'}, {'\'', 'e', 'é'}, | ||
241 | {'^', 'E', 'Ê'}, {'^', 'e', 'ê'}, | ||
242 | {'"', 'E', 'Ë'}, {'"', 'e', 'ë'}, | ||
243 | {'`', 'I', 'Ì'}, {'`', 'i', 'ì'}, | ||
244 | {'\'', 'I', 'Í'}, {'\'', 'i', 'í'}, | ||
245 | {'^', 'I', 'Î'}, {'^', 'i', 'î'}, | ||
246 | {'"', 'I', 'Ï'}, {'"', 'i', 'ï'}, | ||
247 | {'-', 'D', 'Ð'}, {'-', 'd', 'ð'}, | ||
248 | {'~', 'N', 'Ñ'}, {'~', 'n', 'ñ'}, | ||
249 | {'`', 'O', 'Ò'}, {'`', 'o', 'ò'}, | ||
250 | {'\'', 'O', 'Ó'}, {'\'', 'o', 'ó'}, | ||
251 | {'^', 'O', 'Ô'}, {'^', 'o', 'ô'}, | ||
252 | {'~', 'O', 'Õ'}, {'~', 'o', 'õ'}, | ||
253 | {'"', 'O', 'Ö'}, {'"', 'o', 'ö'}, | ||
254 | {'/', 'O', 'Ø'}, {'/', 'o', 'ø'}, | ||
255 | {'`', 'U', 'Ù'}, {'`', 'u', 'ù'}, | ||
256 | {'\'', 'U', 'Ú'}, {'\'', 'u', 'ú'}, | ||
257 | {'^', 'U', 'Û'}, {'^', 'u', 'û'}, | ||
258 | {'"', 'U', 'Ü'}, {'"', 'u', 'ü'}, | ||
259 | {'\'', 'Y', 'Ý'}, {'\'', 'y', 'ý'}, | ||
260 | {'T', 'H', 'Þ'}, {'t', 'h', 'þ'}, | ||
261 | {'s', 's', 'ß'}, {'"', 'y', 'ÿ'}, | ||
262 | {'s', 'z', 'ß'}, {'i', 'j', 'ÿ'}, | ||
263 | }; | ||
264 | |||
265 | unsigned int accent_table_size = 68; | ||
diff --git a/drivers/tc/lk201-map.map b/drivers/tc/lk201-map.map deleted file mode 100644 index 2c636b4b7823..000000000000 --- a/drivers/tc/lk201-map.map +++ /dev/null | |||
@@ -1,356 +0,0 @@ | |||
1 | # Default kernel keymap. This uses 7 modifier combinations. | ||
2 | keymaps 0-2,4-5,8,12 | ||
3 | # Change the above line into | ||
4 | # keymaps 0-2,4-6,8,12 | ||
5 | # in case you want the entries | ||
6 | # altgr control keycode 83 = Boot | ||
7 | # altgr control keycode 111 = Boot | ||
8 | # below. | ||
9 | # | ||
10 | # In fact AltGr is used very little, and one more keymap can | ||
11 | # be saved by mapping AltGr to Alt (and adapting a few entries): | ||
12 | # keycode 100 = Alt | ||
13 | # | ||
14 | keycode 0x15 = grave tilde | ||
15 | alt keycode 0x15 = Escape | ||
16 | control keycode 0x15 = Meta_Escape | ||
17 | keycode 0x16 = one exclam | ||
18 | alt keycode 0x16 = Meta_one | ||
19 | keycode 0x17 = two at at | ||
20 | control keycode 0x17 = nul | ||
21 | shift control keycode 0x17 = nul | ||
22 | alt keycode 0x17 = Meta_two | ||
23 | keycode 0x18 = three numbersign | ||
24 | control keycode 0x18 = Escape | ||
25 | alt keycode 0x18 = Meta_three | ||
26 | keycode 0x19 = four dollar dollar | ||
27 | control keycode 0x19 = Control_backslash | ||
28 | alt keycode 0x19 = Meta_four | ||
29 | keycode 0x1a = five percent | ||
30 | control keycode 0x1a = Control_bracketright | ||
31 | alt keycode 0x1a = Meta_five | ||
32 | keycode 0x1b = six asciicircum | ||
33 | control keycode 0x1b = Control_asciicircum | ||
34 | alt keycode 0x1b = Meta_six | ||
35 | keycode 0x1c = seven ampersand braceleft | ||
36 | control keycode 0x1c = Control_underscore | ||
37 | alt keycode 0x1c = Meta_seven | ||
38 | keycode 0x1d = eight asterisk bracketleft | ||
39 | control keycode 0x1d = Delete | ||
40 | alt keycode 0x1d = Meta_eight | ||
41 | keycode 0x1e = nine parenleft bracketright | ||
42 | alt keycode 0x1e = Meta_nine | ||
43 | keycode 0x1f = zero parenright braceright | ||
44 | alt keycode 0x1f = Meta_zero | ||
45 | keycode 0x20 = minus underscore backslash | ||
46 | control keycode 0x20 = Control_underscore | ||
47 | shift control keycode 0x20 = Control_underscore | ||
48 | alt keycode 0x20 = Meta_minus | ||
49 | keycode 0x21 = equal plus | ||
50 | alt keycode 0x21 = Meta_equal | ||
51 | keycode 0x22 = Delete Delete | ||
52 | control keycode 0x22 = BackSpace | ||
53 | alt keycode 0x22 = Meta_Delete | ||
54 | keycode 0x2a = Tab Tab | ||
55 | alt keycode 0x2a = Meta_Tab | ||
56 | keycode 0x2b = q | ||
57 | keycode 0x2c = w | ||
58 | keycode 0x2d = e | ||
59 | altgr keycode 0x2d = Hex_E | ||
60 | keycode 0x2e = r | ||
61 | keycode 0x2f = t | ||
62 | keycode 0x30 = y | ||
63 | keycode 0x31 = u | ||
64 | keycode 0x32 = i | ||
65 | keycode 0x33 = o | ||
66 | keycode 0x34 = p | ||
67 | keycode 0x35 = bracketleft braceleft | ||
68 | control keycode 0x35 = Escape | ||
69 | alt keycode 0x35 = Meta_bracketleft | ||
70 | keycode 0x36 = bracketright braceright asciitilde | ||
71 | control keycode 0x36 = Control_bracketright | ||
72 | alt keycode 0x36 = Meta_bracketright | ||
73 | keycode 0x37 = Return | ||
74 | alt keycode 0x37 = Meta_Control_m | ||
75 | keycode 0x3f = Control | ||
76 | keycode 0x41 = a | ||
77 | altgr keycode 0x41 = Hex_A | ||
78 | keycode 0x42 = s | ||
79 | keycode 0x43 = d | ||
80 | altgr keycode 0x43 = Hex_D | ||
81 | keycode 0x44 = f | ||
82 | altgr keycode 0x44 = Hex_F | ||
83 | keycode 0x45 = g | ||
84 | keycode 0x46 = h | ||
85 | keycode 0x47 = j | ||
86 | keycode 0x48 = k | ||
87 | keycode 0x49 = l | ||
88 | keycode 0x4a = semicolon colon | ||
89 | alt keycode 0x4a = Meta_semicolon | ||
90 | keycode 0x4b = apostrophe quotedbl | ||
91 | control keycode 0x4b = Control_g | ||
92 | alt keycode 0x4b = Meta_apostrophe | ||
93 | # keycode 41 = grave asciitilde | ||
94 | # control keycode 41 = nul | ||
95 | # alt keycode 41 = Meta_grave | ||
96 | keycode 0x52 = Shift | ||
97 | keycode 0x4c = backslash bar | ||
98 | control keycode 0x4c = Control_backslash | ||
99 | alt keycode 0x4c = Meta_backslash | ||
100 | keycode 0x53 = greater less | ||
101 | keycode 0x54 = z | ||
102 | keycode 0x55 = x | ||
103 | keycode 0x56 = c | ||
104 | altgr keycode 0x56 = Hex_C | ||
105 | keycode 0x57 = v | ||
106 | keycode 0x58 = b | ||
107 | altgr keycode 0x58 = Hex_B | ||
108 | keycode 0x59 = n | ||
109 | keycode 0x5a = m | ||
110 | keycode 0x5b = comma less | ||
111 | alt keycode 0x5b = Meta_comma | ||
112 | keycode 0x5c = period greater | ||
113 | control keycode 0x5c = Compose | ||
114 | alt keycode 0x5c = Meta_period | ||
115 | keycode 0x5d = slash question | ||
116 | control keycode 0x5d = Delete | ||
117 | alt keycode 0x5d = Meta_slash | ||
118 | |||
119 | keycode 0x67 = Alt | ||
120 | keycode 0x68 = space space | ||
121 | control keycode 0x68 = nul | ||
122 | alt keycode 0x68 = Meta_space | ||
123 | keycode 0x40 = Caps_Lock | ||
124 | keycode 0x01 = F1 | ||
125 | control keycode 0x01 = F1 | ||
126 | alt keycode 0x01 = Console_1 | ||
127 | control alt keycode 0x01 = Console_1 | ||
128 | keycode 0x02 = F2 | ||
129 | control keycode 0x02 = F2 | ||
130 | alt keycode 0x02 = Console_2 | ||
131 | control alt keycode 0x02 = Console_2 | ||
132 | keycode 0x03 = F3 | ||
133 | control keycode 0x03 = F3 | ||
134 | alt keycode 0x03 = Console_3 | ||
135 | control alt keycode 0x03 = Console_3 | ||
136 | keycode 0x04 = F4 | ||
137 | control keycode 0x04 = F4 | ||
138 | alt keycode 0x04 = Console_4 | ||
139 | control alt keycode 0x04 = Console_4 | ||
140 | keycode 0x05 = F5 | ||
141 | control keycode 0x05 = F5 | ||
142 | alt keycode 0x05 = Console_5 | ||
143 | control alt keycode 0x05 = Console_5 | ||
144 | keycode 0x06 = F6 | ||
145 | control keycode 0x06 = F6 | ||
146 | alt keycode 0x06 = Console_6 | ||
147 | control alt keycode 0x06 = Console_6 | ||
148 | keycode 0x07 = F7 | ||
149 | control keycode 0x07 = F7 | ||
150 | alt keycode 0x07 = Console_7 | ||
151 | control alt keycode 0x07 = Console_7 | ||
152 | keycode 0x08 = F8 | ||
153 | control keycode 0x08 = F8 | ||
154 | alt keycode 0x08 = Console_8 | ||
155 | control alt keycode 0x08 = Console_8 | ||
156 | keycode 0x09 = F9 | ||
157 | control keycode 0x09 = F9 | ||
158 | alt keycode 0x09 = Console_9 | ||
159 | control alt keycode 0x09 = Console_9 | ||
160 | keycode 0x0a = F10 | ||
161 | control keycode 0x0a = F10 | ||
162 | alt keycode 0x0a = Console_10 | ||
163 | control alt keycode 0x0a = Console_10 | ||
164 | keycode 0x0b = F11 | ||
165 | control keycode 0x0b = F11 | ||
166 | alt keycode 0x0b = Console_11 | ||
167 | control alt keycode 0x0b = Console_11 | ||
168 | keycode 0x0c = F12 | ||
169 | control keycode 0x0c = F12 | ||
170 | alt keycode 0x0c = Console_12 | ||
171 | control alt keycode 0x0c = Console_12 | ||
172 | keycode 0x0d = F13 | ||
173 | control keycode 0x0d = F13 | ||
174 | alt keycode 0x0d = Console_13 | ||
175 | control alt keycode 0x0d = Console_13 | ||
176 | keycode 0x0e = F14 | ||
177 | control keycode 0x0e = F14 | ||
178 | alt keycode 0x0e = Console_14 | ||
179 | control alt keycode 0x0e = Console_14 | ||
180 | |||
181 | keycode 0x11 = F17 | ||
182 | control keycode 0x11 = F17 | ||
183 | alt keycode 0x11 = Console_17 | ||
184 | control alt keycode 0x11 = Console_17 | ||
185 | keycode 0x12 = F18 | ||
186 | control keycode 0x12 = F18 | ||
187 | alt keycode 0x12 = Console_18 | ||
188 | control alt keycode 0x12 = Console_18 | ||
189 | keycode 0x13 = F19 | ||
190 | control keycode 0x13 = F19 | ||
191 | alt keycode 0x13 = Console_19 | ||
192 | control alt keycode 0x13 = Console_19 | ||
193 | keycode 0x14 = F20 | ||
194 | control keycode 0x14 = F20 | ||
195 | alt keycode 0x14 = Console_20 | ||
196 | control alt keycode 0x14 = Console_20 | ||
197 | |||
198 | |||
199 | keycode 0x3b = KP_7 | ||
200 | alt keycode 0x3b = Ascii_7 | ||
201 | altgr keycode 0x3b = Hex_7 | ||
202 | keycode 0x3c = KP_8 | ||
203 | alt keycode 0x3c = Ascii_8 | ||
204 | altgr keycode 0x3c = Hex_8 | ||
205 | keycode 0x3d = KP_9 | ||
206 | alt keycode 0x3d = Ascii_9 | ||
207 | altgr keycode 0x3d = Hex_9 | ||
208 | keycode 0x3e = KP_Subtract | ||
209 | keycode 0x4e = KP_4 | ||
210 | alt keycode 0x4e = Ascii_4 | ||
211 | altgr keycode 0x4e = Hex_4 | ||
212 | keycode 0x4f = KP_5 | ||
213 | alt keycode 0x4f = Ascii_5 | ||
214 | altgr keycode 0x4f = Hex_5 | ||
215 | keycode 0x50 = KP_6 | ||
216 | alt keycode 0x50 = Ascii_6 | ||
217 | altgr keycode 0x50 = Hex_6 | ||
218 | keycode 0x62 = KP_1 | ||
219 | alt keycode 0x62 = Ascii_1 | ||
220 | altgr keycode 0x62 = Hex_1 | ||
221 | keycode 0x63 = KP_2 | ||
222 | alt keycode 0x63 = Ascii_2 | ||
223 | altgr keycode 0x63 = Hex_2 | ||
224 | keycode 0x64 = KP_3 | ||
225 | alt keycode 0x64 = Ascii_3 | ||
226 | altgr keycode 0x64 = Hex_3 | ||
227 | keycode 0x6b = KP_0 | ||
228 | alt keycode 0x6b = Ascii_0 | ||
229 | altgr keycode 0x6b = Hex_0 | ||
230 | keycode 0x6c = KP_Period | ||
231 | # altgr control keycode 0x6c = Boot | ||
232 | control alt keycode 0x6c = Boot | ||
233 | keycode 0x65 = KP_Enter | ||
234 | |||
235 | keycode 0x3f = Control | ||
236 | |||
237 | # keycode 100 = AltGr | ||
238 | |||
239 | keycode 0x23 = Find | ||
240 | keycode 0x4d = Up | ||
241 | keycode 0x39 = Prior | ||
242 | shift keycode 0x39 = Scroll_Backward | ||
243 | keycode 0x5f = Left | ||
244 | alt keycode 0x5f = Decr_Console | ||
245 | keycode 0x61 = Right | ||
246 | alt keycode 0x61 = Incr_Console | ||
247 | keycode 0x38 = Select | ||
248 | keycode 0x60 = Down | ||
249 | keycode 0x3a = Next | ||
250 | shift keycode 0x3a = Scroll_Forward | ||
251 | keycode 0x24 = Insert | ||
252 | keycode 0x25 = Remove | ||
253 | # altgr control keycode 0x25 = Boot | ||
254 | control alt keycode 0x25 = Boot | ||
255 | |||
256 | keycode 0x0f = Help Show_Memory Show_Registers | ||
257 | control keycode 0x0f = Show_State | ||
258 | |||
259 | keycode 0x10 = Do | ||
260 | |||
261 | string F1 = "\033[[A" | ||
262 | string F2 = "\033[[B" | ||
263 | string F3 = "\033[[C" | ||
264 | string F4 = "\033[[D" | ||
265 | string F5 = "\033[[E" | ||
266 | string F6 = "\033[17~" | ||
267 | string F7 = "\033[18~" | ||
268 | string F8 = "\033[19~" | ||
269 | string F9 = "\033[20~" | ||
270 | string F10 = "\033[21~" | ||
271 | string F11 = "\033[23~" | ||
272 | string F12 = "\033[24~" | ||
273 | string F13 = "\033[25~" | ||
274 | string F14 = "\033[26~" | ||
275 | string F15 = "\033[28~" | ||
276 | string F16 = "\033[29~" | ||
277 | string F17 = "\033[31~" | ||
278 | string F18 = "\033[32~" | ||
279 | string F19 = "\033[33~" | ||
280 | string F20 = "\033[34~" | ||
281 | string Find = "\033[1~" | ||
282 | string Insert = "\033[2~" | ||
283 | string Remove = "\033[3~" | ||
284 | string Select = "\033[4~" | ||
285 | string Prior = "\033[5~" | ||
286 | string Next = "\033[6~" | ||
287 | string Macro = "\033[M" | ||
288 | string Pause = "\033[P" | ||
289 | compose '`' 'A' to 'À' | ||
290 | compose '`' 'a' to 'à' | ||
291 | compose '\'' 'A' to 'Á' | ||
292 | compose '\'' 'a' to 'á' | ||
293 | compose '^' 'A' to 'Â' | ||
294 | compose '^' 'a' to 'â' | ||
295 | compose '~' 'A' to 'Ã' | ||
296 | compose '~' 'a' to 'ã' | ||
297 | compose '"' 'A' to 'Ä' | ||
298 | compose '"' 'a' to 'ä' | ||
299 | compose 'O' 'A' to 'Å' | ||
300 | compose 'o' 'a' to 'å' | ||
301 | compose '0' 'A' to 'Å' | ||
302 | compose '0' 'a' to 'å' | ||
303 | compose 'A' 'A' to 'Å' | ||
304 | compose 'a' 'a' to 'å' | ||
305 | compose 'A' 'E' to 'Æ' | ||
306 | compose 'a' 'e' to 'æ' | ||
307 | compose ',' 'C' to 'Ç' | ||
308 | compose ',' 'c' to 'ç' | ||
309 | compose '`' 'E' to 'È' | ||
310 | compose '`' 'e' to 'è' | ||
311 | compose '\'' 'E' to 'É' | ||
312 | compose '\'' 'e' to 'é' | ||
313 | compose '^' 'E' to 'Ê' | ||
314 | compose '^' 'e' to 'ê' | ||
315 | compose '"' 'E' to 'Ë' | ||
316 | compose '"' 'e' to 'ë' | ||
317 | compose '`' 'I' to 'Ì' | ||
318 | compose '`' 'i' to 'ì' | ||
319 | compose '\'' 'I' to 'Í' | ||
320 | compose '\'' 'i' to 'í' | ||
321 | compose '^' 'I' to 'Î' | ||
322 | compose '^' 'i' to 'î' | ||
323 | compose '"' 'I' to 'Ï' | ||
324 | compose '"' 'i' to 'ï' | ||
325 | compose '-' 'D' to 'Ð' | ||
326 | compose '-' 'd' to 'ð' | ||
327 | compose '~' 'N' to 'Ñ' | ||
328 | compose '~' 'n' to 'ñ' | ||
329 | compose '`' 'O' to 'Ò' | ||
330 | compose '`' 'o' to 'ò' | ||
331 | compose '\'' 'O' to 'Ó' | ||
332 | compose '\'' 'o' to 'ó' | ||
333 | compose '^' 'O' to 'Ô' | ||
334 | compose '^' 'o' to 'ô' | ||
335 | compose '~' 'O' to 'Õ' | ||
336 | compose '~' 'o' to 'õ' | ||
337 | compose '"' 'O' to 'Ö' | ||
338 | compose '"' 'o' to 'ö' | ||
339 | compose '/' 'O' to 'Ø' | ||
340 | compose '/' 'o' to 'ø' | ||
341 | compose '`' 'U' to 'Ù' | ||
342 | compose '`' 'u' to 'ù' | ||
343 | compose '\'' 'U' to 'Ú' | ||
344 | compose '\'' 'u' to 'ú' | ||
345 | compose '^' 'U' to 'Û' | ||
346 | compose '^' 'u' to 'û' | ||
347 | compose '"' 'U' to 'Ü' | ||
348 | compose '"' 'u' to 'ü' | ||
349 | compose '\'' 'Y' to 'Ý' | ||
350 | compose '\'' 'y' to 'ý' | ||
351 | compose 'T' 'H' to 'Þ' | ||
352 | compose 't' 'h' to 'þ' | ||
353 | compose 's' 's' to 'ß' | ||
354 | compose '"' 'y' to 'ÿ' | ||
355 | compose 's' 'z' to 'ß' | ||
356 | compose 'i' 'j' to 'ÿ' | ||
diff --git a/drivers/tc/lk201-remap.c b/drivers/tc/lk201-remap.c deleted file mode 100644 index d39098c2720e..000000000000 --- a/drivers/tc/lk201-remap.c +++ /dev/null | |||
@@ -1,172 +0,0 @@ | |||
1 | /* | ||
2 | * Keyboard mappings for DEC LK201/401/501 keyboards | ||
3 | * | ||
4 | * 17.05.99 Michael Engel (engel@unix-ag.org) | ||
5 | * | ||
6 | * DEC US keyboards generate keycodes in the range 0x55 - 0xfb | ||
7 | * | ||
8 | * This conflicts with Linux scancode conventions which define | ||
9 | * 0x00-0x7f as "normal" and 0x80-0xff as "shifted" scancodes, so we | ||
10 | * have to remap the keycodes to 0x00-0x7f with the scancodeRemap | ||
11 | * array. The generated scancode is simply the number of the key counted | ||
12 | * from the left upper to the right lower corner of the keyboard ... | ||
13 | * | ||
14 | * These scancodes are then being remapped (I hope ;-)) with the | ||
15 | * lk501*map[] arrays which define scancode -> Linux code mapping | ||
16 | * | ||
17 | * Oh man is this horrible ;-) | ||
18 | * | ||
19 | * Scancodes with dual labels exist for keyboards as follows: | ||
20 | * | ||
21 | * code: left label / right label | ||
22 | * | ||
23 | * 0x73: LKx01, LK421 / LK443, LK444 | ||
24 | * 0x74: LKx01, LK421 / LK443, LK444 | ||
25 | * 0x7c: LKx01, LK421 / LK443, LK444 | ||
26 | * 0x8a: LKx01, LK421 / LK443, LK444 | ||
27 | * 0x8b: LKx01, LK421 / LK443, LK444 | ||
28 | * 0x8c: LKx01, LK421 / LK443, LK444 | ||
29 | * 0x8d: LKx01, LK421 / LK443, LK444 | ||
30 | * 0x8e: LKx01, LK421 / LK443, LK444 | ||
31 | * 0x8f: LKx01, LK421 / LK443, LK444 | ||
32 | * 0x9c: LKx01, LK421 / LK443, LK444 | ||
33 | * 0xa1: LKx01, LK421 / LK443, LK444 | ||
34 | * 0xa2: LKx01, LK421 / LK443, LK444 | ||
35 | * 0xa3: LKx01, LK421 / LK443, LK444 | ||
36 | * 0xa4: LKx01, LK421 / LK443, LK444 | ||
37 | * 0xad: LK421 / LK443, LK444 | ||
38 | * 0xc9: LKx01, LK421, LK443 / LK444 | ||
39 | * 0xf7: LKx01, LK443 / LK444 | ||
40 | */ | ||
41 | |||
42 | unsigned char scancodeRemap[256] = { | ||
43 | /* ----- */ | ||
44 | /* 0 */ 0, 0, 0, 0, | ||
45 | /* ----- */ | ||
46 | /* 4 */ 0, 0, 0, 0, | ||
47 | /* ----- */ | ||
48 | /* 8 */ 0, 0, 0, 0, | ||
49 | /* ----- */ | ||
50 | /* c */ 0, 0, 0, 0, | ||
51 | /* ----- */ | ||
52 | /* 10 */ 0, 0, 0, 0, | ||
53 | /* ----- */ | ||
54 | /* 14 */ 0, 0, 0, 0, | ||
55 | /* ----- */ | ||
56 | /* 18 */ 0, 0, 0, 0, | ||
57 | /* ----- */ | ||
58 | /* 1c */ 0, 0, 0, 0, | ||
59 | /* ----- */ | ||
60 | /* 20 */ 0, 0, 0, 0, | ||
61 | /* ----- */ | ||
62 | /* 24 */ 0, 0, 0, 0, | ||
63 | /* ----- */ | ||
64 | /* 28 */ 0, 0, 0, 0, | ||
65 | /* ----- */ | ||
66 | /* 2c */ 0, 0, 0, 0, | ||
67 | /* ----- */ | ||
68 | /* 30 */ 0, 0, 0, 0, | ||
69 | /* ----- */ | ||
70 | /* 34 */ 0, 0, 0, 0, | ||
71 | /* ----- */ | ||
72 | /* 38 */ 0, 0, 0, 0, | ||
73 | /* ----- */ | ||
74 | /* 3c */ 0, 0, 0, 0, | ||
75 | /* ----- */ | ||
76 | /* 40 */ 0, 0, 0, 0, | ||
77 | /* ----- */ | ||
78 | /* 44 */ 0, 0, 0, 0, | ||
79 | /* ----- */ | ||
80 | /* 48 */ 0, 0, 0, 0, | ||
81 | /* ----- */ | ||
82 | /* 4c */ 0, 0, 0, 0, | ||
83 | /* ----- */ | ||
84 | /* 50 */ 0, 0, 0, 0, | ||
85 | /* ----- ESC F1 F2 */ | ||
86 | /* 54 */ 0, 0, 0x01, 0x02, | ||
87 | /* ----- F3 F4 F5 */ | ||
88 | /* 58 */ 0x03, 0x04, 0x05, 0, | ||
89 | /* ----- */ | ||
90 | /* 5c */ 0, 0, 0, 0, | ||
91 | /* ----- */ | ||
92 | /* 60 */ 0, 0, 0, 0, | ||
93 | /* ----- F6 F7 F8 F9 */ | ||
94 | /* 64 */ 0x06, 0x07, 0x08, 0x09, | ||
95 | /* ----- F10 */ | ||
96 | /* 68 */ 0x0a, 0, 0, 0, | ||
97 | /* ----- */ | ||
98 | /* 6c */ 0, 0, 0, 0, | ||
99 | /* ----- F11 F12 F13/PRNT SCRN */ | ||
100 | /* 70 */ 0, 0x0b, 0x0c, 0x0d, | ||
101 | /* ----- F14/SCRL LCK */ | ||
102 | /* 74 */ 0x0e, 0, 0, 0, | ||
103 | /* ----- */ | ||
104 | /* 78 */ 0, 0, 0, 0, | ||
105 | /* ----- HELP/PAUSE DO */ | ||
106 | /* 7c */ 0x0f, 0x10, 0, 0, | ||
107 | /* ----- F17 F18 F19 F20 */ | ||
108 | /* 80 */ 0x11, 0x12, 0x13, 0x14, | ||
109 | /* ----- */ | ||
110 | /* 84 */ 0, 0, 0, 0, | ||
111 | /* ----- FIND/INSERT INSERT/HOME */ | ||
112 | /* 88 */ 0, 0, 0x23, 0x24, | ||
113 | /* ----- REMOVE/PG UP SELECT/DELETE PREVIOUS/END NEXT/PG DN */ | ||
114 | /* 8c */ 0x25, 0x38, 0x39, 0x3a, | ||
115 | /* ----- KP 0 */ | ||
116 | /* 90 */ 0, 0, 0x6b, 0, | ||
117 | /* ----- KP . KP ENTER KP 1 KP 2 */ | ||
118 | /* 94 */ 0x6c, 0x65, 0x62, 0x63, | ||
119 | /* ----- KP 3 KP 4 KP 5 KP 6 */ | ||
120 | /* 98 */ 0x64, 0x4e, 0x4f, 0x50, | ||
121 | /* ----- KP ,/KP + KP 7 KP 8 KP 9 */ | ||
122 | /* 9c */ 0x51, 0x3b, 0x3c, 0x3d, | ||
123 | /* ----- KP - KP F1/NUM LCK KP F2/KP / KP F3/KP * */ | ||
124 | /* a0 */ 0x3e, 0x26, 0x27, 0x28, | ||
125 | /* ----- KP F4/KP - LEFT */ | ||
126 | /* a4 */ 0x29, 0, 0, 0x5f, | ||
127 | /* ----- RIGHT DOWN UP SHIFT Rt */ | ||
128 | /* a8 */ 0x61, 0x60, 0x4d, 0x5e, | ||
129 | /* ----- ALT COMP Rt/CTRL Rt SHIFT CONTROL */ | ||
130 | /* ac */ 0, 0, 0x52, 0x3f, | ||
131 | /* ----- CAPS COMPOSE ALT Rt */ | ||
132 | /* b0 */ 0x40, 0x67, 0, 0, | ||
133 | /* ----- */ | ||
134 | /* b4 */ 0, 0, 0, 0, | ||
135 | /* ----- */ | ||
136 | /* b8 */ 0, 0, 0, 0, | ||
137 | /* ----- BKSP RET TAB ` */ | ||
138 | /* bc */ 0x22, 0x37, 0x2a, 0x15, | ||
139 | /* ----- 1 q a z */ | ||
140 | /* c0 */ 0x16, 0x2b, 0x41, 0x54, | ||
141 | /* ----- 2 w s */ | ||
142 | /* c4 */ 0, 0x17, 0x2c, 0x42, | ||
143 | /* ----- x </\\ 3 */ | ||
144 | /* c8 */ 0x55, 0x53, 0, 0x18, | ||
145 | /* ----- e d c */ | ||
146 | /* cc */ 0x2d, 0x43, 0x56, 0, | ||
147 | /* ----- 4 r f v */ | ||
148 | /* d0 */ 0x19, 0x2e, 0x44, 0x57, | ||
149 | /* ----- SPACE 5 t */ | ||
150 | /* d4 */ 0x68, 0, 0x1a, 0x2f, | ||
151 | /* ----- g b 6 */ | ||
152 | /* d8 */ 0x45, 0x58, 0, 0x1b, | ||
153 | /* ----- y h n */ | ||
154 | /* dc */ 0x30, 0x46, 0x59, 0, | ||
155 | /* ----- 7 u j m */ | ||
156 | /* e0 */ 0x1c, 0x31, 0x47, 0x5a, | ||
157 | /* ----- 8 i k */ | ||
158 | /* e4 */ 0, 0x1d, 0x32, 0x48, | ||
159 | /* ----- , 9 o */ | ||
160 | /* e8 */ 0x5b, 0, 0x1e, 0x33, | ||
161 | /* ----- l . 0 */ | ||
162 | /* ec */ 0x49, 0x5c, 0, 0x1f, | ||
163 | /* ----- p ; / */ | ||
164 | /* f0 */ 0x34, 0, 0x4a, 0x5d, | ||
165 | /* ----- = ] \\/\' */ | ||
166 | /* f4 */ 0, 0x21, 0x36, 0x4c, | ||
167 | /* ----- - [ \' */ | ||
168 | /* f8 */ 0, 0x20, 0x35, 0x4b, | ||
169 | /* ----- */ | ||
170 | /* fc */ 0, 0, 0, 0, | ||
171 | }; | ||
172 | |||
diff --git a/drivers/tc/lk201.c b/drivers/tc/lk201.c deleted file mode 100644 index a90c255f079d..000000000000 --- a/drivers/tc/lk201.c +++ /dev/null | |||
@@ -1,439 +0,0 @@ | |||
1 | /* | ||
2 | * | ||
3 | * This file is subject to the terms and conditions of the GNU General Public | ||
4 | * License. See the file "COPYING" in the main directory of this archive | ||
5 | * for more details. | ||
6 | * | ||
7 | * Copyright (C) 1999-2002 Harald Koerfgen <hkoerfg@web.de> | ||
8 | * Copyright (C) 2001, 2002, 2003, 2004 Maciej W. Rozycki | ||
9 | */ | ||
10 | |||
11 | |||
12 | #include <linux/errno.h> | ||
13 | #include <linux/tty.h> | ||
14 | #include <linux/kernel.h> | ||
15 | #include <linux/init.h> | ||
16 | #include <linux/delay.h> | ||
17 | #include <linux/kbd_ll.h> | ||
18 | #include <linux/kbd_kern.h> | ||
19 | #include <linux/vt_kern.h> | ||
20 | |||
21 | #include <asm/keyboard.h> | ||
22 | #include <asm/dec/tc.h> | ||
23 | #include <asm/dec/machtype.h> | ||
24 | #include <asm/dec/serial.h> | ||
25 | |||
26 | #include "lk201.h" | ||
27 | |||
28 | /* | ||
29 | * Only handle DECstations that have an LK201 interface. | ||
30 | * Maxine uses LK501 at the Access.Bus and various DECsystems | ||
31 | * have no keyboard interface at all. | ||
32 | */ | ||
33 | #define LK_IFACE (mips_machtype == MACH_DS23100 || \ | ||
34 | mips_machtype == MACH_DS5000_200 || \ | ||
35 | mips_machtype == MACH_DS5000_1XX || \ | ||
36 | mips_machtype == MACH_DS5000_2X0) | ||
37 | /* | ||
38 | * These use the Z8530 SCC. Others use the DZ11. | ||
39 | */ | ||
40 | #define LK_IFACE_ZS (mips_machtype == MACH_DS5000_1XX || \ | ||
41 | mips_machtype == MACH_DS5000_2X0) | ||
42 | |||
43 | /* Simple translation table for the SysRq keys */ | ||
44 | |||
45 | #ifdef CONFIG_MAGIC_SYSRQ | ||
46 | /* | ||
47 | * Actually no translation at all, at least until we figure out | ||
48 | * how to define SysRq for LK201 and friends. --macro | ||
49 | */ | ||
50 | unsigned char lk201_sysrq_xlate[128]; | ||
51 | unsigned char *kbd_sysrq_xlate = lk201_sysrq_xlate; | ||
52 | |||
53 | unsigned char kbd_sysrq_key = -1; | ||
54 | #endif | ||
55 | |||
56 | #define KEYB_LINE 3 | ||
57 | |||
58 | static int __init lk201_init(void *); | ||
59 | static void __init lk201_info(void *); | ||
60 | static void lk201_rx_char(unsigned char, unsigned char); | ||
61 | |||
62 | static struct dec_serial_hook lk201_hook = { | ||
63 | .init_channel = lk201_init, | ||
64 | .init_info = lk201_info, | ||
65 | .rx_char = NULL, | ||
66 | .poll_rx_char = NULL, | ||
67 | .poll_tx_char = NULL, | ||
68 | .cflags = B4800 | CS8 | CSTOPB | CLOCAL, | ||
69 | }; | ||
70 | |||
71 | /* | ||
72 | * This is used during keyboard initialisation | ||
73 | */ | ||
74 | static unsigned char lk201_reset_string[] = { | ||
75 | LK_CMD_SET_DEFAULTS, | ||
76 | LK_CMD_MODE(LK_MODE_RPT_DOWN, 1), | ||
77 | LK_CMD_MODE(LK_MODE_RPT_DOWN, 2), | ||
78 | LK_CMD_MODE(LK_MODE_RPT_DOWN, 3), | ||
79 | LK_CMD_MODE(LK_MODE_RPT_DOWN, 4), | ||
80 | LK_CMD_MODE(LK_MODE_DOWN_UP, 5), | ||
81 | LK_CMD_MODE(LK_MODE_DOWN_UP, 6), | ||
82 | LK_CMD_MODE(LK_MODE_RPT_DOWN, 7), | ||
83 | LK_CMD_MODE(LK_MODE_RPT_DOWN, 8), | ||
84 | LK_CMD_MODE(LK_MODE_RPT_DOWN, 9), | ||
85 | LK_CMD_MODE(LK_MODE_RPT_DOWN, 10), | ||
86 | LK_CMD_MODE(LK_MODE_RPT_DOWN, 11), | ||
87 | LK_CMD_MODE(LK_MODE_RPT_DOWN, 12), | ||
88 | LK_CMD_MODE(LK_MODE_DOWN, 13), | ||
89 | LK_CMD_MODE(LK_MODE_RPT_DOWN, 14), | ||
90 | LK_CMD_DIS_KEYCLK, | ||
91 | LK_CMD_ENB_BELL, LK_PARAM_VOLUME(4), | ||
92 | }; | ||
93 | |||
94 | static void *lk201_handle; | ||
95 | |||
96 | static int lk201_send(unsigned char ch) | ||
97 | { | ||
98 | if (lk201_hook.poll_tx_char(lk201_handle, ch)) { | ||
99 | printk(KERN_ERR "lk201: transmit timeout\n"); | ||
100 | return -EIO; | ||
101 | } | ||
102 | return 0; | ||
103 | } | ||
104 | |||
105 | static inline int lk201_get_id(void) | ||
106 | { | ||
107 | return lk201_send(LK_CMD_REQ_ID); | ||
108 | } | ||
109 | |||
110 | static int lk201_reset(void) | ||
111 | { | ||
112 | int i, r; | ||
113 | |||
114 | for (i = 0; i < sizeof(lk201_reset_string); i++) { | ||
115 | r = lk201_send(lk201_reset_string[i]); | ||
116 | if (r < 0) | ||
117 | return r; | ||
118 | } | ||
119 | return 0; | ||
120 | } | ||
121 | |||
122 | static void lk201_report(unsigned char id[6]) | ||
123 | { | ||
124 | char *report = "lk201: keyboard attached, "; | ||
125 | |||
126 | switch (id[2]) { | ||
127 | case LK_STAT_PWRUP_OK: | ||
128 | printk(KERN_INFO "%sself-test OK\n", report); | ||
129 | break; | ||
130 | case LK_STAT_PWRUP_KDOWN: | ||
131 | /* The keyboard will resend the power-up ID | ||
132 | after all keys are released, so we don't | ||
133 | bother handling the error specially. Still | ||
134 | there may be a short-circuit inside. | ||
135 | */ | ||
136 | printk(KERN_ERR "%skey down (stuck?), code: 0x%02x\n", | ||
137 | report, id[3]); | ||
138 | break; | ||
139 | case LK_STAT_PWRUP_ERROR: | ||
140 | printk(KERN_ERR "%sself-test failure\n", report); | ||
141 | break; | ||
142 | default: | ||
143 | printk(KERN_ERR "%sunknown error: 0x%02x\n", | ||
144 | report, id[2]); | ||
145 | } | ||
146 | } | ||
147 | |||
148 | static void lk201_id(unsigned char id[6]) | ||
149 | { | ||
150 | /* | ||
151 | * Report whether there is an LK201 or an LK401 | ||
152 | * The LK401 has ALT keys... | ||
153 | */ | ||
154 | switch (id[4]) { | ||
155 | case 1: | ||
156 | printk(KERN_INFO "lk201: LK201 detected\n"); | ||
157 | break; | ||
158 | case 2: | ||
159 | printk(KERN_INFO "lk201: LK401 detected\n"); | ||
160 | break; | ||
161 | case 3: | ||
162 | printk(KERN_INFO "lk201: LK443 detected\n"); | ||
163 | break; | ||
164 | case 4: | ||
165 | printk(KERN_INFO "lk201: LK421 detected\n"); | ||
166 | break; | ||
167 | default: | ||
168 | printk(KERN_WARNING | ||
169 | "lk201: unknown keyboard detected, ID %d\n", id[4]); | ||
170 | printk(KERN_WARNING "lk201: ... please report to " | ||
171 | "<linux-mips@linux-mips.org>\n"); | ||
172 | } | ||
173 | } | ||
174 | |||
175 | #define DEFAULT_KEYB_REP_DELAY (250/5) /* [5ms] */ | ||
176 | #define DEFAULT_KEYB_REP_RATE 30 /* [cps] */ | ||
177 | |||
178 | static struct kbd_repeat kbdrate = { | ||
179 | DEFAULT_KEYB_REP_DELAY, | ||
180 | DEFAULT_KEYB_REP_RATE | ||
181 | }; | ||
182 | |||
183 | static void parse_kbd_rate(struct kbd_repeat *r) | ||
184 | { | ||
185 | if (r->delay <= 0) | ||
186 | r->delay = kbdrate.delay; | ||
187 | if (r->rate <= 0) | ||
188 | r->rate = kbdrate.rate; | ||
189 | |||
190 | if (r->delay < 5) | ||
191 | r->delay = 5; | ||
192 | if (r->delay > 630) | ||
193 | r->delay = 630; | ||
194 | if (r->rate < 12) | ||
195 | r->rate = 12; | ||
196 | if (r->rate > 127) | ||
197 | r->rate = 127; | ||
198 | if (r->rate == 125) | ||
199 | r->rate = 124; | ||
200 | } | ||
201 | |||
202 | static int write_kbd_rate(struct kbd_repeat *rep) | ||
203 | { | ||
204 | int delay, rate; | ||
205 | int i; | ||
206 | |||
207 | delay = rep->delay / 5; | ||
208 | rate = rep->rate; | ||
209 | for (i = 0; i < 4; i++) { | ||
210 | if (lk201_hook.poll_tx_char(lk201_handle, | ||
211 | LK_CMD_RPT_RATE(i))) | ||
212 | return 1; | ||
213 | if (lk201_hook.poll_tx_char(lk201_handle, | ||
214 | LK_PARAM_DELAY(delay))) | ||
215 | return 1; | ||
216 | if (lk201_hook.poll_tx_char(lk201_handle, | ||
217 | LK_PARAM_RATE(rate))) | ||
218 | return 1; | ||
219 | } | ||
220 | return 0; | ||
221 | } | ||
222 | |||
223 | static int lk201_kbd_rate(struct kbd_repeat *rep) | ||
224 | { | ||
225 | if (rep == NULL) | ||
226 | return -EINVAL; | ||
227 | |||
228 | parse_kbd_rate(rep); | ||
229 | |||
230 | if (write_kbd_rate(rep)) { | ||
231 | memcpy(rep, &kbdrate, sizeof(struct kbd_repeat)); | ||
232 | return -EIO; | ||
233 | } | ||
234 | |||
235 | memcpy(&kbdrate, rep, sizeof(struct kbd_repeat)); | ||
236 | |||
237 | return 0; | ||
238 | } | ||
239 | |||
240 | static void lk201_kd_mksound(unsigned int hz, unsigned int ticks) | ||
241 | { | ||
242 | if (!ticks) | ||
243 | return; | ||
244 | |||
245 | /* | ||
246 | * Can't set frequency and we "approximate" | ||
247 | * duration by volume. ;-) | ||
248 | */ | ||
249 | ticks /= HZ / 32; | ||
250 | if (ticks > 7) | ||
251 | ticks = 7; | ||
252 | ticks = 7 - ticks; | ||
253 | |||
254 | if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_ENB_BELL)) | ||
255 | return; | ||
256 | if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_VOLUME(ticks))) | ||
257 | return; | ||
258 | if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_BELL)) | ||
259 | return; | ||
260 | } | ||
261 | |||
262 | void kbd_leds(unsigned char leds) | ||
263 | { | ||
264 | unsigned char l = 0; | ||
265 | |||
266 | if (!lk201_handle) /* FIXME */ | ||
267 | return; | ||
268 | |||
269 | /* FIXME -- Only Hold and Lock LEDs for now. --macro */ | ||
270 | if (leds & LED_SCR) | ||
271 | l |= LK_LED_HOLD; | ||
272 | if (leds & LED_CAP) | ||
273 | l |= LK_LED_LOCK; | ||
274 | |||
275 | if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_LEDS_ON)) | ||
276 | return; | ||
277 | if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_LED_MASK(l))) | ||
278 | return; | ||
279 | if (lk201_hook.poll_tx_char(lk201_handle, LK_CMD_LEDS_OFF)) | ||
280 | return; | ||
281 | if (lk201_hook.poll_tx_char(lk201_handle, LK_PARAM_LED_MASK(~l))) | ||
282 | return; | ||
283 | } | ||
284 | |||
285 | int kbd_setkeycode(unsigned int scancode, unsigned int keycode) | ||
286 | { | ||
287 | return -EINVAL; | ||
288 | } | ||
289 | |||
290 | int kbd_getkeycode(unsigned int scancode) | ||
291 | { | ||
292 | return -EINVAL; | ||
293 | } | ||
294 | |||
295 | int kbd_translate(unsigned char scancode, unsigned char *keycode, | ||
296 | char raw_mode) | ||
297 | { | ||
298 | *keycode = scancode; | ||
299 | return 1; | ||
300 | } | ||
301 | |||
302 | char kbd_unexpected_up(unsigned char keycode) | ||
303 | { | ||
304 | return 0x80; | ||
305 | } | ||
306 | |||
307 | static void lk201_rx_char(unsigned char ch, unsigned char fl) | ||
308 | { | ||
309 | static unsigned char id[6]; | ||
310 | static int id_i; | ||
311 | |||
312 | static int shift_state = 0; | ||
313 | static int prev_scancode; | ||
314 | unsigned char c = scancodeRemap[ch]; | ||
315 | |||
316 | if (fl != TTY_NORMAL && fl != TTY_OVERRUN) { | ||
317 | printk(KERN_ERR "lk201: keyboard receive error: 0x%02x\n", fl); | ||
318 | return; | ||
319 | } | ||
320 | |||
321 | /* Assume this is a power-up ID. */ | ||
322 | if (ch == LK_STAT_PWRUP_ID && !id_i) { | ||
323 | id[id_i++] = ch; | ||
324 | return; | ||
325 | } | ||
326 | |||
327 | /* Handle the power-up sequence. */ | ||
328 | if (id_i) { | ||
329 | id[id_i++] = ch; | ||
330 | if (id_i == 4) { | ||
331 | /* OK, the power-up concluded. */ | ||
332 | lk201_report(id); | ||
333 | if (id[2] == LK_STAT_PWRUP_OK) | ||
334 | lk201_get_id(); | ||
335 | else { | ||
336 | id_i = 0; | ||
337 | printk(KERN_ERR "lk201: keyboard power-up " | ||
338 | "error, skipping initialization\n"); | ||
339 | } | ||
340 | } else if (id_i == 6) { | ||
341 | /* We got the ID; report it and start operation. */ | ||
342 | id_i = 0; | ||
343 | lk201_id(id); | ||
344 | lk201_reset(); | ||
345 | } | ||
346 | return; | ||
347 | } | ||
348 | |||
349 | /* Everything else is a scancode/status response. */ | ||
350 | id_i = 0; | ||
351 | switch (ch) { | ||
352 | case LK_STAT_RESUME_ERR: | ||
353 | case LK_STAT_ERROR: | ||
354 | case LK_STAT_INHIBIT_ACK: | ||
355 | case LK_STAT_TEST_ACK: | ||
356 | case LK_STAT_MODE_KEYDOWN: | ||
357 | case LK_STAT_MODE_ACK: | ||
358 | break; | ||
359 | case LK_KEY_LOCK: | ||
360 | shift_state ^= LK_LOCK; | ||
361 | handle_scancode(c, (shift_state & LK_LOCK) ? 1 : 0); | ||
362 | break; | ||
363 | case LK_KEY_SHIFT: | ||
364 | shift_state ^= LK_SHIFT; | ||
365 | handle_scancode(c, (shift_state & LK_SHIFT) ? 1 : 0); | ||
366 | break; | ||
367 | case LK_KEY_CTRL: | ||
368 | shift_state ^= LK_CTRL; | ||
369 | handle_scancode(c, (shift_state & LK_CTRL) ? 1 : 0); | ||
370 | break; | ||
371 | case LK_KEY_COMP: | ||
372 | shift_state ^= LK_COMP; | ||
373 | handle_scancode(c, (shift_state & LK_COMP) ? 1 : 0); | ||
374 | break; | ||
375 | case LK_KEY_RELEASE: | ||
376 | if (shift_state & LK_SHIFT) | ||
377 | handle_scancode(scancodeRemap[LK_KEY_SHIFT], 0); | ||
378 | if (shift_state & LK_CTRL) | ||
379 | handle_scancode(scancodeRemap[LK_KEY_CTRL], 0); | ||
380 | if (shift_state & LK_COMP) | ||
381 | handle_scancode(scancodeRemap[LK_KEY_COMP], 0); | ||
382 | if (shift_state & LK_LOCK) | ||
383 | handle_scancode(scancodeRemap[LK_KEY_LOCK], 0); | ||
384 | shift_state = 0; | ||
385 | break; | ||
386 | case LK_KEY_REPEAT: | ||
387 | handle_scancode(prev_scancode, 1); | ||
388 | break; | ||
389 | default: | ||
390 | prev_scancode = c; | ||
391 | handle_scancode(c, 1); | ||
392 | break; | ||
393 | } | ||
394 | tasklet_schedule(&keyboard_tasklet); | ||
395 | } | ||
396 | |||
397 | static void __init lk201_info(void *handle) | ||
398 | { | ||
399 | } | ||
400 | |||
401 | static int __init lk201_init(void *handle) | ||
402 | { | ||
403 | /* First install handlers. */ | ||
404 | lk201_handle = handle; | ||
405 | kbd_rate = lk201_kbd_rate; | ||
406 | kd_mksound = lk201_kd_mksound; | ||
407 | |||
408 | lk201_hook.rx_char = lk201_rx_char; | ||
409 | |||
410 | /* Then just issue a reset -- the handlers will do the rest. */ | ||
411 | lk201_send(LK_CMD_POWER_UP); | ||
412 | |||
413 | return 0; | ||
414 | } | ||
415 | |||
416 | void __init kbd_init_hw(void) | ||
417 | { | ||
418 | /* Maxine uses LK501 at the Access.Bus. */ | ||
419 | if (!LK_IFACE) | ||
420 | return; | ||
421 | |||
422 | printk(KERN_INFO "lk201: DECstation LK keyboard driver v0.05.\n"); | ||
423 | |||
424 | if (LK_IFACE_ZS) { | ||
425 | /* | ||
426 | * kbd_init_hw() is being called before | ||
427 | * rs_init() so just register the kbd hook | ||
428 | * and let zs_init do the rest :-) | ||
429 | */ | ||
430 | if (!register_dec_serial_hook(KEYB_LINE, &lk201_hook)) | ||
431 | unregister_dec_serial_hook(KEYB_LINE); | ||
432 | } else { | ||
433 | /* | ||
434 | * TODO: modify dz.c to allow similar hooks | ||
435 | * for LK201 handling on DS2100, DS3100, and DS5000/200 | ||
436 | */ | ||
437 | printk(KERN_ERR "lk201: support for DZ11 not yet ready.\n"); | ||
438 | } | ||
439 | } | ||
diff --git a/drivers/tc/lk201.h b/drivers/tc/lk201.h deleted file mode 100644 index 99f3203c41b8..000000000000 --- a/drivers/tc/lk201.h +++ /dev/null | |||
@@ -1,125 +0,0 @@ | |||
1 | /* | ||
2 | * Commands to the keyboard processor | ||
3 | */ | ||
4 | |||
5 | #define LK_PARAM 0x80 /* start/end parameter list */ | ||
6 | |||
7 | #define LK_CMD_RESUME 0x8b /* resume transmission to the host */ | ||
8 | #define LK_CMD_INHIBIT 0x89 /* stop transmission to the host */ | ||
9 | #define LK_CMD_LEDS_ON 0x13 /* light LEDs */ | ||
10 | /* 1st param: led bitmask */ | ||
11 | #define LK_CMD_LEDS_OFF 0x11 /* turn off LEDs */ | ||
12 | /* 1st param: led bitmask */ | ||
13 | #define LK_CMD_DIS_KEYCLK 0x99 /* disable the keyclick */ | ||
14 | #define LK_CMD_ENB_KEYCLK 0x1b /* enable the keyclick */ | ||
15 | /* 1st param: volume */ | ||
16 | #define LK_CMD_DIS_CTLCLK 0xb9 /* disable the Ctrl keyclick */ | ||
17 | #define LK_CMD_ENB_CTLCLK 0xbb /* enable the Ctrl keyclick */ | ||
18 | #define LK_CMD_SOUND_CLK 0x9f /* emit a keyclick */ | ||
19 | #define LK_CMD_DIS_BELL 0xa1 /* disable the bell */ | ||
20 | #define LK_CMD_ENB_BELL 0x23 /* enable the bell */ | ||
21 | /* 1st param: volume */ | ||
22 | #define LK_CMD_BELL 0xa7 /* emit a bell */ | ||
23 | #define LK_CMD_TMP_NORPT 0xd1 /* disable typematic */ | ||
24 | /* for the currently pressed key */ | ||
25 | #define LK_CMD_ENB_RPT 0xe3 /* enable typematic */ | ||
26 | /* for RPT_DOWN groups */ | ||
27 | #define LK_CMD_DIS_RPT 0xe1 /* disable typematic */ | ||
28 | /* for RPT_DOWN groups */ | ||
29 | #define LK_CMD_RPT_TO_DOWN 0xd9 /* set RPT_DOWN groups to DOWN */ | ||
30 | #define LK_CMD_REQ_ID 0xab /* request the keyboard ID */ | ||
31 | #define LK_CMD_POWER_UP 0xfd /* init power-up sequence */ | ||
32 | #define LK_CMD_TEST_MODE 0xcb /* enter the factory test mode */ | ||
33 | #define LK_CMD_TEST_EXIT 0x80 /* exit the factory test mode */ | ||
34 | #define LK_CMD_SET_DEFAULTS 0xd3 /* set power-up defaults */ | ||
35 | |||
36 | #define LK_CMD_MODE(m,div) (LK_PARAM|(((div)&0xf)<<3)|(((m)&0x3)<<1)) | ||
37 | /* select the repeat mode */ | ||
38 | /* for the selected key group */ | ||
39 | #define LK_CMD_MODE_AR(m,div) ((((div)&0xf)<<3)|(((m)&0x3)<<1)) | ||
40 | /* select the repeat mode */ | ||
41 | /* and the repeat register */ | ||
42 | /* for the selected key group */ | ||
43 | /* 1st param: register number */ | ||
44 | #define LK_CMD_RPT_RATE(r) (0x78|(((r)&0x3)<<1)) | ||
45 | /* set the delay and repeat rate */ | ||
46 | /* for the selected repeat register */ | ||
47 | /* 1st param: initial delay */ | ||
48 | /* 2nd param: repeat rate */ | ||
49 | |||
50 | /* there are 4 leds, represent them in the low 4 bits of a byte */ | ||
51 | #define LK_PARAM_LED_MASK(ledbmap) (LK_PARAM|((ledbmap)&0xf)) | ||
52 | #define LK_LED_WAIT 0x1 /* Wait LED */ | ||
53 | #define LK_LED_COMP 0x2 /* Compose LED */ | ||
54 | #define LK_LED_LOCK 0x4 /* Lock LED */ | ||
55 | #define LK_LED_HOLD 0x8 /* Hold Screen LED */ | ||
56 | |||
57 | /* max volume is 0, lowest is 0x7 */ | ||
58 | #define LK_PARAM_VOLUME(v) (LK_PARAM|((v)&0x7)) | ||
59 | |||
60 | /* mode set command details, div is a key group number */ | ||
61 | #define LK_MODE_DOWN 0x0 /* make only */ | ||
62 | #define LK_MODE_RPT_DOWN 0x1 /* make and typematic */ | ||
63 | #define LK_MODE_DOWN_UP 0x3 /* make and release */ | ||
64 | |||
65 | /* there are 4 repeat registers */ | ||
66 | #define LK_PARAM_AR(r) (LK_PARAM|((v)&0x3)) | ||
67 | |||
68 | /* | ||
69 | * Mappings between key groups and keycodes are as follows: | ||
70 | * | ||
71 | * 1: 0xbf - 0xff -- alphanumeric, | ||
72 | * 2: 0x91 - 0xa5 -- numeric keypad, | ||
73 | * 3: 0xbc -- Backspace, | ||
74 | * 4: 0xbd - 0xbe -- Tab, Return, | ||
75 | * 5: 0xb0 - 0xb2 -- Lock, Compose Character, | ||
76 | * 6: 0xad - 0xaf -- Ctrl, Shift, | ||
77 | * 7: 0xa6 - 0xa8 -- Left Arrow, Right Arrow, | ||
78 | * 8: 0xa9 - 0xac -- Up Arrow, Down Arrow, Right Shift, | ||
79 | * 9: 0x88 - 0x90 -- editor keypad, | ||
80 | * 10: 0x56 - 0x62 -- F1 - F5, | ||
81 | * 11: 0x63 - 0x6e -- F6 - F10, | ||
82 | * 12: 0x6f - 0x7a -- F11 - F14, | ||
83 | * 13: 0x7b - 0x7d -- Help, Do, | ||
84 | * 14: 0x7e - 0x87 -- F17 - F20. | ||
85 | * | ||
86 | * Notes: | ||
87 | * 1. Codes in the 0x00 - 0x40 range are reserved. | ||
88 | * 2. The assignment of the 0x41 - 0x55 range is undiscovered, probably 10. | ||
89 | */ | ||
90 | |||
91 | /* delay is 5 - 630 ms; 0x00 and 0x7f are reserved */ | ||
92 | #define LK_PARAM_DELAY(t) ((t)&0x7f) | ||
93 | |||
94 | /* rate is 12 - 127 Hz; 0x00 - 0x0b and 0x7d (power-up!) are reserved */ | ||
95 | #define LK_PARAM_RATE(r) (LK_PARAM|((r)&0x7f)) | ||
96 | |||
97 | #define LK_SHIFT 1<<0 | ||
98 | #define LK_CTRL 1<<1 | ||
99 | #define LK_LOCK 1<<2 | ||
100 | #define LK_COMP 1<<3 | ||
101 | |||
102 | #define LK_KEY_SHIFT 0xae | ||
103 | #define LK_KEY_CTRL 0xaf | ||
104 | #define LK_KEY_LOCK 0xb0 | ||
105 | #define LK_KEY_COMP 0xb1 | ||
106 | |||
107 | #define LK_KEY_RELEASE 0xb3 /* all keys released */ | ||
108 | #define LK_KEY_REPEAT 0xb4 /* repeat the last key */ | ||
109 | |||
110 | /* status responses */ | ||
111 | #define LK_STAT_RESUME_ERR 0xb5 /* keystrokes lost while inhibited */ | ||
112 | #define LK_STAT_ERROR 0xb6 /* an invalid command received */ | ||
113 | #define LK_STAT_INHIBIT_ACK 0xb7 /* transmission inhibited */ | ||
114 | #define LK_STAT_TEST_ACK 0xb8 /* the factory test mode entered */ | ||
115 | #define LK_STAT_MODE_KEYDOWN 0xb9 /* a key is down on a change */ | ||
116 | /* to the DOWN_UP mode; */ | ||
117 | /* the keycode follows */ | ||
118 | #define LK_STAT_MODE_ACK 0xba /* the mode command succeeded */ | ||
119 | |||
120 | #define LK_STAT_PWRUP_ID 0x01 /* the power-up response start mark */ | ||
121 | #define LK_STAT_PWRUP_OK 0x00 /* the power-up self test OK */ | ||
122 | #define LK_STAT_PWRUP_KDOWN 0x3d /* a key was down during the test */ | ||
123 | #define LK_STAT_PWRUP_ERROR 0x3e /* keyboard self test failure */ | ||
124 | |||
125 | extern unsigned char scancodeRemap[256]; | ||
diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c index c99938d5f78e..69aa68287d3f 100644 --- a/drivers/usb/core/usb.c +++ b/drivers/usb/core/usb.c | |||
@@ -982,7 +982,6 @@ EXPORT_SYMBOL(usb_altnum_to_altsetting); | |||
982 | 982 | ||
983 | EXPORT_SYMBOL(__usb_get_extra_descriptor); | 983 | EXPORT_SYMBOL(__usb_get_extra_descriptor); |
984 | 984 | ||
985 | EXPORT_SYMBOL(usb_find_device); | ||
986 | EXPORT_SYMBOL(usb_get_current_frame_number); | 985 | EXPORT_SYMBOL(usb_get_current_frame_number); |
987 | 986 | ||
988 | EXPORT_SYMBOL(usb_buffer_alloc); | 987 | EXPORT_SYMBOL(usb_buffer_alloc); |
diff --git a/drivers/usb/mon/mon_text.c b/drivers/usb/mon/mon_text.c index ebb04ac4857b..5e3e4e9b6c77 100644 --- a/drivers/usb/mon/mon_text.c +++ b/drivers/usb/mon/mon_text.c | |||
@@ -87,7 +87,7 @@ struct mon_reader_text { | |||
87 | 87 | ||
88 | static struct dentry *mon_dir; /* Usually /sys/kernel/debug/usbmon */ | 88 | static struct dentry *mon_dir; /* Usually /sys/kernel/debug/usbmon */ |
89 | 89 | ||
90 | static void mon_text_ctor(void *, struct kmem_cache *, unsigned long); | 90 | static void mon_text_ctor(struct kmem_cache *, void *); |
91 | 91 | ||
92 | struct mon_text_ptr { | 92 | struct mon_text_ptr { |
93 | int cnt, limit; | 93 | int cnt, limit; |
@@ -720,7 +720,7 @@ void mon_text_del(struct mon_bus *mbus) | |||
720 | /* | 720 | /* |
721 | * Slab interface: constructor. | 721 | * Slab interface: constructor. |
722 | */ | 722 | */ |
723 | static void mon_text_ctor(void *mem, struct kmem_cache *slab, unsigned long sflags) | 723 | static void mon_text_ctor(struct kmem_cache *slab, void *mem) |
724 | { | 724 | { |
725 | /* | 725 | /* |
726 | * Nothing to initialize. No, really! | 726 | * Nothing to initialize. No, really! |
diff --git a/drivers/usb/storage/libusual.c b/drivers/usb/storage/libusual.c index 06d1107dbd47..55b952084f0c 100644 --- a/drivers/usb/storage/libusual.c +++ b/drivers/usb/storage/libusual.c | |||
@@ -30,7 +30,7 @@ static atomic_t usu_bias = ATOMIC_INIT(USB_US_DEFAULT_BIAS); | |||
30 | #define BIAS_NAME_SIZE (sizeof("usb-storage")) | 30 | #define BIAS_NAME_SIZE (sizeof("usb-storage")) |
31 | static const char *bias_names[3] = { "none", "usb-storage", "ub" }; | 31 | static const char *bias_names[3] = { "none", "usb-storage", "ub" }; |
32 | 32 | ||
33 | static DECLARE_MUTEX_LOCKED(usu_init_notify); | 33 | static struct semaphore usu_init_notify; |
34 | static DECLARE_COMPLETION(usu_end_notify); | 34 | static DECLARE_COMPLETION(usu_end_notify); |
35 | static atomic_t total_threads = ATOMIC_INIT(0); | 35 | static atomic_t total_threads = ATOMIC_INIT(0); |
36 | 36 | ||
@@ -204,6 +204,8 @@ static int __init usb_usual_init(void) | |||
204 | { | 204 | { |
205 | int rc; | 205 | int rc; |
206 | 206 | ||
207 | sema_init(&usu_init_notify, 0); | ||
208 | |||
207 | rc = usb_register(&usu_driver); | 209 | rc = usb_register(&usu_driver); |
208 | up(&usu_init_notify); | 210 | up(&usu_init_notify); |
209 | return rc; | 211 | return rc; |
diff --git a/drivers/video/console/dummycon.c b/drivers/video/console/dummycon.c index d9315d99445f..b63860f7beab 100644 --- a/drivers/video/console/dummycon.c +++ b/drivers/video/console/dummycon.c | |||
@@ -18,8 +18,8 @@ | |||
18 | */ | 18 | */ |
19 | 19 | ||
20 | #if defined(__arm__) | 20 | #if defined(__arm__) |
21 | #define DUMMY_COLUMNS ORIG_VIDEO_COLS | 21 | #define DUMMY_COLUMNS screen_info.orig_video_cols |
22 | #define DUMMY_ROWS ORIG_VIDEO_LINES | 22 | #define DUMMY_ROWS screen_info.orig_video_lines |
23 | #elif defined(__hppa__) | 23 | #elif defined(__hppa__) |
24 | /* set by Kconfig. Use 80x25 for 640x480 and 160x64 for 1280x1024 */ | 24 | /* set by Kconfig. Use 80x25 for 640x480 and 160x64 for 1280x1024 */ |
25 | #define DUMMY_COLUMNS CONFIG_DUMMY_CONSOLE_COLUMNS | 25 | #define DUMMY_COLUMNS CONFIG_DUMMY_CONSOLE_COLUMNS |
diff --git a/drivers/video/console/vgacon.c b/drivers/video/console/vgacon.c index e9afb7ebd566..f65bcd314d54 100644 --- a/drivers/video/console/vgacon.c +++ b/drivers/video/console/vgacon.c | |||
@@ -362,7 +362,7 @@ static const char *vgacon_startup(void) | |||
362 | u16 saved1, saved2; | 362 | u16 saved1, saved2; |
363 | volatile u16 *p; | 363 | volatile u16 *p; |
364 | 364 | ||
365 | if (ORIG_VIDEO_ISVGA == VIDEO_TYPE_VLFB) { | 365 | if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB) { |
366 | no_vga: | 366 | no_vga: |
367 | #ifdef CONFIG_DUMMY_CONSOLE | 367 | #ifdef CONFIG_DUMMY_CONSOLE |
368 | conswitchp = &dummy_con; | 368 | conswitchp = &dummy_con; |
@@ -372,29 +372,30 @@ static const char *vgacon_startup(void) | |||
372 | #endif | 372 | #endif |
373 | } | 373 | } |
374 | 374 | ||
375 | /* SCREEN_INFO initialized? */ | 375 | /* boot_params.screen_info initialized? */ |
376 | if ((ORIG_VIDEO_MODE == 0) && | 376 | if ((screen_info.orig_video_mode == 0) && |
377 | (ORIG_VIDEO_LINES == 0) && | 377 | (screen_info.orig_video_lines == 0) && |
378 | (ORIG_VIDEO_COLS == 0)) | 378 | (screen_info.orig_video_cols == 0)) |
379 | goto no_vga; | 379 | goto no_vga; |
380 | 380 | ||
381 | /* VGA16 modes are not handled by VGACON */ | 381 | /* VGA16 modes are not handled by VGACON */ |
382 | if ((ORIG_VIDEO_MODE == 0x0D) || /* 320x200/4 */ | 382 | if ((screen_info.orig_video_mode == 0x0D) || /* 320x200/4 */ |
383 | (ORIG_VIDEO_MODE == 0x0E) || /* 640x200/4 */ | 383 | (screen_info.orig_video_mode == 0x0E) || /* 640x200/4 */ |
384 | (ORIG_VIDEO_MODE == 0x10) || /* 640x350/4 */ | 384 | (screen_info.orig_video_mode == 0x10) || /* 640x350/4 */ |
385 | (ORIG_VIDEO_MODE == 0x12) || /* 640x480/4 */ | 385 | (screen_info.orig_video_mode == 0x12) || /* 640x480/4 */ |
386 | (ORIG_VIDEO_MODE == 0x6A)) /* 800x600/4, 0x6A is very common */ | 386 | (screen_info.orig_video_mode == 0x6A)) /* 800x600/4 (VESA) */ |
387 | goto no_vga; | 387 | goto no_vga; |
388 | 388 | ||
389 | vga_video_num_lines = ORIG_VIDEO_LINES; | 389 | vga_video_num_lines = screen_info.orig_video_lines; |
390 | vga_video_num_columns = ORIG_VIDEO_COLS; | 390 | vga_video_num_columns = screen_info.orig_video_cols; |
391 | state.vgabase = NULL; | 391 | state.vgabase = NULL; |
392 | 392 | ||
393 | if (ORIG_VIDEO_MODE == 7) { /* Is this a monochrome display? */ | 393 | if (screen_info.orig_video_mode == 7) { |
394 | /* Monochrome display */ | ||
394 | vga_vram_base = 0xb0000; | 395 | vga_vram_base = 0xb0000; |
395 | vga_video_port_reg = VGA_CRT_IM; | 396 | vga_video_port_reg = VGA_CRT_IM; |
396 | vga_video_port_val = VGA_CRT_DM; | 397 | vga_video_port_val = VGA_CRT_DM; |
397 | if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) { | 398 | if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) { |
398 | static struct resource ega_console_resource = | 399 | static struct resource ega_console_resource = |
399 | { .name = "ega", .start = 0x3B0, .end = 0x3BF }; | 400 | { .name = "ega", .start = 0x3B0, .end = 0x3BF }; |
400 | vga_video_type = VIDEO_TYPE_EGAM; | 401 | vga_video_type = VIDEO_TYPE_EGAM; |
@@ -422,12 +423,12 @@ static const char *vgacon_startup(void) | |||
422 | vga_vram_base = 0xb8000; | 423 | vga_vram_base = 0xb8000; |
423 | vga_video_port_reg = VGA_CRT_IC; | 424 | vga_video_port_reg = VGA_CRT_IC; |
424 | vga_video_port_val = VGA_CRT_DC; | 425 | vga_video_port_val = VGA_CRT_DC; |
425 | if ((ORIG_VIDEO_EGA_BX & 0xff) != 0x10) { | 426 | if ((screen_info.orig_video_ega_bx & 0xff) != 0x10) { |
426 | int i; | 427 | int i; |
427 | 428 | ||
428 | vga_vram_size = 0x8000; | 429 | vga_vram_size = 0x8000; |
429 | 430 | ||
430 | if (!ORIG_VIDEO_ISVGA) { | 431 | if (!screen_info.orig_video_isVGA) { |
431 | static struct resource ega_console_resource | 432 | static struct resource ega_console_resource |
432 | = { .name = "ega", .start = 0x3C0, .end = 0x3DF }; | 433 | = { .name = "ega", .start = 0x3C0, .end = 0x3DF }; |
433 | vga_video_type = VIDEO_TYPE_EGAC; | 434 | vga_video_type = VIDEO_TYPE_EGAC; |
@@ -521,14 +522,14 @@ static const char *vgacon_startup(void) | |||
521 | || vga_video_type == VIDEO_TYPE_VGAC | 522 | || vga_video_type == VIDEO_TYPE_VGAC |
522 | || vga_video_type == VIDEO_TYPE_EGAM) { | 523 | || vga_video_type == VIDEO_TYPE_EGAM) { |
523 | vga_hardscroll_enabled = vga_hardscroll_user_enable; | 524 | vga_hardscroll_enabled = vga_hardscroll_user_enable; |
524 | vga_default_font_height = ORIG_VIDEO_POINTS; | 525 | vga_default_font_height = screen_info.orig_video_points; |
525 | vga_video_font_height = ORIG_VIDEO_POINTS; | 526 | vga_video_font_height = screen_info.orig_video_points; |
526 | /* This may be suboptimal but is a safe bet - go with it */ | 527 | /* This may be suboptimal but is a safe bet - go with it */ |
527 | vga_scan_lines = | 528 | vga_scan_lines = |
528 | vga_video_font_height * vga_video_num_lines; | 529 | vga_video_font_height * vga_video_num_lines; |
529 | } | 530 | } |
530 | 531 | ||
531 | vgacon_xres = ORIG_VIDEO_COLS * VGA_FONTWIDTH; | 532 | vgacon_xres = screen_info.orig_video_cols * VGA_FONTWIDTH; |
532 | vgacon_yres = vga_scan_lines; | 533 | vgacon_yres = vga_scan_lines; |
533 | 534 | ||
534 | if (!vga_init_done) { | 535 | if (!vga_init_done) { |
@@ -798,7 +799,7 @@ static int vgacon_switch(struct vc_data *c) | |||
798 | { | 799 | { |
799 | int x = c->vc_cols * VGA_FONTWIDTH; | 800 | int x = c->vc_cols * VGA_FONTWIDTH; |
800 | int y = c->vc_rows * c->vc_font.height; | 801 | int y = c->vc_rows * c->vc_font.height; |
801 | int rows = ORIG_VIDEO_LINES * vga_default_font_height/ | 802 | int rows = screen_info.orig_video_lines * vga_default_font_height/ |
802 | c->vc_font.height; | 803 | c->vc_font.height; |
803 | /* | 804 | /* |
804 | * We need to save screen size here as it's the only way | 805 | * We need to save screen size here as it's the only way |
@@ -818,7 +819,7 @@ static int vgacon_switch(struct vc_data *c) | |||
818 | 819 | ||
819 | if ((vgacon_xres != x || vgacon_yres != y) && | 820 | if ((vgacon_xres != x || vgacon_yres != y) && |
820 | (!(vga_video_num_columns % 2) && | 821 | (!(vga_video_num_columns % 2) && |
821 | vga_video_num_columns <= ORIG_VIDEO_COLS && | 822 | vga_video_num_columns <= screen_info.orig_video_cols && |
822 | vga_video_num_lines <= rows)) | 823 | vga_video_num_lines <= rows)) |
823 | vgacon_doresize(c, c->vc_cols, c->vc_rows); | 824 | vgacon_doresize(c, c->vc_cols, c->vc_rows); |
824 | } | 825 | } |
@@ -1280,8 +1281,8 @@ static int vgacon_font_get(struct vc_data *c, struct console_font *font) | |||
1280 | static int vgacon_resize(struct vc_data *c, unsigned int width, | 1281 | static int vgacon_resize(struct vc_data *c, unsigned int width, |
1281 | unsigned int height, unsigned int user) | 1282 | unsigned int height, unsigned int user) |
1282 | { | 1283 | { |
1283 | if (width % 2 || width > ORIG_VIDEO_COLS || | 1284 | if (width % 2 || width > screen_info.orig_video_cols || |
1284 | height > (ORIG_VIDEO_LINES * vga_default_font_height)/ | 1285 | height > (screen_info.orig_video_lines * vga_default_font_height)/ |
1285 | c->vc_font.height) | 1286 | c->vc_font.height) |
1286 | /* let svgatextmode tinker with video timings and | 1287 | /* let svgatextmode tinker with video timings and |
1287 | return success */ | 1288 | return success */ |
@@ -1313,8 +1314,8 @@ static void vgacon_save_screen(struct vc_data *c) | |||
1313 | * console initialization routines. | 1314 | * console initialization routines. |
1314 | */ | 1315 | */ |
1315 | vga_bootup_console = 1; | 1316 | vga_bootup_console = 1; |
1316 | c->vc_x = ORIG_X; | 1317 | c->vc_x = screen_info.orig_x; |
1317 | c->vc_y = ORIG_Y; | 1318 | c->vc_y = screen_info.orig_y; |
1318 | } | 1319 | } |
1319 | 1320 | ||
1320 | /* We can't copy in more then the size of the video buffer, | 1321 | /* We can't copy in more then the size of the video buffer, |
diff --git a/drivers/video/intelfb/intelfbdrv.c b/drivers/video/intelfb/intelfbdrv.c index 0428f211f192..e8e38edb9b5b 100644 --- a/drivers/video/intelfb/intelfbdrv.c +++ b/drivers/video/intelfb/intelfbdrv.c | |||
@@ -804,7 +804,8 @@ static int __devinit intelfb_pci_register(struct pci_dev *pdev, | |||
804 | if (bailearly == 1) | 804 | if (bailearly == 1) |
805 | bailout(dinfo); | 805 | bailout(dinfo); |
806 | 806 | ||
807 | if (FIXED_MODE(dinfo) && ORIG_VIDEO_ISVGA != VIDEO_TYPE_VLFB) { | 807 | if (FIXED_MODE(dinfo) && |
808 | screen_info.orig_video_isVGA != VIDEO_TYPE_VLFB) { | ||
808 | ERR_MSG("Video mode must be programmed at boot time.\n"); | 809 | ERR_MSG("Video mode must be programmed at boot time.\n"); |
809 | cleanup(dinfo); | 810 | cleanup(dinfo); |
810 | return -ENODEV; | 811 | return -ENODEV; |
@@ -815,7 +816,7 @@ static int __devinit intelfb_pci_register(struct pci_dev *pdev, | |||
815 | 816 | ||
816 | /* Initialise dinfo and related data. */ | 817 | /* Initialise dinfo and related data. */ |
817 | /* If an initial mode was programmed at boot time, get its details. */ | 818 | /* If an initial mode was programmed at boot time, get its details. */ |
818 | if (ORIG_VIDEO_ISVGA == VIDEO_TYPE_VLFB) | 819 | if (screen_info.orig_video_isVGA == VIDEO_TYPE_VLFB) |
819 | get_initial_mode(dinfo); | 820 | get_initial_mode(dinfo); |
820 | 821 | ||
821 | if (bailearly == 3) | 822 | if (bailearly == 3) |
diff --git a/drivers/video/omap/lcd_h3.c b/drivers/video/omap/lcd_h3.c index 51807b4e26d1..c604d935c188 100644 --- a/drivers/video/omap/lcd_h3.c +++ b/drivers/video/omap/lcd_h3.c | |||
@@ -28,8 +28,6 @@ | |||
28 | 28 | ||
29 | #define MODULE_NAME "omapfb-lcd_h3" | 29 | #define MODULE_NAME "omapfb-lcd_h3" |
30 | 30 | ||
31 | #define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args) | ||
32 | |||
33 | static int h3_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) | 31 | static int h3_panel_init(struct lcd_panel *panel, struct omapfb_device *fbdev) |
34 | { | 32 | { |
35 | return 0; | 33 | return 0; |
@@ -48,7 +46,7 @@ static int h3_panel_enable(struct lcd_panel *panel) | |||
48 | if (!r) | 46 | if (!r) |
49 | r = tps65010_set_gpio_out_value(GPIO2, HIGH); | 47 | r = tps65010_set_gpio_out_value(GPIO2, HIGH); |
50 | if (r) | 48 | if (r) |
51 | pr_err("Unable to turn on LCD panel\n"); | 49 | pr_err(MODULE_NAME ": Unable to turn on LCD panel\n"); |
52 | 50 | ||
53 | return r; | 51 | return r; |
54 | } | 52 | } |
@@ -62,7 +60,7 @@ static void h3_panel_disable(struct lcd_panel *panel) | |||
62 | if (!r) | 60 | if (!r) |
63 | tps65010_set_gpio_out_value(GPIO2, LOW); | 61 | tps65010_set_gpio_out_value(GPIO2, LOW); |
64 | if (r) | 62 | if (r) |
65 | pr_err("Unable to turn off LCD panel\n"); | 63 | pr_err(MODULE_NAME ": Unable to turn off LCD panel\n"); |
66 | } | 64 | } |
67 | 65 | ||
68 | static unsigned long h3_panel_get_caps(struct lcd_panel *panel) | 66 | static unsigned long h3_panel_get_caps(struct lcd_panel *panel) |
diff --git a/drivers/video/omap/lcd_inn1610.c b/drivers/video/omap/lcd_inn1610.c index 95604ca43301..5ef119c813e0 100644 --- a/drivers/video/omap/lcd_inn1610.c +++ b/drivers/video/omap/lcd_inn1610.c | |||
@@ -27,20 +27,18 @@ | |||
27 | 27 | ||
28 | #define MODULE_NAME "omapfb-lcd_h3" | 28 | #define MODULE_NAME "omapfb-lcd_h3" |
29 | 29 | ||
30 | #define pr_err(fmt, args...) printk(KERN_ERR MODULE_NAME ": " fmt, ## args) | ||
31 | |||
32 | static int innovator1610_panel_init(struct lcd_panel *panel, | 30 | static int innovator1610_panel_init(struct lcd_panel *panel, |
33 | struct omapfb_device *fbdev) | 31 | struct omapfb_device *fbdev) |
34 | { | 32 | { |
35 | int r = 0; | 33 | int r = 0; |
36 | 34 | ||
37 | if (omap_request_gpio(14)) { | 35 | if (omap_request_gpio(14)) { |
38 | pr_err("can't request GPIO 14\n"); | 36 | pr_err(MODULE_NAME ": can't request GPIO 14\n"); |
39 | r = -1; | 37 | r = -1; |
40 | goto exit; | 38 | goto exit; |
41 | } | 39 | } |
42 | if (omap_request_gpio(15)) { | 40 | if (omap_request_gpio(15)) { |
43 | pr_err("can't request GPIO 15\n"); | 41 | pr_err(MODULE_NAME ": can't request GPIO 15\n"); |
44 | omap_free_gpio(14); | 42 | omap_free_gpio(14); |
45 | r = -1; | 43 | r = -1; |
46 | goto exit; | 44 | goto exit; |
diff --git a/drivers/video/vga16fb.c b/drivers/video/vga16fb.c index 2a14d28c4163..9b3c5923365e 100644 --- a/drivers/video/vga16fb.c +++ b/drivers/video/vga16fb.c | |||
@@ -1364,7 +1364,7 @@ static int __init vga16fb_probe(struct platform_device *dev) | |||
1364 | par = info->par; | 1364 | par = info->par; |
1365 | 1365 | ||
1366 | mutex_init(&par->open_lock); | 1366 | mutex_init(&par->open_lock); |
1367 | par->isVGA = ORIG_VIDEO_ISVGA; | 1367 | par->isVGA = screen_info.orig_video_isVGA; |
1368 | par->palette_blanked = 0; | 1368 | par->palette_blanked = 0; |
1369 | par->vesa_blanked = 0; | 1369 | par->vesa_blanked = 0; |
1370 | 1370 | ||
diff --git a/drivers/w1/masters/matrox_w1.c b/drivers/w1/masters/matrox_w1.c index d356da5709fc..1550431ccb6a 100644 --- a/drivers/w1/masters/matrox_w1.c +++ b/drivers/w1/masters/matrox_w1.c | |||
@@ -33,7 +33,6 @@ | |||
33 | #include <linux/slab.h> | 33 | #include <linux/slab.h> |
34 | #include <linux/pci_ids.h> | 34 | #include <linux/pci_ids.h> |
35 | #include <linux/pci.h> | 35 | #include <linux/pci.h> |
36 | #include <linux/timer.h> | ||
37 | 36 | ||
38 | #include "../w1.h" | 37 | #include "../w1.h" |
39 | #include "../w1_int.h" | 38 | #include "../w1_int.h" |