summaryrefslogtreecommitdiffstats
path: root/drivers/net/irda/toshoboe.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/net/irda/toshoboe.c')
-rw-r--r--drivers/net/irda/toshoboe.c53
1 files changed, 18 insertions, 35 deletions
diff --git a/drivers/net/irda/toshoboe.c b/drivers/net/irda/toshoboe.c
index 387208e2f..1f1f2cb14 100644
--- a/drivers/net/irda/toshoboe.c
+++ b/drivers/net/irda/toshoboe.c
@@ -603,7 +603,12 @@ static int toshoboe_net_ioctl(struct net_device *dev, struct ifreq *rq, int cmd)
switch (cmd) {
case SIOCSBANDWIDTH: /* Set bandwidth */
- if (!capable(CAP_NET_ADMIN))
+ /*
+ * This function will also be used by IrLAP to change the
+ * speed, so we still must allow for speed change within
+ * interrupt context.
+ */
+ if (!in_interrupt() && !capable(CAP_NET_ADMIN))
return -EPERM;
/* toshoboe_setbaud(self, irq->ifr_baudrate); */
/* Just change speed once - inserted by Paul Bristow */
@@ -717,7 +722,7 @@ toshoboe_open (struct pci_dev *pci_dev)
self->open = 0;
self->stopped = 0;
self->pdev = pci_dev;
- self->base = pci_dev->resource[0].start;
+ self->base = pci_resource_start (pci_dev, 0);
self->io.sir_base = self->base;
self->io.irq = pci_dev->irq;
@@ -900,7 +905,6 @@ toshoboe_gotosleep (struct toshoboe_cb *self)
static void
toshoboe_wakeup (struct toshoboe_cb *self)
{
- struct net_device *dev = self->netdev;
unsigned long flags;
if (!self->stopped)
@@ -952,36 +956,26 @@ int __init toshoboe_init (void)
struct pci_dev *pci_dev = NULL;
int found = 0;
- do
- {
- pci_dev = pci_find_device (PCI_VENDOR_ID_TOSHIBA,
- PCI_DEVICE_ID_FIR701, pci_dev);
- if (pci_dev)
- {
+ while ((pci_dev = pci_find_device (PCI_VENDOR_ID_TOSHIBA,
+ PCI_DEVICE_ID_FIR701, pci_dev)) != NULL) {
+ if (pci_enable_device(pci_dev))
+ continue;
printk (KERN_WARNING "ToshOboe: Found 701 chip at 0x%0lx irq %d\n",
- pci_dev->resource[0].start,
+ pci_resource_start (pci_dev, 0),
pci_dev->irq);
if (!toshoboe_open (pci_dev))
found++;
- }
-
- }
- while (pci_dev);
-
+ }
if (found)
- {
return 0;
- }
return -ENODEV;
}
-#ifdef MODULE
-static void
-toshoboe_cleanup (void)
+static void __exit toshoboe_cleanup (void)
{
int i;
@@ -997,19 +991,8 @@ toshoboe_cleanup (void)
}
-
-int
-init_module (void)
-{
- return toshoboe_init ();
-}
-
-
-void
-cleanup_module (void)
-{
- toshoboe_cleanup ();
-}
-
-
+#ifdef MODULE
+module_init(toshoboe_init);
#endif
+module_exit(toshoboe_cleanup);
+