svn commit: r349085 - head/sys/dev/pwm

Ian Lepore ian at FreeBSD.org
Sat Jun 15 21:51:56 UTC 2019


Author: ian
Date: Sat Jun 15 21:51:55 2019
New Revision: 349085
URL: https://svnweb.freebsd.org/changeset/base/349085

Log:
  Destroy the cdev on device detach.  Also, make the driver and devclass
  static, because nothing outside this file needs them.

Modified:
  head/sys/dev/pwm/pwmc.c

Modified: head/sys/dev/pwm/pwmc.c
==============================================================================
--- head/sys/dev/pwm/pwmc.c	Sat Jun 15 21:36:14 2019	(r349084)
+++ head/sys/dev/pwm/pwmc.c	Sat Jun 15 21:51:55 2019	(r349085)
@@ -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);


More information about the svn-src-all mailing list