git: bc923d93dffc - main - LinuxKPI: Implement dev_driver_string()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Mon, 10 Jan 2022 19:50:33 UTC
The branch main has been updated by wulf:
URL: https://cgit.FreeBSD.org/src/commit/?id=bc923d93dffc9d82a705d4e5b9960daa9acdcca6
commit bc923d93dffc9d82a705d4e5b9960daa9acdcca6
Author: Vladimir Kondratyev <wulf@FreeBSD.org>
AuthorDate: 2021-11-15 15:09:14 +0000
Commit: Vladimir Kondratyev <wulf@FreeBSD.org>
CommitDate: 2022-01-10 19:49:37 +0000
LinuxKPI: Implement dev_driver_string()
Required by drm-kmod 5.7
MFC after: 1 week
Reviewed by: bz, hselasky, manu
Differential Revision: https://reviews.freebsd.org/D33290
---
sys/compat/linuxkpi/common/include/linux/device.h | 15 +++++++++++++++
1 file changed, 15 insertions(+)
diff --git a/sys/compat/linuxkpi/common/include/linux/device.h b/sys/compat/linuxkpi/common/include/linux/device.h
index 71cca729243a..010eb2d316cd 100644
--- a/sys/compat/linuxkpi/common/include/linux/device.h
+++ b/sys/compat/linuxkpi/common/include/linux/device.h
@@ -228,6 +228,21 @@ void lkpi_devres_release_free_list(struct device *);
void lkpi_devres_unlink(struct device *, void *);
void lkpi_devm_kmalloc_release(struct device *, void *);
+static inline const char *
+dev_driver_string(const struct device *dev)
+{
+ driver_t *drv;
+ const char *str = "";
+
+ if (dev->bsddev != NULL) {
+ drv = device_get_driver(dev->bsddev);
+ if (drv != NULL)
+ str = drv->name;
+ }
+
+ return (str);
+}
+
static inline void *
dev_get_drvdata(const struct device *dev)
{