pci driver with char devices

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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 [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[Index of Archives]     [Kernel Newbies]     [Netfilter]     [Bugtraq]     [Photo]     [Stuff]     [Gimp]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Video 4 Linux]     [Linux for the blind]     [Linux Resources]
  Powered by Linux