uio driver cannot be registered to uio subsystem

Frank Prepelica Frank.Prepelica at ubidyne.com
Thu Aug 6 17:56:06 EST 2009


Hi everbody,

I've got an custom uio interrupt driver. The driver will be registered
as platfrom driver.

static int __init uio_irq3_init(void)
{
   return platform_driver_register(&uio_irq3_driver);
}

After starting the kernel the driver is registered under
/sys/bus/platform/drivers. (I guess this is supposed to happen)
BUT as I can see the uio_irq3_probe() function isn't called and
therefore the driver will not be registered to the
UIO subsystem! (there are no devices in /sys/class/)

What went wrong? Which process is responsible for calling the probe
function? 

I also tried to compile the uio drivers which are provided by the kernel
itself. But after starting the kernel not one of these drivers appears
in /sys/class/ too! 

Can anybody please tell what I am doing wrong? Pls see below, too!

Thanks in advance!
Kind regrads

Frank Prepelica
Software Design Engineer

Ubidyne GmbH
Lise-Meitner-Str.-14
89081 Ulm - Germany


Here is the code for the driver if needed!
<------- snip

#include <linux/uio_driver.h>
#include <linux/platform_device.h>
#include <linux/module.h>


struct uio_pdrv_irq3 {
	struct uio_info *uioinfo;
	spinlock_t lock;
	unsigned long flags;
};


static irqreturn_t interrupt_handler_irq3(int irq, struct uio_info
*dev_info)
{
	eturn IRQ_HANDLED;
}


static int uio_irq3_irqcontrol(struct uio_info *dev_info, s32 irq_on)
{
    printk("IRQCONTROL");
    return 0;
}


static int uio_irq3_probe(struct platform_device *pdev)
{
	struct uio_info *uioinfo = pdev->dev.platform_data;
	struct uio_pdrv_irq3 *priv;
	int ret = -EINVAL;    
    
	priv = kzalloc(sizeof(*priv), GFP_KERNEL);
	if (!priv) {
		ret = -ENOMEM;
		dev_err(&pdev->dev, "unable to kmalloc\n");
		goto bad0;
	}    
    
    priv->uioinfo = uioinfo;
    priv->flags = 0;
    uioinfo->irq_flags |= IRQF_DISABLED | IRQF_TRIGGER_FALLING;
    uioinfo->irq = 19;
    uioinfo->handler = interrupt_handler_irq3;
    uioinfo->irqcontrol = uio_irq3_irqcontrol;
    uioinfo->priv = priv;

    uio_register_device(&pdev->dev, priv->uioinfo);
        return -ENODEV;
    
	platform_set_drvdata(pdev, priv);
	return 0;    
    
 bad0:
	return ret;    
}

static int uio_irq3_remove(struct platform_device *pdev)
{
    struct uio_pdrv_irq3 *priv = platform_get_drvdata(pdev);
	uio_unregister_device(priv->uioinfo);
	return 0;
}


static struct platform_driver uio_irq3_driver = {
	.probe		= uio_irq3_probe,
	.remove		= uio_irq3_remove,
    	.driver = {
        .name = "IRQ3",
        .owner = THIS_MODULE,
    },
};

static int __init uio_irq3_init(void)
{
	return platform_driver_register(&uio_irq3_driver);
}

static void __exit uio_irq3_exit(void)
{
	platform_device_unregister(&uio_irq3_driver);
}


module_init(uio_irq3_init);
module_exit(uio_irq3_exit);


MODULE_LICENSE("tbd");
MODULE_AUTHOR("tbd");
MODULE_DESCRIPTION("IRQ3 Interrupt Handler - CPLD Interrupts");

<------- snap


More information about the Linuxppc-dev mailing list