git: bc3e9499ca5b - stable/13 - LinuxKPI: Implement dev_driver_string()
- Go to: [ bottom of page ] [ top of archives ] [ this month ]
Date: Sat, 22 Jan 2022 19:36:20 UTC
The branch stable/13 has been updated by wulf: URL: https://cgit.FreeBSD.org/src/commit/?id=bc3e9499ca5bcff65884c41ce73bfe67db531d8a commit bc3e9499ca5bcff65884c41ce73bfe67db531d8a Author: Vladimir Kondratyev <wulf@FreeBSD.org> AuthorDate: 2021-11-15 15:09:14 +0000 Commit: Vladimir Kondratyev <wulf@FreeBSD.org> CommitDate: 2022-01-22 19:34:36 +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 (cherry picked from commit bc923d93dffc9d82a705d4e5b9960daa9acdcca6) --- 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 abafcd7ba5c4..04217fa8b35f 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) {