diff options
Diffstat (limited to 'drivers/net/irda')
-rw-r--r-- | drivers/net/irda/donauboe.c | 6 | ||||
-rw-r--r-- | drivers/net/irda/irda-usb.c | 6 | ||||
-rw-r--r-- | drivers/net/irda/irport.c | 3 | ||||
-rw-r--r-- | drivers/net/irda/pxaficp_ir.c | 14 | ||||
-rw-r--r-- | drivers/net/irda/sir_dev.c | 3 | ||||
-rw-r--r-- | drivers/net/irda/smsc-ircc2.c | 129 | ||||
-rw-r--r-- | drivers/net/irda/vlsi_ir.c | 3 |
7 files changed, 96 insertions, 68 deletions
diff --git a/drivers/net/irda/donauboe.c b/drivers/net/irda/donauboe.c index 0a08c539c051..0282771b1cbb 100644 --- a/drivers/net/irda/donauboe.c +++ b/drivers/net/irda/donauboe.c | |||
@@ -1695,11 +1695,9 @@ toshoboe_open (struct pci_dev *pci_dev, const struct pci_device_id *pdid) | |||
1695 | 1695 | ||
1696 | freebufs: | 1696 | freebufs: |
1697 | for (i = 0; i < TX_SLOTS; ++i) | 1697 | for (i = 0; i < TX_SLOTS; ++i) |
1698 | if (self->tx_bufs[i]) | 1698 | kfree (self->tx_bufs[i]); |
1699 | kfree (self->tx_bufs[i]); | ||
1700 | for (i = 0; i < RX_SLOTS; ++i) | 1699 | for (i = 0; i < RX_SLOTS; ++i) |
1701 | if (self->rx_bufs[i]) | 1700 | kfree (self->rx_bufs[i]); |
1702 | kfree (self->rx_bufs[i]); | ||
1703 | kfree(self->ringbuf); | 1701 | kfree(self->ringbuf); |
1704 | 1702 | ||
1705 | freeregion: | 1703 | freeregion: |
diff --git a/drivers/net/irda/irda-usb.c b/drivers/net/irda/irda-usb.c index 6c766fdc51a6..c22c0517883c 100644 --- a/drivers/net/irda/irda-usb.c +++ b/drivers/net/irda/irda-usb.c | |||
@@ -1168,10 +1168,8 @@ static inline void irda_usb_close(struct irda_usb_cb *self) | |||
1168 | unregister_netdev(self->netdev); | 1168 | unregister_netdev(self->netdev); |
1169 | 1169 | ||
1170 | /* Remove the speed buffer */ | 1170 | /* Remove the speed buffer */ |
1171 | if (self->speed_buff != NULL) { | 1171 | kfree(self->speed_buff); |
1172 | kfree(self->speed_buff); | 1172 | self->speed_buff = NULL; |
1173 | self->speed_buff = NULL; | ||
1174 | } | ||
1175 | } | 1173 | } |
1176 | 1174 | ||
1177 | /********************** USB CONFIG SUBROUTINES **********************/ | 1175 | /********************** USB CONFIG SUBROUTINES **********************/ |
diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c index 5971315f3fa0..3d016a498e1d 100644 --- a/drivers/net/irda/irport.c +++ b/drivers/net/irda/irport.c | |||
@@ -235,8 +235,7 @@ static int irport_close(struct irport_cb *self) | |||
235 | __FUNCTION__, self->io.sir_base); | 235 | __FUNCTION__, self->io.sir_base); |
236 | release_region(self->io.sir_base, self->io.sir_ext); | 236 | release_region(self->io.sir_base, self->io.sir_ext); |
237 | 237 | ||
238 | if (self->tx_buff.head) | 238 | kfree(self->tx_buff.head); |
239 | kfree(self->tx_buff.head); | ||
240 | 239 | ||
241 | if (self->rx_buff.skb) | 240 | if (self->rx_buff.skb) |
242 | kfree_skb(self->rx_buff.skb); | 241 | kfree_skb(self->rx_buff.skb); |
diff --git a/drivers/net/irda/pxaficp_ir.c b/drivers/net/irda/pxaficp_ir.c index 9571145c2090..e1aa9910503b 100644 --- a/drivers/net/irda/pxaficp_ir.c +++ b/drivers/net/irda/pxaficp_ir.c | |||
@@ -705,15 +705,12 @@ static int pxa_irda_stop(struct net_device *dev) | |||
705 | return 0; | 705 | return 0; |
706 | } | 706 | } |
707 | 707 | ||
708 | static int pxa_irda_suspend(struct device *_dev, pm_message_t state, u32 level) | 708 | static int pxa_irda_suspend(struct device *_dev, pm_message_t state) |
709 | { | 709 | { |
710 | struct net_device *dev = dev_get_drvdata(_dev); | 710 | struct net_device *dev = dev_get_drvdata(_dev); |
711 | struct pxa_irda *si; | 711 | struct pxa_irda *si; |
712 | 712 | ||
713 | if (!dev || level != SUSPEND_DISABLE) | 713 | if (dev && netif_running(dev)) { |
714 | return 0; | ||
715 | |||
716 | if (netif_running(dev)) { | ||
717 | si = netdev_priv(dev); | 714 | si = netdev_priv(dev); |
718 | netif_device_detach(dev); | 715 | netif_device_detach(dev); |
719 | pxa_irda_shutdown(si); | 716 | pxa_irda_shutdown(si); |
@@ -722,15 +719,12 @@ static int pxa_irda_suspend(struct device *_dev, pm_message_t state, u32 level) | |||
722 | return 0; | 719 | return 0; |
723 | } | 720 | } |
724 | 721 | ||
725 | static int pxa_irda_resume(struct device *_dev, u32 level) | 722 | static int pxa_irda_resume(struct device *_dev) |
726 | { | 723 | { |
727 | struct net_device *dev = dev_get_drvdata(_dev); | 724 | struct net_device *dev = dev_get_drvdata(_dev); |
728 | struct pxa_irda *si; | 725 | struct pxa_irda *si; |
729 | 726 | ||
730 | if (!dev || level != RESUME_ENABLE) | 727 | if (dev && netif_running(dev)) { |
731 | return 0; | ||
732 | |||
733 | if (netif_running(dev)) { | ||
734 | si = netdev_priv(dev); | 728 | si = netdev_priv(dev); |
735 | pxa_irda_startup(si); | 729 | pxa_irda_startup(si); |
736 | netif_device_attach(dev); | 730 | netif_device_attach(dev); |
diff --git a/drivers/net/irda/sir_dev.c b/drivers/net/irda/sir_dev.c index efc5a8870565..df22b8b532e7 100644 --- a/drivers/net/irda/sir_dev.c +++ b/drivers/net/irda/sir_dev.c | |||
@@ -490,8 +490,7 @@ static void sirdev_free_buffers(struct sir_dev *dev) | |||
490 | { | 490 | { |
491 | if (dev->rx_buff.skb) | 491 | if (dev->rx_buff.skb) |
492 | kfree_skb(dev->rx_buff.skb); | 492 | kfree_skb(dev->rx_buff.skb); |
493 | if (dev->tx_buff.head) | 493 | kfree(dev->tx_buff.head); |
494 | kfree(dev->tx_buff.head); | ||
495 | dev->rx_buff.head = dev->tx_buff.head = NULL; | 494 | dev->rx_buff.head = dev->tx_buff.head = NULL; |
496 | dev->rx_buff.skb = NULL; | 495 | dev->rx_buff.skb = NULL; |
497 | } | 496 | } |
diff --git a/drivers/net/irda/smsc-ircc2.c b/drivers/net/irda/smsc-ircc2.c index 424515d35932..a1d207f2fa68 100644 --- a/drivers/net/irda/smsc-ircc2.c +++ b/drivers/net/irda/smsc-ircc2.c | |||
@@ -639,21 +639,14 @@ static void smsc_ircc_setup_qos(struct smsc_ircc_cb *self) | |||
639 | */ | 639 | */ |
640 | static void smsc_ircc_init_chip(struct smsc_ircc_cb *self) | 640 | static void smsc_ircc_init_chip(struct smsc_ircc_cb *self) |
641 | { | 641 | { |
642 | int iobase, ir_mode, ctrl, fast; | 642 | int iobase = self->io.fir_base; |
643 | |||
644 | IRDA_ASSERT(self != NULL, return;); | ||
645 | |||
646 | iobase = self->io.fir_base; | ||
647 | ir_mode = IRCC_CFGA_IRDA_SIR_A; | ||
648 | ctrl = 0; | ||
649 | fast = 0; | ||
650 | 643 | ||
651 | register_bank(iobase, 0); | 644 | register_bank(iobase, 0); |
652 | outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); | 645 | outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); |
653 | outb(0x00, iobase + IRCC_MASTER); | 646 | outb(0x00, iobase + IRCC_MASTER); |
654 | 647 | ||
655 | register_bank(iobase, 1); | 648 | register_bank(iobase, 1); |
656 | outb(((inb(iobase + IRCC_SCE_CFGA) & 0x87) | ir_mode), | 649 | outb(((inb(iobase + IRCC_SCE_CFGA) & 0x87) | IRCC_CFGA_IRDA_SIR_A), |
657 | iobase + IRCC_SCE_CFGA); | 650 | iobase + IRCC_SCE_CFGA); |
658 | 651 | ||
659 | #ifdef smsc_669 /* Uses pin 88/89 for Rx/Tx */ | 652 | #ifdef smsc_669 /* Uses pin 88/89 for Rx/Tx */ |
@@ -667,10 +660,10 @@ static void smsc_ircc_init_chip(struct smsc_ircc_cb *self) | |||
667 | outb(SMSC_IRCC2_FIFO_THRESHOLD, iobase + IRCC_FIFO_THRESHOLD); | 660 | outb(SMSC_IRCC2_FIFO_THRESHOLD, iobase + IRCC_FIFO_THRESHOLD); |
668 | 661 | ||
669 | register_bank(iobase, 4); | 662 | register_bank(iobase, 4); |
670 | outb((inb(iobase + IRCC_CONTROL) & 0x30) | ctrl, iobase + IRCC_CONTROL); | 663 | outb((inb(iobase + IRCC_CONTROL) & 0x30), iobase + IRCC_CONTROL); |
671 | 664 | ||
672 | register_bank(iobase, 0); | 665 | register_bank(iobase, 0); |
673 | outb(fast, iobase + IRCC_LCR_A); | 666 | outb(0, iobase + IRCC_LCR_A); |
674 | 667 | ||
675 | smsc_ircc_set_sir_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); | 668 | smsc_ircc_set_sir_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); |
676 | 669 | ||
@@ -1557,6 +1550,46 @@ static int ircc_is_receiving(struct smsc_ircc_cb *self) | |||
1557 | } | 1550 | } |
1558 | #endif /* unused */ | 1551 | #endif /* unused */ |
1559 | 1552 | ||
1553 | static int smsc_ircc_request_irq(struct smsc_ircc_cb *self) | ||
1554 | { | ||
1555 | int error; | ||
1556 | |||
1557 | error = request_irq(self->io.irq, smsc_ircc_interrupt, 0, | ||
1558 | self->netdev->name, self->netdev); | ||
1559 | if (error) | ||
1560 | IRDA_DEBUG(0, "%s(), unable to allocate irq=%d, err=%d\n", | ||
1561 | __FUNCTION__, self->io.irq, error); | ||
1562 | |||
1563 | return error; | ||
1564 | } | ||
1565 | |||
1566 | static void smsc_ircc_start_interrupts(struct smsc_ircc_cb *self) | ||
1567 | { | ||
1568 | unsigned long flags; | ||
1569 | |||
1570 | spin_lock_irqsave(&self->lock, flags); | ||
1571 | |||
1572 | self->io.speed = 0; | ||
1573 | smsc_ircc_change_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); | ||
1574 | |||
1575 | spin_unlock_irqrestore(&self->lock, flags); | ||
1576 | } | ||
1577 | |||
1578 | static void smsc_ircc_stop_interrupts(struct smsc_ircc_cb *self) | ||
1579 | { | ||
1580 | int iobase = self->io.fir_base; | ||
1581 | unsigned long flags; | ||
1582 | |||
1583 | spin_lock_irqsave(&self->lock, flags); | ||
1584 | |||
1585 | register_bank(iobase, 0); | ||
1586 | outb(0, iobase + IRCC_IER); | ||
1587 | outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); | ||
1588 | outb(0x00, iobase + IRCC_MASTER); | ||
1589 | |||
1590 | spin_unlock_irqrestore(&self->lock, flags); | ||
1591 | } | ||
1592 | |||
1560 | 1593 | ||
1561 | /* | 1594 | /* |
1562 | * Function smsc_ircc_net_open (dev) | 1595 | * Function smsc_ircc_net_open (dev) |
@@ -1568,7 +1601,6 @@ static int smsc_ircc_net_open(struct net_device *dev) | |||
1568 | { | 1601 | { |
1569 | struct smsc_ircc_cb *self; | 1602 | struct smsc_ircc_cb *self; |
1570 | char hwname[16]; | 1603 | char hwname[16]; |
1571 | unsigned long flags; | ||
1572 | 1604 | ||
1573 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); | 1605 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); |
1574 | 1606 | ||
@@ -1576,6 +1608,11 @@ static int smsc_ircc_net_open(struct net_device *dev) | |||
1576 | self = netdev_priv(dev); | 1608 | self = netdev_priv(dev); |
1577 | IRDA_ASSERT(self != NULL, return 0;); | 1609 | IRDA_ASSERT(self != NULL, return 0;); |
1578 | 1610 | ||
1611 | if (self->io.suspended) { | ||
1612 | IRDA_DEBUG(0, "%s(), device is suspended\n", __FUNCTION__); | ||
1613 | return -EAGAIN; | ||
1614 | } | ||
1615 | |||
1579 | if (request_irq(self->io.irq, smsc_ircc_interrupt, 0, dev->name, | 1616 | if (request_irq(self->io.irq, smsc_ircc_interrupt, 0, dev->name, |
1580 | (void *) dev)) { | 1617 | (void *) dev)) { |
1581 | IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n", | 1618 | IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n", |
@@ -1583,11 +1620,7 @@ static int smsc_ircc_net_open(struct net_device *dev) | |||
1583 | return -EAGAIN; | 1620 | return -EAGAIN; |
1584 | } | 1621 | } |
1585 | 1622 | ||
1586 | spin_lock_irqsave(&self->lock, flags); | 1623 | smsc_ircc_start_interrupts(self); |
1587 | /*smsc_ircc_sir_start(self);*/ | ||
1588 | self->io.speed = 0; | ||
1589 | smsc_ircc_change_speed(self, SMSC_IRCC2_C_IRDA_FALLBACK_SPEED); | ||
1590 | spin_unlock_irqrestore(&self->lock, flags); | ||
1591 | 1624 | ||
1592 | /* Give self a hardware name */ | 1625 | /* Give self a hardware name */ |
1593 | /* It would be cool to offer the chip revision here - Jean II */ | 1626 | /* It would be cool to offer the chip revision here - Jean II */ |
@@ -1640,7 +1673,12 @@ static int smsc_ircc_net_close(struct net_device *dev) | |||
1640 | irlap_close(self->irlap); | 1673 | irlap_close(self->irlap); |
1641 | self->irlap = NULL; | 1674 | self->irlap = NULL; |
1642 | 1675 | ||
1643 | free_irq(self->io.irq, dev); | 1676 | smsc_ircc_stop_interrupts(self); |
1677 | |||
1678 | /* if we are called from smsc_ircc_resume we don't have IRQ reserved */ | ||
1679 | if (!self->io.suspended) | ||
1680 | free_irq(self->io.irq, dev); | ||
1681 | |||
1644 | disable_dma(self->io.dma); | 1682 | disable_dma(self->io.dma); |
1645 | free_dma(self->io.dma); | 1683 | free_dma(self->io.dma); |
1646 | 1684 | ||
@@ -1651,11 +1689,18 @@ static int smsc_ircc_suspend(struct device *dev, pm_message_t state) | |||
1651 | { | 1689 | { |
1652 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); | 1690 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); |
1653 | 1691 | ||
1654 | IRDA_MESSAGE("%s, Suspending\n", driver_name); | ||
1655 | |||
1656 | if (!self->io.suspended) { | 1692 | if (!self->io.suspended) { |
1657 | smsc_ircc_net_close(self->netdev); | 1693 | IRDA_DEBUG(1, "%s, Suspending\n", driver_name); |
1694 | |||
1695 | rtnl_lock(); | ||
1696 | if (netif_running(self->netdev)) { | ||
1697 | netif_device_detach(self->netdev); | ||
1698 | smsc_ircc_stop_interrupts(self); | ||
1699 | free_irq(self->io.irq, self->netdev); | ||
1700 | disable_dma(self->io.dma); | ||
1701 | } | ||
1658 | self->io.suspended = 1; | 1702 | self->io.suspended = 1; |
1703 | rtnl_unlock(); | ||
1659 | } | 1704 | } |
1660 | 1705 | ||
1661 | return 0; | 1706 | return 0; |
@@ -1666,11 +1711,25 @@ static int smsc_ircc_resume(struct device *dev) | |||
1666 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); | 1711 | struct smsc_ircc_cb *self = dev_get_drvdata(dev); |
1667 | 1712 | ||
1668 | if (self->io.suspended) { | 1713 | if (self->io.suspended) { |
1669 | 1714 | IRDA_DEBUG(1, "%s, Waking up\n", driver_name); | |
1670 | smsc_ircc_net_open(self->netdev); | 1715 | |
1716 | rtnl_lock(); | ||
1717 | smsc_ircc_init_chip(self); | ||
1718 | if (netif_running(self->netdev)) { | ||
1719 | if (smsc_ircc_request_irq(self)) { | ||
1720 | /* | ||
1721 | * Don't fail resume process, just kill this | ||
1722 | * network interface | ||
1723 | */ | ||
1724 | unregister_netdevice(self->netdev); | ||
1725 | } else { | ||
1726 | enable_dma(self->io.dma); | ||
1727 | smsc_ircc_start_interrupts(self); | ||
1728 | netif_device_attach(self->netdev); | ||
1729 | } | ||
1730 | } | ||
1671 | self->io.suspended = 0; | 1731 | self->io.suspended = 0; |
1672 | 1732 | rtnl_unlock(); | |
1673 | IRDA_MESSAGE("%s, Waking up\n", driver_name); | ||
1674 | } | 1733 | } |
1675 | return 0; | 1734 | return 0; |
1676 | } | 1735 | } |
@@ -1683,9 +1742,6 @@ static int smsc_ircc_resume(struct device *dev) | |||
1683 | */ | 1742 | */ |
1684 | static int __exit smsc_ircc_close(struct smsc_ircc_cb *self) | 1743 | static int __exit smsc_ircc_close(struct smsc_ircc_cb *self) |
1685 | { | 1744 | { |
1686 | int iobase; | ||
1687 | unsigned long flags; | ||
1688 | |||
1689 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); | 1745 | IRDA_DEBUG(1, "%s\n", __FUNCTION__); |
1690 | 1746 | ||
1691 | IRDA_ASSERT(self != NULL, return -1;); | 1747 | IRDA_ASSERT(self != NULL, return -1;); |
@@ -1695,22 +1751,7 @@ static int __exit smsc_ircc_close(struct smsc_ircc_cb *self) | |||
1695 | /* Remove netdevice */ | 1751 | /* Remove netdevice */ |
1696 | unregister_netdev(self->netdev); | 1752 | unregister_netdev(self->netdev); |
1697 | 1753 | ||
1698 | /* Make sure the irq handler is not exectuting */ | 1754 | smsc_ircc_stop_interrupts(self); |
1699 | spin_lock_irqsave(&self->lock, flags); | ||
1700 | |||
1701 | /* Stop interrupts */ | ||
1702 | iobase = self->io.fir_base; | ||
1703 | register_bank(iobase, 0); | ||
1704 | outb(0, iobase + IRCC_IER); | ||
1705 | outb(IRCC_MASTER_RESET, iobase + IRCC_MASTER); | ||
1706 | outb(0x00, iobase + IRCC_MASTER); | ||
1707 | #if 0 | ||
1708 | /* Reset to SIR mode */ | ||
1709 | register_bank(iobase, 1); | ||
1710 | outb(IRCC_CFGA_IRDA_SIR_A|IRCC_CFGA_TX_POLARITY, iobase + IRCC_SCE_CFGA); | ||
1711 | outb(IRCC_CFGB_IR, iobase + IRCC_SCE_CFGB); | ||
1712 | #endif | ||
1713 | spin_unlock_irqrestore(&self->lock, flags); | ||
1714 | 1755 | ||
1715 | /* Release the PORTS that this driver is using */ | 1756 | /* Release the PORTS that this driver is using */ |
1716 | IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __FUNCTION__, | 1757 | IRDA_DEBUG(0, "%s(), releasing 0x%03x\n", __FUNCTION__, |
diff --git a/drivers/net/irda/vlsi_ir.c b/drivers/net/irda/vlsi_ir.c index 651c5a6578fd..a9f49f058cfb 100644 --- a/drivers/net/irda/vlsi_ir.c +++ b/drivers/net/irda/vlsi_ir.c | |||
@@ -473,8 +473,7 @@ static int vlsi_free_ring(struct vlsi_ring *r) | |||
473 | rd_set_addr_status(rd, 0, 0); | 473 | rd_set_addr_status(rd, 0, 0); |
474 | if (busaddr) | 474 | if (busaddr) |
475 | pci_unmap_single(r->pdev, busaddr, r->len, r->dir); | 475 | pci_unmap_single(r->pdev, busaddr, r->len, r->dir); |
476 | if (rd->buf) | 476 | kfree(rd->buf); |
477 | kfree(rd->buf); | ||
478 | } | 477 | } |
479 | kfree(r); | 478 | kfree(r); |
480 | return 0; | 479 | return 0; |