diff options
author | hselasky <hselasky@FreeBSD.org> | 2016-05-13 13:01:02 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2016-05-13 13:01:02 +0000 |
commit | 948541ae6af570b4f42e4c119e34acaf611b2368 (patch) | |
tree | 9a45eb5cd014a1dfe20d5445728b9c8a6dfa3ab7 /sys/compat/linuxkpi | |
parent | 7bf21672e6306c2a580adbc86bb158572bbd3b8a (diff) | |
download | FreeBSD-src-948541ae6af570b4f42e4c119e34acaf611b2368.zip FreeBSD-src-948541ae6af570b4f42e4c119e34acaf611b2368.tar.gz |
Handle case of class being set, but not parent when calling
device_register() in the LinuxKPI.
Obtained from: kmacy @
MFC after: 1 week
Sponsored by: Mellanox Technologies
Diffstat (limited to 'sys/compat/linuxkpi')
-rw-r--r-- | sys/compat/linuxkpi/common/include/linux/device.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index f4b8ec6..4b4c232 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -2,7 +2,7 @@ * Copyright (c) 2010 Isilon Systems, Inc. * Copyright (c) 2010 iX Systems, Inc. * Copyright (c) 2010 Panasas, Inc. - * Copyright (c) 2013, 2014 Mellanox Technologies, Ltd. + * Copyright (c) 2013-2016 Mellanox Technologies, Ltd. * All rights reserved. * * Redistribution and use in source and binary forms, with or without @@ -203,11 +203,15 @@ device_register(struct device *dev) int unit; bsddev = NULL; + unit = -1; + if (dev->devt) { unit = MINOR(dev->devt); bsddev = devclass_get_device(dev->class->bsdclass, unit); - } else - unit = -1; + } else if (dev->parent == NULL) { + bsddev = devclass_get_device(dev->class->bsdclass, 0); + } + if (bsddev == NULL) bsddev = device_add_child(dev->parent->bsddev, dev->class->kobj.name, unit); |