Date: Tue, 21 Nov 2017 10:19:33 +0000 (UTC) From: Hans Petter Selasky <hselasky@FreeBSD.org> To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org Subject: svn commit: r326054 - stable/10/sys/ofed/include/linux Message-ID: <201711211019.vALAJXqH097381@repo.freebsd.org>
next in thread | raw e-mail | index | archive | help
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);
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201711211019.vALAJXqH097381>