diff options
author | hselasky <hselasky@FreeBSD.org> | 2016-05-16 17:41:25 +0000 |
---|---|---|
committer | hselasky <hselasky@FreeBSD.org> | 2016-05-16 17:41:25 +0000 |
commit | a8602da0e07b46194b16b42c130723f51deda733 (patch) | |
tree | c67ae1f00a4eba175ec5ec5d0bdb575e9c0ffc06 /sys/compat/linuxkpi | |
parent | 6cbf1d06487a4bc55554792d71e8e6ca0eadcda1 (diff) | |
download | FreeBSD-src-a8602da0e07b46194b16b42c130723f51deda733.zip FreeBSD-src-a8602da0e07b46194b16b42c130723f51deda733.tar.gz |
Only lock Giant when needed in the LinuxKPI.
Suggested by: ngie @
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 | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index ccee7b4..2f43d81 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -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, |