lkml.org 
[lkml]   [2006]   [May]   [26]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
Subjectpci 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/

\
 
 \ /
  Last update: 2006-05-26 16:22    [W:0.028 / U:0.216 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site