static int orinoco_plx_open(struct net_device *dev) { struct orinoco_private *priv = (struct orinoco_private *) dev->priv; int err; netif_device_attach(dev); err = orinoco_reset(priv); if (err) printk(KERN_ERR "%s: orinoco_reset failed in orinoco_plx_open()", dev->name); else netif_start_queue(dev); return err; }
static int orinoco_ioctl_reset(struct net_device *dev, struct iw_request_info *info, void *wrqu, char *extra) { struct orinoco_private *priv = ndev_priv(dev); if (!capable(CAP_NET_ADMIN)) return -EPERM; if (info->cmd == (SIOCIWFIRSTPRIV + 0x1)) { printk(KERN_DEBUG "%s: Forcing reset!\n", dev->name); /* Firmware reset */ orinoco_reset(&priv->reset_work); } else { printk(KERN_DEBUG "%s: Force scheduling reset!\n", dev->name); schedule_work(&priv->reset_work); } return 0; }
static int orinoco_cs_open(struct net_device *dev) { struct orinoco_private *priv = (struct orinoco_private *)dev->priv; struct orinoco_pccard* card = (struct orinoco_pccard *)priv->card; dev_link_t *link = &card->link; int err; TRACE_ENTER(priv->ndev.name); link->open++; netif_device_attach(dev); err = orinoco_reset(priv); if (err) orinoco_cs_stop(dev); else netif_start_queue(dev); TRACE_EXIT(priv->ndev.name); return err; }
static int orinoco_cs_event(event_t event, int priority, event_callback_args_t * args) { dev_link_t *link = args->client_data; struct orinoco_private *priv = (struct orinoco_private *)link->priv; struct net_device *dev = &priv->ndev; TRACE_ENTER("orinoco"); switch (event) { case CS_EVENT_CARD_REMOVAL: /* FIXME: Erg.. this whole hw_ready thing looks racy to me. this may not be fixable without changin the PCMCIA subsystem, though */ priv->hw_ready = 0; orinoco_shutdown(priv); link->state &= ~DEV_PRESENT; if (link->state & DEV_CONFIG) { netif_stop_queue(dev); netif_device_detach(dev); mod_timer(&link->release, jiffies + HZ / 20); } break; case CS_EVENT_CARD_INSERTION: link->state |= DEV_PRESENT | DEV_CONFIG_PENDING; orinoco_cs_config(link); break; case CS_EVENT_PM_SUSPEND: link->state |= DEV_SUSPEND; /* Fall through... */ case CS_EVENT_RESET_PHYSICAL: orinoco_shutdown(priv); /* Mark the device as stopped, to block IO until later */ if (link->state & DEV_CONFIG) { if (link->open) { netif_stop_queue(dev); netif_device_detach(dev); } CardServices(ReleaseConfiguration, link->handle); } break; case CS_EVENT_PM_RESUME: link->state &= ~DEV_SUSPEND; /* Fall through... */ case CS_EVENT_CARD_RESET: if (link->state & DEV_CONFIG) { CardServices(RequestConfiguration, link->handle, &link->conf); if (link->open) { if (orinoco_reset(priv) == 0) { netif_device_attach(dev); netif_start_queue(dev); } else { printk(KERN_ERR "%s: Error resetting device on PCMCIA event\n", dev->name); orinoco_cs_stop(dev); } } } /* In a normal driver, additional code may go here to restore the device state and restart IO. */ break; } TRACE_EXIT("orinoco"); return 0; } /* orinoco_cs_event */