Module: xenomai-3
Branch: next
Commit: 118db7bca9151b12fd737ee40ff3485109336eaf
URL:    
http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=118db7bca9151b12fd737ee40ff3485109336eaf

Author: Philippe Gerum <r...@xenomai.org>
Date:   Wed Nov  9 12:48:27 2016 +0100

cobalt/rtdm: device: allow switching device class back to default

Passing NULL to rtdm_drv_set_sysclass() is now allowed, to switch a
driver back to creating devices into the default "rtdm" class.

---

 kernel/cobalt/rtdm/device.c |    7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/kernel/cobalt/rtdm/device.c b/kernel/cobalt/rtdm/device.c
index d0df7fa..b174c1b 100644
--- a/kernel/cobalt/rtdm/device.c
+++ b/kernel/cobalt/rtdm/device.c
@@ -575,7 +575,9 @@ EXPORT_SYMBOL_GPL(rtdm_dev_unregister);
  *
  * @param[in] drv Address of the RTDM driver descriptor.
  *
- * @param[in] cls Pointer to the kernel device class.
+ * @param[in] cls Pointer to the kernel device class. NULL is allowed
+ * to clear a previous setting, switching back to the default "rtdm"
+ * device class.
  *
  * @return 0 on success, otherwise:
  *
@@ -592,7 +594,8 @@ EXPORT_SYMBOL_GPL(rtdm_dev_unregister);
  */
 int rtdm_drv_set_sysclass(struct rtdm_driver *drv, struct class *cls)
 {
-       if (drv->profile_info.kdev_class || atomic_read(&drv->refcount))
+       if ((cls && drv->profile_info.kdev_class) ||
+           atomic_read(&drv->refcount))
                return -EBUSY;
 
        drv->profile_info.kdev_class = cls;


_______________________________________________
Xenomai-git mailing list
Xenomai-git@xenomai.org
https://xenomai.org/mailman/listinfo/xenomai-git

Reply via email to