Index: sys/compat/linuxkpi/common/include/linux/device.h =================================================================== --- sys/compat/linuxkpi/common/include/linux/device.h +++ sys/compat/linuxkpi/common/include/linux/device.h @@ -483,6 +483,34 @@ device_unregister(device_get_softc(bsddev)); } +static inline void +device_release_driver(struct device *dev) +{ + + /* We also need to cleanup LinuxKPI bits. What else? */ + lkpi_devres_release_free_list(dev); + dev_set_drvdata(dev, NULL); + /* Do not call dev->release! */ + + mtx_lock(&Giant); + if (device_is_attached(dev->bsddev)) + device_detach(dev->bsddev); + mtx_unlock(&Giant); +} + +static inline int +device_reprobe(struct device *dev) +{ + int error; + + device_release_driver(dev); + mtx_lock(&Giant); + error = device_probe_and_attach(dev->bsddev); + mtx_unlock(&Giant); + + return (-error); +} + #define dev_pm_set_driver_flags(dev, flags) do { \ } while (0)