Author: hselasky Date: Tue Nov 21 10:19:33 2017 New Revision: 326054 URL: https://svnweb.freebsd.org/changeset/base/326054
Log: MFC r299674 and r299931: Handle case of class being set, but not parent when calling device_register() in the LinuxKPI. Requested by: Chelsio Sponsored by: Mellanox Technologies Modified: stable/10/sys/ofed/include/linux/device.h Directory Properties: stable/10/ (props changed) Modified: stable/10/sys/ofed/include/linux/device.h ============================================================================== --- stable/10/sys/ofed/include/linux/device.h Tue Nov 21 09:08:27 2017 (r326053) +++ stable/10/sys/ofed/include/linux/device.h Tue Nov 21 10:19:33 2017 (r326054) @@ -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 @@ -294,15 +294,19 @@ 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; - if (bsddev == NULL) + } else if (dev->parent == NULL) { + bsddev = devclass_get_device(dev->class->bsdclass, 0); + } + if (bsddev == NULL && dev->parent != NULL) { bsddev = device_add_child(dev->parent->bsddev, dev->class->kobj.name, unit); - if (bsddev) { + } + if (bsddev != NULL) { if (dev->devt == 0) dev->devt = makedev(0, device_get_unit(bsddev)); device_set_softc(bsddev, dev); _______________________________________________ svn-src-stable-10@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-stable-10 To unsubscribe, send any mail to "svn-src-stable-10-unsubscr...@freebsd.org"