diff --git a/drivers/net/irda/Kconfig b/drivers/net/irda/Kconfig index 65806956728a..ce816ba9c40d 100644 --- a/drivers/net/irda/Kconfig +++ b/drivers/net/irda/Kconfig @@ -190,147 +190,6 @@ config KS959_DONGLE To compile it as a module, choose M here: the module will be called ks959-sir. -comment "Old SIR device drivers" - -config IRPORT_SIR - tristate "IrPORT (IrDA serial driver)" - depends on IRDA && BROKEN_ON_SMP - ---help--- - Say Y here if you want to build support for the IrPORT IrDA device - driver. To compile it as a module, choose M here: the module will be - called irport. IrPORT can be used instead of IrTTY and sometimes - this can be better. One example is if your IrDA port does not - have echo-canceling, which will work OK with IrPORT since this - driver is working in half-duplex mode only. You don't need to use - irattach with IrPORT, but you just insert it the same way as FIR - drivers (insmod irport io=0x3e8 irq=11). Notice that IrPORT is a - SIR device driver which means that speed is limited to 115200 bps. - - If unsure, say Y. - -comment "Old Serial dongle support" - -config DONGLE_OLD - bool "Old Serial dongle support" - depends on IRPORT_SIR && BROKEN_ON_SMP - help - Say Y here if you have an infrared device that connects to your - computer's serial port. These devices are called dongles. Then say Y - or M to the driver for your particular dongle below. - - Note that the answer to this question won't directly affect the - kernel: saying N will just cause the configurator to skip all - the questions about serial dongles. - -config ESI_DONGLE_OLD - tristate "ESI JetEye PC dongle" - depends on DONGLE_OLD && IRDA - help - Say Y here if you want to build support for the Extended Systems - JetEye PC dongle. To compile it as a module, choose M here. The ESI - dongle attaches to the normal 9-pin serial port connector, and can - currently only be used by IrTTY. To activate support for ESI - dongles you will have to start irattach like this: - "irattach -d esi". - -config ACTISYS_DONGLE_OLD - tristate "ACTiSYS IR-220L and IR220L+ dongle" - depends on DONGLE_OLD && IRDA - help - Say Y here if you want to build support for the ACTiSYS IR-220L and - IR220L+ dongles. To compile it as a module, choose M here. The - ACTiSYS dongles attaches to the normal 9-pin serial port connector, - and can currently only be used by IrTTY. To activate support for - ACTiSYS dongles you will have to start irattach like this: - "irattach -d actisys" or "irattach -d actisys+". - -config TEKRAM_DONGLE_OLD - tristate "Tekram IrMate 210B dongle" - depends on DONGLE_OLD && IRDA - help - Say Y here if you want to build support for the Tekram IrMate 210B - dongle. To compile it as a module, choose M here. The Tekram dongle - attaches to the normal 9-pin serial port connector, and can - currently only be used by IrTTY. To activate support for Tekram - dongles you will have to start irattach like this: - "irattach -d tekram". - -config GIRBIL_DONGLE_OLD - tristate "Greenwich GIrBIL dongle" - depends on DONGLE_OLD && IRDA - help - Say Y here if you want to build support for the Greenwich GIrBIL - dongle. To compile it as a module, choose M here. The Greenwich - dongle attaches to the normal 9-pin serial port connector, and can - currently only be used by IrTTY. To activate support for Greenwich - dongles you will have to insert "irattach -d girbil" in the - /etc/irda/drivers script. - -config LITELINK_DONGLE_OLD - tristate "Parallax LiteLink dongle" - depends on DONGLE_OLD && IRDA - help - Say Y here if you want to build support for the Parallax Litelink - dongle. To compile it as a module, choose M here. The Parallax - dongle attaches to the normal 9-pin serial port connector, and can - currently only be used by IrTTY. To activate support for Parallax - dongles you will have to start irattach like this: - "irattach -d litelink". - -config MCP2120_DONGLE_OLD - tristate "Microchip MCP2120" - depends on DONGLE_OLD && IRDA - help - Say Y here if you want to build support for the Microchip MCP2120 - dongle. To compile it as a module, choose M here. The MCP2120 dongle - attaches to the normal 9-pin serial port connector, and can - currently only be used by IrTTY. To activate support for MCP2120 - dongles you will have to insert "irattach -d mcp2120" in the - /etc/irda/drivers script. - - You must build this dongle yourself. For more information see: - - -config OLD_BELKIN_DONGLE_OLD - tristate "Old Belkin dongle" - depends on DONGLE_OLD && IRDA - help - Say Y here if you want to build support for the Adaptec Airport 1000 - and 2000 dongles. To compile it as a module, choose M here: the module - will be called old_belkin. Some information is contained in the - comments at the top of . - -config ACT200L_DONGLE_OLD - tristate "ACTiSYS IR-200L dongle (EXPERIMENTAL)" - depends on DONGLE_OLD && EXPERIMENTAL && IRDA - help - Say Y here if you want to build support for the ACTiSYS IR-200L - dongle. To compile it as a module, choose M here. The ACTiSYS - IR-200L dongle attaches to the normal 9-pin serial port connector, - and can currently only be used by IrTTY. To activate support for - ACTiSYS IR-200L dongles you will have to start irattach like this: - "irattach -d act200l". - -config MA600_DONGLE_OLD - tristate "Mobile Action MA600 dongle (EXPERIMENTAL)" - depends on DONGLE_OLD && EXPERIMENTAL && IRDA - ---help--- - Say Y here if you want to build support for the Mobile Action MA600 - dongle. To compile it as a module, choose M here. The MA600 dongle - attaches to the normal 9-pin serial port connector, and can - currently only be tested on IrCOMM. To activate support for MA600 - dongles you will have to insert "irattach -d ma600" in the - /etc/irda/drivers script. Note: irutils 0.9.15 requires no - modification. irutils 0.9.9 needs modification. For more - information, download the following tar gzip file. - - There is a pre-compiled module on - - -config EP7211_IR - tristate "EP7211 I/R support" - depends on DONGLE_OLD && ARCH_EP7211 && IRDA - comment "FIR device drivers" config USB_IRDA diff --git a/drivers/net/irda/Makefile b/drivers/net/irda/Makefile index fefbb5909081..5d20fde32a24 100644 --- a/drivers/net/irda/Makefile +++ b/drivers/net/irda/Makefile @@ -5,8 +5,6 @@ # Rewritten to use lists instead of if-statements. # -# Old SIR drivers -obj-$(CONFIG_IRPORT_SIR) += irport.o # FIR drivers obj-$(CONFIG_USB_IRDA) += irda-usb.o obj-$(CONFIG_SIGMATEL_FIR) += stir4200.o @@ -20,21 +18,10 @@ obj-$(CONFIG_VLSI_FIR) += vlsi_ir.o obj-$(CONFIG_VIA_FIR) += via-ircc.o obj-$(CONFIG_PXA_FICP) += pxaficp_ir.o obj-$(CONFIG_MCS_FIR) += mcs7780.o -# Old dongle drivers for old SIR drivers -obj-$(CONFIG_ESI_DONGLE_OLD) += esi.o -obj-$(CONFIG_TEKRAM_DONGLE_OLD) += tekram.o -obj-$(CONFIG_ACTISYS_DONGLE_OLD) += actisys.o -obj-$(CONFIG_GIRBIL_DONGLE_OLD) += girbil.o -obj-$(CONFIG_LITELINK_DONGLE_OLD) += litelink.o -obj-$(CONFIG_OLD_BELKIN_DONGLE_OLD) += old_belkin.o -obj-$(CONFIG_MCP2120_DONGLE_OLD) += mcp2120.o -obj-$(CONFIG_ACT200L_DONGLE_OLD) += act200l.o -obj-$(CONFIG_MA600_DONGLE_OLD) += ma600.o -obj-$(CONFIG_EP7211_IR) += ep7211_ir.o obj-$(CONFIG_AU1000_FIR) += au1k_ir.o -# New SIR drivers +# SIR drivers obj-$(CONFIG_IRTTY_SIR) += irtty-sir.o sir-dev.o -# New dongles drivers for new SIR drivers +# dongle drivers for SIR drivers obj-$(CONFIG_ESI_DONGLE) += esi-sir.o obj-$(CONFIG_TEKRAM_DONGLE) += tekram-sir.o obj-$(CONFIG_ACTISYS_DONGLE) += actisys-sir.o diff --git a/drivers/net/irda/irport.c b/drivers/net/irda/irport.c deleted file mode 100644 index c79caa5d3d71..000000000000 --- a/drivers/net/irda/irport.c +++ /dev/null @@ -1,1123 +0,0 @@ -/********************************************************************* - * - * Filename: irport.c - * Version: 1.0 - * Description: Half duplex serial port SIR driver for IrDA. - * Status: Experimental. - * Author: Dag Brattli - * Created at: Sun Aug 3 13:49:59 1997 - * Modified at: Fri Jan 28 20:22:38 2000 - * Modified by: Dag Brattli - * Sources: serial.c by Linus Torvalds - * - * Copyright (c) 1997, 1998, 1999-2000 Dag Brattli, All Rights Reserved. - * Copyright (c) 2000-2003 Jean Tourrilhes, All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 59 Temple Place, Suite 330, Boston, - * MA 02111-1307 USA - * - * This driver is ment to be a small half duplex serial driver to be - * used for IR-chipsets that has a UART (16550) compatibility mode. - * Eventually it will replace irtty, because of irtty has some - * problems that is hard to get around when we don't have control - * over the serial driver. This driver may also be used by FIR - * drivers to handle SIR mode for them. - * - ********************************************************************/ - -#include - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include "irport.h" - -#define IO_EXTENT 8 - -/* - * Currently you'll need to set these values using insmod like this: - * insmod irport io=0x3e8 irq=11 - */ -static unsigned int io[] = { ~0, ~0, ~0, ~0 }; -static unsigned int irq[] = { 0, 0, 0, 0 }; - -static unsigned int qos_mtt_bits = 0x03; - -static struct irport_cb *dev_self[] = { NULL, NULL, NULL, NULL}; -static char *driver_name = "irport"; - -static inline void irport_write_wakeup(struct irport_cb *self); -static inline int irport_write(int iobase, int fifo_size, __u8 *buf, int len); -static inline void irport_receive(struct irport_cb *self); - -static int irport_net_ioctl(struct net_device *dev, struct ifreq *rq, - int cmd); -static inline int irport_is_receiving(struct irport_cb *self); -static int irport_set_dtr_rts(struct net_device *dev, int dtr, int rts); -static int irport_raw_write(struct net_device *dev, __u8 *buf, int len); -static struct net_device_stats *irport_net_get_stats(struct net_device *dev); -static int irport_change_speed_complete(struct irda_task *task); -static void irport_timeout(struct net_device *dev); - -static irqreturn_t irport_interrupt(int irq, void *dev_id); -static int irport_hard_xmit(struct sk_buff *skb, struct net_device *dev); -static void irport_change_speed(void *priv, __u32 speed); -static int irport_net_open(struct net_device *dev); -static int irport_net_close(struct net_device *dev); - -static struct irport_cb * -irport_open(int i, unsigned int iobase, unsigned int irq) -{ - struct net_device *dev; - struct irport_cb *self; - - IRDA_DEBUG(1, "%s()\n", __FUNCTION__); - - /* Lock the port that we need */ - if (!request_region(iobase, IO_EXTENT, driver_name)) { - IRDA_DEBUG(0, "%s(), can't get iobase of 0x%03x\n", - __FUNCTION__, iobase); - goto err_out1; - } - - /* - * Allocate new instance of the driver - */ - dev = alloc_irdadev(sizeof(struct irport_cb)); - if (!dev) { - IRDA_ERROR("%s(), can't allocate memory for " - "irda device!\n", __FUNCTION__); - goto err_out2; - } - - self = dev->priv; - spin_lock_init(&self->lock); - - /* Need to store self somewhere */ - dev_self[i] = self; - self->priv = self; - self->index = i; - - /* Initialize IO */ - self->io.sir_base = iobase; - self->io.sir_ext = IO_EXTENT; - self->io.irq = irq; - self->io.fifo_size = 16; /* 16550A and compatible */ - - /* Initialize QoS for this device */ - irda_init_max_qos_capabilies(&self->qos); - - self->qos.baud_rate.bits = IR_9600|IR_19200|IR_38400|IR_57600| - IR_115200; - - self->qos.min_turn_time.bits = qos_mtt_bits; - irda_qos_bits_to_value(&self->qos); - - /* Bootstrap ZeroCopy Rx */ - self->rx_buff.truesize = IRDA_SKB_MAX_MTU; - self->rx_buff.skb = __dev_alloc_skb(self->rx_buff.truesize, - GFP_KERNEL); - if (self->rx_buff.skb == NULL) { - IRDA_ERROR("%s(), can't allocate memory for " - "receive buffer!\n", __FUNCTION__); - goto err_out3; - } - skb_reserve(self->rx_buff.skb, 1); - self->rx_buff.head = self->rx_buff.skb->data; - /* No need to memset the buffer, unless you are really pedantic */ - - /* Finish setup the Rx buffer descriptor */ - self->rx_buff.in_frame = FALSE; - self->rx_buff.state = OUTSIDE_FRAME; - self->rx_buff.data = self->rx_buff.head; - - /* Specify how much memory we want */ - self->tx_buff.truesize = 4000; - - /* Allocate memory if needed */ - if (self->tx_buff.truesize > 0) { - self->tx_buff.head = kzalloc(self->tx_buff.truesize, - GFP_KERNEL); - if (self->tx_buff.head == NULL) { - IRDA_ERROR("%s(), can't allocate memory for " - "transmit buffer!\n", __FUNCTION__); - goto err_out4; - } - } - self->tx_buff.data = self->tx_buff.head; - - self->netdev = dev; - - /* May be overridden by piggyback drivers */ - self->interrupt = irport_interrupt; - self->change_speed = irport_change_speed; - - /* Override the network functions we need to use */ - dev->hard_start_xmit = irport_hard_xmit; - dev->tx_timeout = irport_timeout; - dev->watchdog_timeo = HZ; /* Allow time enough for speed change */ - dev->open = irport_net_open; - dev->stop = irport_net_close; - dev->get_stats = irport_net_get_stats; - dev->do_ioctl = irport_net_ioctl; - - /* Make ifconfig display some details */ - dev->base_addr = iobase; - dev->irq = irq; - - if (register_netdev(dev)) { - IRDA_ERROR("%s(), register_netdev() failed!\n", __FUNCTION__); - goto err_out5; - } - IRDA_MESSAGE("IrDA: Registered device %s (irport io=0x%X irq=%d)\n", - dev->name, iobase, irq); - - return self; - err_out5: - kfree(self->tx_buff.head); - err_out4: - kfree_skb(self->rx_buff.skb); - err_out3: - free_netdev(dev); - dev_self[i] = NULL; - err_out2: - release_region(iobase, IO_EXTENT); - err_out1: - return NULL; -} - -static int irport_close(struct irport_cb *self) -{ - IRDA_ASSERT(self != NULL, return -1;); - - /* We are not using any dongle anymore! */ - if (self->dongle) - irda_device_dongle_cleanup(self->dongle); - self->dongle = NULL; - - /* Remove netdevice */ - unregister_netdev(self->netdev); - - /* Release the IO-port that this driver is using */ - IRDA_DEBUG(0 , "%s(), Releasing Region %03x\n", - __FUNCTION__, self->io.sir_base); - release_region(self->io.sir_base, self->io.sir_ext); - - kfree(self->tx_buff.head); - - if (self->rx_buff.skb) - kfree_skb(self->rx_buff.skb); - self->rx_buff.skb = NULL; - - /* Remove ourselves */ - dev_self[self->index] = NULL; - free_netdev(self->netdev); - - return 0; -} - -static void irport_stop(struct irport_cb *self) -{ - int iobase; - - iobase = self->io.sir_base; - - /* We can't lock, we may be called from a FIR driver - Jean II */ - - /* We are not transmitting any more */ - self->transmitting = 0; - - /* Reset UART */ - outb(0, iobase+UART_MCR); - - /* Turn off interrupts */ - outb(0, iobase+UART_IER); -} - -static void irport_start(struct irport_cb *self) -{ - int iobase; - - iobase = self->io.sir_base; - - irport_stop(self); - - /* We can't lock, we may be called from a FIR driver - Jean II */ - - /* Initialize UART */ - outb(UART_LCR_WLEN8, iobase+UART_LCR); /* Reset DLAB */ - outb((UART_MCR_DTR | UART_MCR_RTS | UART_MCR_OUT2), iobase+UART_MCR); - - /* Turn on interrups */ - outb(UART_IER_RLSI | UART_IER_RDI |UART_IER_THRI, iobase+UART_IER); -} - -/* - * Function irport_get_fcr (speed) - * - * Compute value of fcr - * - */ -static inline unsigned int irport_get_fcr(__u32 speed) -{ - unsigned int fcr; /* FIFO control reg */ - - /* Enable fifos */ - fcr = UART_FCR_ENABLE_FIFO; - - /* - * Use trigger level 1 to avoid 3 ms. timeout delay at 9600 bps, and - * almost 1,7 ms at 19200 bps. At speeds above that we can just forget - * about this timeout since it will always be fast enough. - */ - if (speed < 38400) - fcr |= UART_FCR_TRIGGER_1; - else - //fcr |= UART_FCR_TRIGGER_14; - fcr |= UART_FCR_TRIGGER_8; - - return(fcr); -} - -/* - * Function irport_change_speed (self, speed) - * - * Set speed of IrDA port to specified baudrate - * - * This function should be called with irq off and spin-lock. - */ -static void irport_change_speed(void *priv, __u32 speed) -{ - struct irport_cb *self = (struct irport_cb *) priv; - int iobase; - unsigned int fcr; /* FIFO control reg */ - unsigned int lcr; /* Line control reg */ - int divisor; - - IRDA_ASSERT(self != NULL, return;); - IRDA_ASSERT(speed != 0, return;); - - IRDA_DEBUG(1, "%s(), Setting speed to: %d - iobase=%#x\n", - __FUNCTION__, speed, self->io.sir_base); - - /* We can't lock, we may be called from a FIR driver - Jean II */ - - iobase = self->io.sir_base; - - /* Update accounting for new speed */ - self->io.speed = speed; - - /* Turn off interrupts */ - outb(0, iobase+UART_IER); - - divisor = SPEED_MAX/speed; - - /* Get proper fifo configuration */ - fcr = irport_get_fcr(speed); - - /* IrDA ports use 8N1 */ - lcr = UART_LCR_WLEN8; - - outb(UART_LCR_DLAB | lcr, iobase+UART_LCR); /* Set DLAB */ - outb(divisor & 0xff, iobase+UART_DLL); /* Set speed */ - outb(divisor >> 8, iobase+UART_DLM); - outb(lcr, iobase+UART_LCR); /* Set 8N1 */ - outb(fcr, iobase+UART_FCR); /* Enable FIFO's */ - - /* Turn on interrups */ - /* This will generate a fatal interrupt storm. - * People calling us will do that properly - Jean II */ - //outb(/*UART_IER_RLSI|*/UART_IER_RDI/*|UART_IER_THRI*/, iobase+UART_IER); -} - -/* - * Function __irport_change_speed (instance, state, param) - * - * State machine for changing speed of the device. We do it this way since - * we cannot use schedule_timeout() when we are in interrupt context - * - */ -static int __irport_change_speed(struct irda_task *task) -{ - struct irport_cb *self; - __u32 speed = (__u32) task->param; - unsigned long flags = 0; - int wasunlocked = 0; - int ret = 0; - - IRDA_DEBUG(2, "%s(), <%ld>\n", __FUNCTION__, jiffies); - - self = (struct irport_cb *) task->instance; - - IRDA_ASSERT(self != NULL, return -1;); - - /* Locking notes : this function may be called from irq context with - * spinlock, via irport_write_wakeup(), or from non-interrupt without - * spinlock (from the task timer). Yuck ! - * This is ugly, and unsafe is the spinlock is not already acquired. - * This will be fixed when irda-task get rewritten. - * Jean II */ - if (!spin_is_locked(&self->lock)) { - spin_lock_irqsave(&self->lock, flags); - wasunlocked = 1; - } - - switch (task->state) { - case IRDA_TASK_INIT: - case IRDA_TASK_WAIT: - /* Are we ready to change speed yet? */ - if (self->tx_buff.len > 0) { - task->state = IRDA_TASK_WAIT; - - /* Try again later */ - ret = msecs_to_jiffies(20); - break; - } - - if (self->dongle) - irda_task_next_state(task, IRDA_TASK_CHILD_INIT); - else - irda_task_next_state(task, IRDA_TASK_CHILD_DONE); - break; - case IRDA_TASK_CHILD_INIT: - /* Go to default speed */ - self->change_speed(self->priv, 9600); - - /* Change speed of dongle */ - if (irda_task_execute(self->dongle, - self->dongle->issue->change_speed, - NULL, task, (void *) speed)) - { - /* Dongle need more time to change its speed */ - irda_task_next_state(task, IRDA_TASK_CHILD_WAIT); - - /* Give dongle 1 sec to finish */ - ret = msecs_to_jiffies(1000); - } else - /* Child finished immediately */ - irda_task_next_state(task, IRDA_TASK_CHILD_DONE); - break; - case IRDA_TASK_CHILD_WAIT: - IRDA_WARNING("%s(), changing speed of dongle timed out!\n", __FUNCTION__); - ret = -1; - break; - case IRDA_TASK_CHILD_DONE: - /* Finally we are ready to change the speed */ - self->change_speed(self->priv, speed); - - irda_task_next_state(task, IRDA_TASK_DONE); - break; - default: - IRDA_ERROR("%s(), unknown state %d\n", - __FUNCTION__, task->state); - irda_task_next_state(task, IRDA_TASK_DONE); - ret = -1; - break; - } - /* Put stuff in the state we found them - Jean II */ - if(wasunlocked) { - spin_unlock_irqrestore(&self->lock, flags); - } - - return ret; -} - -/* - * Function irport_change_speed_complete (task) - * - * Called when the change speed operation completes - * - */ -static int irport_change_speed_complete(struct irda_task *task) -{ - struct irport_cb *self; - - IRDA_DEBUG(1, "%s()\n", __FUNCTION__); - - self = (struct irport_cb *) task->instance; - - IRDA_ASSERT(self != NULL, return -1;); - IRDA_ASSERT(self->netdev != NULL, return -1;); - - /* Finished changing speed, so we are not busy any longer */ - /* Signal network layer so it can try to send the frame */ - - netif_wake_queue(self->netdev); - - return 0; -} - -/* - * Function irport_timeout (struct net_device *dev) - * - * The networking layer thinks we timed out. - * - */ - -static void irport_timeout(struct net_device *dev) -{ - struct irport_cb *self; - int iobase; - int iir, lsr; - unsigned long flags; - - self = (struct irport_cb *) dev->priv; - IRDA_ASSERT(self != NULL, return;); - iobase = self->io.sir_base; - - IRDA_WARNING("%s: transmit timed out, jiffies = %ld, trans_start = %ld\n", - dev->name, jiffies, dev->trans_start); - spin_lock_irqsave(&self->lock, flags); - - /* Debug what's happening... */ - - /* Get interrupt status */ - lsr = inb(iobase+UART_LSR); - /* Read interrupt register */ - iir = inb(iobase+UART_IIR); - IRDA_DEBUG(0, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n", - __FUNCTION__, iir, lsr, iobase); - - IRDA_DEBUG(0, "%s(), transmitting=%d, remain=%d, done=%td\n", - __FUNCTION__, self->transmitting, self->tx_buff.len, - self->tx_buff.data - self->tx_buff.head); - - /* Now, restart the port */ - irport_start(self); - self->change_speed(self->priv, self->io.speed); - /* This will re-enable irqs */ - outb(/*UART_IER_RLSI|*/UART_IER_RDI/*|UART_IER_THRI*/, iobase+UART_IER); - dev->trans_start = jiffies; - spin_unlock_irqrestore(&self->lock, flags); - - netif_wake_queue(dev); -} - -/* - * Function irport_wait_hw_transmitter_finish () - * - * Wait for the real end of HW transmission - * - * The UART is a strict FIFO, and we get called only when we have finished - * pushing data to the FIFO, so the maximum amount of time we must wait - * is only for the FIFO to drain out. - * - * We use a simple calibrated loop. We may need to adjust the loop - * delay (udelay) to balance I/O traffic and latency. And we also need to - * adjust the maximum timeout. - * It would probably be better to wait for the proper interrupt, - * but it doesn't seem to be available. - * - * We can't use jiffies or kernel timers because : - * 1) We are called from the interrupt handler, which disable softirqs, - * so jiffies won't be increased - * 2) Jiffies granularity is usually very coarse (10ms), and we don't - * want to wait that long to detect stuck hardware. - * Jean II - */ - -static void irport_wait_hw_transmitter_finish(struct irport_cb *self) -{ - int iobase; - int count = 1000; /* 1 ms */ - - iobase = self->io.sir_base; - - /* Calibrated busy loop */ - while((count-- > 0) && !(inb(iobase+UART_LSR) & UART_LSR_TEMT)) - udelay(1); - - if(count == 0) - IRDA_DEBUG(0, "%s(): stuck transmitter\n", __FUNCTION__); -} - -/* - * Function irport_hard_start_xmit (struct sk_buff *skb, struct net_device *dev) - * - * Transmits the current frame until FIFO is full, then - * waits until the next transmitt interrupt, and continues until the - * frame is transmitted. - */ -static int irport_hard_xmit(struct sk_buff *skb, struct net_device *dev) -{ - struct irport_cb *self; - unsigned long flags; - int iobase; - s32 speed; - - IRDA_DEBUG(1, "%s()\n", __FUNCTION__); - - IRDA_ASSERT(dev != NULL, return 0;); - - self = (struct irport_cb *) dev->priv; - IRDA_ASSERT(self != NULL, return 0;); - - iobase = self->io.sir_base; - - netif_stop_queue(dev); - - /* Make sure tests & speed change are atomic */ - spin_lock_irqsave(&self->lock, flags); - - /* Check if we need to change the speed */ - speed = irda_get_next_speed(skb); - if ((speed != self->io.speed) && (speed != -1)) { - /* Check for empty frame */ - if (!skb->len) { - /* - * We send frames one by one in SIR mode (no - * pipelining), so at this point, if we were sending - * a previous frame, we just received the interrupt - * telling us it is finished (UART_IIR_THRI). - * Therefore, waiting for the transmitter to really - * finish draining the fifo won't take too long. - * And the interrupt handler is not expected to run. - * - Jean II */ - irport_wait_hw_transmitter_finish(self); - /* Better go there already locked - Jean II */ - irda_task_execute(self, __irport_change_speed, - irport_change_speed_complete, - NULL, (void *) speed); - dev->trans_start = jiffies; - spin_unlock_irqrestore(&self->lock, flags); - dev_kfree_skb(skb); - return 0; - } else - self->new_speed = speed; - } - - /* Init tx buffer */ - self->tx_buff.data = self->tx_buff.head; - - /* Copy skb to tx_buff while wrapping, stuffing and making CRC */ - self->tx_buff.len = async_wrap_skb(skb, self->tx_buff.data, - self->tx_buff.truesize); - - self->stats.tx_bytes += self->tx_buff.len; - - /* We are transmitting */ - self->transmitting = 1; - - /* Turn on transmit finished interrupt. Will fire immediately! */ - outb(UART_IER_THRI, iobase+UART_IER); - - dev->trans_start = jiffies; - spin_unlock_irqrestore(&self->lock, flags); - - dev_kfree_skb(skb); - - return 0; -} - -/* - * Function irport_write (driver) - * - * Fill Tx FIFO with transmit data - * - * Called only from irport_write_wakeup() - */ -static inline int irport_write(int iobase, int fifo_size, __u8 *buf, int len) -{ - int actual = 0; - - /* Fill FIFO with current frame */ - while ((actual < fifo_size) && (actual < len)) { - /* Transmit next byte */ - outb(buf[actual], iobase+UART_TX); - - actual++; - } - - return actual; -} - -/* - * Function irport_write_wakeup (tty) - * - * Called by the driver when there's room for more data. If we have - * more packets to send, we send them here. - * - * Called only from irport_interrupt() - * Make sure this function is *not* called while we are receiving, - * otherwise we will reset fifo and loose data :-( - */ -static inline void irport_write_wakeup(struct irport_cb *self) -{ - int actual = 0; - int iobase; - unsigned int fcr; - - IRDA_ASSERT(self != NULL, return;); - - IRDA_DEBUG(4, "%s()\n", __FUNCTION__); - - iobase = self->io.sir_base; - - /* Finished with frame? */ - if (self->tx_buff.len > 0) { - /* Write data left in transmit buffer */ - actual = irport_write(iobase, self->io.fifo_size, - self->tx_buff.data, self->tx_buff.len); - self->tx_buff.data += actual; - self->tx_buff.len -= actual; - } else { - /* - * Now serial buffer is almost free & we can start - * transmission of another packet. But first we must check - * if we need to change the speed of the hardware - */ - if (self->new_speed) { - irport_wait_hw_transmitter_finish(self); - irda_task_execute(self, __irport_change_speed, - irport_change_speed_complete, - NULL, (void *) self->new_speed); - self->new_speed = 0; - } else { - /* Tell network layer that we want more frames */ - netif_wake_queue(self->netdev); - } - self->stats.tx_packets++; - - /* - * Reset Rx FIFO to make sure that all reflected transmit data - * is discarded. This is needed for half duplex operation - */ - fcr = irport_get_fcr(self->io.speed); - fcr |= UART_FCR_CLEAR_RCVR; - outb(fcr, iobase+UART_FCR); - - /* Finished transmitting */ - self->transmitting = 0; - - /* Turn on receive interrupts */ - outb(UART_IER_RDI, iobase+UART_IER); - - IRDA_DEBUG(1, "%s() : finished Tx\n", __FUNCTION__); - } -} - -/* - * Function irport_receive (self) - * - * Receive one frame from the infrared port - * - * Called only from irport_interrupt() - */ -static inline void irport_receive(struct irport_cb *self) -{ - int boguscount = 0; - int iobase; - - IRDA_ASSERT(self != NULL, return;); - - iobase = self->io.sir_base; - - /* - * Receive all characters in Rx FIFO, unwrap and unstuff them. - * async_unwrap_char will deliver all found frames - */ - do { - async_unwrap_char(self->netdev, &self->stats, &self->rx_buff, - inb(iobase+UART_RX)); - - /* Make sure we don't stay here too long */ - if (boguscount++ > 32) { - IRDA_DEBUG(2,"%s(), breaking!\n", __FUNCTION__); - break; - } - } while (inb(iobase+UART_LSR) & UART_LSR_DR); -} - -/* - * Function irport_interrupt (irq, dev_id) - * - * Interrupt handler - */ -static irqreturn_t irport_interrupt(int irq, void *dev_id) -{ - struct net_device *dev = dev_id; - struct irport_cb *self; - int boguscount = 0; - int iobase; - int iir, lsr; - int handled = 0; - - self = dev->priv; - - spin_lock(&self->lock); - - iobase = self->io.sir_base; - - /* Cut'n'paste interrupt routine from serial.c - * This version try to minimise latency and I/O operations. - * Simplified and modified to enforce half duplex operation. - * - Jean II */ - - /* Check status even is iir reg is cleared, more robust and - * eliminate a read on the I/O bus - Jean II */ - do { - /* Get interrupt status ; Clear interrupt */ - lsr = inb(iobase+UART_LSR); - - /* Are we receiving or transmitting ? */ - if(!self->transmitting) { - /* Received something ? */ - if (lsr & UART_LSR_DR) - irport_receive(self); - } else { - /* Room in Tx fifo ? */ - if (lsr & (UART_LSR_THRE | UART_LSR_TEMT)) - irport_write_wakeup(self); - } - - /* A bit hackish, but working as expected... Jean II */ - if(lsr & (UART_LSR_THRE | UART_LSR_TEMT | UART_LSR_DR)) - handled = 1; - - /* Make sure we don't stay here to long */ - if (boguscount++ > 10) { - IRDA_WARNING("%s() irq handler looping : lsr=%02x\n", - __FUNCTION__, lsr); - break; - } - - /* Read interrupt register */ - iir = inb(iobase+UART_IIR); - - /* Enable this debug only when no other options and at low - * bit rates, otherwise it may cause Rx overruns (lsr=63). - * - Jean II */ - IRDA_DEBUG(6, "%s(), iir=%02x, lsr=%02x, iobase=%#x\n", - __FUNCTION__, iir, lsr, iobase); - - /* As long as interrupt pending... */ - } while ((iir & UART_IIR_NO_INT) == 0); - - spin_unlock(&self->lock); - return IRQ_RETVAL(handled); -} - -/* - * Function irport_net_open (dev) - * - * Network device is taken up. Usually this is done by "ifconfig irda0 up" - * - */ -static int irport_net_open(struct net_device *dev) -{ - struct irport_cb *self; - int iobase; - char hwname[16]; - unsigned long flags; - - IRDA_DEBUG(2, "%s()\n", __FUNCTION__); - - IRDA_ASSERT(dev != NULL, return -1;); - self = (struct irport_cb *) dev->priv; - - iobase = self->io.sir_base; - - if (request_irq(self->io.irq, self->interrupt, 0, dev->name, - (void *) dev)) { - IRDA_DEBUG(0, "%s(), unable to allocate irq=%d\n", - __FUNCTION__, self->io.irq); - return -EAGAIN; - } - - spin_lock_irqsave(&self->lock, flags); - /* Init uart */ - irport_start(self); - /* Set 9600 bauds per default, including at the dongle */ - irda_task_execute(self, __irport_change_speed, - irport_change_speed_complete, - NULL, (void *) 9600); - spin_unlock_irqrestore(&self->lock, flags); - - - /* Give self a hardware name */ - sprintf(hwname, "SIR @ 0x%03x", self->io.sir_base); - - /* - * Open new IrLAP layer instance, now that everything should be - * initialized properly - */ - self->irlap = irlap_open(dev, &self->qos, hwname); - - /* Ready to play! */ - - netif_start_queue(dev); - - return 0; -} - -/* - * Function irport_net_close (self) - * - * Network device is taken down. Usually this is done by - * "ifconfig irda0 down" - */ -static int irport_net_close(struct net_device *dev) -{ - struct irport_cb *self; - int iobase; - unsigned long flags; - - IRDA_DEBUG(4, "%s()\n", __FUNCTION__); - - IRDA_ASSERT(dev != NULL, return -1;); - self = (struct irport_cb *) dev->priv; - - IRDA_ASSERT(self != NULL, return -1;); - - iobase = self->io.sir_base; - - /* Stop device */ - netif_stop_queue(dev); - - /* Stop and remove instance of IrLAP */ - if (self->irlap) - irlap_close(self->irlap); - self->irlap = NULL; - - spin_lock_irqsave(&self->lock, flags); - irport_stop(self); - spin_unlock_irqrestore(&self->lock, flags); - - free_irq(self->io.irq, dev); - - return 0; -} - -/* - * Function irport_is_receiving (self) - * - * Returns true is we are currently receiving data - * - */ -static inline int irport_is_receiving(struct irport_cb *self) -{ - return (self->rx_buff.state != OUTSIDE_FRAME); -} - -/* - * Function irport_set_dtr_rts (tty, dtr, rts) - * - * This function can be used by dongles etc. to set or reset the status - * of the dtr and rts lines - */ -static int irport_set_dtr_rts(struct net_device *dev, int dtr, int rts) -{ - struct irport_cb *self = dev->priv; - int iobase; - - IRDA_ASSERT(self != NULL, return -1;); - - iobase = self->io.sir_base; - - if (dtr) - dtr = UART_MCR_DTR; - if (rts) - rts = UART_MCR_RTS; - - outb(dtr|rts|UART_MCR_OUT2, iobase+UART_MCR); - - return 0; -} - -static int irport_raw_write(struct net_device *dev, __u8 *buf, int len) -{ - struct irport_cb *self = (struct irport_cb *) dev->priv; - int actual = 0; - int iobase; - - IRDA_ASSERT(self != NULL, return -1;); - - iobase = self->io.sir_base; - - /* Tx FIFO should be empty! */ - if (!(inb(iobase+UART_LSR) & UART_LSR_THRE)) { - IRDA_DEBUG( 0, "%s(), failed, fifo not empty!\n", __FUNCTION__); - return -1; - } - - /* Fill FIFO with current frame */ - while (actual < len) { - /* Transmit next byte */ - outb(buf[actual], iobase+UART_TX); - actual++; - } - - return actual; -} - -/* - * Function irport_net_ioctl (dev, rq, cmd) - * - * Process IOCTL commands for this device - * - */ -static int irport_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd) -{ - struct if_irda_req *irq = (struct if_irda_req *) rq; - struct irport_cb *self; - dongle_t *dongle; - unsigned long flags; - int ret = 0; - - IRDA_ASSERT(dev != NULL, return -1;); - - self = dev->priv; - - IRDA_ASSERT(self != NULL, return -1;); - - IRDA_DEBUG(2, "%s(), %s, (cmd=0x%X)\n", __FUNCTION__, dev->name, cmd); - - switch (cmd) { - case SIOCSBANDWIDTH: /* Set bandwidth */ - if (!capable(CAP_NET_ADMIN)) - ret = -EPERM; - else - irda_task_execute(self, __irport_change_speed, NULL, - NULL, (void *) irq->ifr_baudrate); - break; - case SIOCSDONGLE: /* Set dongle */ - if (!capable(CAP_NET_ADMIN)) { - ret = -EPERM; - break; - } - - /* Locking : - * irda_device_dongle_init() can't be locked. - * irda_task_execute() doesn't need to be locked. - * Jean II - */ - - /* Initialize dongle */ - dongle = irda_device_dongle_init(dev, irq->ifr_dongle); - if (!dongle) - break; - - dongle->set_mode = NULL; - dongle->read = NULL; - dongle->write = irport_raw_write; - dongle->set_dtr_rts = irport_set_dtr_rts; - - /* Now initialize the dongle! */ - dongle->issue->open(dongle, &self->qos); - - /* Reset dongle */ - irda_task_execute(dongle, dongle->issue->reset, NULL, NULL, - NULL); - - /* Make dongle available to driver only now to avoid - * race conditions - Jean II */ - self->dongle = dongle; - break; - case SIOCSMEDIABUSY: /* Set media busy */ - if (!capable(CAP_NET_ADMIN)) { - ret = -EPERM; - break; - } - - irda_device_set_media_busy(self->netdev, TRUE); - break; - case SIOCGRECEIVING: /* Check if we are receiving right now */ - irq->ifr_receiving = irport_is_receiving(self); - break; - case SIOCSDTRRTS: - if (!capable(CAP_NET_ADMIN)) { - ret = -EPERM; - break; - } - - /* No real need to lock... */ - spin_lock_irqsave(&self->lock, flags); - irport_set_dtr_rts(dev, irq->ifr_dtr, irq->ifr_rts); - spin_unlock_irqrestore(&self->lock, flags); - break; - default: - ret = -EOPNOTSUPP; - } - - return ret; -} - -static struct net_device_stats *irport_net_get_stats(struct net_device *dev) -{ - struct irport_cb *self = (struct irport_cb *) dev->priv; - - return &self->stats; -} - -static int __init irport_init(void) -{ - int i; - - for (i=0; (io[i] < 2000) && (i < ARRAY_SIZE(dev_self)); i++) { - if (irport_open(i, io[i], irq[i]) != NULL) - return 0; - } - /* - * Maybe something failed, but we can still be usable for FIR drivers - */ - return 0; -} - -/* - * Function irport_cleanup () - * - * Close all configured ports - * - */ -static void __exit irport_cleanup(void) -{ - int i; - - IRDA_DEBUG( 4, "%s()\n", __FUNCTION__); - - for (i=0; i < ARRAY_SIZE(dev_self); i++) { - if (dev_self[i]) - irport_close(dev_self[i]); - } -} - -module_param_array(io, int, NULL, 0); -MODULE_PARM_DESC(io, "Base I/O addresses"); -module_param_array(irq, int, NULL, 0); -MODULE_PARM_DESC(irq, "IRQ lines"); - -MODULE_AUTHOR("Dag Brattli "); -MODULE_DESCRIPTION("Half duplex serial driver for IrDA SIR mode"); -MODULE_LICENSE("GPL"); - -module_init(irport_init); -module_exit(irport_cleanup); - diff --git a/drivers/net/irda/irport.h b/drivers/net/irda/irport.h deleted file mode 100644 index 39829cffba13..000000000000 --- a/drivers/net/irda/irport.h +++ /dev/null @@ -1,80 +0,0 @@ -/********************************************************************* - * - * Filename: irport.h - * Version: 0.1 - * Description: Serial driver for IrDA - * Status: Experimental. - * Author: Dag Brattli - * Created at: Sun Aug 3 13:49:59 1997 - * Modified at: Fri Jan 14 10:21:10 2000 - * Modified by: Dag Brattli - * - * Copyright (c) 1997, 1998-2000 Dag Brattli - * All Rights Reserved. - * - * This program is free software; you can redistribute it and/or - * modify it under the terms of the GNU General Public License as - * published by the Free Software Foundation; either version 2 of - * the License, or (at your option) any later version. - * - * Neither Dag Brattli nor University of Tromsø admit liability nor - * provide warranty for any of this software. This material is - * provided "AS-IS" and at no charge. - * - ********************************************************************/ - -#ifndef IRPORT_H -#define IRPORT_H - -#include -#include -#include -#include - -#include - -#define SPEED_DEFAULT 9600 -#define SPEED_MAX 115200 - -/* - * These are the supported serial types. - */ -#define PORT_UNKNOWN 0 -#define PORT_8250 1 -#define PORT_16450 2 -#define PORT_16550 3 -#define PORT_16550A 4 -#define PORT_CIRRUS 5 -#define PORT_16650 6 -#define PORT_MAX 6 - -#define FRAME_MAX_SIZE 2048 - -struct irport_cb { - struct net_device *netdev; /* Yes! we are some kind of netdevice */ - struct net_device_stats stats; - - struct irlap_cb *irlap; /* The link layer we are attached to */ - - chipio_t io; /* IrDA controller information */ - iobuff_t tx_buff; /* Transmit buffer */ - iobuff_t rx_buff; /* Receive buffer */ - - struct qos_info qos; /* QoS capabilities for this device */ - dongle_t *dongle; /* Dongle driver */ - - __u32 flags; /* Interface flags */ - __u32 new_speed; - int mode; - int index; /* Instance index */ - int transmitting; /* Are we transmitting ? */ - - spinlock_t lock; /* For serializing operations */ - - /* For piggyback drivers */ - void *priv; - void (*change_speed)(void *priv, __u32 speed); - irq_handler_t interrupt; -}; - -#endif /* IRPORT_H */ diff --git a/include/net/irda/irda_device.h b/include/net/irda/irda_device.h index bca19ca7bdd4..f70e9b39ebaf 100644 --- a/include/net/irda/irda_device.h +++ b/include/net/irda/irda_device.h @@ -228,21 +228,8 @@ static inline int irda_device_txqueue_empty(const struct net_device *dev) int irda_device_set_raw_mode(struct net_device* self, int status); struct net_device *alloc_irdadev(int sizeof_priv); -/* Dongle interface */ -void irda_device_unregister_dongle(struct dongle_reg *dongle); -int irda_device_register_dongle(struct dongle_reg *dongle); -dongle_t *irda_device_dongle_init(struct net_device *dev, int type); -int irda_device_dongle_cleanup(dongle_t *dongle); - void irda_setup_dma(int channel, dma_addr_t buffer, int count, int mode); -void irda_task_delete(struct irda_task *task); -struct irda_task *irda_task_execute(void *instance, - IRDA_TASK_CALLBACK function, - IRDA_TASK_CALLBACK finished, - struct irda_task *parent, void *param); -void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state); - /* * Function irda_get_mtt (skb) * diff --git a/net/irda/irda_device.c b/net/irda/irda_device.c index 435b563d29a6..87185910d0ee 100644 --- a/net/irda/irda_device.c +++ b/net/irda/irda_device.c @@ -57,20 +57,6 @@ static void __irda_task_delete(struct irda_task *task); static hashbin_t *dongles = NULL; static hashbin_t *tasks = NULL; -#ifdef CONFIG_IRDA_DEBUG -static const char *task_state[] = { - "IRDA_TASK_INIT", - "IRDA_TASK_DONE", - "IRDA_TASK_WAIT", - "IRDA_TASK_WAIT1", - "IRDA_TASK_WAIT2", - "IRDA_TASK_WAIT3", - "IRDA_TASK_CHILD_INIT", - "IRDA_TASK_CHILD_WAIT", - "IRDA_TASK_CHILD_DONE", -}; -#endif /* CONFIG_IRDA_DEBUG */ - static void irda_task_timer_expired(void *data); int __init irda_device_init( void) @@ -176,14 +162,6 @@ int irda_device_is_receiving(struct net_device *dev) return req.ifr_receiving; } -void irda_task_next_state(struct irda_task *task, IRDA_TASK_STATE state) -{ - IRDA_DEBUG(2, "%s(), state = %s\n", __FUNCTION__, task_state[state]); - - task->state = state; -} -EXPORT_SYMBOL(irda_task_next_state); - static void __irda_task_delete(struct irda_task *task) { del_timer(&task->timer); @@ -191,14 +169,13 @@ static void __irda_task_delete(struct irda_task *task) kfree(task); } -void irda_task_delete(struct irda_task *task) +static void irda_task_delete(struct irda_task *task) { /* Unregister task */ hashbin_remove(tasks, (long) task, NULL); __irda_task_delete(task); } -EXPORT_SYMBOL(irda_task_delete); /* * Function irda_task_kick (task) @@ -271,51 +248,6 @@ static int irda_task_kick(struct irda_task *task) return finished; } -/* - * Function irda_task_execute (instance, function, finished) - * - * This function registers and tries to execute tasks that may take some - * time to complete. We do it this hairy way since we may have been - * called from interrupt context, so it's not possible to use - * schedule_timeout() - * Two important notes : - * o Make sure you irda_task_delete(task); in case you delete the - * calling instance. - * o No real need to lock when calling this function, but you may - * want to lock within the task handler. - * Jean II - */ -struct irda_task *irda_task_execute(void *instance, - IRDA_TASK_CALLBACK function, - IRDA_TASK_CALLBACK finished, - struct irda_task *parent, void *param) -{ - struct irda_task *task; - - IRDA_DEBUG(2, "%s()\n", __FUNCTION__); - - task = kmalloc(sizeof(struct irda_task), GFP_ATOMIC); - if (!task) - return NULL; - - task->state = IRDA_TASK_INIT; - task->instance = instance; - task->function = function; - task->finished = finished; - task->parent = parent; - task->param = param; - task->magic = IRDA_TASK_MAGIC; - - init_timer(&task->timer); - - /* Register task */ - hashbin_insert(tasks, (irda_queue_t *) task, (long) task, NULL); - - /* No time to waste, so lets get going! */ - return irda_task_kick(task) ? NULL : task; -} -EXPORT_SYMBOL(irda_task_execute); - /* * Function irda_task_timer_expired (data) * @@ -364,105 +296,6 @@ struct net_device *alloc_irdadev(int sizeof_priv) } EXPORT_SYMBOL(alloc_irdadev); -/* - * Function irda_device_init_dongle (self, type, qos) - * - * Initialize attached dongle. - * - * Important : request_module require us to call this function with - * a process context and irq enabled. - Jean II - */ -dongle_t *irda_device_dongle_init(struct net_device *dev, int type) -{ - struct dongle_reg *reg; - dongle_t *dongle = kzalloc(sizeof(dongle_t), GFP_KERNEL); - - might_sleep(); - - spin_lock(&dongles->hb_spinlock); - reg = hashbin_find(dongles, type, NULL); - -#ifdef CONFIG_KMOD - /* Try to load the module needed */ - if (!reg && capable(CAP_SYS_MODULE)) { - spin_unlock(&dongles->hb_spinlock); - - request_module("irda-dongle-%d", type); - - spin_lock(&dongles->hb_spinlock); - reg = hashbin_find(dongles, type, NULL); - } -#endif - - if (!reg || !try_module_get(reg->owner) ) { - IRDA_ERROR("IrDA: Unable to find requested dongle type %x\n", - type); - kfree(dongle); - dongle = NULL; - } - if (dongle) { - /* Bind the registration info to this particular instance */ - dongle->issue = reg; - dongle->dev = dev; - } - spin_unlock(&dongles->hb_spinlock); - return dongle; -} -EXPORT_SYMBOL(irda_device_dongle_init); - -/* - * Function irda_device_dongle_cleanup (dongle) - */ -int irda_device_dongle_cleanup(dongle_t *dongle) -{ - IRDA_ASSERT(dongle != NULL, return -1;); - - dongle->issue->close(dongle); - module_put(dongle->issue->owner); - kfree(dongle); - - return 0; -} -EXPORT_SYMBOL(irda_device_dongle_cleanup); - -/* - * Function irda_device_register_dongle (dongle) - */ -int irda_device_register_dongle(struct dongle_reg *new) -{ - spin_lock(&dongles->hb_spinlock); - /* Check if this dongle has been registered before */ - if (hashbin_find(dongles, new->type, NULL)) { - IRDA_MESSAGE("%s: Dongle type %x already registered\n", - __FUNCTION__, new->type); - } else { - /* Insert IrDA dongle into hashbin */ - hashbin_insert(dongles, (irda_queue_t *) new, new->type, NULL); - } - spin_unlock(&dongles->hb_spinlock); - - return 0; -} -EXPORT_SYMBOL(irda_device_register_dongle); - -/* - * Function irda_device_unregister_dongle (dongle) - * - * Unregister dongle, and remove dongle from list of registered dongles - * - */ -void irda_device_unregister_dongle(struct dongle_reg *dongle) -{ - struct dongle *node; - - spin_lock(&dongles->hb_spinlock); - node = hashbin_remove(dongles, dongle->type, NULL); - if (!node) - IRDA_ERROR("%s: dongle not found!\n", __FUNCTION__); - spin_unlock(&dongles->hb_spinlock); -} -EXPORT_SYMBOL(irda_device_unregister_dongle); - #ifdef CONFIG_ISA_DMA_API /* * Function setup_dma (idev, buffer, count, mode)