Beispiel #1
0
static void deinit_vfc_device(struct vfc_dev *dev)
{
	if(dev == NULL)
		return;
	sbus_iounmap(dev->regs, sizeof(struct vfc_regs));
	kfree(dev);
}
Beispiel #2
0
static void deinit_vfc_device(struct vfc_dev *dev)
{
	if(dev == NULL)
		return;
	devfs_unregister (dev->de);
	sbus_iounmap((unsigned long)dev->regs, sizeof(struct vfc_regs));
	kfree(dev);
}
Beispiel #3
0
static void deinit_vfc_device(struct vfc_dev *dev)
{
	if(dev == NULL)
		return;
	devfs_remove("vfc/%d", dev->instance);
	sbus_iounmap((unsigned long)dev->regs, sizeof(struct vfc_regs));
	kfree(dev);
}
Beispiel #4
0
static int __devexit myri_sbus_remove(struct of_device *dev)
{
	struct myri_eth *mp = dev_get_drvdata(&dev->dev);
	struct net_device *net_dev = mp->dev;

	unregister_netdevice(net_dev);

	free_irq(net_dev->irq, net_dev);

	if (mp->eeprom.cpuvers < CPUVERS_4_0) {
		sbus_iounmap(mp->regs, mp->reg_size);
	} else {
		sbus_iounmap(mp->cregs, PAGE_SIZE);
		sbus_iounmap(mp->lregs, (256 * 1024));
		sbus_iounmap(mp->lanai, (512 * 1024));
	}

	free_netdev(net_dev);

	dev_set_drvdata(&dev->dev, NULL);

	return 0;
}
Beispiel #5
0
static void __exit parport_sunbpp_exit(void)
{
	while (!list_empty(&port_list)) {
		Node *node = list_entry(port_list.next, Node, list);
		struct parport *p = node->port;
		struct parport_operations *ops = p->ops;
		parport_remove_port(p);

		if (p->irq != PARPORT_IRQ_NONE) {
			parport_sunbpp_disable_irq(p);
			free_irq(p->irq, p);
		}
		sbus_iounmap((void __iomem *)p->base, p->size);
		parport_put_port(p);
		kfree (ops);
		list_del(&node->list);
		kfree (node);
	}
}
Beispiel #6
0
static int __devexit bpp_remove(struct of_device *dev)
{
	struct parport *p = dev_get_drvdata(&dev->dev);
	struct parport_operations *ops = p->ops;

	parport_remove_port(p);

	if (p->irq != PARPORT_IRQ_NONE) {
		parport_sunbpp_disable_irq(p);
		free_irq(p->irq, p);
	}

	sbus_iounmap((void __iomem *) p->base, p->size);
	parport_put_port(p);
	kfree(ops);

	dev_set_drvdata(&dev->dev, NULL);

	return 0;
}
void
cleanup_module(void)
{
	struct parport *p = parport_enumerate();

	while (p) {
		struct parport *next = p->next;

		if (1/*p->modes & PARPORT_MODE_PCSPP*/) { 
			struct parport_operations *ops = p->ops;

			if (p->irq != PARPORT_IRQ_NONE) {
				parport_sunbpp_disable_irq(p);
				free_irq(p->irq, p);
			}
			sbus_iounmap(p->base, p->size);
			parport_proc_unregister(p);
			parport_unregister_port(p);
			kfree (ops);
		}
		p = next;
	}
}
Beispiel #8
0
static inline void apc_free(void)
{
	sbus_iounmap(regs, apc_regsize);
}
static int __init init_one_port(struct sbus_dev *sdev)
{
	struct parport *p;
	/* at least in theory there may be a "we don't dma" case */
	struct parport_operations *ops;
	unsigned long base;
	int irq, dma, err, size;
	struct bpp_regs *regs;
	unsigned char value_tcr;

	dprintk((KERN_DEBUG "init_one_port(%p): ranges, alloc_io, ", sdev));
	irq = sdev->irqs[0];
	base = sbus_ioremap(&sdev->resource[0], 0,
			    sdev->reg_addrs[0].reg_size, 
			    "sunbpp");
	size = sdev->reg_addrs[0].reg_size;
	dma = PARPORT_DMA_NONE;

	dprintk(("alloc(ppops), "));
	ops = kmalloc (sizeof (struct parport_operations), GFP_KERNEL);
        if (!ops) {
		sbus_iounmap(base, size);
		return 0;
        }

        memcpy (ops, &parport_sunbpp_ops, sizeof (struct parport_operations));

	dprintk(("register_port\n"));
	if (!(p = parport_register_port(base, irq, dma, ops))) {
		kfree(ops);
		sbus_iounmap(base, size);
		return 0;
	}

	p->size = size;

	dprintk((KERN_DEBUG "init_one_port: request_irq(%08x:%p:%x:%s:%p) ",
		p->irq, parport_sunbpp_interrupt, SA_SHIRQ, p->name, p));
	if ((err = request_irq(p->irq, parport_sunbpp_interrupt,
			       SA_SHIRQ, p->name, p)) != 0) {
		dprintk(("ERROR %d\n", err));
		parport_unregister_port(p);
		kfree(ops);
		sbus_iounmap(base, size);
		return err;
	} else {
		dprintk(("OK\n"));
		parport_sunbpp_enable_irq(p);
	}

	regs = (struct bpp_regs *)p->base;
	dprintk((KERN_DEBUG "forward\n"));
	value_tcr = sbus_readb(&regs->p_tcr);
	value_tcr &= ~P_TCR_DIR;
	sbus_writeb(value_tcr, &regs->p_tcr);

	printk(KERN_INFO "%s: sunbpp at 0x%lx\n", p->name, p->base);
	parport_proc_register(p);
	parport_announce_port (p);

	return 1;
}
Beispiel #10
0
static int __init init_one_port(struct sbus_dev *sdev)
{
	struct parport *p;
	/* at least in theory there may be a "we don't dma" case */
	struct parport_operations *ops;
	void __iomem *base;
	int irq, dma, err = 0, size;
	struct bpp_regs __iomem *regs;
	unsigned char value_tcr;
	Node *node;

	dprintk((KERN_DEBUG "init_one_port(%p): ranges, alloc_io, ", sdev));
	node = kmalloc(sizeof(Node), GFP_KERNEL);
	if (!node)
		goto out0;

	irq = sdev->irqs[0];
	base = sbus_ioremap(&sdev->resource[0], 0,
			    sdev->reg_addrs[0].reg_size, 
			    "sunbpp");
	if (!base)
		goto out1;

	size = sdev->reg_addrs[0].reg_size;
	dma = PARPORT_DMA_NONE;

	dprintk(("alloc(ppops), "));
	ops = kmalloc (sizeof (struct parport_operations), GFP_KERNEL);
        if (!ops)
		goto out2;

        memcpy (ops, &parport_sunbpp_ops, sizeof (struct parport_operations));

	dprintk(("register_port\n"));
	if (!(p = parport_register_port((unsigned long)base, irq, dma, ops)))
		goto out3;

	p->size = size;

	dprintk((KERN_DEBUG "init_one_port: request_irq(%08x:%p:%x:%s:%p) ",
		p->irq, parport_sunbpp_interrupt, SA_SHIRQ, p->name, p));
	if ((err = request_irq(p->irq, parport_sunbpp_interrupt,
			       SA_SHIRQ, p->name, p)) != 0) {
		dprintk(("ERROR %d\n", err));
		goto out4;
	}
	dprintk(("OK\n"));
	parport_sunbpp_enable_irq(p);

	regs = (struct bpp_regs __iomem *)p->base;
	dprintk((KERN_DEBUG "forward\n"));
	value_tcr = sbus_readb(&regs->p_tcr);
	value_tcr &= ~P_TCR_DIR;
	sbus_writeb(value_tcr, &regs->p_tcr);

	printk(KERN_INFO "%s: sunbpp at 0x%lx\n", p->name, p->base);
	node->port = p;
	list_add(&node->list, &port_list);
	parport_announce_port (p);

	return 1;

out4:
	parport_put_port(p);
out3:
	kfree(ops);
out2:
	sbus_iounmap(base, size);
out1:
	kfree(node);
out0:
	return err;
}
Beispiel #11
0
Datei: bpp.c Projekt: 274914765/C
static inline void freeLptPort(int idx)
{
      sbus_iounmap(base_addrs[idx], BPP_SIZE);
}
Beispiel #12
0
static int __devinit init_one_port(struct sbus_dev *sdev)
{
	struct parport *p;
	/* at least in theory there may be a "we don't dma" case */
	struct parport_operations *ops;
	void __iomem *base;
	int irq, dma, err = 0, size;
	struct bpp_regs __iomem *regs;
	unsigned char value_tcr;

	irq = sdev->irqs[0];
	base = sbus_ioremap(&sdev->resource[0], 0,
			    sdev->reg_addrs[0].reg_size, 
			    "sunbpp");
	if (!base)
		return -ENODEV;

	size = sdev->reg_addrs[0].reg_size;
	dma = PARPORT_DMA_NONE;

	ops = kmalloc(sizeof(struct parport_operations), GFP_KERNEL);
        if (!ops)
		goto out_unmap;

        memcpy (ops, &parport_sunbpp_ops, sizeof (struct parport_operations));

	dprintk(("register_port\n"));
	if (!(p = parport_register_port((unsigned long)base, irq, dma, ops)))
		goto out_free_ops;

	p->size = size;
	p->dev = &sdev->ofdev.dev;

	if ((err = request_irq(p->irq, parport_sunbpp_interrupt,
			       IRQF_SHARED, p->name, p)) != 0) {
		goto out_put_port;
	}

	parport_sunbpp_enable_irq(p);

	regs = (struct bpp_regs __iomem *)p->base;

	value_tcr = sbus_readb(&regs->p_tcr);
	value_tcr &= ~P_TCR_DIR;
	sbus_writeb(value_tcr, &regs->p_tcr);

	printk(KERN_INFO "%s: sunbpp at 0x%lx\n", p->name, p->base);

	dev_set_drvdata(&sdev->ofdev.dev, p);

	parport_announce_port(p);

	return 0;

out_put_port:
	parport_put_port(p);

out_free_ops:
	kfree(ops);

out_unmap:
	sbus_iounmap(base, size);

	return err;
}