From aa2b6b4957447f2b079dfd03ef3cb81baca42340 Mon Sep 17 00:00:00 2001 From: Mark Johnston Date: Sat, 8 Jul 2017 18:53:02 +0000 Subject: [PATCH] Add device_is_registered() to the LinuxKPI. MFC after: 1 week --- sys/compat/linuxkpi/common/include/linux/device.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h index 174a067bd25..278730a95da 100644 --- a/sys/compat/linuxkpi/common/include/linux/device.h +++ b/sys/compat/linuxkpi/common/include/linux/device.h @@ -359,13 +359,20 @@ device_create_with_groups(struct class *class, return dev; } +static inline bool +device_is_registered(struct device *dev) +{ + + return (dev->bsddev != NULL); +} + static inline int device_register(struct device *dev) { device_t bsddev = NULL; int unit = -1; - if (dev->bsddev != NULL) + if (device_is_registered(dev)) goto done; if (dev->devt) {