svn commit: r299960 - head/sys/compat/linuxkpi/common/include/linux
Hans Petter Selasky
hselasky at FreeBSD.org
Mon May 16 17:41:26 UTC 2016
Author: hselasky
Date: Mon May 16 17:41:25 2016
New Revision: 299960
URL: https://svnweb.freebsd.org/changeset/base/299960
Log:
Only lock Giant when needed in the LinuxKPI.
Suggested by: ngie @
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 Mon May 16 17:32:28 2016 (r299959)
+++ head/sys/compat/linuxkpi/common/include/linux/device.h Mon May 16 17:41:25 2016 (r299960)
@@ -333,10 +333,11 @@ device_unregister(struct device *dev)
bsddev = dev->bsddev;
dev->bsddev = NULL;
- mtx_lock(&Giant);
- if (bsddev != NULL)
+ if (bsddev != NULL) {
+ mtx_lock(&Giant);
device_delete_child(device_get_parent(bsddev), bsddev);
- mtx_unlock(&Giant);
+ mtx_unlock(&Giant);
+ }
put_device(dev);
}
@@ -348,10 +349,11 @@ device_del(struct device *dev)
bsddev = dev->bsddev;
dev->bsddev = NULL;
- mtx_lock(&Giant);
- if (bsddev != NULL)
+ if (bsddev != NULL) {
+ mtx_lock(&Giant);
device_delete_child(device_get_parent(bsddev), bsddev);
- mtx_unlock(&Giant);
+ mtx_unlock(&Giant);
+ }
}
struct device *device_create(struct class *class, struct device *parent,
More information about the svn-src-head
mailing list