Module: xenomai-3 Branch: stable-3.0.x Commit: f53f8441939ab7dcc4710e1ab71be8e8a5f2a79f URL: http://git.xenomai.org/?p=xenomai-3.git;a=commit;h=f53f8441939ab7dcc4710e1ab71be8e8a5f2a79f
Author: Greg Gallagher <g...@embeddedgreg.com> Date: Fri Feb 2 03:23:00 2018 +0100 cobalt/rtdm: Handle device paths from the device tree that start with a forward slash If the device name from the device tree starts with a forward slash (/) the rtdm device stores it in the registry including the forward slash. When we go to use that device and do the registry lookup we use a relative path from /dev/rtdm which doesn't contain the forward slash and fails to find a match. Open won't return an error but IO calls will fail. To fix this when we register an RTDM device skip the first character if it's a forward slash. In my case the path from the device tree is /amba_pl/gpio@41200000/gpio905 which gets stored in the registry. When we want to use the device and look up the device path in the registry we use amba_pl/gpio@41200000/gpio905 which won't find a match in the registry. Tested on Zynq7000 gpio drivers --- kernel/cobalt/rtdm/device.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/kernel/cobalt/rtdm/device.c b/kernel/cobalt/rtdm/device.c index 4533dfb..4cfdb1c 100644 --- a/kernel/cobalt/rtdm/device.c +++ b/kernel/cobalt/rtdm/device.c @@ -394,6 +394,7 @@ int rtdm_dev_register(struct rtdm_device *dev) int ret, major, minor; xnkey_t id; dev_t rdev; + const char *dev_name; secondary_mode_only(); @@ -446,8 +447,12 @@ int rtdm_dev_register(struct rtdm_device *dev) ret = -ENOMEM; goto fail; } - - ret = xnregistry_enter(dev->name, dev, + if (dev->name[0] == '/') { + dev_name = dev->name+1; + } else { + dev_name = dev->name; + } + ret = xnregistry_enter(dev_name, dev, &dev->named.handle, NULL); if (ret) goto fail; _______________________________________________ Xenomai-git mailing list Xenomai-git@xenomai.org https://xenomai.org/mailman/listinfo/xenomai-git