/* * Suspend the IrDA interface. */ static int sa1100_irda_suspend(struct net_device *dev, int state) { struct sa1100_irda *si = dev->priv; if (si && si->open) { /* * Stop the transmit queue */ netif_device_detach(dev); disable_irq(dev->irq); sa1100_irda_shutdown(si); __sa1100_irda_set_power(si, 0); } return 0; }
/* * Suspend the IrDA interface. */ static int sa1100_irda_suspend(struct platform_device *pdev, pm_message_t state) { struct net_device *dev = platform_get_drvdata(pdev); struct sa1100_irda *si; if (!dev) return 0; si = dev->priv; if (si->open) { /* * Stop the transmit queue */ netif_device_detach(dev); disable_irq(dev->irq); sa1100_irda_shutdown(si); __sa1100_irda_set_power(si, 0); } return 0; }
/* * Suspend the IrDA interface. */ static int sa1100_irda_suspend(struct device *_dev, u32 state, u32 level) { struct net_device *dev = dev_get_drvdata(_dev); struct sa1100_irda *si; if (!dev || level != SUSPEND_DISABLE) return 0; si = dev->priv; if (si->open) { /* * Stop the transmit queue */ netif_device_detach(dev); disable_irq(dev->irq); sa1100_irda_shutdown(si); __sa1100_irda_set_power(si, 0); } return 0; }
static int sa1100_irda_stop(struct net_device *dev) { struct sa1100_irda *si = dev->priv; disable_irq(dev->irq); sa1100_irda_shutdown(si); /* * If we have been doing DMA receive, make sure we * tidy that up cleanly. */ if (si->rxskb) { pci_unmap_single(NULL, si->rxbuf_dma, HPSIR_MAX_RXLEN, PCI_DMA_FROMDEVICE); dev_kfree_skb(si->rxskb); si->rxskb = NULL; } /* Stop IrLAP */ if (si->irlap) { irlap_close(si->irlap); si->irlap = NULL; } netif_stop_queue(dev); si->open = 0; /* * Free resources */ sa1100_free_dma(si->txdma); sa1100_free_dma(si->rxdma); free_irq(dev->irq, dev); sa1100_set_power(si, 0); MOD_DEC_USE_COUNT; return 0; }
static int sa1100_irda_start(struct net_device *dev) { struct sa1100_irda *si = dev->priv; int err; si->speed = 9600; err = request_irq(dev->irq, sa1100_irda_irq, 0, dev->name, dev); if (err) goto err_irq; err = sa1100_request_dma(DMA_Ser2HSSPRd, "IrDA receive", NULL, NULL, &si->rxdma); if (err) goto err_rx_dma; err = sa1100_request_dma(DMA_Ser2HSSPWr, "IrDA transmit", sa1100_irda_txdma_irq, dev, &si->txdma); if (err) goto err_tx_dma; /* * The interrupt must remain disabled for now. */ disable_irq(dev->irq); /* * Setup the serial port for the specified speed. */ err = sa1100_irda_startup(si); if (err) goto err_startup; /* * Open a new IrLAP layer instance. */ si->irlap = irlap_open(dev, &si->qos, "sa1100"); err = -ENOMEM; if (!si->irlap) goto err_irlap; /* * Now enable the interrupt and start the queue */ si->open = 1; sa1100_set_power(si, power_level); /* low power mode */ enable_irq(dev->irq); netif_start_queue(dev); return 0; err_irlap: si->open = 0; sa1100_irda_shutdown(si); err_startup: sa1100_free_dma(si->txdma); err_tx_dma: sa1100_free_dma(si->rxdma); err_rx_dma: free_irq(dev->irq, dev); err_irq: return err; }