Thread: Linux (2.6.10+) device driver: multiple classes?

  1. #1
    Sr. Software Engineer filker0's Avatar
    Join Date
    Sep 2005
    Location
    West Virginia
    Posts
    235

    Question Linux (2.6.10+) device driver: multiple classes?

    I'm writing a device driver for a custom PCI device in an embedded system. We're using a pretty-much stock Linux 2.6.10 or later kernel (we'll settle on the version as we get closer to the end of the initial development).

    This device has a single PCI target ASIC that is set up to give access to several custom I/O devices that will be managed through on-board logic (once set-up directly by the Linux driver) and data will be buffered in on-board memory and polled by the driver (block transfers will be done using DMA). There are three distinct types of external I/O connections supported by the device, and I'm using a single low-level driver that will present each type of external interface as a different device to user-space programs (one /dev file for each "connection").

    The issue that I'm trying to resolve is whether a single module can create multiple classes in sysfs. Each type of connection has a different set of attributes, so I don't want to use a single class. I think that the kernel doesn't forbid multiple classes in one driver module, but is it considered an acceptable practice?

    Any thoughts will be appreciated.

  2. #2
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    I would say it's a recognised evil.
    ater all, a multipartition structure on a hard drive, with multiple filesystem formats is essentially a different class for each hard drive partition.

    if it's for an embedded usage ( cell phone, pda etc ) then how you devise the device drivers is your choice. the best place to get input for linux kernel questions, specially if there is a plan to release the drivers for inclusion in the kernel, would be from the linux kernel developers email list.

    http://www.kernel.org

    Quote Originally Posted by linux kernel archives
    The Linux kernel is discussed on the linux-kernel mailing list at vger.kernel.org. The FAQ is available at http://www.kernel.org/pub/linux/docs/lkml/, please read the FAQ before subscribing.

    Although there is no official archive site, unofficial archives of the list can be found at:

    * http://marc.theaimsgroup.com/?l=linux-kernel
    * http://www.ussg.iu.edu/hypermail/linux/kernel/

    and a summary service can be found at:

    * http://www.kernel-traffic.org/
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

  3. #3
    Sr. Software Engineer filker0's Avatar
    Join Date
    Sep 2005
    Location
    West Virginia
    Posts
    235
    Thanks for the info.

    I know that, with custom hardware and an embedded application, this driver will never be submitted for distribution (though the driver itself will be open source, the hardware is not, and there's not much point in distributing the driver). I'm just trying to make sure that what I'm planning on doing is not likely to break with the next major Linux kernel revision.

    None of the examples that I've looked at so far have done the multiple device classes thing, but none of the documentation that I've read has ruled it out.

  4. #4
    Registered User Jaqui's Avatar
    Join Date
    Feb 2005
    Posts
    416
    the next major kernel revision wll be in the 2.8 series.
    the current development version is the 2.7 series

    most of what is happening with the kernel right now is fine tuning the code to improve performance, and bug fixing. ( some security fixes )

    so unless you use some existing kernel code that is depreciated and on the way out, the future kernel shouldn't have much effect on your driver.
    Quote Originally Posted by Jeff Henager
    If the average user can put a CD in and boot the system and follow the prompts, he can install and use Linux. If he can't do that simple task, he doesn't need to be around technology.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Writing a linux hardware driver
    By nexusone in forum Linux Programming
    Replies: 1
    Last Post: 08-12-2008, 07:33 PM
  2. Serial port programming in Linux
    By g4j31a5 in forum Linux Programming
    Replies: 20
    Last Post: 11-06-2006, 10:44 PM
  3. Device Driver: sysfs confusion
    By filker0 in forum Linux Programming
    Replies: 0
    Last Post: 12-02-2005, 11:36 AM
  4. Splitting a dialog up into multiple classes
    By Just in forum Windows Programming
    Replies: 1
    Last Post: 05-29-2005, 11:11 PM
  5. Multiple Inheritance - Size of Classes?
    By Zeusbwr in forum C++ Programming
    Replies: 10
    Last Post: 11-26-2004, 09:04 AM