svn commit: r299674 - head/sys/compat/linuxkpi/common/include/linux

Hans Petter Selasky hselasky at FreeBSD.org
Fri May 13 13:01:03 UTC 2016


Author: hselasky
Date: Fri May 13 13:01:02 2016
New Revision: 299674
URL: https://svnweb.freebsd.org/changeset/base/299674

Log:
  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

Modified:
  head/sys/compat/linuxkpi/common/include/linux/device.h

Modified: head/sys/compat/linuxkpi/common/include/linux/device.h
==============================================================================
--- head/sys/compat/linuxkpi/common/include/linux/device.h	Fri May 13 12:41:21 2016	(r299673)
+++ head/sys/compat/linuxkpi/common/include/linux/device.h	Fri May 13 13:01:02 2016	(r299674)
@@ -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);


More information about the svn-src-head mailing list