Messages in this thread | | | Date | Fri, 26 May 2006 16:19:56 +0200 | From | "Josep Cañadell" <> | Subject | pci driver with char devices |
| |
Hello all,
I have written a pci driver for a simple device. It only read and write from a I/O ports region. (It works)
My structure is: pci_driver and a cdev to create the device file. And the probe function is: (approximately)
SCLink_probe(struct pci_dev *my_pci_dev, ...) { dev_t dev; pci_enable_device(my_pci_dev);
result = alloc_chrdev_region(&dev, 0, 1, "SCLink"); SCLink_major = MAJOR(dev);
cdev_init(&char_dev, &fops); char_dev.owner = THIS_MODULE; char_dev.ops = &SCLink_fops; //file_operations err = cdev_add(&char_dev, dev, 1);
pci_request_regions(my_pci_dev, "SCLink");
}
//static int __init SCLink_init(void) // return pci_register_driver(&SCLink_driver);
Is this structure acceptable? Can I create a char device for each BAR? Any suggestion?
Thanks in advance ;-) - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
| |