Skip to content
  • Philippe Gerum's avatar
    cobalt/rtdm, kernel/drivers: split device class / instance abstractions · 1909729e
    Philippe Gerum authored
    How devices are described for registration with rtdm_dev_register() is
    significantly modified, affecting both named and protocol device
    drivers exactly the same way. Aside of fixing consistency issues, the
    bulk of changes is aimed at narrowing the gap between the regular
    Linux device driver model and RTDM.
    
    RTDM now shares the Linux namespace for named devices, which are
    backed by common character device objects from the regular Linux
    device model. As a consequence of this, file descriptors obtained on
    named RTDM devices are regular file descriptors on real chrdevs,
    visible from the /proc/<pid>/fd interface.
    
    The major change required for supporting this closer integration of
    RTDM into the regular Linux driver model involved splitting the device
    class properties from the device instance definitions, which used to
    be combined in Xenomai 2.x into the rtdm_device descriptor.
    
    A new rtdm_device_class descriptor is introduced, for describing the
    general static properties of the devices exposed by a
    driver. rtdm_device now represents an instance of such class.
    
    rtdm_device objects link to the descriptor of the rtdm_device class
    they belong to.
    
    Hotplug support
    ---------------
    
    RTDM first allocates and reserves a major and a range of device minors
    when the first device of a named device class is registered via
    rtdm_dev_register(). Up to class->device_count minors will be
    reserved. Minor number are assigned to devices in order of
    registration, starting from minor #0.
    
    Device nodes for named RTDM devices are automatically visible from the
    /dev/rtdm/ hierarchy with hotplug-enabled device fs (DEVTMPFS now
    recommended).
    1909729e