Пример #1
0
STATIC      status_t
do_deluser (struct net_device * ndev, int lockit)
{
    if (ndev->flags & IFF_UP)
        return -EBUSY;

    {
        ci_t       *ci;
        mch_t      *ch;
        const struct c4_priv *priv;
        int         channum;

        priv = (struct c4_priv *) dev_to_hdlc (ndev)->priv;
        ci = priv->ci;
        channum = priv->channum;

        ch = c4_find_chan (channum);
        if (ch == NULL)
            return -ENOENT;
        ch->user = 0;               /* will be freed, below */
    }

    if (lockit)
        rtnl_unlock ();             /* needed if Ioctl calling sequence */
    unregister_hdlc_device (ndev);
    if (lockit)
        rtnl_lock ();               /* needed if Ioctl calling sequence */
    free_netdev (ndev);
    return 0;
}
Пример #2
0
static void pci200_pci_remove_one(struct pci_dev *pdev)
{
	int i;
	card_t *card = pci_get_drvdata(pdev);

	for (i = 0; i < 2; i++)
		if (card->ports[i].card)
			unregister_hdlc_device(card->ports[i].netdev);

	if (card->irq)
		free_irq(card->irq, card);

	if (card->rambase)
		iounmap(card->rambase);
	if (card->scabase)
		iounmap(card->scabase);
	if (card->plxbase)
		iounmap(card->plxbase);

	pci_release_regions(pdev);
	pci_disable_device(pdev);
	pci_set_drvdata(pdev, NULL);
	if (card->ports[0].netdev)
		free_netdev(card->ports[0].netdev);
	if (card->ports[1].netdev)
		free_netdev(card->ports[1].netdev);
	kfree(card);
}
Пример #3
0
STATIC      status_t
do_create_chan (struct net_device * ndev, void *data)
{
    ci_t       *ci;
    struct net_device *dev;
    struct sbecom_chan_param cp;
    int         ret;

    if (copy_from_user (&cp, data, sizeof (struct sbecom_chan_param)))
        return -EFAULT;
    ci = get_ci_by_dev (ndev);
    if (!ci)
        return -EINVAL;
    dev = create_chan (ndev, ci, &cp);
    if (!dev)
        return -EBUSY;
    ret = mkret (c4_new_chan (ci, cp.port, cp.channum, dev));
    if (ret)
    {
        rtnl_unlock ();             /* needed due to Ioctl calling sequence */
        unregister_hdlc_device (dev);
        rtnl_lock ();               /* needed due to Ioctl calling sequence */
        free_netdev (dev);
    }
    return ret;
}
Пример #4
0
static void n2_destroy_card(card_t *card)
{
    int cnt;

    for (cnt = 0; cnt < 2; cnt++)
        if (card->ports[cnt].card) {
            struct net_device *dev = port_to_dev(&card->ports[cnt]);
            unregister_hdlc_device(dev);
        }

    if (card->irq)
        free_irq(card->irq, card);

    if (card->winbase) {
        iounmap(card->winbase);
        release_mem_region(card->phy_winbase, USE_WINDOWSIZE);
    }

    if (card->io)
        release_region(card->io, N2_IOPORTS);
    if (card->ports[0].dev)
        free_netdev(card->ports[0].dev);
    if (card->ports[1].dev)
        free_netdev(card->ports[1].dev);
    kfree(card);
}
Пример #5
0
static int __devexit hss_remove_one(struct platform_device *pdev)
{
	struct port *port = platform_get_drvdata(pdev);

	unregister_hdlc_device(port->netdev);
	free_netdev(port->netdev);
	npe_release(port->npe);
	platform_set_drvdata(pdev, NULL);
	kfree(port);
	return 0;
}
Пример #6
0
Файл: c101.c Проект: E-LLP/n900
static void __exit c101_cleanup(void)
{
	card_t *card = first_card;

	while (card) {
		card_t *ptr = card;
		card = card->next_card;
		unregister_hdlc_device(port_to_dev(ptr));
		c101_destroy_card(ptr);
	}
}
Пример #7
0
void cleanup_module(void)
{
	card_t *card=first_card;

	while (card) {
		card_t *ptr=card;
		card=card->next_card;
		unregister_hdlc_device(&ptr->hdlc);
		c101_destroy_card(ptr);
	}
}
Пример #8
0
static void t3e3_remove_channel(struct channel *channel)
{
	struct pci_dev *pdev = channel->pdev;
	struct net_device *dev = channel->dev;

	/*                                                            */
	cpld_stop_intr(channel);
	free_irq(dev->irq, dev);
	dc_drop_descriptor_list(channel);
	unregister_hdlc_device(dev);
	free_netdev(dev);
	pci_release_regions(pdev);
	pci_disable_device(pdev);
	pci_set_drvdata(pdev, NULL);
}
Пример #9
0
static int __devinit t3e3_init_channel(struct channel *channel, struct pci_dev *pdev, struct card *card)
{
	struct net_device *dev;
	unsigned int val;
	int err;

	err = pci_enable_device(pdev);
	if (err)
		return err;

	err = pci_request_regions(pdev, "SBE 2T3E3");
	if (err)
		goto disable;

	dev = alloc_hdlcdev(channel);
	if (!dev) {
		printk(KERN_ERR "SBE 2T3E3" ": Out of memory\n");
		err = -ENOMEM;
		goto free_regions;
	}

	t3e3_sc_init(channel);
	dev_to_priv(dev) = channel;

	channel->pdev = pdev;
	channel->dev = dev;
	channel->card = card;
	channel->addr = pci_resource_start(pdev, 0);
	if (pdev->subsystem_device == PCI_SUBDEVICE_ID_SBE_2T3E3_P1)
		channel->h.slot = 1;
	else
		channel->h.slot = 0;

	err = setup_device(dev, channel);
	if (err)
		goto free_dev;

	pci_read_config_dword(channel->pdev, 0x40, &val); /* mask sleep mode */
	pci_write_config_dword(channel->pdev, 0x40, val & 0x3FFFFFFF);

	pci_read_config_byte(channel->pdev, PCI_CACHE_LINE_SIZE, &channel->h.cache_size);
	pci_read_config_dword(channel->pdev, PCI_COMMAND, &channel->h.command);
	t3e3_init(channel);

	err = request_irq(dev->irq, &t3e3_intr, IRQF_SHARED, dev->name, dev);
	if (err) {
		printk(KERN_WARNING "%s: could not get irq: %d\n", dev->name, dev->irq);
		goto unregister_dev;
	}

	pci_set_drvdata(pdev, channel);
	return 0;

unregister_dev:
	unregister_hdlc_device(dev);
free_dev:
	free_netdev(dev);
free_regions:
	pci_release_regions(pdev);
disable:
	pci_disable_device(pdev);
	return err;
}