diff options
Diffstat (limited to 'drivers/tty')
| -rw-r--r-- | drivers/tty/serial/icom.c | 89 |
1 files changed, 48 insertions, 41 deletions
diff --git a/drivers/tty/serial/icom.c b/drivers/tty/serial/icom.c index 7c9a06732ae5..d98e43348970 100644 --- a/drivers/tty/serial/icom.c +++ b/drivers/tty/serial/icom.c | |||
| @@ -297,25 +297,25 @@ static void stop_processor(struct icom_port *icom_port) | |||
| 297 | spin_lock_irqsave(&icom_lock, flags); | 297 | spin_lock_irqsave(&icom_lock, flags); |
| 298 | 298 | ||
| 299 | port = icom_port->port; | 299 | port = icom_port->port; |
| 300 | if (port >= ARRAY_SIZE(stop_proc)) { | ||
| 301 | dev_err(&icom_port->adapter->pci_dev->dev, | ||
| 302 | "Invalid port assignment\n"); | ||
| 303 | goto unlock; | ||
| 304 | } | ||
| 305 | |||
| 300 | if (port == 0 || port == 1) | 306 | if (port == 0 || port == 1) |
| 301 | stop_proc[port].global_control_reg = &icom_port->global_reg->control; | 307 | stop_proc[port].global_control_reg = &icom_port->global_reg->control; |
| 302 | else | 308 | else |
| 303 | stop_proc[port].global_control_reg = &icom_port->global_reg->control_2; | 309 | stop_proc[port].global_control_reg = &icom_port->global_reg->control_2; |
| 304 | 310 | ||
| 311 | temp = readl(stop_proc[port].global_control_reg); | ||
| 312 | temp = (temp & ~start_proc[port].processor_id) | stop_proc[port].processor_id; | ||
| 313 | writel(temp, stop_proc[port].global_control_reg); | ||
| 305 | 314 | ||
| 306 | if (port < 4) { | 315 | /* write flush */ |
| 307 | temp = readl(stop_proc[port].global_control_reg); | 316 | readl(stop_proc[port].global_control_reg); |
| 308 | temp = | ||
| 309 | (temp & ~start_proc[port].processor_id) | stop_proc[port].processor_id; | ||
| 310 | writel(temp, stop_proc[port].global_control_reg); | ||
| 311 | |||
| 312 | /* write flush */ | ||
| 313 | readl(stop_proc[port].global_control_reg); | ||
| 314 | } else { | ||
| 315 | dev_err(&icom_port->adapter->pci_dev->dev, | ||
| 316 | "Invalid port assignment\n"); | ||
| 317 | } | ||
| 318 | 317 | ||
| 318 | unlock: | ||
| 319 | spin_unlock_irqrestore(&icom_lock, flags); | 319 | spin_unlock_irqrestore(&icom_lock, flags); |
| 320 | } | 320 | } |
| 321 | 321 | ||
| @@ -328,23 +328,25 @@ static void start_processor(struct icom_port *icom_port) | |||
| 328 | spin_lock_irqsave(&icom_lock, flags); | 328 | spin_lock_irqsave(&icom_lock, flags); |
| 329 | 329 | ||
| 330 | port = icom_port->port; | 330 | port = icom_port->port; |
| 331 | if (port >= ARRAY_SIZE(start_proc)) { | ||
| 332 | dev_err(&icom_port->adapter->pci_dev->dev, | ||
| 333 | "Invalid port assignment\n"); | ||
| 334 | goto unlock; | ||
| 335 | } | ||
| 336 | |||
| 331 | if (port == 0 || port == 1) | 337 | if (port == 0 || port == 1) |
| 332 | start_proc[port].global_control_reg = &icom_port->global_reg->control; | 338 | start_proc[port].global_control_reg = &icom_port->global_reg->control; |
| 333 | else | 339 | else |
| 334 | start_proc[port].global_control_reg = &icom_port->global_reg->control_2; | 340 | start_proc[port].global_control_reg = &icom_port->global_reg->control_2; |
| 335 | if (port < 4) { | ||
| 336 | temp = readl(start_proc[port].global_control_reg); | ||
| 337 | temp = | ||
| 338 | (temp & ~stop_proc[port].processor_id) | start_proc[port].processor_id; | ||
| 339 | writel(temp, start_proc[port].global_control_reg); | ||
| 340 | 341 | ||
| 341 | /* write flush */ | 342 | temp = readl(start_proc[port].global_control_reg); |
| 342 | readl(start_proc[port].global_control_reg); | 343 | temp = (temp & ~stop_proc[port].processor_id) | start_proc[port].processor_id; |
| 343 | } else { | 344 | writel(temp, start_proc[port].global_control_reg); |
| 344 | dev_err(&icom_port->adapter->pci_dev->dev, | 345 | |
| 345 | "Invalid port assignment\n"); | 346 | /* write flush */ |
| 346 | } | 347 | readl(start_proc[port].global_control_reg); |
| 347 | 348 | ||
| 349 | unlock: | ||
| 348 | spin_unlock_irqrestore(&icom_lock, flags); | 350 | spin_unlock_irqrestore(&icom_lock, flags); |
| 349 | } | 351 | } |
| 350 | 352 | ||
| @@ -557,6 +559,12 @@ static int startup(struct icom_port *icom_port) | |||
| 557 | */ | 559 | */ |
| 558 | spin_lock_irqsave(&icom_lock, flags); | 560 | spin_lock_irqsave(&icom_lock, flags); |
| 559 | port = icom_port->port; | 561 | port = icom_port->port; |
| 562 | if (port >= ARRAY_SIZE(int_mask_tbl)) { | ||
| 563 | dev_err(&icom_port->adapter->pci_dev->dev, | ||
| 564 | "Invalid port assignment\n"); | ||
| 565 | goto unlock; | ||
| 566 | } | ||
| 567 | |||
| 560 | if (port == 0 || port == 1) | 568 | if (port == 0 || port == 1) |
| 561 | int_mask_tbl[port].global_int_mask = &icom_port->global_reg->int_mask; | 569 | int_mask_tbl[port].global_int_mask = &icom_port->global_reg->int_mask; |
| 562 | else | 570 | else |
| @@ -566,17 +574,14 @@ static int startup(struct icom_port *icom_port) | |||
| 566 | writew(0x00FF, icom_port->int_reg); | 574 | writew(0x00FF, icom_port->int_reg); |
| 567 | else | 575 | else |
| 568 | writew(0x3F00, icom_port->int_reg); | 576 | writew(0x3F00, icom_port->int_reg); |
| 569 | if (port < 4) { | ||
| 570 | temp = readl(int_mask_tbl[port].global_int_mask); | ||
| 571 | writel(temp & ~int_mask_tbl[port].processor_id, int_mask_tbl[port].global_int_mask); | ||
| 572 | 577 | ||
| 573 | /* write flush */ | 578 | temp = readl(int_mask_tbl[port].global_int_mask); |
| 574 | readl(int_mask_tbl[port].global_int_mask); | 579 | writel(temp & ~int_mask_tbl[port].processor_id, int_mask_tbl[port].global_int_mask); |
| 575 | } else { | 580 | |
| 576 | dev_err(&icom_port->adapter->pci_dev->dev, | 581 | /* write flush */ |
| 577 | "Invalid port assignment\n"); | 582 | readl(int_mask_tbl[port].global_int_mask); |
| 578 | } | ||
| 579 | 583 | ||
| 584 | unlock: | ||
| 580 | spin_unlock_irqrestore(&icom_lock, flags); | 585 | spin_unlock_irqrestore(&icom_lock, flags); |
| 581 | return 0; | 586 | return 0; |
| 582 | } | 587 | } |
| @@ -595,21 +600,23 @@ static void shutdown(struct icom_port *icom_port) | |||
| 595 | * disable all interrupts | 600 | * disable all interrupts |
| 596 | */ | 601 | */ |
| 597 | port = icom_port->port; | 602 | port = icom_port->port; |
| 603 | if (port >= ARRAY_SIZE(int_mask_tbl)) { | ||
| 604 | dev_err(&icom_port->adapter->pci_dev->dev, | ||
| 605 | "Invalid port assignment\n"); | ||
| 606 | goto unlock; | ||
| 607 | } | ||
| 598 | if (port == 0 || port == 1) | 608 | if (port == 0 || port == 1) |
| 599 | int_mask_tbl[port].global_int_mask = &icom_port->global_reg->int_mask; | 609 | int_mask_tbl[port].global_int_mask = &icom_port->global_reg->int_mask; |
| 600 | else | 610 | else |
| 601 | int_mask_tbl[port].global_int_mask = &icom_port->global_reg->int_mask_2; | 611 | int_mask_tbl[port].global_int_mask = &icom_port->global_reg->int_mask_2; |
| 602 | 612 | ||
| 603 | if (port < 4) { | 613 | temp = readl(int_mask_tbl[port].global_int_mask); |
| 604 | temp = readl(int_mask_tbl[port].global_int_mask); | 614 | writel(temp | int_mask_tbl[port].processor_id, int_mask_tbl[port].global_int_mask); |
| 605 | writel(temp | int_mask_tbl[port].processor_id, int_mask_tbl[port].global_int_mask); | ||
| 606 | 615 | ||
| 607 | /* write flush */ | 616 | /* write flush */ |
| 608 | readl(int_mask_tbl[port].global_int_mask); | 617 | readl(int_mask_tbl[port].global_int_mask); |
| 609 | } else { | 618 | |
| 610 | dev_err(&icom_port->adapter->pci_dev->dev, | 619 | unlock: |
| 611 | "Invalid port assignment\n"); | ||
| 612 | } | ||
| 613 | spin_unlock_irqrestore(&icom_lock, flags); | 620 | spin_unlock_irqrestore(&icom_lock, flags); |
| 614 | 621 | ||
| 615 | /* | 622 | /* |
