From 6bb80425354d33242dce5e5fcf655ec305de9b63 Mon Sep 17 00:00:00 2001 From: Ian Lepore Date: Sat, 15 Jun 2019 21:51:55 +0000 Subject: [PATCH] Destroy the cdev on device detach. Also, make the driver and devclass static, because nothing outside this file needs them. --- sys/dev/pwm/pwmc.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/sys/dev/pwm/pwmc.c b/sys/dev/pwm/pwmc.c index 36d2b0046b63..592411cffd1c 100644 --- a/sys/dev/pwm/pwmc.c +++ b/sys/dev/pwm/pwmc.c @@ -137,6 +137,10 @@ pwmc_attach(device_t dev) static int pwmc_detach(device_t dev) { + struct pwmc_softc *sc; + + sc = device_get_softc(dev); + destroy_dev(sc->pwm_dev); return (0); } @@ -150,12 +154,12 @@ static device_method_t pwmc_methods[] = { DEVMETHOD_END }; -driver_t pwmc_driver = { +static driver_t pwmc_driver = { "pwmc", pwmc_methods, sizeof(struct pwmc_softc), }; -devclass_t pwmc_devclass; +static devclass_t pwmc_devclass; DRIVER_MODULE(pwmc, pwm, pwmc_driver, pwmc_devclass, 0, 0); MODULE_VERSION(pwmc, 1);